fbio.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __LINUX_FBIO_H
  3. #define __LINUX_FBIO_H
  4. #include <linux/compiler.h>
  5. #include <linux/types.h>
  6. /* Constants used for fbio SunOS compatibility */
  7. /* (C) 1996 Miguel de Icaza */
  8. /* Frame buffer types */
  9. #define FBTYPE_NOTYPE -1
  10. #define FBTYPE_SUN1BW 0 /* mono */
  11. #define FBTYPE_SUN1COLOR 1
  12. #define FBTYPE_SUN2BW 2
  13. #define FBTYPE_SUN2COLOR 3
  14. #define FBTYPE_SUN2GP 4
  15. #define FBTYPE_SUN5COLOR 5
  16. #define FBTYPE_SUN3COLOR 6
  17. #define FBTYPE_MEMCOLOR 7
  18. #define FBTYPE_SUN4COLOR 8
  19. #define FBTYPE_NOTSUN1 9
  20. #define FBTYPE_NOTSUN2 10
  21. #define FBTYPE_NOTSUN3 11
  22. #define FBTYPE_SUNFAST_COLOR 12 /* cg6 */
  23. #define FBTYPE_SUNROP_COLOR 13
  24. #define FBTYPE_SUNFB_VIDEO 14
  25. #define FBTYPE_SUNGIFB 15
  26. #define FBTYPE_SUNGPLAS 16
  27. #define FBTYPE_SUNGP3 17
  28. #define FBTYPE_SUNGT 18
  29. #define FBTYPE_SUNLEO 19 /* zx Leo card */
  30. #define FBTYPE_MDICOLOR 20 /* cg14 */
  31. #define FBTYPE_TCXCOLOR 21 /* SUNW,tcx card */
  32. #define FBTYPE_LASTPLUSONE 21 /* This is not last + 1 in fact... */
  33. /* Does not seem to be listed in the Sun file either */
  34. #define FBTYPE_CREATOR 22
  35. #define FBTYPE_PCI_IGA1682 23
  36. #define FBTYPE_P9100COLOR 24
  37. #define FBTYPE_PCI_GENERIC 1000
  38. #define FBTYPE_PCI_MACH64 1001
  39. /* fbio ioctls */
  40. /* Returned by FBIOGTYPE */
  41. struct fbtype {
  42. int fb_type; /* fb type, see above */
  43. int fb_height; /* pixels */
  44. int fb_width; /* pixels */
  45. int fb_depth;
  46. int fb_cmsize; /* color map entries */
  47. int fb_size; /* fb size in bytes */
  48. };
  49. #define FBIOGTYPE _IOR('F', 0, struct fbtype)
  50. struct fbcmap {
  51. int index; /* first element (0 origin) */
  52. int count;
  53. unsigned char __user *red;
  54. unsigned char __user *green;
  55. unsigned char __user *blue;
  56. };
  57. #ifdef __KERNEL__
  58. #define FBIOPUTCMAP_SPARC _IOW('F', 3, struct fbcmap)
  59. #define FBIOGETCMAP_SPARC _IOW('F', 4, struct fbcmap)
  60. #else
  61. #define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
  62. #define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
  63. #endif
  64. /* # of device specific values */
  65. #define FB_ATTR_NDEVSPECIFIC 8
  66. /* # of possible emulations */
  67. #define FB_ATTR_NEMUTYPES 4
  68. struct fbsattr {
  69. int flags;
  70. int emu_type; /* -1 if none */
  71. int dev_specific[FB_ATTR_NDEVSPECIFIC];
  72. };
  73. struct fbgattr {
  74. int real_type; /* real frame buffer type */
  75. int owner; /* unknown */
  76. struct fbtype fbtype; /* real frame buffer fbtype */
  77. struct fbsattr sattr;
  78. int emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */
  79. };
  80. #define FBIOSATTR _IOW('F', 5, struct fbgattr) /* Unsupported: */
  81. #define FBIOGATTR _IOR('F', 6, struct fbgattr) /* supported */
  82. #define FBIOSVIDEO _IOW('F', 7, int)
  83. #define FBIOGVIDEO _IOR('F', 8, int)
  84. struct fbcursor {
  85. short set; /* what to set, choose from the list above */
  86. short enable; /* cursor on/off */
  87. struct fbcurpos pos; /* cursor position */
  88. struct fbcurpos hot; /* cursor hot spot */
  89. struct fbcmap cmap; /* color map info */
  90. struct fbcurpos size; /* cursor bit map size */
  91. char __user *image; /* cursor image bits */
  92. char __user *mask; /* cursor mask bits */
  93. };
  94. /* set/get cursor attributes/shape */
  95. #define FBIOSCURSOR _IOW('F', 24, struct fbcursor)
  96. #define FBIOGCURSOR _IOWR('F', 25, struct fbcursor)
  97. /* set/get cursor position */
  98. #define FBIOSCURPOS _IOW('F', 26, struct fbcurpos)
  99. #define FBIOGCURPOS _IOW('F', 27, struct fbcurpos)
  100. /* get max cursor size */
  101. #define FBIOGCURMAX _IOR('F', 28, struct fbcurpos)
  102. /* wid manipulation */
  103. struct fb_wid_alloc {
  104. #define FB_WID_SHARED_8 0
  105. #define FB_WID_SHARED_24 1
  106. #define FB_WID_DBL_8 2
  107. #define FB_WID_DBL_24 3
  108. __u32 wa_type;
  109. __s32 wa_index; /* Set on return */
  110. __u32 wa_count;
  111. };
  112. struct fb_wid_item {
  113. __u32 wi_type;
  114. __s32 wi_index;
  115. __u32 wi_attrs;
  116. __u32 wi_values[32];
  117. };
  118. struct fb_wid_list {
  119. __u32 wl_flags;
  120. __u32 wl_count;
  121. struct fb_wid_item *wl_list;
  122. };
  123. #define FBIO_WID_ALLOC _IOWR('F', 30, struct fb_wid_alloc)
  124. #define FBIO_WID_FREE _IOW('F', 31, struct fb_wid_alloc)
  125. #define FBIO_WID_PUT _IOW('F', 32, struct fb_wid_list)
  126. #define FBIO_WID_GET _IOWR('F', 33, struct fb_wid_list)
  127. /* Creator ioctls */
  128. #define FFB_IOCTL ('F'<<8)
  129. #define FFB_SYS_INFO (FFB_IOCTL|80)
  130. #define FFB_CLUTREAD (FFB_IOCTL|81)
  131. #define FFB_CLUTPOST (FFB_IOCTL|82)
  132. #define FFB_SETDIAGMODE (FFB_IOCTL|83)
  133. #define FFB_GETMONITORID (FFB_IOCTL|84)
  134. #define FFB_GETVIDEOMODE (FFB_IOCTL|85)
  135. #define FFB_SETVIDEOMODE (FFB_IOCTL|86)
  136. #define FFB_SETSERVER (FFB_IOCTL|87)
  137. #define FFB_SETOVCTL (FFB_IOCTL|88)
  138. #define FFB_GETOVCTL (FFB_IOCTL|89)
  139. #define FFB_GETSAXNUM (FFB_IOCTL|90)
  140. #define FFB_FBDEBUG (FFB_IOCTL|91)
  141. /* Cg14 ioctls */
  142. #define MDI_IOCTL ('M'<<8)
  143. #define MDI_RESET (MDI_IOCTL|1)
  144. #define MDI_GET_CFGINFO (MDI_IOCTL|2)
  145. #define MDI_SET_PIXELMODE (MDI_IOCTL|3)
  146. # define MDI_32_PIX 32
  147. # define MDI_16_PIX 16
  148. # define MDI_8_PIX 8
  149. struct mdi_cfginfo {
  150. int mdi_ncluts; /* Number of implemented CLUTs in this MDI */
  151. int mdi_type; /* FBTYPE name */
  152. int mdi_height; /* height */
  153. int mdi_width; /* width */
  154. int mdi_size; /* available ram */
  155. int mdi_mode; /* 8bpp, 16bpp or 32bpp */
  156. int mdi_pixfreq; /* pixel clock (from PROM) */
  157. };
  158. /* SparcLinux specific ioctl for the MDI, should be replaced for
  159. * the SET_XLUT/SET_CLUTn ioctls instead
  160. */
  161. #define MDI_CLEAR_XLUT (MDI_IOCTL|9)
  162. /* leo & ffb ioctls */
  163. struct fb_clut_alloc {
  164. __u32 clutid; /* Set on return */
  165. __u32 flag;
  166. __u32 index;
  167. };
  168. struct fb_clut {
  169. #define FB_CLUT_WAIT 0x00000001 /* Not yet implemented */
  170. __u32 flag;
  171. __u32 clutid;
  172. __u32 offset;
  173. __u32 count;
  174. char * red;
  175. char * green;
  176. char * blue;
  177. };
  178. struct fb_clut32 {
  179. __u32 flag;
  180. __u32 clutid;
  181. __u32 offset;
  182. __u32 count;
  183. __u32 red;
  184. __u32 green;
  185. __u32 blue;
  186. };
  187. #define LEO_CLUTALLOC _IOWR('L', 53, struct fb_clut_alloc)
  188. #define LEO_CLUTFREE _IOW('L', 54, struct fb_clut_alloc)
  189. #define LEO_CLUTREAD _IOW('L', 55, struct fb_clut)
  190. #define LEO_CLUTPOST _IOW('L', 56, struct fb_clut)
  191. #define LEO_SETGAMMA _IOW('L', 68, int) /* Not yet implemented */
  192. #define LEO_GETGAMMA _IOR('L', 69, int) /* Not yet implemented */
  193. #ifdef __KERNEL__
  194. /* Addresses on the fd of a cgsix that are mappable */
  195. #define CG6_FBC 0x70000000
  196. #define CG6_TEC 0x70001000
  197. #define CG6_BTREGS 0x70002000
  198. #define CG6_FHC 0x70004000
  199. #define CG6_THC 0x70005000
  200. #define CG6_ROM 0x70006000
  201. #define CG6_RAM 0x70016000
  202. #define CG6_DHC 0x80000000
  203. #define CG3_MMAP_OFFSET 0x4000000
  204. /* Addresses on the fd of a tcx that are mappable */
  205. #define TCX_RAM8BIT 0x00000000
  206. #define TCX_RAM24BIT 0x01000000
  207. #define TCX_UNK3 0x10000000
  208. #define TCX_UNK4 0x20000000
  209. #define TCX_CONTROLPLANE 0x28000000
  210. #define TCX_UNK6 0x30000000
  211. #define TCX_UNK7 0x38000000
  212. #define TCX_TEC 0x70000000
  213. #define TCX_BTREGS 0x70002000
  214. #define TCX_THC 0x70004000
  215. #define TCX_DHC 0x70008000
  216. #define TCX_ALT 0x7000a000
  217. #define TCX_SYNC 0x7000e000
  218. #define TCX_UNK2 0x70010000
  219. /* CG14 definitions */
  220. /* Offsets into the OBIO space: */
  221. #define CG14_REGS 0 /* registers */
  222. #define CG14_CURSORREGS 0x1000 /* cursor registers */
  223. #define CG14_DACREGS 0x2000 /* DAC registers */
  224. #define CG14_XLUT 0x3000 /* X Look Up Table -- ??? */
  225. #define CG14_CLUT1 0x4000 /* Color Look Up Table */
  226. #define CG14_CLUT2 0x5000 /* Color Look Up Table */
  227. #define CG14_CLUT3 0x6000 /* Color Look Up Table */
  228. #define CG14_AUTO 0xf000
  229. #endif /* KERNEL */
  230. /* These are exported to userland for applications to use */
  231. /* Mappable offsets for the cg14: control registers */
  232. #define MDI_DIRECT_MAP 0x10000000
  233. #define MDI_CTLREG_MAP 0x20000000
  234. #define MDI_CURSOR_MAP 0x30000000
  235. #define MDI_SHDW_VRT_MAP 0x40000000
  236. /* Mappable offsets for the cg14: frame buffer resolutions */
  237. /* 32 bits */
  238. #define MDI_CHUNKY_XBGR_MAP 0x50000000
  239. #define MDI_CHUNKY_BGR_MAP 0x60000000
  240. /* 16 bits */
  241. #define MDI_PLANAR_X16_MAP 0x70000000
  242. #define MDI_PLANAR_C16_MAP 0x80000000
  243. /* 8 bit is done as CG3 MMAP offset */
  244. /* 32 bits, planar */
  245. #define MDI_PLANAR_X32_MAP 0x90000000
  246. #define MDI_PLANAR_B32_MAP 0xa0000000
  247. #define MDI_PLANAR_G32_MAP 0xb0000000
  248. #define MDI_PLANAR_R32_MAP 0xc0000000
  249. /* Mappable offsets on leo */
  250. #define LEO_SS0_MAP 0x00000000
  251. #define LEO_LC_SS0_USR_MAP 0x00800000
  252. #define LEO_LD_SS0_MAP 0x00801000
  253. #define LEO_LX_CURSOR_MAP 0x00802000
  254. #define LEO_SS1_MAP 0x00803000
  255. #define LEO_LC_SS1_USR_MAP 0x01003000
  256. #define LEO_LD_SS1_MAP 0x01004000
  257. #define LEO_UNK_MAP 0x01005000
  258. #define LEO_LX_KRN_MAP 0x01006000
  259. #define LEO_LC_SS0_KRN_MAP 0x01007000
  260. #define LEO_LC_SS1_KRN_MAP 0x01008000
  261. #define LEO_LD_GBL_MAP 0x01009000
  262. #define LEO_UNK2_MAP 0x0100a000
  263. #ifdef __KERNEL__
  264. struct fbcmap32 {
  265. int index; /* first element (0 origin) */
  266. int count;
  267. u32 red;
  268. u32 green;
  269. u32 blue;
  270. };
  271. #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
  272. #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)
  273. struct fbcursor32 {
  274. short set; /* what to set, choose from the list above */
  275. short enable; /* cursor on/off */
  276. struct fbcurpos pos; /* cursor position */
  277. struct fbcurpos hot; /* cursor hot spot */
  278. struct fbcmap32 cmap; /* color map info */
  279. struct fbcurpos size; /* cursor bit map size */
  280. u32 image; /* cursor image bits */
  281. u32 mask; /* cursor mask bits */
  282. };
  283. #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
  284. #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)
  285. #endif
  286. #endif /* __LINUX_FBIO_H */