fb.h 19 KB

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