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