1 #ifndef _LINUX_FB_H
2 #define _LINUX_FB_H
3 
4 #include <linux/tty.h>
5 #include <asm/types.h>
6 
7 /* Definitions of frame buffers						*/
8 
9 #define FB_MAJOR		29
10 #define FB_MAX			32	/* sufficient for now */
11 
12 /* ioctls
13    0x46 is 'F'								*/
14 #define FBIOGET_VSCREENINFO	0x4600
15 #define FBIOPUT_VSCREENINFO	0x4601
16 #define FBIOGET_FSCREENINFO	0x4602
17 #define FBIOGETCMAP		0x4604
18 #define FBIOPUTCMAP		0x4605
19 #define FBIOPAN_DISPLAY		0x4606
20 /* 0x4607-0x460B are defined below */
21 /* #define FBIOGET_MONITORSPEC	0x460C */
22 /* #define FBIOPUT_MONITORSPEC	0x460D */
23 /* #define FBIOSWITCH_MONIBIT	0x460E */
24 #define FBIOGET_CON2FBMAP	0x460F
25 #define FBIOPUT_CON2FBMAP	0x4610
26 #define FBIOBLANK		0x4611		/* arg: 0 or vesa level + 1 */
27 #define FBIOGET_VBLANK		_IOR('F', 0x12, struct fb_vblank)
28 #define FBIO_ALLOC              0x4613
29 #define FBIO_FREE               0x4614
30 #define FBIOGET_GLYPH           0x4615
31 #define FBIOGET_HWCINFO         0x4616
32 #define FBIOPUT_MODEINFO        0x4617
33 #define FBIOGET_DISPINFO        0x4618
34 
35 
36 #define FB_TYPE_PACKED_PIXELS		0	/* Packed Pixels	*/
37 #define FB_TYPE_PLANES			1	/* Non interleaved planes */
38 #define FB_TYPE_INTERLEAVED_PLANES	2	/* Interleaved planes	*/
39 #define FB_TYPE_TEXT			3	/* Text/attributes	*/
40 #define FB_TYPE_VGA_PLANES		4	/* EGA/VGA planes	*/
41 
42 #define FB_AUX_TEXT_MDA		0	/* Monochrome text */
43 #define FB_AUX_TEXT_CGA		1	/* CGA/EGA/VGA Color text */
44 #define FB_AUX_TEXT_S3_MMIO	2	/* S3 MMIO fasttext */
45 #define FB_AUX_TEXT_MGA_STEP16	3	/* MGA Millenium I: text, attr, 14 reserved bytes */
46 #define FB_AUX_TEXT_MGA_STEP8	4	/* other MGAs:      text, attr,  6 reserved bytes */
47 
48 #define FB_AUX_VGA_PLANES_VGA4		0	/* 16 color planes (EGA/VGA) */
49 #define FB_AUX_VGA_PLANES_CFB4		1	/* CFB4 in planes (VGA) */
50 #define FB_AUX_VGA_PLANES_CFB8		2	/* CFB8 in planes (VGA) */
51 
52 #define FB_VISUAL_MONO01		0	/* Monochr. 1=Black 0=White */
53 #define FB_VISUAL_MONO10		1	/* Monochr. 1=White 0=Black */
54 #define FB_VISUAL_TRUECOLOR		2	/* True color	*/
55 #define FB_VISUAL_PSEUDOCOLOR		3	/* Pseudo color (like atari) */
56 #define FB_VISUAL_DIRECTCOLOR		4	/* Direct color */
57 #define FB_VISUAL_STATIC_PSEUDOCOLOR	5	/* Pseudo color readonly */
58 
59 #define FB_ACCEL_NONE		0	/* no hardware accelerator	*/
60 #define FB_ACCEL_ATARIBLITT	1	/* Atari Blitter		*/
61 #define FB_ACCEL_AMIGABLITT	2	/* Amiga Blitter                */
62 #define FB_ACCEL_S3_TRIO64	3	/* Cybervision64 (S3 Trio64)    */
63 #define FB_ACCEL_NCR_77C32BLT	4	/* RetinaZ3 (NCR 77C32BLT)      */
64 #define FB_ACCEL_S3_VIRGE	5	/* Cybervision64/3D (S3 ViRGE)	*/
65 #define FB_ACCEL_ATI_MACH64GX	6	/* ATI Mach 64GX family		*/
66 #define FB_ACCEL_DEC_TGA	7	/* DEC 21030 TGA		*/
67 #define FB_ACCEL_ATI_MACH64CT	8	/* ATI Mach 64CT family		*/
68 #define FB_ACCEL_ATI_MACH64VT	9	/* ATI Mach 64CT family VT class */
69 #define FB_ACCEL_ATI_MACH64GT	10	/* ATI Mach 64CT family GT class */
70 #define FB_ACCEL_SUN_CREATOR	11	/* Sun Creator/Creator3D	*/
71 #define FB_ACCEL_SUN_CGSIX	12	/* Sun cg6			*/
72 #define FB_ACCEL_SUN_LEO	13	/* Sun leo/zx			*/
73 #define FB_ACCEL_IMS_TWINTURBO	14	/* IMS Twin Turbo		*/
74 #define FB_ACCEL_3DLABS_PERMEDIA2 15	/* 3Dlabs Permedia 2		*/
75 #define FB_ACCEL_MATROX_MGA2064W 16	/* Matrox MGA2064W (Millenium)	*/
76 #define FB_ACCEL_MATROX_MGA1064SG 17	/* Matrox MGA1064SG (Mystique)	*/
77 #define FB_ACCEL_MATROX_MGA2164W 18	/* Matrox MGA2164W (Millenium II) */
78 #define FB_ACCEL_MATROX_MGA2164W_AGP 19	/* Matrox MGA2164W (Millenium II) */
79 #define FB_ACCEL_MATROX_MGAG100	20	/* Matrox G100 (Productiva G100) */
80 #define FB_ACCEL_MATROX_MGAG200	21	/* Matrox G200 (Myst, Mill, ...) */
81 #define FB_ACCEL_SUN_CG14	22	/* Sun cgfourteen		 */
82 #define FB_ACCEL_SUN_BWTWO	23	/* Sun bwtwo			*/
83 #define FB_ACCEL_SUN_CGTHREE	24	/* Sun cgthree			*/
84 #define FB_ACCEL_SUN_TCX	25	/* Sun tcx			*/
85 #define FB_ACCEL_MATROX_MGAG400	26	/* Matrox G400			*/
86 #define FB_ACCEL_NV3		27	/* nVidia RIVA 128              */
87 #define FB_ACCEL_NV4		28	/* nVidia RIVA TNT		*/
88 #define FB_ACCEL_NV5		29	/* nVidia RIVA TNT2		*/
89 #define FB_ACCEL_CT_6555x	30	/* C&T 6555x			*/
90 #define FB_ACCEL_3DFX_BANSHEE	31	/* 3Dfx Banshee			*/
91 #define FB_ACCEL_ATI_RAGE128	32	/* ATI Rage128 family		*/
92 #define FB_ACCEL_IGS_CYBER2000	33	/* CyberPro 2000		*/
93 #define FB_ACCEL_IGS_CYBER2010	34	/* CyberPro 2010		*/
94 #define FB_ACCEL_IGS_CYBER5000	35	/* CyberPro 5000		*/
95 #define FB_ACCEL_SIS_GLAMOUR    36	/* SiS 300/630/540              */
96 #define FB_ACCEL_3DLABS_PERMEDIA3 37	/* 3Dlabs Permedia 3		*/
97 #define FB_ACCEL_ATI_RADEON	38	/* ATI Radeon family		*/
98 #define FB_ACCEL_SIS_GLAMOUR_2  40	/* SiS 315, 650, 740		*/
99 #define FB_ACCEL_SIS_XABRE	41	/* SiS 330 ("Xabre")		*/
100 #define FB_ACCEL_EPSON_SED1356	42	/* Epson SED1356		*/
101 
102 #define FB_ACCEL_NEOMAGIC_NM2070 90	/* NeoMagic NM2070              */
103 #define FB_ACCEL_NEOMAGIC_NM2090 91	/* NeoMagic NM2090              */
104 #define FB_ACCEL_NEOMAGIC_NM2093 92	/* NeoMagic NM2093              */
105 #define FB_ACCEL_NEOMAGIC_NM2097 93	/* NeoMagic NM2097              */
106 #define FB_ACCEL_NEOMAGIC_NM2160 94	/* NeoMagic NM2160              */
107 #define FB_ACCEL_NEOMAGIC_NM2200 95	/* NeoMagic NM2200              */
108 #define FB_ACCEL_NEOMAGIC_NM2230 96	/* NeoMagic NM2230              */
109 #define FB_ACCEL_NEOMAGIC_NM2360 97	/* NeoMagic NM2360              */
110 #define FB_ACCEL_NEOMAGIC_NM2380 98	/* NeoMagic NM2380              */
111 
112 
113 struct fb_fix_screeninfo {
114 	char id[16];			/* identification string eg "TT Builtin" */
115 	unsigned long smem_start;	/* Start of frame buffer mem */
116 					/* (physical address) */
117 	__u32 smem_len;			/* Length of frame buffer mem */
118 	__u32 type;			/* see FB_TYPE_*		*/
119 	__u32 type_aux;			/* Interleave for interleaved Planes */
120 	__u32 visual;			/* see FB_VISUAL_*		*/
121 	__u16 xpanstep;			/* zero if no hardware panning  */
122 	__u16 ypanstep;			/* zero if no hardware panning  */
123 	__u16 ywrapstep;		/* zero if no hardware ywrap    */
124 	__u32 line_length;		/* length of a line in bytes    */
125 	unsigned long mmio_start;	/* Start of Memory Mapped I/O   */
126 					/* (physical address) */
127 	__u32 mmio_len;			/* Length of Memory Mapped I/O  */
128 	__u32 accel;			/* Type of acceleration available */
129 	__u16 reserved[3];		/* Reserved for future compatibility */
130 };
131 
132 /* Interpretation of offset for color fields: All offsets are from the right,
133  * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
134  * can use the offset as right argument to <<). A pixel afterwards is a bit
135  * stream and is written to video memory as that unmodified. This implies
136  * big-endian byte order if bits_per_pixel is greater than 8.
137  */
138 struct fb_bitfield {
139 	__u32 offset;			/* beginning of bitfield	*/
140 	__u32 length;			/* length of bitfield		*/
141 	__u32 msb_right;		/* != 0 : Most significant bit is */
142 					/* right */
143 };
144 
145 #define FB_NONSTD_HAM		1	/* Hold-And-Modify (HAM)        */
146 
147 #define FB_ACTIVATE_NOW		0	/* set values immediately (or vbl)*/
148 #define FB_ACTIVATE_NXTOPEN	1	/* activate on next open	*/
149 #define FB_ACTIVATE_TEST	2	/* don't set, round up impossible */
150 #define FB_ACTIVATE_MASK       15
151 					/* values			*/
152 #define FB_ACTIVATE_VBL	       16	/* activate values on next vbl  */
153 #define FB_CHANGE_CMAP_VBL     32	/* change colormap on vbl	*/
154 #define FB_ACTIVATE_ALL	       64	/* change all VCs on this fb	*/
155 
156 #define FB_ACCELF_TEXT		1	/* text mode acceleration */
157 
158 #define FB_SYNC_HOR_HIGH_ACT	1	/* horizontal sync high active	*/
159 #define FB_SYNC_VERT_HIGH_ACT	2	/* vertical sync high active	*/
160 #define FB_SYNC_EXT		4	/* external sync		*/
161 #define FB_SYNC_COMP_HIGH_ACT	8	/* composite sync high active   */
162 #define FB_SYNC_BROADCAST	16	/* broadcast video timings      */
163 					/* vtotal = 144d/288n/576i => PAL  */
164 					/* vtotal = 121d/242n/484i => NTSC */
165 #define FB_SYNC_ON_GREEN	32	/* sync on green */
166 
167 #define FB_VMODE_NONINTERLACED  0	/* non interlaced */
168 #define FB_VMODE_INTERLACED	1	/* interlaced	*/
169 #define FB_VMODE_DOUBLE		2	/* double scan */
170 #define FB_VMODE_MASK		255
171 
172 #define FB_VMODE_YWRAP		256	/* ywrap instead of panning     */
173 #define FB_VMODE_SMOOTH_XPAN	512	/* smooth xpan possible (internally used) */
174 #define FB_VMODE_CONUPDATE	512	/* don't update x/yoffset	*/
175 
176 struct fb_var_screeninfo {
177 	__u32 xres;			/* visible resolution		*/
178 	__u32 yres;
179 	__u32 xres_virtual;		/* virtual resolution		*/
180 	__u32 yres_virtual;
181 	__u32 xoffset;			/* offset from virtual to visible */
182 	__u32 yoffset;			/* resolution			*/
183 
184 	__u32 bits_per_pixel;		/* guess what			*/
185 	__u32 grayscale;		/* != 0 Graylevels instead of colors */
186 
187 	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
188 	struct fb_bitfield green;	/* else only length is significant */
189 	struct fb_bitfield blue;
190 	struct fb_bitfield transp;	/* transparency			*/
191 
192 	__u32 nonstd;			/* != 0 Non standard pixel format */
193 
194 	__u32 activate;			/* see FB_ACTIVATE_*		*/
195 
196 	__u32 height;			/* height of picture in mm    */
197 	__u32 width;			/* width of picture in mm     */
198 
199 	__u32 accel_flags;		/* acceleration flags (hints)	*/
200 
201 	/* Timing: All values in pixclocks, except pixclock (of course) */
202 	__u32 pixclock;			/* pixel clock in ps (pico seconds) */
203 	__u32 left_margin;		/* time from sync to picture	*/
204 	__u32 right_margin;		/* time from picture to sync	*/
205 	__u32 upper_margin;		/* time from sync to picture	*/
206 	__u32 lower_margin;
207 	__u32 hsync_len;		/* length of horizontal sync	*/
208 	__u32 vsync_len;		/* length of vertical sync	*/
209 	__u32 sync;			/* see FB_SYNC_*		*/
210 	__u32 vmode;			/* see FB_VMODE_*		*/
211 	__u32 reserved[6];		/* Reserved for future compatibility */
212 };
213 
214 struct fb_cmap {
215 	__u32 start;			/* First entry	*/
216 	__u32 len;			/* Number of entries */
217 	__u16 *red;			/* Red values	*/
218 	__u16 *green;
219 	__u16 *blue;
220 	__u16 *transp;			/* transparency, can be NULL */
221 };
222 
223 struct fb_con2fbmap {
224 	__u32 console;
225 	__u32 framebuffer;
226 };
227 
228 /* VESA Blanking Levels */
229 #define VESA_NO_BLANKING        0
230 #define VESA_VSYNC_SUSPEND      1
231 #define VESA_HSYNC_SUSPEND      2
232 #define VESA_POWERDOWN          3
233 
234 struct fb_monspecs {
235 	__u32 hfmin;			/* hfreq lower limit (Hz) */
236 	__u32 hfmax; 			/* hfreq upper limit (Hz) */
237 	__u16 vfmin;			/* vfreq lower limit (Hz) */
238 	__u16 vfmax;			/* vfreq upper limit (Hz) */
239 	unsigned dpms : 1;		/* supports DPMS */
240 };
241 
242 #define FB_VBLANK_VBLANKING	0x001	/* currently in a vertical blank */
243 #define FB_VBLANK_HBLANKING	0x002	/* currently in a horizontal blank */
244 #define FB_VBLANK_HAVE_VBLANK	0x004	/* vertical blanks can be detected */
245 #define FB_VBLANK_HAVE_HBLANK	0x008	/* horizontal blanks can be detected */
246 #define FB_VBLANK_HAVE_COUNT	0x010	/* global retrace counter is available */
247 #define FB_VBLANK_HAVE_VCOUNT	0x020	/* the vcount field is valid */
248 #define FB_VBLANK_HAVE_HCOUNT	0x040	/* the hcount field is valid */
249 #define FB_VBLANK_VSYNCING	0x080	/* currently in a vsync */
250 #define FB_VBLANK_HAVE_VSYNC	0x100	/* verical syncs can be detected */
251 
252 struct fb_vblank {
253 	__u32 flags;			/* FB_VBLANK flags */
254 	__u32 count;			/* counter of retraces since boot */
255 	__u32 vcount;			/* current scanline position */
256 	__u32 hcount;			/* current scandot position */
257 	__u32 reserved[4];		/* reserved for future compatibility */
258 };
259 
260 #ifdef __KERNEL__
261 
262 #if 1 /* to go away in 2.5.0 */
263 extern int GET_FB_IDX(kdev_t rdev);
264 #else
265 #define GET_FB_IDX(node)	(MINOR(node))
266 #endif
267 
268 #include <linux/fs.h>
269 #include <linux/init.h>
270 #include <linux/devfs_fs_kernel.h>
271 
272 
273 struct fb_info;
274 struct fb_info_gen;
275 struct vm_area_struct;
276 struct file;
277 
278     /*
279      *  Frame buffer operations
280      */
281 
282 struct fb_ops {
283     /* open/release and usage marking */
284     struct module *owner;
285     int (*fb_open)(struct fb_info *info, int user);
286     int (*fb_release)(struct fb_info *info, int user);
287     /* get non settable parameters */
288     int (*fb_get_fix)(struct fb_fix_screeninfo *fix, int con,
289 		      struct fb_info *info);
290     /* get settable parameters */
291     int (*fb_get_var)(struct fb_var_screeninfo *var, int con,
292 		      struct fb_info *info);
293     /* set settable parameters */
294     int (*fb_set_var)(struct fb_var_screeninfo *var, int con,
295 		      struct fb_info *info);
296     /* get colormap */
297     int (*fb_get_cmap)(struct fb_cmap *cmap, int kspc, int con,
298 		       struct fb_info *info);
299     /* set colormap */
300     int (*fb_set_cmap)(struct fb_cmap *cmap, int kspc, int con,
301 		       struct fb_info *info);
302     /* pan display (optional) */
303     int (*fb_pan_display)(struct fb_var_screeninfo *var, int con,
304 			  struct fb_info *info);
305     /* perform fb specific ioctl (optional) */
306     int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
307 		    unsigned long arg, int con, struct fb_info *info);
308     /* perform fb specific mmap */
309     int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
310     /* switch to/from raster image mode */
311     int (*fb_rasterimg)(struct fb_info *info, int start);
312 };
313 
314 struct fb_info {
315    char modename[40];			/* default video mode */
316    kdev_t node;
317    int flags;
318    int open;                            /* Has this been open already ? */
319 #define FBINFO_FLAG_MODULE	1	/* Low-level driver is a module */
320    struct fb_var_screeninfo var;        /* Current var */
321    struct fb_fix_screeninfo fix;        /* Current fix */
322    struct fb_monspecs monspecs;         /* Current Monitor specs */
323    struct fb_cmap cmap;                 /* Current cmap */
324    struct fb_ops *fbops;
325    char *screen_base;                   /* Virtual address */
326    u32 mapped_vram;			/* ioremap()'ed VRAM */
327    struct display *disp;		/* initial display variable */
328    struct vc_data *display_fg;		/* Console visible on this display */
329    char fontname[40];			/* default font name */
330    devfs_handle_t devfs_handle;         /* Devfs handle for new name         */
331    devfs_handle_t devfs_lhandle;        /* Devfs handle for compat. symlink  */
332    int (*changevar)(int);		/* tell console var has changed */
333    int (*switch_con)(int, struct fb_info*);
334 					/* tell fb to switch consoles */
335    int (*updatevar)(int, struct fb_info*);
336 					/* tell fb to update the vars */
337    void (*blank)(int, struct fb_info*);	/* tell fb to (un)blank the screen */
338 					/* arg = 0: unblank */
339 					/* arg > 0: VESA level (arg-1) */
340    void *pseudo_palette;                /* Fake palette of 16 colors and
341 					   the cursor's color for non
342                                            palette mode */
343    /* From here on everything is device dependent */
344    void *par;
345 };
346 
347 #ifdef MODULE
348 #define FBINFO_FLAG_DEFAULT	FBINFO_FLAG_MODULE
349 #else
350 #define FBINFO_FLAG_DEFAULT	0
351 #endif
352 
353     /*
354      *  This structure abstracts from the underlying hardware. It is not
355      *  mandatory but used by the `generic' frame buffer operations.
356      *  Read drivers/video/skeletonfb.c for more information.
357      */
358 
359 struct fbgen_hwswitch {
360     void (*detect)(void);
361     int (*encode_fix)(struct fb_fix_screeninfo *fix, const void *par,
362 		      struct fb_info_gen *info);
363     int (*decode_var)(const struct fb_var_screeninfo *var, void *par,
364 		      struct fb_info_gen *info);
365     int (*encode_var)(struct fb_var_screeninfo *var, const void *par,
366 		      struct fb_info_gen *info);
367     void (*get_par)(void *par, struct fb_info_gen *info);
368     void (*set_par)(const void *par, struct fb_info_gen *info);
369     int (*getcolreg)(unsigned regno, unsigned *red, unsigned *green,
370 		     unsigned *blue, unsigned *transp, struct fb_info *info);
371     int (*setcolreg)(unsigned regno, unsigned red, unsigned green,
372 		     unsigned blue, unsigned transp, struct fb_info *info);
373     int (*pan_display)(const struct fb_var_screeninfo *var,
374 		       struct fb_info_gen *info);
375     int (*blank)(int blank_mode, struct fb_info_gen *info);
376     void (*set_disp)(const void *par, struct display *disp,
377 		     struct fb_info_gen *info);
378 };
379 
380 struct fb_info_gen {
381     struct fb_info info;
382 
383     /* Entries for a generic frame buffer device */
384     /* Yes, this starts looking like C++ */
385     u_int parsize;
386     struct fbgen_hwswitch *fbhw;
387 
388    /* From here on everything is device dependent */
389 };
390 
391     /*
392      *  `Generic' versions of the frame buffer device operations
393      */
394 
395 extern int fbgen_get_fix(struct fb_fix_screeninfo *fix, int con,
396 			 struct fb_info *info);
397 extern int fbgen_get_var(struct fb_var_screeninfo *var, int con,
398 			 struct fb_info *info);
399 extern int fbgen_set_var(struct fb_var_screeninfo *var, int con,
400 			 struct fb_info *info);
401 extern int fbgen_get_cmap(struct fb_cmap *cmap, int kspc, int con,
402 			  struct fb_info *info);
403 extern int fbgen_set_cmap(struct fb_cmap *cmap, int kspc, int con,
404 			  struct fb_info *info);
405 extern int fbgen_pan_display(struct fb_var_screeninfo *var, int con,
406 			     struct fb_info *info);
407 
408     /*
409      *  Helper functions
410      */
411 
412 extern int fbgen_do_set_var(struct fb_var_screeninfo *var, int isactive,
413 			    struct fb_info_gen *info);
414 extern void fbgen_set_disp(int con, struct fb_info_gen *info);
415 extern void fbgen_install_cmap(int con, struct fb_info_gen *info);
416 extern int fbgen_update_var(int con, struct fb_info *info);
417 extern int fbgen_switch(int con, struct fb_info *info);
418 extern void fbgen_blank(int blank, struct fb_info *info);
419 
420 
421 /* drivers/video/fbmem.c */
422 extern int register_framebuffer(struct fb_info *fb_info);
423 extern int unregister_framebuffer(struct fb_info *fb_info);
424 
425 extern int num_registered_fb;
426 extern struct fb_info *registered_fb[FB_MAX];
427 
428 /* drivers/video/fbmon.c */
429 extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
430 			       const struct fb_info *fb_info);
431 extern int fbmon_dpms(const struct fb_info *fb_info);
432 
433 /* drivers/video/fbcmap.c */
434 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
435 extern void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to,
436 			 int fsfromto);
437 extern int fb_get_cmap(struct fb_cmap *cmap, int kspc,
438 		       int (*getcolreg)(u_int, u_int *, u_int *, u_int *,
439 					u_int *, struct fb_info *),
440 		       struct fb_info *fb_info);
441 extern int fb_set_cmap(struct fb_cmap *cmap, int kspc,
442 		       int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,
443 					struct fb_info *),
444 		       struct fb_info *fb_info);
445 extern struct fb_cmap *fb_default_cmap(int len);
446 extern void fb_invert_cmaps(void);
447 
448 struct fb_videomode {
449     const char *name;	/* optional */
450     u32 refresh;	/* optional */
451     u32 xres;
452     u32 yres;
453     u32 pixclock;
454     u32 left_margin;
455     u32 right_margin;
456     u32 upper_margin;
457     u32 lower_margin;
458     u32 hsync_len;
459     u32 vsync_len;
460     u32 sync;
461     u32 vmode;
462 };
463 
464 #ifdef MODULE
fb_find_mode(struct fb_var_screeninfo * var,struct fb_info * info,const char * mode_option,const struct fb_videomode * db,unsigned int dbsize,const struct fb_videomode * default_mode,unsigned int default_bpp)465 static inline int fb_find_mode(struct fb_var_screeninfo *var,
466 			       struct fb_info *info, const char *mode_option,
467 			       const struct fb_videomode *db,
468 			       unsigned int dbsize,
469 			       const struct fb_videomode *default_mode,
470 			       unsigned int default_bpp)
471 {
472     extern int __fb_try_mode(struct fb_var_screeninfo *var,
473 	    		     struct fb_info *info,
474 			     const struct fb_videomode *mode,
475 			     unsigned int bpp);
476     /*
477      *  FIXME: How to make the compiler optimize vga640x400 away if
478      *         default_mode is non-NULL?
479      */
480     static const struct fb_videomode vga640x400 = {
481 	/* 640x400 @ 70 Hz, 31.5 kHz hsync */
482 	NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
483 	0, FB_VMODE_NONINTERLACED
484     };
485     if (!default_mode)
486 	default_mode = &vga640x400;
487     if (!default_bpp)
488 	default_bpp = 8;
489     return __fb_try_mode(var, info, default_mode, default_bpp);
490 }
491 #else
492 extern int __init fb_find_mode(struct fb_var_screeninfo *var,
493 			       struct fb_info *info, const char *mode_option,
494 			       const struct fb_videomode *db,
495 			       unsigned int dbsize,
496 			       const struct fb_videomode *default_mode,
497 			       unsigned int default_bpp);
498 #endif
499 
500 #endif /* __KERNEL__ */
501 
502 #if 1
503 
504 #define FBCMD_GET_CURRENTPAR	0xDEAD0005
505 #define FBCMD_SET_CURRENTPAR	0xDEAD8005
506 
507 #endif
508 
509 
510 #if 1 /* Preliminary */
511 
512    /*
513     *    Hardware Cursor
514     */
515 
516 #define FBIOGET_FCURSORINFO     0x4607
517 #define FBIOGET_VCURSORINFO     0x4608
518 #define FBIOPUT_VCURSORINFO     0x4609
519 #define FBIOGET_CURSORSTATE     0x460A
520 #define FBIOPUT_CURSORSTATE     0x460B
521 
522 
523 struct fb_fix_cursorinfo {
524 	__u16 crsr_width;		/* width and height of the cursor in */
525 	__u16 crsr_height;		/* pixels (zero if no cursor)	*/
526 	__u16 crsr_xsize;		/* cursor size in display pixels */
527 	__u16 crsr_ysize;
528 	__u16 crsr_color1;		/* colormap entry for cursor color1 */
529 	__u16 crsr_color2;		/* colormap entry for cursor color2 */
530 };
531 
532 struct fb_var_cursorinfo {
533 	__u16 width;
534 	__u16 height;
535 	__u16 xspot;
536 	__u16 yspot;
537 	__u8 data[1];			/* field with [height][width]        */
538 };
539 
540 struct fb_cursorstate {
541 	__s16 xoffset;
542 	__s16 yoffset;
543 	__u16 mode;
544 };
545 
546 #define FB_CURSOR_OFF		0
547 #define FB_CURSOR_ON		1
548 #define FB_CURSOR_FLASH		2
549 
550 #endif /* Preliminary */
551 
552 #endif /* _LINUX_FB_H */
553