1#ifndef _LINUX_FB_H
2#define _LINUX_FB_H
3
4#include <linux/types.h>
5
6
7
8#define FB_MAX 32
9
10#define FB_TYPE_PACKED_PIXELS 0
11
12#define FB_VISUAL_MONO01 0
13#define FB_VISUAL_MONO10 1
14#define FB_VISUAL_TRUECOLOR 2
15#define FB_VISUAL_PSEUDOCOLOR 3
16#define FB_VISUAL_DIRECTCOLOR 4
17#define FB_VISUAL_STATIC_PSEUDOCOLOR 5
18
19#define FB_ACCEL_NONE 0
20
21struct fb_fix_screeninfo {
22 char id[16];
23 unsigned long smem_start;
24
25 __u32 smem_len;
26 __u32 type;
27 __u32 type_aux;
28 __u32 visual;
29 __u16 xpanstep;
30 __u16 ypanstep;
31 __u16 ywrapstep;
32 __u32 line_length;
33 unsigned long mmio_start;
34
35 __u32 mmio_len;
36 __u32 accel;
37
38 __u16 reserved[3];
39};
40
41
42
43
44
45
46
47
48
49
50
51
52struct fb_bitfield {
53 __u32 offset;
54 __u32 length;
55 __u32 msb_right;
56
57};
58
59#define FB_NONSTD_HAM 1
60#define FB_NONSTD_REV_PIX_IN_B 2
61
62#define FB_ACTIVATE_NOW 0
63#define FB_ACTIVATE_NXTOPEN 1
64#define FB_ACTIVATE_TEST 2
65#define FB_ACTIVATE_MASK 15
66
67#define FB_ACTIVATE_VBL 16
68#define FB_CHANGE_CMAP_VBL 32
69#define FB_ACTIVATE_ALL 64
70#define FB_ACTIVATE_FORCE 128
71#define FB_ACTIVATE_INV_MODE 256
72
73#define FB_SYNC_HOR_HIGH_ACT 1
74#define FB_SYNC_VERT_HIGH_ACT 2
75#define FB_SYNC_EXT 4
76#define FB_SYNC_COMP_HIGH_ACT 8
77#define FB_SYNC_BROADCAST 16
78
79
80#define FB_SYNC_ON_GREEN 32
81
82#define FB_VMODE_NONINTERLACED 0
83#define FB_VMODE_INTERLACED 1
84#define FB_VMODE_DOUBLE 2
85#define FB_VMODE_ODD_FLD_FIRST 4
86#define FB_VMODE_MASK 255
87
88#define FB_VMODE_YWRAP 256
89#define FB_VMODE_SMOOTH_XPAN 512
90#define FB_VMODE_CONUPDATE 512
91
92
93
94
95#define FB_ROTATE_UR 0
96#define FB_ROTATE_CW 1
97#define FB_ROTATE_UD 2
98#define FB_ROTATE_CCW 3
99
100#define PICOS2KHZ(a) (1000000000UL/(a))
101#define KHZ2PICOS(a) (1000000000UL/(a))
102
103struct fb_var_screeninfo {
104 __u32 xres;
105 __u32 yres;
106 __u32 xres_virtual;
107 __u32 yres_virtual;
108 __u32 xoffset;
109 __u32 yoffset;
110
111 __u32 bits_per_pixel;
112 __u32 grayscale;
113
114 struct fb_bitfield red;
115 struct fb_bitfield green;
116 struct fb_bitfield blue;
117 struct fb_bitfield transp;
118
119 __u32 nonstd;
120
121 __u32 activate;
122
123 __u32 height;
124 __u32 width;
125
126 __u32 accel_flags;
127
128
129 __u32 pixclock;
130 __u32 left_margin;
131 __u32 right_margin;
132 __u32 upper_margin;
133 __u32 lower_margin;
134 __u32 hsync_len;
135 __u32 vsync_len;
136 __u32 sync;
137 __u32 vmode;
138 __u32 rotate;
139 __u32 reserved[5];
140};
141
142struct fb_cmap {
143 __u32 start;
144 __u32 len;
145 __u16 *red;
146 __u16 *green;
147 __u16 *blue;
148 __u16 *transp;
149};
150
151struct fb_con2fbmap {
152 __u32 console;
153 __u32 framebuffer;
154};
155
156
157#define VESA_NO_BLANKING 0
158#define VESA_VSYNC_SUSPEND 1
159#define VESA_HSYNC_SUSPEND 2
160#define VESA_POWERDOWN 3
161
162
163enum {
164
165 FB_BLANK_UNBLANK = VESA_NO_BLANKING,
166
167
168 FB_BLANK_NORMAL = VESA_NO_BLANKING + 1,
169
170
171 FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
172
173
174 FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
175
176
177 FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1
178};
179
180#define FB_VBLANK_VBLANKING 0x001
181#define FB_VBLANK_HBLANKING 0x002
182#define FB_VBLANK_HAVE_VBLANK 0x004
183#define FB_VBLANK_HAVE_HBLANK 0x008
184#define FB_VBLANK_HAVE_COUNT 0x010
185#define FB_VBLANK_HAVE_VCOUNT 0x020
186#define FB_VBLANK_HAVE_HCOUNT 0x040
187#define FB_VBLANK_VSYNCING 0x080
188#define FB_VBLANK_HAVE_VSYNC 0x100
189
190struct fb_vblank {
191 __u32 flags;
192 __u32 count;
193 __u32 vcount;
194 __u32 hcount;
195 __u32 reserved[4];
196};
197
198
199#define ROP_COPY 0
200#define ROP_XOR 1
201
202struct fb_copyarea {
203 __u32 dx;
204 __u32 dy;
205 __u32 width;
206 __u32 height;
207 __u32 sx;
208 __u32 sy;
209};
210
211struct fb_fillrect {
212 __u32 dx;
213 __u32 dy;
214 __u32 width;
215 __u32 height;
216 __u32 color;
217 __u32 rop;
218};
219
220struct fb_image {
221 __u32 dx;
222 __u32 dy;
223 __u32 width;
224 __u32 height;
225 __u32 fg_color;
226 __u32 bg_color;
227 __u8 depth;
228 const char *data;
229 struct fb_cmap cmap;
230};
231
232
233
234
235
236#define FB_CUR_SETIMAGE 0x01
237#define FB_CUR_SETPOS 0x02
238#define FB_CUR_SETHOT 0x04
239#define FB_CUR_SETCMAP 0x08
240#define FB_CUR_SETSHAPE 0x10
241#define FB_CUR_SETSIZE 0x20
242#define FB_CUR_SETALL 0xFF
243
244struct fbcurpos {
245 __u16 x, y;
246};
247
248struct fb_cursor {
249 __u16 set;
250 __u16 enable;
251 __u16 rop;
252 const char *mask;
253 struct fbcurpos hot;
254 struct fb_image image;
255};
256
257#ifdef CONFIG_FB_BACKLIGHT
258
259#define FB_BACKLIGHT_LEVELS 128
260#define FB_BACKLIGHT_MAX 0xFF
261#endif
262
263#ifdef __KERNEL__
264
265struct vm_area_struct;
266struct fb_info;
267struct device;
268struct file;
269
270
271#define FB_DPMS_ACTIVE_OFF 1
272#define FB_DPMS_SUSPEND 2
273#define FB_DPMS_STANDBY 4
274
275#define FB_DISP_DDI 1
276#define FB_DISP_ANA_700_300 2
277#define FB_DISP_ANA_714_286 4
278#define FB_DISP_ANA_1000_400 8
279#define FB_DISP_ANA_700_000 16
280
281#define FB_DISP_MONO 32
282#define FB_DISP_RGB 64
283#define FB_DISP_MULTI 128
284#define FB_DISP_UNKNOWN 256
285
286#define FB_SIGNAL_NONE 0
287#define FB_SIGNAL_BLANK_BLANK 1
288#define FB_SIGNAL_SEPARATE 2
289#define FB_SIGNAL_COMPOSITE 4
290#define FB_SIGNAL_SYNC_ON_GREEN 8
291#define FB_SIGNAL_SERRATION_ON 16
292
293#define FB_MISC_PRIM_COLOR 1
294#define FB_MISC_1ST_DETAIL 2
295struct fb_chroma {
296 __u32 redx;
297 __u32 greenx;
298 __u32 bluex;
299 __u32 whitex;
300 __u32 redy;
301 __u32 greeny;
302 __u32 bluey;
303 __u32 whitey;
304};
305
306struct fb_monspecs {
307 struct fb_chroma chroma;
308 struct fb_videomode *modedb;
309 __u8 manufacturer[4];
310 __u8 monitor[14];
311 __u8 serial_no[14];
312 __u8 ascii[14];
313 __u32 modedb_len;
314 __u32 model;
315 __u32 serial;
316 __u32 year;
317 __u32 week;
318 __u32 hfmin;
319 __u32 hfmax;
320 __u32 dclkmin;
321 __u32 dclkmax;
322 __u16 input;
323 __u16 dpms;
324 __u16 signal;
325 __u16 vfmin;
326 __u16 vfmax;
327 __u16 gamma;
328 __u16 gtf : 1;
329 __u16 misc;
330 __u8 version;
331 __u8 revision;
332 __u8 max_x;
333 __u8 max_y;
334};
335
336struct fb_cmap_user {
337 __u32 start;
338 __u32 len;
339 __u16 *red;
340 __u16 *green;
341 __u16 *blue;
342 __u16 *transp;
343};
344
345struct fb_image_user {
346 __u32 dx;
347 __u32 dy;
348 __u32 width;
349 __u32 height;
350 __u32 fg_color;
351 __u32 bg_color;
352 __u8 depth;
353 const char *data;
354 struct fb_cmap_user cmap;
355};
356
357struct fb_cursor_user {
358 __u16 set;
359 __u16 enable;
360 __u16 rop;
361 const char *mask;
362 struct fbcurpos hot;
363 struct fb_image_user image;
364};
365
366
367
368
369
370
371#define FB_EVENT_MODE_CHANGE 0x01
372
373
374
375#define FB_EVENT_SUSPEND 0x02
376
377
378
379#define FB_EVENT_RESUME 0x03
380
381#define FB_EVENT_MODE_DELETE 0x04
382
383#define FB_EVENT_FB_REGISTERED 0x05
384
385#define FB_EVENT_FB_UNREGISTERED 0x06
386
387#define FB_EVENT_GET_CONSOLE_MAP 0x07
388
389#define FB_EVENT_SET_CONSOLE_MAP 0x08
390
391#define FB_EVENT_BLANK 0x09
392
393#define FB_EVENT_NEW_MODELIST 0x0A
394
395
396#define FB_EVENT_MODE_CHANGE_ALL 0x0B
397
398#define FB_EVENT_CONBLANK 0x0C
399
400#define FB_EVENT_GET_REQ 0x0D
401
402#define FB_EVENT_FB_UNBIND 0x0E
403
404struct fb_event {
405 struct fb_info *info;
406 void *data;
407};
408
409struct fb_blit_caps {
410 u32 x;
411 u32 y;
412 u32 len;
413 u32 flags;
414};
415
416
417
418
419
420
421
422
423
424#define FB_PIXMAP_DEFAULT 1
425#define FB_PIXMAP_SYSTEM 2
426#define FB_PIXMAP_IO 4
427#define FB_PIXMAP_SYNC 256
428
429struct fb_pixmap {
430 u8 *addr;
431 u32 size;
432 u32 offset;
433 u32 buf_align;
434 u32 scan_align;
435 u32 access_align;
436 u32 flags;
437 u32 blit_x;
438 u32 blit_y;
439
440
441
442 void (*writeio)(struct fb_info *info, void *dst, void *src, unsigned int size);
443 void (*readio) (struct fb_info *info, void *dst, void *src, unsigned int size);
444};
445
446#ifdef CONFIG_FB_DEFERRED_IO
447struct fb_deferred_io {
448
449 unsigned long delay;
450 struct mutex lock;
451 struct list_head pagelist;
452
453 void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
454};
455#endif
456
457
458#define FBINFO_MODULE 0x0001
459#define FBINFO_HWACCEL_DISABLED 0x0002
460
461
462
463
464
465
466#define FBINFO_PARTIAL_PAN_OK 0x0040
467#define FBINFO_READS_FAST 0x0080
468
469
470
471
472
473
474
475
476
477
478
479
480#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
481
482
483
484
485#define FBINFO_FOREIGN_ENDIAN 0x100000
486
487
488
489
490
491#define FBINFO_BE_MATH 0x100000
492
493struct fb_info {
494 int node;
495 int flags;
496 struct fb_var_screeninfo var;
497 struct fb_fix_screeninfo fix;
498 struct fb_monspecs monspecs;
499 struct fb_pixmap pixmap;
500 struct fb_pixmap sprite;
501 struct fb_cmap cmap;
502 struct list_head modelist;
503 struct fb_videomode *mode;
504
505 char *screen_base;
506 unsigned long screen_size;
507 void *pseudo_palette;
508#define FBINFO_STATE_RUNNING 0
509#define FBINFO_STATE_SUSPENDED 1
510 u32 state;
511 void *fbcon_par;
512
513 void *par;
514};
515
516#define FBINFO_DEFAULT 0
517
518#define FBINFO_FLAG_MODULE FBINFO_MODULE
519#define FBINFO_FLAG_DEFAULT FBINFO_DEFAULT
520
521
522#if defined(__sparc__)
523
524
525
526
527
528
529#define fb_readb sbus_readb
530#define fb_readw sbus_readw
531#define fb_readl sbus_readl
532#define fb_readq sbus_readq
533#define fb_writeb sbus_writeb
534#define fb_writew sbus_writew
535#define fb_writel sbus_writel
536#define fb_writeq sbus_writeq
537#define fb_memset sbus_memset_io
538
539#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
540
541#define fb_readb __raw_readb
542#define fb_readw __raw_readw
543#define fb_readl __raw_readl
544#define fb_readq __raw_readq
545#define fb_writeb __raw_writeb
546#define fb_writew __raw_writew
547#define fb_writel __raw_writel
548#define fb_writeq __raw_writeq
549#define fb_memset memset_io
550
551#else
552
553#define fb_readb(addr) (*(volatile u8 *) (addr))
554#define fb_readw(addr) (*(volatile u16 *) (addr))
555#define fb_readl(addr) (*(volatile u32 *) (addr))
556#define fb_readq(addr) (*(volatile u64 *) (addr))
557#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
558#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
559#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
560#define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
561#define fb_memset memset
562
563#endif
564
565#define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
566#define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
567 (val) << (bits))
568#define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
569 (val) >> (bits))
570
571#define FB_MAXTIMINGS 0
572#define FB_VSYNCTIMINGS 1
573#define FB_HSYNCTIMINGS 2
574#define FB_DCLKTIMINGS 3
575#define FB_IGNOREMON 0x100
576
577#define FB_MODE_IS_UNKNOWN 0
578#define FB_MODE_IS_DETAILED 1
579#define FB_MODE_IS_STANDARD 2
580#define FB_MODE_IS_VESA 4
581#define FB_MODE_IS_CALCULATED 8
582#define FB_MODE_IS_FIRST 16
583#define FB_MODE_IS_FROM_VAR 32
584
585
586
587
588extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
589extern void fb_dealloc_cmap(struct fb_cmap *cmap);
590extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to);
591extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to);
592extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info);
593extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info);
594extern const struct fb_cmap *fb_default_cmap(int len);
595extern void fb_invert_cmaps(void);
596
597struct fb_videomode {
598 const char *name;
599 u32 refresh;
600 u32 xres;
601 u32 yres;
602 u32 pixclock;
603 u32 left_margin;
604 u32 right_margin;
605 u32 upper_margin;
606 u32 lower_margin;
607 u32 hsync_len;
608 u32 vsync_len;
609 u32 sync;
610 u32 vmode;
611 u32 flag;
612};
613
614#endif
615
616#endif
617