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