fb.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. #ifndef _LINUX_FB_H
  2. #define _LINUX_FB_H
  3. #include <linux/types.h>
  4. #include <linux/i2c.h>
  5. #ifdef __KERNEL__
  6. #include <linux/kgdb.h>
  7. #endif /* __KERNEL__ */
  8. /* Definitions of frame buffers */
  9. #define FB_MAX 32 /* sufficient for now */
  10. /* ioctls
  11. 0x46 is 'F' */
  12. #define FBIOGET_VSCREENINFO 0x4600
  13. #define FBIOPUT_VSCREENINFO 0x4601
  14. #define FBIOGET_FSCREENINFO 0x4602
  15. #define FBIOGETCMAP 0x4604
  16. #define FBIOPUTCMAP 0x4605
  17. #define FBIOPAN_DISPLAY 0x4606
  18. #ifdef __KERNEL__
  19. #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor_user)
  20. #else
  21. #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor)
  22. #endif
  23. /* 0x4607-0x460B are defined below */
  24. /* #define FBIOGET_MONITORSPEC 0x460C */
  25. /* #define FBIOPUT_MONITORSPEC 0x460D */
  26. /* #define FBIOSWITCH_MONIBIT 0x460E */
  27. #define FBIOGET_CON2FBMAP 0x460F
  28. #define FBIOPUT_CON2FBMAP 0x4610
  29. #define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */
  30. #define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank)
  31. #define FBIO_ALLOC 0x4613
  32. #define FBIO_FREE 0x4614
  33. #define FBIOGET_GLYPH 0x4615
  34. #define FBIOGET_HWCINFO 0x4616
  35. #define FBIOPUT_MODEINFO 0x4617
  36. #define FBIOGET_DISPINFO 0x4618
  37. #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
  38. #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
  39. #define FB_TYPE_PLANES 1 /* Non interleaved planes */
  40. #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
  41. #define FB_TYPE_TEXT 3 /* Text/attributes */
  42. #define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
  43. #define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
  44. #define FB_AUX_TEXT_MDA 0 /* Monochrome text */
  45. #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
  46. #define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
  47. #define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
  48. #define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
  49. #define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */
  50. #define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */
  51. #define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */
  52. #define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */
  53. #define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */
  54. #define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */
  55. #define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */
  56. #define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */
  57. #define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */
  58. #define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */
  59. #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */
  60. #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */
  61. #define FB_VISUAL_TRUECOLOR 2 /* True color */
  62. #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
  63. #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
  64. #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
  65. #define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
  66. #define FB_ACCEL_NONE 0 /* no hardware accelerator */
  67. #define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
  68. #define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */
  69. #define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */
  70. #define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */
  71. #define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */
  72. #define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */
  73. #define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */
  74. #define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */
  75. #define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */
  76. #define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */
  77. #define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */
  78. #define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */
  79. #define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */
  80. #define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */
  81. #define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */
  82. #define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */
  83. #define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */
  84. #define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */
  85. #define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
  86. #define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */
  87. #define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */
  88. #define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */
  89. #define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
  90. #define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
  91. #define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
  92. #define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */
  93. #define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */
  94. #define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */
  95. #define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */
  96. #define FB_ACCEL_CT_6555x 30 /* C&T 6555x */
  97. #define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */
  98. #define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */
  99. #define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */
  100. #define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */
  101. #define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */
  102. #define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */
  103. #define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */
  104. #define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */
  105. #define FB_ACCEL_I810 39 /* Intel 810/815 */
  106. #define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */
  107. #define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */
  108. #define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */
  109. #define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */
  110. #define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */
  111. #define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */
  112. #define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */
  113. #define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */
  114. #define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
  115. #define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */
  116. #define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */
  117. #define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */
  118. #define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */
  119. #define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */
  120. #define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */
  121. #define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
  122. #define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
  123. #define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
  124. #define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */
  125. #define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */
  126. #define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */
  127. #define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */
  128. #define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */
  129. #define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */
  130. #define FB_ACCEL_PXA3XX 99 /* PXA3xx */
  131. #define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */
  132. #define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */
  133. #define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */
  134. #define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */
  135. #define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */
  136. #define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */
  137. #define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */
  138. #define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */
  139. #define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */
  140. #define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */
  141. #define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */
  142. #define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */
  143. #define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */
  144. #define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */
  145. #define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */
  146. #define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
  147. #define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
  148. struct fb_fix_screeninfo {
  149. char id[16]; /* identification string eg "TT Builtin" */
  150. unsigned long smem_start; /* Start of frame buffer mem */
  151. /* (physical address) */
  152. __u32 smem_len; /* Length of frame buffer mem */
  153. __u32 type; /* see FB_TYPE_* */
  154. __u32 type_aux; /* Interleave for interleaved Planes */
  155. __u32 visual; /* see FB_VISUAL_* */
  156. __u16 xpanstep; /* zero if no hardware panning */
  157. __u16 ypanstep; /* zero if no hardware panning */
  158. __u16 ywrapstep; /* zero if no hardware ywrap */
  159. __u32 line_length; /* length of a line in bytes */
  160. unsigned long mmio_start; /* Start of Memory Mapped I/O */
  161. /* (physical address) */
  162. __u32 mmio_len; /* Length of Memory Mapped I/O */
  163. __u32 accel; /* Indicate to driver which */
  164. /* specific chip/card we have */
  165. __u16 capabilities; /* see FB_CAP_* */
  166. __u16 reserved[2]; /* Reserved for future compatibility */
  167. };
  168. /* Interpretation of offset for color fields: All offsets are from the right,
  169. * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
  170. * can use the offset as right argument to <<). A pixel afterwards is a bit
  171. * stream and is written to video memory as that unmodified.
  172. *
  173. * For pseudocolor: offset and length should be the same for all color
  174. * components. Offset specifies the position of the least significant bit
  175. * of the pallette index in a pixel value. Length indicates the number
  176. * of available palette entries (i.e. # of entries = 1 << length).
  177. */
  178. struct fb_bitfield {
  179. __u32 offset; /* beginning of bitfield */
  180. __u32 length; /* length of bitfield */
  181. __u32 msb_right; /* != 0 : Most significant bit is */
  182. /* right */
  183. };
  184. #define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */
  185. #define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */
  186. #define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/
  187. #define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */
  188. #define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */
  189. #define FB_ACTIVATE_MASK 15
  190. /* values */
  191. #define FB_ACTIVATE_VBL 16 /* activate values on next vbl */
  192. #define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */
  193. #define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
  194. #define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/
  195. #define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */
  196. #define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */
  197. #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
  198. #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
  199. #define FB_SYNC_EXT 4 /* external sync */
  200. #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
  201. #define FB_SYNC_BROADCAST 16 /* broadcast video timings */
  202. /* vtotal = 144d/288n/576i => PAL */
  203. /* vtotal = 121d/242n/484i => NTSC */
  204. #define FB_SYNC_ON_GREEN 32 /* sync on green */
  205. #define FB_VMODE_NONINTERLACED 0 /* non interlaced */
  206. #define FB_VMODE_INTERLACED 1 /* interlaced */
  207. #define FB_VMODE_DOUBLE 2 /* double scan */
  208. #define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */
  209. #define FB_VMODE_MASK 255
  210. #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
  211. #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
  212. #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
  213. /*
  214. * Display rotation support
  215. */
  216. #define FB_ROTATE_UR 0
  217. #define FB_ROTATE_CW 1
  218. #define FB_ROTATE_UD 2
  219. #define FB_ROTATE_CCW 3
  220. #define PICOS2KHZ(a) (1000000000UL/(a))
  221. #define KHZ2PICOS(a) (1000000000UL/(a))
  222. struct fb_var_screeninfo {
  223. __u32 xres; /* visible resolution */
  224. __u32 yres;
  225. __u32 xres_virtual; /* virtual resolution */
  226. __u32 yres_virtual;
  227. __u32 xoffset; /* offset from virtual to visible */
  228. __u32 yoffset; /* resolution */
  229. __u32 bits_per_pixel; /* guess what */
  230. __u32 grayscale; /* 0 = color, 1 = grayscale, */
  231. /* >1 = FOURCC */
  232. struct fb_bitfield red; /* bitfield in fb mem if true color, */
  233. struct fb_bitfield green; /* else only length is significant */
  234. struct fb_bitfield blue;
  235. struct fb_bitfield transp; /* transparency */
  236. __u32 nonstd; /* != 0 Non standard pixel format */
  237. __u32 activate; /* see FB_ACTIVATE_* */
  238. __u32 height; /* height of picture in mm */
  239. __u32 width; /* width of picture in mm */
  240. __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */
  241. /* Timing: All values in pixclocks, except pixclock (of course) */
  242. __u32 pixclock; /* pixel clock in ps (pico seconds) */
  243. __u32 left_margin; /* time from sync to picture */
  244. __u32 right_margin; /* time from picture to sync */
  245. __u32 upper_margin; /* time from sync to picture */
  246. __u32 lower_margin;
  247. __u32 hsync_len; /* length of horizontal sync */
  248. __u32 vsync_len; /* length of vertical sync */
  249. __u32 sync; /* see FB_SYNC_* */
  250. __u32 vmode; /* see FB_VMODE_* */
  251. __u32 rotate; /* angle we rotate counter clockwise */
  252. __u32 colorspace; /* colorspace for FOURCC-based modes */
  253. __u32 reserved[4]; /* Reserved for future compatibility */
  254. };
  255. struct fb_cmap {
  256. __u32 start; /* First entry */
  257. __u32 len; /* Number of entries */
  258. __u16 *red; /* Red values */
  259. __u16 *green;
  260. __u16 *blue;
  261. __u16 *transp; /* transparency, can be NULL */
  262. };
  263. struct fb_con2fbmap {
  264. __u32 console;
  265. __u32 framebuffer;
  266. };
  267. /* VESA Blanking Levels */
  268. #define VESA_NO_BLANKING 0
  269. #define VESA_VSYNC_SUSPEND 1
  270. #define VESA_HSYNC_SUSPEND 2
  271. #define VESA_POWERDOWN 3
  272. enum {
  273. /* screen: unblanked, hsync: on, vsync: on */
  274. FB_BLANK_UNBLANK = VESA_NO_BLANKING,
  275. /* screen: blanked, hsync: on, vsync: on */
  276. FB_BLANK_NORMAL = VESA_NO_BLANKING + 1,
  277. /* screen: blanked, hsync: on, vsync: off */
  278. FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
  279. /* screen: blanked, hsync: off, vsync: on */
  280. FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
  281. /* screen: blanked, hsync: off, vsync: off */
  282. FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1
  283. };
  284. #define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */
  285. #define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */
  286. #define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */
  287. #define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */
  288. #define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */
  289. #define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */
  290. #define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */
  291. #define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */
  292. #define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */
  293. struct fb_vblank {
  294. __u32 flags; /* FB_VBLANK flags */
  295. __u32 count; /* counter of retraces since boot */
  296. __u32 vcount; /* current scanline position */
  297. __u32 hcount; /* current scandot position */
  298. __u32 reserved[4]; /* reserved for future compatibility */
  299. };
  300. /* Internal HW accel */
  301. #define ROP_COPY 0
  302. #define ROP_XOR 1
  303. struct fb_copyarea {
  304. __u32 dx;
  305. __u32 dy;
  306. __u32 width;
  307. __u32 height;
  308. __u32 sx;
  309. __u32 sy;
  310. };
  311. struct fb_fillrect {
  312. __u32 dx; /* screen-relative */
  313. __u32 dy;
  314. __u32 width;
  315. __u32 height;
  316. __u32 color;
  317. __u32 rop;
  318. };
  319. struct fb_image {
  320. __u32 dx; /* Where to place image */
  321. __u32 dy;
  322. __u32 width; /* Size of image */
  323. __u32 height;
  324. __u32 fg_color; /* Only used when a mono bitmap */
  325. __u32 bg_color;
  326. __u8 depth; /* Depth of the image */
  327. const char *data; /* Pointer to image data */
  328. struct fb_cmap cmap; /* color map info */
  329. };
  330. /*
  331. * hardware cursor control
  332. */
  333. #define FB_CUR_SETIMAGE 0x01
  334. #define FB_CUR_SETPOS 0x02
  335. #define FB_CUR_SETHOT 0x04
  336. #define FB_CUR_SETCMAP 0x08
  337. #define FB_CUR_SETSHAPE 0x10
  338. #define FB_CUR_SETSIZE 0x20
  339. #define FB_CUR_SETALL 0xFF
  340. struct fbcurpos {
  341. __u16 x, y;
  342. };
  343. struct fb_cursor {
  344. __u16 set; /* what to set */
  345. __u16 enable; /* cursor on/off */
  346. __u16 rop; /* bitop operation */
  347. const char *mask; /* cursor mask bits */
  348. struct fbcurpos hot; /* cursor hot spot */
  349. struct fb_image image; /* Cursor image */
  350. };
  351. #ifdef CONFIG_FB_BACKLIGHT
  352. /* Settings for the generic backlight code */
  353. #define FB_BACKLIGHT_LEVELS 128
  354. #define FB_BACKLIGHT_MAX 0xFF
  355. #endif
  356. #ifdef __KERNEL__
  357. #include <linux/fs.h>
  358. #include <linux/init.h>
  359. #include <linux/workqueue.h>
  360. #include <linux/notifier.h>
  361. #include <linux/list.h>
  362. #include <linux/backlight.h>
  363. #include <linux/slab.h>
  364. #include <asm/io.h>
  365. struct vm_area_struct;
  366. struct fb_info;
  367. struct device;
  368. struct file;
  369. /* Definitions below are used in the parsed monitor specs */
  370. #define FB_DPMS_ACTIVE_OFF 1
  371. #define FB_DPMS_SUSPEND 2
  372. #define FB_DPMS_STANDBY 4
  373. #define FB_DISP_DDI 1
  374. #define FB_DISP_ANA_700_300 2
  375. #define FB_DISP_ANA_714_286 4
  376. #define FB_DISP_ANA_1000_400 8
  377. #define FB_DISP_ANA_700_000 16
  378. #define FB_DISP_MONO 32
  379. #define FB_DISP_RGB 64
  380. #define FB_DISP_MULTI 128
  381. #define FB_DISP_UNKNOWN 256
  382. #define FB_SIGNAL_NONE 0
  383. #define FB_SIGNAL_BLANK_BLANK 1
  384. #define FB_SIGNAL_SEPARATE 2
  385. #define FB_SIGNAL_COMPOSITE 4
  386. #define FB_SIGNAL_SYNC_ON_GREEN 8
  387. #define FB_SIGNAL_SERRATION_ON 16
  388. #define FB_MISC_PRIM_COLOR 1
  389. #define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */
  390. struct fb_chroma {
  391. __u32 redx; /* in fraction of 1024 */
  392. __u32 greenx;
  393. __u32 bluex;
  394. __u32 whitex;
  395. __u32 redy;
  396. __u32 greeny;
  397. __u32 bluey;
  398. __u32 whitey;
  399. };
  400. struct fb_monspecs {
  401. struct fb_chroma chroma;
  402. struct fb_videomode *modedb; /* mode database */
  403. __u8 manufacturer[4]; /* Manufacturer */
  404. __u8 monitor[14]; /* Monitor String */
  405. __u8 serial_no[14]; /* Serial Number */
  406. __u8 ascii[14]; /* ? */
  407. __u32 modedb_len; /* mode database length */
  408. __u32 model; /* Monitor Model */
  409. __u32 serial; /* Serial Number - Integer */
  410. __u32 year; /* Year manufactured */
  411. __u32 week; /* Week Manufactured */
  412. __u32 hfmin; /* hfreq lower limit (Hz) */
  413. __u32 hfmax; /* hfreq upper limit (Hz) */
  414. __u32 dclkmin; /* pixelclock lower limit (Hz) */
  415. __u32 dclkmax; /* pixelclock upper limit (Hz) */
  416. __u16 input; /* display type - see FB_DISP_* */
  417. __u16 dpms; /* DPMS support - see FB_DPMS_ */
  418. __u16 signal; /* Signal Type - see FB_SIGNAL_* */
  419. __u16 vfmin; /* vfreq lower limit (Hz) */
  420. __u16 vfmax; /* vfreq upper limit (Hz) */
  421. __u16 gamma; /* Gamma - in fractions of 100 */
  422. __u16 gtf : 1; /* supports GTF */
  423. __u16 misc; /* Misc flags - see FB_MISC_* */
  424. __u8 version; /* EDID version... */
  425. __u8 revision; /* ...and revision */
  426. __u8 max_x; /* Maximum horizontal size (cm) */
  427. __u8 max_y; /* Maximum vertical size (cm) */
  428. };
  429. struct fb_cmap_user {
  430. __u32 start; /* First entry */
  431. __u32 len; /* Number of entries */
  432. __u16 __user *red; /* Red values */
  433. __u16 __user *green;
  434. __u16 __user *blue;
  435. __u16 __user *transp; /* transparency, can be NULL */
  436. };
  437. struct fb_image_user {
  438. __u32 dx; /* Where to place image */
  439. __u32 dy;
  440. __u32 width; /* Size of image */
  441. __u32 height;
  442. __u32 fg_color; /* Only used when a mono bitmap */
  443. __u32 bg_color;
  444. __u8 depth; /* Depth of the image */
  445. const char __user *data; /* Pointer to image data */
  446. struct fb_cmap_user cmap; /* color map info */
  447. };
  448. struct fb_cursor_user {
  449. __u16 set; /* what to set */
  450. __u16 enable; /* cursor on/off */
  451. __u16 rop; /* bitop operation */
  452. const char __user *mask; /* cursor mask bits */
  453. struct fbcurpos hot; /* cursor hot spot */
  454. struct fb_image_user image; /* Cursor image */
  455. };
  456. /*
  457. * Register/unregister for framebuffer events
  458. */
  459. /* The resolution of the passed in fb_info about to change */
  460. #define FB_EVENT_MODE_CHANGE 0x01
  461. /* The display on this fb_info is beeing suspended, no access to the
  462. * framebuffer is allowed any more after that call returns
  463. */
  464. #define FB_EVENT_SUSPEND 0x02
  465. /* The display on this fb_info was resumed, you can restore the display
  466. * if you own it
  467. */
  468. #define FB_EVENT_RESUME 0x03
  469. /* An entry from the modelist was removed */
  470. #define FB_EVENT_MODE_DELETE 0x04
  471. /* A driver registered itself */
  472. #define FB_EVENT_FB_REGISTERED 0x05
  473. /* A driver unregistered itself */
  474. #define FB_EVENT_FB_UNREGISTERED 0x06
  475. /* CONSOLE-SPECIFIC: get console to framebuffer mapping */
  476. #define FB_EVENT_GET_CONSOLE_MAP 0x07
  477. /* CONSOLE-SPECIFIC: set console to framebuffer mapping */
  478. #define FB_EVENT_SET_CONSOLE_MAP 0x08
  479. /* A hardware display blank change occurred */
  480. #define FB_EVENT_BLANK 0x09
  481. /* Private modelist is to be replaced */
  482. #define FB_EVENT_NEW_MODELIST 0x0A
  483. /* The resolution of the passed in fb_info about to change and
  484. all vc's should be changed */
  485. #define FB_EVENT_MODE_CHANGE_ALL 0x0B
  486. /* A software display blank change occurred */
  487. #define FB_EVENT_CONBLANK 0x0C
  488. /* Get drawing requirements */
  489. #define FB_EVENT_GET_REQ 0x0D
  490. /* Unbind from the console if possible */
  491. #define FB_EVENT_FB_UNBIND 0x0E
  492. /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */
  493. #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
  494. struct fb_event {
  495. struct fb_info *info;
  496. void *data;
  497. };
  498. struct fb_blit_caps {
  499. u32 x;
  500. u32 y;
  501. u32 len;
  502. u32 flags;
  503. };
  504. extern int fb_register_client(struct notifier_block *nb);
  505. extern int fb_unregister_client(struct notifier_block *nb);
  506. extern int fb_notifier_call_chain(unsigned long val, void *v);
  507. /*
  508. * Pixmap structure definition
  509. *
  510. * The purpose of this structure is to translate data
  511. * from the hardware independent format of fbdev to what
  512. * format the hardware needs.
  513. */
  514. #define FB_PIXMAP_DEFAULT 1 /* used internally by fbcon */
  515. #define FB_PIXMAP_SYSTEM 2 /* memory is in system RAM */
  516. #define FB_PIXMAP_IO 4 /* memory is iomapped */
  517. #define FB_PIXMAP_SYNC 256 /* set if GPU can DMA */
  518. struct fb_pixmap {
  519. u8 *addr; /* pointer to memory */
  520. u32 size; /* size of buffer in bytes */
  521. u32 offset; /* current offset to buffer */
  522. u32 buf_align; /* byte alignment of each bitmap */
  523. u32 scan_align; /* alignment per scanline */
  524. u32 access_align; /* alignment per read/write (bits) */
  525. u32 flags; /* see FB_PIXMAP_* */
  526. u32 blit_x; /* supported bit block dimensions (1-32)*/
  527. u32 blit_y; /* Format: blit_x = 1 << (width - 1) */
  528. /* blit_y = 1 << (height - 1) */
  529. /* if 0, will be set to 0xffffffff (all)*/
  530. /* access methods */
  531. void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
  532. void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
  533. };
  534. #ifdef CONFIG_FB_DEFERRED_IO
  535. struct fb_deferred_io {
  536. /* delay between mkwrite and deferred handler */
  537. unsigned long delay;
  538. struct mutex lock; /* mutex that protects the page list */
  539. struct list_head pagelist; /* list of touched pages */
  540. /* callback */
  541. void (*first_io)(struct fb_info *info);
  542. void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
  543. };
  544. #endif
  545. /*
  546. * Frame buffer operations
  547. *
  548. * LOCKING NOTE: those functions must _ALL_ be called with the console
  549. * semaphore held, this is the only suitable locking mechanism we have
  550. * in 2.6. Some may be called at interrupt time at this point though.
  551. *
  552. * The exception to this is the debug related hooks. Putting the fb
  553. * into a debug state (e.g. flipping to the kernel console) and restoring
  554. * it must be done in a lock-free manner, so low level drivers should
  555. * keep track of the initial console (if applicable) and may need to
  556. * perform direct, unlocked hardware writes in these hooks.
  557. */
  558. struct fb_ops {
  559. /* open/release and usage marking */
  560. struct module *owner;
  561. int (*fb_open)(struct fb_info *info, int user);
  562. int (*fb_release)(struct fb_info *info, int user);
  563. /* For framebuffers with strange non linear layouts or that do not
  564. * work with normal memory mapped access
  565. */
  566. ssize_t (*fb_read)(struct fb_info *info, char __user *buf,
  567. size_t count, loff_t *ppos);
  568. ssize_t (*fb_write)(struct fb_info *info, const char __user *buf,
  569. size_t count, loff_t *ppos);
  570. /* checks var and eventually tweaks it to something supported,
  571. * DO NOT MODIFY PAR */
  572. int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
  573. /* set the video mode according to info->var */
  574. int (*fb_set_par)(struct fb_info *info);
  575. /* set color register */
  576. int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
  577. unsigned blue, unsigned transp, struct fb_info *info);
  578. /* set color registers in batch */
  579. int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);
  580. /* blank display */
  581. int (*fb_blank)(int blank, struct fb_info *info);
  582. /* pan display */
  583. int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
  584. /* Draws a rectangle */
  585. void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
  586. /* Copy data from area to another */
  587. void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
  588. /* Draws a image to the display */
  589. void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
  590. /* Draws cursor */
  591. int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
  592. /* Rotates the display */
  593. void (*fb_rotate)(struct fb_info *info, int angle);
  594. /* wait for blit idle, optional */
  595. int (*fb_sync)(struct fb_info *info);
  596. /* perform fb specific ioctl (optional) */
  597. int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
  598. unsigned long arg);
  599. /* Handle 32bit compat ioctl (optional) */
  600. int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
  601. unsigned long arg);
  602. /* perform fb specific mmap */
  603. int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
  604. /* get capability given var */
  605. void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
  606. struct fb_var_screeninfo *var);
  607. /* teardown any resources to do with this framebuffer */
  608. void (*fb_destroy)(struct fb_info *info);
  609. /* called at KDB enter and leave time to prepare the console */
  610. int (*fb_debug_enter)(struct fb_info *info);
  611. int (*fb_debug_leave)(struct fb_info *info);
  612. };
  613. #ifdef CONFIG_FB_TILEBLITTING
  614. #define FB_TILE_CURSOR_NONE 0
  615. #define FB_TILE_CURSOR_UNDERLINE 1
  616. #define FB_TILE_CURSOR_LOWER_THIRD 2
  617. #define FB_TILE_CURSOR_LOWER_HALF 3
  618. #define FB_TILE_CURSOR_TWO_THIRDS 4
  619. #define FB_TILE_CURSOR_BLOCK 5
  620. struct fb_tilemap {
  621. __u32 width; /* width of each tile in pixels */
  622. __u32 height; /* height of each tile in scanlines */
  623. __u32 depth; /* color depth of each tile */
  624. __u32 length; /* number of tiles in the map */
  625. const __u8 *data; /* actual tile map: a bitmap array, packed
  626. to the nearest byte */
  627. };
  628. struct fb_tilerect {
  629. __u32 sx; /* origin in the x-axis */
  630. __u32 sy; /* origin in the y-axis */
  631. __u32 width; /* number of tiles in the x-axis */
  632. __u32 height; /* number of tiles in the y-axis */
  633. __u32 index; /* what tile to use: index to tile map */
  634. __u32 fg; /* foreground color */
  635. __u32 bg; /* background color */
  636. __u32 rop; /* raster operation */
  637. };
  638. struct fb_tilearea {
  639. __u32 sx; /* source origin in the x-axis */
  640. __u32 sy; /* source origin in the y-axis */
  641. __u32 dx; /* destination origin in the x-axis */
  642. __u32 dy; /* destination origin in the y-axis */
  643. __u32 width; /* number of tiles in the x-axis */
  644. __u32 height; /* number of tiles in the y-axis */
  645. };
  646. struct fb_tileblit {
  647. __u32 sx; /* origin in the x-axis */
  648. __u32 sy; /* origin in the y-axis */
  649. __u32 width; /* number of tiles in the x-axis */
  650. __u32 height; /* number of tiles in the y-axis */
  651. __u32 fg; /* foreground color */
  652. __u32 bg; /* background color */
  653. __u32 length; /* number of tiles to draw */
  654. __u32 *indices; /* array of indices to tile map */
  655. };
  656. struct fb_tilecursor {
  657. __u32 sx; /* cursor position in the x-axis */
  658. __u32 sy; /* cursor position in the y-axis */
  659. __u32 mode; /* 0 = erase, 1 = draw */
  660. __u32 shape; /* see FB_TILE_CURSOR_* */
  661. __u32 fg; /* foreground color */
  662. __u32 bg; /* background color */
  663. };
  664. struct fb_tile_ops {
  665. /* set tile characteristics */
  666. void (*fb_settile)(struct fb_info *info, struct fb_tilemap *map);
  667. /* all dimensions from hereon are in terms of tiles */
  668. /* move a rectangular region of tiles from one area to another*/
  669. void (*fb_tilecopy)(struct fb_info *info, struct fb_tilearea *area);
  670. /* fill a rectangular region with a tile */
  671. void (*fb_tilefill)(struct fb_info *info, struct fb_tilerect *rect);
  672. /* copy an array of tiles */
  673. void (*fb_tileblit)(struct fb_info *info, struct fb_tileblit *blit);
  674. /* cursor */
  675. void (*fb_tilecursor)(struct fb_info *info,
  676. struct fb_tilecursor *cursor);
  677. /* get maximum length of the tile map */
  678. int (*fb_get_tilemax)(struct fb_info *info);
  679. };
  680. #endif /* CONFIG_FB_TILEBLITTING */
  681. /* FBINFO_* = fb_info.flags bit flags */
  682. #define FBINFO_MODULE 0x0001 /* Low-level driver is a module */
  683. #define FBINFO_HWACCEL_DISABLED 0x0002
  684. /* When FBINFO_HWACCEL_DISABLED is set:
  685. * Hardware acceleration is turned off. Software implementations
  686. * of required functions (copyarea(), fillrect(), and imageblit())
  687. * takes over; acceleration engine should be in a quiescent state */
  688. /* hints */
  689. #define FBINFO_VIRTFB 0x0004 /* FB is System RAM, not device. */
  690. #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */
  691. #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */
  692. /* hardware supported ops */
  693. /* semantics: when a bit is set, it indicates that the operation is
  694. * accelerated by hardware.
  695. * required functions will still work even if the bit is not set.
  696. * optional functions may not even exist if the flag bit is not set.
  697. */
  698. #define FBINFO_HWACCEL_NONE 0x0000
  699. #define FBINFO_HWACCEL_COPYAREA 0x0100 /* required */
  700. #define FBINFO_HWACCEL_FILLRECT 0x0200 /* required */
  701. #define FBINFO_HWACCEL_IMAGEBLIT 0x0400 /* required */
  702. #define FBINFO_HWACCEL_ROTATE 0x0800 /* optional */
  703. #define FBINFO_HWACCEL_XPAN 0x1000 /* optional */
  704. #define FBINFO_HWACCEL_YPAN 0x2000 /* optional */
  705. #define FBINFO_HWACCEL_YWRAP 0x4000 /* optional */
  706. #define FBINFO_MISC_USEREVENT 0x10000 /* event request
  707. from userspace */
  708. #define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
  709. /* A driver may set this flag to indicate that it does want a set_par to be
  710. * called every time when fbcon_switch is executed. The advantage is that with
  711. * this flag set you can really be sure that set_par is always called before
  712. * any of the functions dependent on the correct hardware state or altering
  713. * that state, even if you are using some broken X releases. The disadvantage
  714. * is that it introduces unwanted delays to every console switch if set_par
  715. * is slow. It is a good idea to try this flag in the drivers initialization
  716. * code whenever there is a bug report related to switching between X and the
  717. * framebuffer console.
  718. */
  719. #define FBINFO_MISC_ALWAYS_SETPAR 0x40000
  720. /* where the fb is a firmware driver, and can be replaced with a proper one */
  721. #define FBINFO_MISC_FIRMWARE 0x80000
  722. /*
  723. * Host and GPU endianness differ.
  724. */
  725. #define FBINFO_FOREIGN_ENDIAN 0x100000
  726. /*
  727. * Big endian math. This is the same flags as above, but with different
  728. * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
  729. * and host endianness. Drivers should not use this flag.
  730. */
  731. #define FBINFO_BE_MATH 0x100000
  732. /* report to the VT layer that this fb driver can accept forced console
  733. output like oopses */
  734. #define FBINFO_CAN_FORCE_OUTPUT 0x200000
  735. struct fb_info {
  736. atomic_t count;
  737. int node;
  738. int flags;
  739. struct mutex lock; /* Lock for open/release/ioctl funcs */
  740. struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */
  741. struct fb_var_screeninfo var; /* Current var */
  742. struct fb_fix_screeninfo fix; /* Current fix */
  743. struct fb_monspecs monspecs; /* Current Monitor specs */
  744. struct work_struct queue; /* Framebuffer event queue */
  745. struct fb_pixmap pixmap; /* Image hardware mapper */
  746. struct fb_pixmap sprite; /* Cursor hardware mapper */
  747. struct fb_cmap cmap; /* Current cmap */
  748. struct list_head modelist; /* mode list */
  749. struct fb_videomode *mode; /* current mode */
  750. #ifdef CONFIG_FB_BACKLIGHT
  751. /* assigned backlight device */
  752. /* set before framebuffer registration,
  753. remove after unregister */
  754. struct backlight_device *bl_dev;
  755. /* Backlight level curve */
  756. struct mutex bl_curve_mutex;
  757. u8 bl_curve[FB_BACKLIGHT_LEVELS];
  758. #endif
  759. #ifdef CONFIG_FB_DEFERRED_IO
  760. struct delayed_work deferred_work;
  761. struct fb_deferred_io *fbdefio;
  762. #endif
  763. struct fb_ops *fbops;
  764. struct device *device; /* This is the parent */
  765. struct device *dev; /* This is this fb device */
  766. int class_flag; /* private sysfs flags */
  767. #ifdef CONFIG_FB_TILEBLITTING
  768. struct fb_tile_ops *tileops; /* Tile Blitting */
  769. #endif
  770. char __iomem *screen_base; /* Virtual address */
  771. unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */
  772. void *pseudo_palette; /* Fake palette of 16 colors */
  773. #define FBINFO_STATE_RUNNING 0
  774. #define FBINFO_STATE_SUSPENDED 1
  775. u32 state; /* Hardware state i.e suspend */
  776. void *fbcon_par; /* fbcon use-only private area */
  777. /* From here on everything is device dependent */
  778. void *par;
  779. /* we need the PCI or similar aperture base/size not
  780. smem_start/size as smem_start may just be an object
  781. allocated inside the aperture so may not actually overlap */
  782. struct apertures_struct {
  783. unsigned int count;
  784. struct aperture {
  785. resource_size_t base;
  786. resource_size_t size;
  787. } ranges[0];
  788. } *apertures;
  789. };
  790. static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
  791. struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
  792. + max_num * sizeof(struct aperture), GFP_KERNEL);
  793. if (!a)
  794. return NULL;
  795. a->count = max_num;
  796. return a;
  797. }
  798. #ifdef MODULE
  799. #define FBINFO_DEFAULT FBINFO_MODULE
  800. #else
  801. #define FBINFO_DEFAULT 0
  802. #endif
  803. // This will go away
  804. #define FBINFO_FLAG_MODULE FBINFO_MODULE
  805. #define FBINFO_FLAG_DEFAULT FBINFO_DEFAULT
  806. /* This will go away
  807. * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags
  808. * when it wants to turn the acceleration engine on. This is
  809. * really a separate operation, and should be modified via sysfs.
  810. * But for now, we leave it broken with the following define
  811. */
  812. #define STUPID_ACCELF_TEXT_SHIT
  813. // This will go away
  814. #if defined(__sparc__)
  815. /* We map all of our framebuffers such that big-endian accesses
  816. * are what we want, so the following is sufficient.
  817. */
  818. // This will go away
  819. #define fb_readb sbus_readb
  820. #define fb_readw sbus_readw
  821. #define fb_readl sbus_readl
  822. #define fb_readq sbus_readq
  823. #define fb_writeb sbus_writeb
  824. #define fb_writew sbus_writew
  825. #define fb_writel sbus_writel
  826. #define fb_writeq sbus_writeq
  827. #define fb_memset sbus_memset_io
  828. #define fb_memcpy_fromfb sbus_memcpy_fromio
  829. #define fb_memcpy_tofb sbus_memcpy_toio
  830. #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
  831. #define fb_readb __raw_readb
  832. #define fb_readw __raw_readw
  833. #define fb_readl __raw_readl
  834. #define fb_readq __raw_readq
  835. #define fb_writeb __raw_writeb
  836. #define fb_writew __raw_writew
  837. #define fb_writel __raw_writel
  838. #define fb_writeq __raw_writeq
  839. #define fb_memset memset_io
  840. #define fb_memcpy_fromfb memcpy_fromio
  841. #define fb_memcpy_tofb memcpy_toio
  842. #else
  843. #define fb_readb(addr) (*(volatile u8 *) (addr))
  844. #define fb_readw(addr) (*(volatile u16 *) (addr))
  845. #define fb_readl(addr) (*(volatile u32 *) (addr))
  846. #define fb_readq(addr) (*(volatile u64 *) (addr))
  847. #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
  848. #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
  849. #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
  850. #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
  851. #define fb_memset memset
  852. #define fb_memcpy_fromfb memcpy
  853. #define fb_memcpy_tofb memcpy
  854. #endif
  855. #define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
  856. #define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
  857. (val) << (bits))
  858. #define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
  859. (val) >> (bits))
  860. /*
  861. * `Generic' versions of the frame buffer device operations
  862. */
  863. extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var);
  864. extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var);
  865. extern int fb_blank(struct fb_info *info, int blank);
  866. extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
  867. extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
  868. extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
  869. /*
  870. * Drawing operations where framebuffer is in system RAM
  871. */
  872. extern void sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
  873. extern void sys_copyarea(struct fb_info *info, const struct fb_copyarea *area);
  874. extern void sys_imageblit(struct fb_info *info, const struct fb_image *image);
  875. extern ssize_t fb_sys_read(struct fb_info *info, char __user *buf,
  876. size_t count, loff_t *ppos);
  877. extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
  878. size_t count, loff_t *ppos);
  879. /* drivers/video/fbmem.c */
  880. extern int register_framebuffer(struct fb_info *fb_info);
  881. extern int unregister_framebuffer(struct fb_info *fb_info);
  882. extern int unlink_framebuffer(struct fb_info *fb_info);
  883. extern void remove_conflicting_framebuffers(struct apertures_struct *a,
  884. const char *name, bool primary);
  885. extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
  886. extern int fb_show_logo(struct fb_info *fb_info, int rotate);
  887. extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
  888. extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
  889. u32 height, u32 shift_high, u32 shift_low, u32 mod);
  890. extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
  891. extern void fb_set_suspend(struct fb_info *info, int state);
  892. extern int fb_get_color_depth(struct fb_var_screeninfo *var,
  893. struct fb_fix_screeninfo *fix);
  894. extern int fb_get_options(char *name, char **option);
  895. extern int fb_new_modelist(struct fb_info *info);
  896. extern struct fb_info *registered_fb[FB_MAX];
  897. extern int num_registered_fb;
  898. extern struct class *fb_class;
  899. extern int lock_fb_info(struct fb_info *info);
  900. static inline void unlock_fb_info(struct fb_info *info)
  901. {
  902. mutex_unlock(&info->lock);
  903. }
  904. static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
  905. u8 *src, u32 s_pitch, u32 height)
  906. {
  907. int i, j;
  908. d_pitch -= s_pitch;
  909. for (i = height; i--; ) {
  910. /* s_pitch is a few bytes at the most, memcpy is suboptimal */
  911. for (j = 0; j < s_pitch; j++)
  912. *dst++ = *src++;
  913. dst += d_pitch;
  914. }
  915. }
  916. /* drivers/video/fb_defio.c */
  917. extern void fb_deferred_io_init(struct fb_info *info);
  918. extern void fb_deferred_io_open(struct fb_info *info,
  919. struct inode *inode,
  920. struct file *file);
  921. extern void fb_deferred_io_cleanup(struct fb_info *info);
  922. extern int fb_deferred_io_fsync(struct file *file, loff_t start,
  923. loff_t end, int datasync);
  924. static inline bool fb_be_math(struct fb_info *info)
  925. {
  926. #ifdef CONFIG_FB_FOREIGN_ENDIAN
  927. #if defined(CONFIG_FB_BOTH_ENDIAN)
  928. return info->flags & FBINFO_BE_MATH;
  929. #elif defined(CONFIG_FB_BIG_ENDIAN)
  930. return true;
  931. #elif defined(CONFIG_FB_LITTLE_ENDIAN)
  932. return false;
  933. #endif /* CONFIG_FB_BOTH_ENDIAN */
  934. #else
  935. #ifdef __BIG_ENDIAN
  936. return true;
  937. #else
  938. return false;
  939. #endif /* __BIG_ENDIAN */
  940. #endif /* CONFIG_FB_FOREIGN_ENDIAN */
  941. }
  942. /* drivers/video/fbsysfs.c */
  943. extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
  944. extern void framebuffer_release(struct fb_info *info);
  945. extern int fb_init_device(struct fb_info *fb_info);
  946. extern void fb_cleanup_device(struct fb_info *head);
  947. extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
  948. /* drivers/video/fbmon.c */
  949. #define FB_MAXTIMINGS 0
  950. #define FB_VSYNCTIMINGS 1
  951. #define FB_HSYNCTIMINGS 2
  952. #define FB_DCLKTIMINGS 3
  953. #define FB_IGNOREMON 0x100
  954. #define FB_MODE_IS_UNKNOWN 0
  955. #define FB_MODE_IS_DETAILED 1
  956. #define FB_MODE_IS_STANDARD 2
  957. #define FB_MODE_IS_VESA 4
  958. #define FB_MODE_IS_CALCULATED 8
  959. #define FB_MODE_IS_FIRST 16
  960. #define FB_MODE_IS_FROM_VAR 32
  961. extern int fbmon_dpms(const struct fb_info *fb_info);
  962. extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
  963. struct fb_info *info);
  964. extern int fb_validate_mode(const struct fb_var_screeninfo *var,
  965. struct fb_info *info);
  966. extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
  967. extern const unsigned char *fb_firmware_edid(struct device *device);
  968. extern void fb_edid_to_monspecs(unsigned char *edid,
  969. struct fb_monspecs *specs);
  970. extern void fb_edid_add_monspecs(unsigned char *edid,
  971. struct fb_monspecs *specs);
  972. extern void fb_destroy_modedb(struct fb_videomode *modedb);
  973. extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
  974. extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
  975. /* drivers/video/modedb.c */
  976. #define VESA_MODEDB_SIZE 34
  977. extern void fb_var_to_videomode(struct fb_videomode *mode,
  978. const struct fb_var_screeninfo *var);
  979. extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
  980. const struct fb_videomode *mode);
  981. extern int fb_mode_is_equal(const struct fb_videomode *mode1,
  982. const struct fb_videomode *mode2);
  983. extern int fb_add_videomode(const struct fb_videomode *mode,
  984. struct list_head *head);
  985. extern void fb_delete_videomode(const struct fb_videomode *mode,
  986. struct list_head *head);
  987. extern const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
  988. struct list_head *head);
  989. extern const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
  990. struct list_head *head);
  991. extern const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
  992. struct list_head *head);
  993. extern void fb_destroy_modelist(struct list_head *head);
  994. extern void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
  995. struct list_head *head);
  996. extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
  997. struct list_head *head);
  998. /* drivers/video/fbcmap.c */
  999. extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
  1000. extern int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags);
  1001. extern void fb_dealloc_cmap(struct fb_cmap *cmap);
  1002. extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to);
  1003. extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to);
  1004. extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info);
  1005. extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info);
  1006. extern const struct fb_cmap *fb_default_cmap(int len);
  1007. extern void fb_invert_cmaps(void);
  1008. struct fb_videomode {
  1009. const char *name; /* optional */
  1010. u32 refresh; /* optional */
  1011. u32 xres;
  1012. u32 yres;
  1013. u32 pixclock;
  1014. u32 left_margin;
  1015. u32 right_margin;
  1016. u32 upper_margin;
  1017. u32 lower_margin;
  1018. u32 hsync_len;
  1019. u32 vsync_len;
  1020. u32 sync;
  1021. u32 vmode;
  1022. u32 flag;
  1023. };
  1024. extern const char *fb_mode_option;
  1025. extern const struct fb_videomode vesa_modes[];
  1026. extern const struct fb_videomode cea_modes[64];
  1027. struct fb_modelist {
  1028. struct list_head list;
  1029. struct fb_videomode mode;
  1030. };
  1031. extern int fb_find_mode(struct fb_var_screeninfo *var,
  1032. struct fb_info *info, const char *mode_option,
  1033. const struct fb_videomode *db,
  1034. unsigned int dbsize,
  1035. const struct fb_videomode *default_mode,
  1036. unsigned int default_bpp);
  1037. #endif /* __KERNEL__ */
  1038. #endif /* _LINUX_FB_H */