Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_FB_H |
| 2 | #define _LINUX_FB_H |
| 3 | |
| 4 | #include <linux/types.h> |
Otavio Salvador | 5da072a | 2013-10-03 08:04:39 -0300 | [diff] [blame] | 5 | #include <linux/list.h> |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 6 | |
| 7 | /* Definitions of frame buffers */ |
| 8 | |
| 9 | #define FB_MAX 32 /* sufficient for now */ |
| 10 | |
| 11 | #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ |
| 12 | |
| 13 | #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ |
| 14 | #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ |
| 15 | #define FB_VISUAL_TRUECOLOR 2 /* True color */ |
| 16 | #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ |
| 17 | #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ |
| 18 | #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ |
| 19 | |
| 20 | #define FB_ACCEL_NONE 0 /* no hardware accelerator */ |
| 21 | |
| 22 | struct fb_fix_screeninfo { |
| 23 | char id[16]; /* identification string eg "TT Builtin" */ |
| 24 | unsigned long smem_start; /* Start of frame buffer mem */ |
| 25 | /* (physical address) */ |
| 26 | __u32 smem_len; /* Length of frame buffer mem */ |
| 27 | __u32 type; /* see FB_TYPE_* */ |
| 28 | __u32 type_aux; /* Interleave for interleaved Planes */ |
| 29 | __u32 visual; /* see FB_VISUAL_* */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 30 | __u16 xpanstep; /* zero if no hardware panning */ |
| 31 | __u16 ypanstep; /* zero if no hardware panning */ |
| 32 | __u16 ywrapstep; /* zero if no hardware ywrap */ |
| 33 | __u32 line_length; /* length of a line in bytes */ |
| 34 | unsigned long mmio_start; /* Start of Memory Mapped I/O */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 35 | /* (physical address) */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 36 | __u32 mmio_len; /* Length of Memory Mapped I/O */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 37 | __u32 accel; /* Indicate to driver which */ |
| 38 | /* specific chip/card we have */ |
| 39 | __u16 reserved[3]; /* Reserved for future compatibility */ |
| 40 | }; |
| 41 | |
| 42 | /* |
| 43 | * Interpretation of offset for color fields: All offsets are from the right, |
| 44 | * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you |
| 45 | * can use the offset as right argument to <<). A pixel afterwards is a bit |
| 46 | * stream and is written to video memory as that unmodified. |
| 47 | * |
| 48 | * For pseudocolor: offset and length should be the same for all color |
| 49 | * components. Offset specifies the position of the least significant bit |
| 50 | * of the pallette index in a pixel value. Length indicates the number |
| 51 | * of available palette entries (i.e. # of entries = 1 << length). |
| 52 | */ |
| 53 | struct fb_bitfield { |
| 54 | __u32 offset; /* beginning of bitfield */ |
| 55 | __u32 length; /* length of bitfield */ |
| 56 | __u32 msb_right; |
| 57 | |
| 58 | }; |
| 59 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 60 | #define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 61 | #define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */ |
| 62 | |
| 63 | #define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ |
| 64 | #define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ |
| 65 | #define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ |
| 66 | #define FB_ACTIVATE_MASK 15 |
| 67 | /* values */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 68 | #define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 69 | #define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ |
| 70 | #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ |
| 71 | #define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 72 | #define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 73 | |
| 74 | #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ |
| 75 | #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ |
| 76 | #define FB_SYNC_EXT 4 /* external sync */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 77 | #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ |
| 78 | #define FB_SYNC_BROADCAST 16 /* broadcast video timings */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 79 | /* vtotal = 144d/288n/576i => PAL */ |
| 80 | /* vtotal = 121d/242n/484i => NTSC */ |
| 81 | #define FB_SYNC_ON_GREEN 32 /* sync on green */ |
| 82 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 83 | #define FB_VMODE_NONINTERLACED 0 /* non interlaced */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 84 | #define FB_VMODE_INTERLACED 1 /* interlaced */ |
| 85 | #define FB_VMODE_DOUBLE 2 /* double scan */ |
| 86 | #define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */ |
| 87 | #define FB_VMODE_MASK 255 |
| 88 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 89 | #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 90 | #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ |
| 91 | #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ |
| 92 | |
| 93 | /* |
| 94 | * Display rotation support |
| 95 | */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 96 | #define FB_ROTATE_UR 0 |
| 97 | #define FB_ROTATE_CW 1 |
| 98 | #define FB_ROTATE_UD 2 |
| 99 | #define FB_ROTATE_CCW 3 |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 100 | |
| 101 | #define PICOS2KHZ(a) (1000000000UL/(a)) |
| 102 | #define KHZ2PICOS(a) (1000000000UL/(a)) |
| 103 | |
| 104 | struct fb_var_screeninfo { |
| 105 | __u32 xres; /* visible resolution */ |
| 106 | __u32 yres; |
| 107 | __u32 xres_virtual; /* virtual resolution */ |
| 108 | __u32 yres_virtual; |
| 109 | __u32 xoffset; /* offset from virtual to visible */ |
| 110 | __u32 yoffset; /* resolution */ |
| 111 | |
| 112 | __u32 bits_per_pixel; /* guess what */ |
| 113 | __u32 grayscale; /* != 0 Graylevels instead of colors */ |
| 114 | |
| 115 | struct fb_bitfield red; /* bitfield in fb mem if true color, */ |
| 116 | struct fb_bitfield green; /* else only length is significant */ |
| 117 | struct fb_bitfield blue; |
| 118 | struct fb_bitfield transp; /* transparency */ |
| 119 | |
| 120 | __u32 nonstd; /* != 0 Non standard pixel format */ |
| 121 | |
| 122 | __u32 activate; /* see FB_ACTIVATE_* */ |
| 123 | |
| 124 | __u32 height; /* height of picture in mm */ |
| 125 | __u32 width; /* width of picture in mm */ |
| 126 | |
| 127 | __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ |
| 128 | |
| 129 | /* Timing: All values in pixclocks, except pixclock (of course) */ |
| 130 | __u32 pixclock; /* pixel clock in ps (pico seconds) */ |
| 131 | __u32 left_margin; /* time from sync to picture */ |
| 132 | __u32 right_margin; /* time from picture to sync */ |
| 133 | __u32 upper_margin; /* time from sync to picture */ |
| 134 | __u32 lower_margin; |
| 135 | __u32 hsync_len; /* length of horizontal sync */ |
| 136 | __u32 vsync_len; /* length of vertical sync */ |
| 137 | __u32 sync; /* see FB_SYNC_* */ |
| 138 | __u32 vmode; /* see FB_VMODE_* */ |
| 139 | __u32 rotate; /* angle we rotate counter clockwise */ |
| 140 | __u32 reserved[5]; /* Reserved for future compatibility */ |
| 141 | }; |
| 142 | |
| 143 | struct fb_cmap { |
| 144 | __u32 start; /* First entry */ |
| 145 | __u32 len; /* Number of entries */ |
| 146 | __u16 *red; /* Red values */ |
| 147 | __u16 *green; |
| 148 | __u16 *blue; |
| 149 | __u16 *transp; /* transparency, can be NULL */ |
| 150 | }; |
| 151 | |
| 152 | struct fb_con2fbmap { |
| 153 | __u32 console; |
| 154 | __u32 framebuffer; |
| 155 | }; |
| 156 | |
| 157 | /* VESA Blanking Levels */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 158 | #define VESA_NO_BLANKING 0 |
| 159 | #define VESA_VSYNC_SUSPEND 1 |
| 160 | #define VESA_HSYNC_SUSPEND 2 |
| 161 | #define VESA_POWERDOWN 3 |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 162 | |
| 163 | |
| 164 | enum { |
| 165 | /* screen: unblanked, hsync: on, vsync: on */ |
| 166 | FB_BLANK_UNBLANK = VESA_NO_BLANKING, |
| 167 | |
| 168 | /* screen: blanked, hsync: on, vsync: on */ |
| 169 | FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, |
| 170 | |
| 171 | /* screen: blanked, hsync: on, vsync: off */ |
| 172 | FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, |
| 173 | |
| 174 | /* screen: blanked, hsync: off, vsync: on */ |
| 175 | FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, |
| 176 | |
| 177 | /* screen: blanked, hsync: off, vsync: off */ |
| 178 | FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1 |
| 179 | }; |
| 180 | |
| 181 | #define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ |
| 182 | #define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */ |
| 183 | #define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */ |
| 184 | #define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */ |
| 185 | #define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */ |
| 186 | #define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */ |
| 187 | #define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */ |
| 188 | #define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */ |
| 189 | #define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */ |
| 190 | |
| 191 | struct fb_vblank { |
| 192 | __u32 flags; /* FB_VBLANK flags */ |
| 193 | __u32 count; /* counter of retraces since boot */ |
| 194 | __u32 vcount; /* current scanline position */ |
| 195 | __u32 hcount; /* current scandot position */ |
| 196 | __u32 reserved[4]; /* reserved for future compatibility */ |
| 197 | }; |
| 198 | |
| 199 | /* Internal HW accel */ |
| 200 | #define ROP_COPY 0 |
| 201 | #define ROP_XOR 1 |
| 202 | |
| 203 | struct fb_copyarea { |
| 204 | __u32 dx; |
| 205 | __u32 dy; |
| 206 | __u32 width; |
| 207 | __u32 height; |
| 208 | __u32 sx; |
| 209 | __u32 sy; |
| 210 | }; |
| 211 | |
| 212 | struct fb_fillrect { |
| 213 | __u32 dx; /* screen-relative */ |
| 214 | __u32 dy; |
| 215 | __u32 width; |
| 216 | __u32 height; |
| 217 | __u32 color; |
| 218 | __u32 rop; |
| 219 | }; |
| 220 | |
| 221 | struct fb_image { |
| 222 | __u32 dx; /* Where to place image */ |
| 223 | __u32 dy; |
| 224 | __u32 width; /* Size of image */ |
| 225 | __u32 height; |
| 226 | __u32 fg_color; /* Only used when a mono bitmap */ |
| 227 | __u32 bg_color; |
| 228 | __u8 depth; /* Depth of the image */ |
| 229 | const char *data; /* Pointer to image data */ |
| 230 | struct fb_cmap cmap; /* color map info */ |
| 231 | }; |
| 232 | |
| 233 | /* |
| 234 | * hardware cursor control |
| 235 | */ |
| 236 | |
| 237 | #define FB_CUR_SETIMAGE 0x01 |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 238 | #define FB_CUR_SETPOS 0x02 |
| 239 | #define FB_CUR_SETHOT 0x04 |
| 240 | #define FB_CUR_SETCMAP 0x08 |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 241 | #define FB_CUR_SETSHAPE 0x10 |
| 242 | #define FB_CUR_SETSIZE 0x20 |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 243 | #define FB_CUR_SETALL 0xFF |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 244 | |
| 245 | struct fbcurpos { |
| 246 | __u16 x, y; |
| 247 | }; |
| 248 | |
| 249 | struct fb_cursor { |
| 250 | __u16 set; /* what to set */ |
| 251 | __u16 enable; /* cursor on/off */ |
| 252 | __u16 rop; /* bitop operation */ |
| 253 | const char *mask; /* cursor mask bits */ |
| 254 | struct fbcurpos hot; /* cursor hot spot */ |
| 255 | struct fb_image image; /* Cursor image */ |
| 256 | }; |
| 257 | |
| 258 | #ifdef CONFIG_FB_BACKLIGHT |
| 259 | /* Settings for the generic backlight code */ |
| 260 | #define FB_BACKLIGHT_LEVELS 128 |
| 261 | #define FB_BACKLIGHT_MAX 0xFF |
| 262 | #endif |
| 263 | |
| 264 | #ifdef __KERNEL__ |
| 265 | |
| 266 | struct vm_area_struct; |
| 267 | struct fb_info; |
| 268 | struct device; |
| 269 | struct file; |
| 270 | |
| 271 | /* Definitions below are used in the parsed monitor specs */ |
| 272 | #define FB_DPMS_ACTIVE_OFF 1 |
| 273 | #define FB_DPMS_SUSPEND 2 |
| 274 | #define FB_DPMS_STANDBY 4 |
| 275 | |
| 276 | #define FB_DISP_DDI 1 |
| 277 | #define FB_DISP_ANA_700_300 2 |
| 278 | #define FB_DISP_ANA_714_286 4 |
| 279 | #define FB_DISP_ANA_1000_400 8 |
| 280 | #define FB_DISP_ANA_700_000 16 |
| 281 | |
| 282 | #define FB_DISP_MONO 32 |
| 283 | #define FB_DISP_RGB 64 |
| 284 | #define FB_DISP_MULTI 128 |
| 285 | #define FB_DISP_UNKNOWN 256 |
| 286 | |
| 287 | #define FB_SIGNAL_NONE 0 |
| 288 | #define FB_SIGNAL_BLANK_BLANK 1 |
| 289 | #define FB_SIGNAL_SEPARATE 2 |
| 290 | #define FB_SIGNAL_COMPOSITE 4 |
| 291 | #define FB_SIGNAL_SYNC_ON_GREEN 8 |
| 292 | #define FB_SIGNAL_SERRATION_ON 16 |
| 293 | |
| 294 | #define FB_MISC_PRIM_COLOR 1 |
| 295 | #define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ |
| 296 | struct fb_chroma { |
| 297 | __u32 redx; /* in fraction of 1024 */ |
| 298 | __u32 greenx; |
| 299 | __u32 bluex; |
| 300 | __u32 whitex; |
| 301 | __u32 redy; |
| 302 | __u32 greeny; |
| 303 | __u32 bluey; |
| 304 | __u32 whitey; |
| 305 | }; |
| 306 | |
| 307 | struct fb_monspecs { |
| 308 | struct fb_chroma chroma; |
| 309 | struct fb_videomode *modedb; /* mode database */ |
| 310 | __u8 manufacturer[4]; /* Manufacturer */ |
| 311 | __u8 monitor[14]; /* Monitor String */ |
| 312 | __u8 serial_no[14]; /* Serial Number */ |
| 313 | __u8 ascii[14]; /* ? */ |
| 314 | __u32 modedb_len; /* mode database length */ |
| 315 | __u32 model; /* Monitor Model */ |
| 316 | __u32 serial; /* Serial Number - Integer */ |
| 317 | __u32 year; /* Year manufactured */ |
| 318 | __u32 week; /* Week Manufactured */ |
| 319 | __u32 hfmin; /* hfreq lower limit (Hz) */ |
| 320 | __u32 hfmax; /* hfreq upper limit (Hz) */ |
| 321 | __u32 dclkmin; /* pixelclock lower limit (Hz) */ |
| 322 | __u32 dclkmax; /* pixelclock upper limit (Hz) */ |
| 323 | __u16 input; /* display type - see FB_DISP_* */ |
| 324 | __u16 dpms; /* DPMS support - see FB_DPMS_ */ |
| 325 | __u16 signal; /* Signal Type - see FB_SIGNAL_* */ |
| 326 | __u16 vfmin; /* vfreq lower limit (Hz) */ |
| 327 | __u16 vfmax; /* vfreq upper limit (Hz) */ |
| 328 | __u16 gamma; /* Gamma - in fractions of 100 */ |
| 329 | __u16 gtf : 1; /* supports GTF */ |
| 330 | __u16 misc; /* Misc flags - see FB_MISC_* */ |
| 331 | __u8 version; /* EDID version... */ |
| 332 | __u8 revision; /* ...and revision */ |
| 333 | __u8 max_x; /* Maximum horizontal size (cm) */ |
| 334 | __u8 max_y; /* Maximum vertical size (cm) */ |
| 335 | }; |
| 336 | |
| 337 | struct fb_cmap_user { |
| 338 | __u32 start; /* First entry */ |
| 339 | __u32 len; /* Number of entries */ |
| 340 | __u16 *red; /* Red values */ |
| 341 | __u16 *green; |
| 342 | __u16 *blue; |
| 343 | __u16 *transp; /* transparency, can be NULL */ |
| 344 | }; |
| 345 | |
| 346 | struct fb_image_user { |
| 347 | __u32 dx; /* Where to place image */ |
| 348 | __u32 dy; |
| 349 | __u32 width; /* Size of image */ |
| 350 | __u32 height; |
| 351 | __u32 fg_color; /* Only used when a mono bitmap */ |
| 352 | __u32 bg_color; |
| 353 | __u8 depth; /* Depth of the image */ |
| 354 | const char *data; /* Pointer to image data */ |
| 355 | struct fb_cmap_user cmap; /* color map info */ |
| 356 | }; |
| 357 | |
| 358 | struct fb_cursor_user { |
| 359 | __u16 set; /* what to set */ |
| 360 | __u16 enable; /* cursor on/off */ |
| 361 | __u16 rop; /* bitop operation */ |
| 362 | const char *mask; /* cursor mask bits */ |
| 363 | struct fbcurpos hot; /* cursor hot spot */ |
| 364 | struct fb_image_user image; /* Cursor image */ |
| 365 | }; |
| 366 | |
| 367 | /* |
| 368 | * Register/unregister for framebuffer events |
| 369 | */ |
| 370 | |
| 371 | /* The resolution of the passed in fb_info about to change */ |
| 372 | #define FB_EVENT_MODE_CHANGE 0x01 |
| 373 | /* The display on this fb_info is beeing suspended, no access to the |
| 374 | * framebuffer is allowed any more after that call returns |
| 375 | */ |
| 376 | #define FB_EVENT_SUSPEND 0x02 |
| 377 | /* The display on this fb_info was resumed, you can restore the display |
| 378 | * if you own it |
| 379 | */ |
| 380 | #define FB_EVENT_RESUME 0x03 |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 381 | /* An entry from the modelist was removed */ |
| 382 | #define FB_EVENT_MODE_DELETE 0x04 |
| 383 | /* A driver registered itself */ |
| 384 | #define FB_EVENT_FB_REGISTERED 0x05 |
| 385 | /* A driver unregistered itself */ |
| 386 | #define FB_EVENT_FB_UNREGISTERED 0x06 |
| 387 | /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ |
| 388 | #define FB_EVENT_GET_CONSOLE_MAP 0x07 |
| 389 | /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ |
| 390 | #define FB_EVENT_SET_CONSOLE_MAP 0x08 |
Vagrant Cascadian | edfdb99 | 2016-04-30 19:18:00 -0700 | [diff] [blame] | 391 | /* A hardware display blank change occurred */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 392 | #define FB_EVENT_BLANK 0x09 |
| 393 | /* Private modelist is to be replaced */ |
| 394 | #define FB_EVENT_NEW_MODELIST 0x0A |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 395 | /* The resolution of the passed in fb_info about to change and |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 396 | all vc's should be changed */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 397 | #define FB_EVENT_MODE_CHANGE_ALL 0x0B |
Vagrant Cascadian | edfdb99 | 2016-04-30 19:18:00 -0700 | [diff] [blame] | 398 | /* A software display blank change occurred */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 399 | #define FB_EVENT_CONBLANK 0x0C |
| 400 | /* Get drawing requirements */ |
| 401 | #define FB_EVENT_GET_REQ 0x0D |
| 402 | /* Unbind from the console if possible */ |
| 403 | #define FB_EVENT_FB_UNBIND 0x0E |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 404 | |
| 405 | struct fb_event { |
| 406 | struct fb_info *info; |
| 407 | void *data; |
| 408 | }; |
| 409 | |
| 410 | struct fb_blit_caps { |
| 411 | u32 x; |
| 412 | u32 y; |
| 413 | u32 len; |
| 414 | u32 flags; |
| 415 | }; |
| 416 | |
| 417 | /* |
| 418 | * Pixmap structure definition |
| 419 | * |
| 420 | * The purpose of this structure is to translate data |
| 421 | * from the hardware independent format of fbdev to what |
| 422 | * format the hardware needs. |
| 423 | */ |
| 424 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 425 | #define FB_PIXMAP_DEFAULT 1 /* used internally by fbcon */ |
| 426 | #define FB_PIXMAP_SYSTEM 2 /* memory is in system RAM */ |
| 427 | #define FB_PIXMAP_IO 4 /* memory is iomapped */ |
| 428 | #define FB_PIXMAP_SYNC 256 /* set if GPU can DMA */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 429 | |
| 430 | struct fb_pixmap { |
| 431 | u8 *addr; /* pointer to memory */ |
| 432 | u32 size; /* size of buffer in bytes */ |
| 433 | u32 offset; /* current offset to buffer */ |
| 434 | u32 buf_align; /* byte alignment of each bitmap */ |
| 435 | u32 scan_align; /* alignment per scanline */ |
| 436 | u32 access_align; /* alignment per read/write (bits) */ |
| 437 | u32 flags; /* see FB_PIXMAP_* */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 438 | u32 blit_x; /* supported bit block dimensions (1-32)*/ |
| 439 | u32 blit_y; /* Format: blit_x = 1 << (width - 1) */ |
| 440 | /* blit_y = 1 << (height - 1) */ |
| 441 | /* if 0, will be set to 0xffffffff (all)*/ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 442 | /* access methods */ |
| 443 | void (*writeio)(struct fb_info *info, void *dst, void *src, unsigned int size); |
| 444 | void (*readio) (struct fb_info *info, void *dst, void *src, unsigned int size); |
| 445 | }; |
| 446 | |
| 447 | #ifdef CONFIG_FB_DEFERRED_IO |
| 448 | struct fb_deferred_io { |
| 449 | /* delay between mkwrite and deferred handler */ |
| 450 | unsigned long delay; |
| 451 | struct mutex lock; /* mutex that protects the page list */ |
| 452 | struct list_head pagelist; /* list of touched pages */ |
| 453 | /* callback */ |
| 454 | void (*deferred_io)(struct fb_info *info, struct list_head *pagelist); |
| 455 | }; |
| 456 | #endif |
| 457 | |
| 458 | /* FBINFO_* = fb_info.flags bit flags */ |
| 459 | #define FBINFO_MODULE 0x0001 /* Low-level driver is a module */ |
| 460 | #define FBINFO_HWACCEL_DISABLED 0x0002 |
| 461 | /* When FBINFO_HWACCEL_DISABLED is set: |
| 462 | * Hardware acceleration is turned off. Software implementations |
| 463 | * of required functions (copyarea(), fillrect(), and imageblit()) |
| 464 | * takes over; acceleration engine should be in a quiescent state */ |
| 465 | |
| 466 | /* hints */ |
| 467 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ |
| 468 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ |
| 469 | |
| 470 | /* |
| 471 | * A driver may set this flag to indicate that it does want a set_par to be |
| 472 | * called every time when fbcon_switch is executed. The advantage is that with |
| 473 | * this flag set you can really be sure that set_par is always called before |
| 474 | * any of the functions dependant on the correct hardware state or altering |
| 475 | * that state, even if you are using some broken X releases. The disadvantage |
| 476 | * is that it introduces unwanted delays to every console switch if set_par |
| 477 | * is slow. It is a good idea to try this flag in the drivers initialization |
| 478 | * code whenever there is a bug report related to switching between X and the |
| 479 | * framebuffer console. |
| 480 | */ |
| 481 | #define FBINFO_MISC_ALWAYS_SETPAR 0x40000 |
| 482 | |
| 483 | /* |
| 484 | * Host and GPU endianness differ. |
| 485 | */ |
| 486 | #define FBINFO_FOREIGN_ENDIAN 0x100000 |
| 487 | /* |
| 488 | * Big endian math. This is the same flags as above, but with different |
| 489 | * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag |
| 490 | * and host endianness. Drivers should not use this flag. |
| 491 | */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 492 | #define FBINFO_BE_MATH 0x100000 |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 493 | |
| 494 | struct fb_info { |
| 495 | int node; |
| 496 | int flags; |
| 497 | struct fb_var_screeninfo var; /* Current var */ |
| 498 | struct fb_fix_screeninfo fix; /* Current fix */ |
| 499 | struct fb_monspecs monspecs; /* Current Monitor specs */ |
| 500 | struct fb_pixmap pixmap; /* Image hardware mapper */ |
| 501 | struct fb_pixmap sprite; /* Cursor hardware mapper */ |
| 502 | struct fb_cmap cmap; /* Current cmap */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 503 | struct list_head modelist; /* mode list */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 504 | struct fb_videomode *mode; /* current mode */ |
| 505 | |
| 506 | char *screen_base; /* Virtual address */ |
| 507 | unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */ |
| 508 | void *pseudo_palette; /* Fake palette of 16 colors */ |
| 509 | #define FBINFO_STATE_RUNNING 0 |
| 510 | #define FBINFO_STATE_SUSPENDED 1 |
| 511 | u32 state; /* Hardware state i.e suspend */ |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 512 | void *fbcon_par; /* fbcon use-only private area */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 513 | /* From here on everything is device dependent */ |
| 514 | void *par; |
| 515 | }; |
| 516 | |
| 517 | #define FBINFO_DEFAULT 0 |
| 518 | |
| 519 | #define FBINFO_FLAG_MODULE FBINFO_MODULE |
| 520 | #define FBINFO_FLAG_DEFAULT FBINFO_DEFAULT |
| 521 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 522 | /* This will go away */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 523 | #if defined(__sparc__) |
| 524 | |
| 525 | /* We map all of our framebuffers such that big-endian accesses |
| 526 | * are what we want, so the following is sufficient. |
| 527 | */ |
| 528 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 529 | /* This will go away */ |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 530 | #define fb_readb sbus_readb |
| 531 | #define fb_readw sbus_readw |
| 532 | #define fb_readl sbus_readl |
| 533 | #define fb_readq sbus_readq |
| 534 | #define fb_writeb sbus_writeb |
| 535 | #define fb_writew sbus_writew |
| 536 | #define fb_writel sbus_writel |
| 537 | #define fb_writeq sbus_writeq |
| 538 | #define fb_memset sbus_memset_io |
| 539 | |
| 540 | #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) |
| 541 | |
| 542 | #define fb_readb __raw_readb |
| 543 | #define fb_readw __raw_readw |
| 544 | #define fb_readl __raw_readl |
| 545 | #define fb_readq __raw_readq |
| 546 | #define fb_writeb __raw_writeb |
| 547 | #define fb_writew __raw_writew |
| 548 | #define fb_writel __raw_writel |
| 549 | #define fb_writeq __raw_writeq |
| 550 | #define fb_memset memset_io |
| 551 | |
| 552 | #else |
| 553 | |
| 554 | #define fb_readb(addr) (*(volatile u8 *) (addr)) |
| 555 | #define fb_readw(addr) (*(volatile u16 *) (addr)) |
| 556 | #define fb_readl(addr) (*(volatile u32 *) (addr)) |
| 557 | #define fb_readq(addr) (*(volatile u64 *) (addr)) |
| 558 | #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) |
| 559 | #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) |
| 560 | #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) |
| 561 | #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b)) |
| 562 | #define fb_memset memset |
| 563 | |
| 564 | #endif |
| 565 | |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 566 | #define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0) |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 567 | #define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \ |
| 568 | (val) << (bits)) |
| 569 | #define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \ |
| 570 | (val) >> (bits)) |
| 571 | /* drivers/video/fbmon.c */ |
| 572 | #define FB_MAXTIMINGS 0 |
| 573 | #define FB_VSYNCTIMINGS 1 |
| 574 | #define FB_HSYNCTIMINGS 2 |
| 575 | #define FB_DCLKTIMINGS 3 |
| 576 | #define FB_IGNOREMON 0x100 |
| 577 | |
| 578 | #define FB_MODE_IS_UNKNOWN 0 |
| 579 | #define FB_MODE_IS_DETAILED 1 |
| 580 | #define FB_MODE_IS_STANDARD 2 |
| 581 | #define FB_MODE_IS_VESA 4 |
| 582 | #define FB_MODE_IS_CALCULATED 8 |
| 583 | #define FB_MODE_IS_FIRST 16 |
Wolfgang Denk | 1136f69 | 2010-10-27 22:48:30 +0200 | [diff] [blame] | 584 | #define FB_MODE_IS_FROM_VAR 32 |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 585 | |
| 586 | |
| 587 | /* drivers/video/fbcmap.c */ |
| 588 | |
| 589 | extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); |
| 590 | extern void fb_dealloc_cmap(struct fb_cmap *cmap); |
| 591 | extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to); |
| 592 | extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to); |
| 593 | extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info); |
| 594 | extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info); |
| 595 | extern const struct fb_cmap *fb_default_cmap(int len); |
| 596 | extern void fb_invert_cmaps(void); |
| 597 | |
| 598 | struct fb_videomode { |
| 599 | const char *name; /* optional */ |
| 600 | u32 refresh; /* optional */ |
| 601 | u32 xres; |
| 602 | u32 yres; |
| 603 | u32 pixclock; |
| 604 | u32 left_margin; |
| 605 | u32 right_margin; |
| 606 | u32 upper_margin; |
| 607 | u32 lower_margin; |
| 608 | u32 hsync_len; |
| 609 | u32 vsync_len; |
| 610 | u32 sync; |
| 611 | u32 vmode; |
| 612 | u32 flag; |
| 613 | }; |
| 614 | |
Fabio Estevam | 4a040e3 | 2014-02-15 14:52:02 -0200 | [diff] [blame] | 615 | int board_video_skip(void); |
| 616 | |
Stefano Babic | 58427f5 | 2010-10-13 12:14:29 +0200 | [diff] [blame] | 617 | #endif /* __KERNEL__ */ |
| 618 | |
| 619 | #endif /* _LINUX_FB_H */ |