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