fb.h 19 KB

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