Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef _LINUX_FB_H
2
#define _LINUX_FB_H
3
 
4
#include <linux/tty.h>
5
#include <linux/workqueue.h>
6
#include <asm/types.h>
7
#include <asm/io.h>
8
 
9
/* Definitions of frame buffers                                         */
10
 
11
#define FB_MAJOR                29
12
#define FB_MAX                  32      /* sufficient for now */
13
 
14
/* ioctls
15
   0x46 is 'F'                                                          */
16
#define FBIOGET_VSCREENINFO     0x4600
17
#define FBIOPUT_VSCREENINFO     0x4601
18
#define FBIOGET_FSCREENINFO     0x4602
19
#define FBIOGETCMAP             0x4604
20
#define FBIOPUTCMAP             0x4605
21
#define FBIOPAN_DISPLAY         0x4606
22
#define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor)
23
/* 0x4607-0x460B are defined below */
24
/* #define FBIOGET_MONITORSPEC  0x460C */
25
/* #define FBIOPUT_MONITORSPEC  0x460D */
26
/* #define FBIOSWITCH_MONIBIT   0x460E */
27
#define FBIOGET_CON2FBMAP       0x460F
28
#define FBIOPUT_CON2FBMAP       0x4610
29
#define FBIOBLANK               0x4611          /* arg: 0 or vesa level + 1 */
30
#define FBIOGET_VBLANK          _IOR('F', 0x12, struct fb_vblank)
31
#define FBIO_ALLOC              0x4613
32
#define FBIO_FREE               0x4614
33
#define FBIOGET_GLYPH           0x4615
34
#define FBIOGET_HWCINFO         0x4616
35
#define FBIOPUT_MODEINFO        0x4617
36
#define FBIOGET_DISPINFO        0x4618
37
 
38
 
39
#define FB_TYPE_PACKED_PIXELS           0       /* Packed Pixels        */
40
#define FB_TYPE_PLANES                  1       /* Non interleaved planes */
41
#define FB_TYPE_INTERLEAVED_PLANES      2       /* Interleaved planes   */
42
#define FB_TYPE_TEXT                    3       /* Text/attributes      */
43
#define FB_TYPE_VGA_PLANES              4       /* EGA/VGA planes       */
44
 
45
#define FB_AUX_TEXT_MDA         0       /* Monochrome text */
46
#define FB_AUX_TEXT_CGA         1       /* CGA/EGA/VGA Color text */
47
#define FB_AUX_TEXT_S3_MMIO     2       /* S3 MMIO fasttext */
48
#define FB_AUX_TEXT_MGA_STEP16  3       /* MGA Millenium I: text, attr, 14 reserved bytes */
49
#define FB_AUX_TEXT_MGA_STEP8   4       /* other MGAs:      text, attr,  6 reserved bytes */
50
 
51
#define FB_AUX_VGA_PLANES_VGA4          0       /* 16 color planes (EGA/VGA) */
52
#define FB_AUX_VGA_PLANES_CFB4          1       /* CFB4 in planes (VGA) */
53
#define FB_AUX_VGA_PLANES_CFB8          2       /* CFB8 in planes (VGA) */
54
 
55
#define FB_VISUAL_MONO01                0       /* Monochr. 1=Black 0=White */
56
#define FB_VISUAL_MONO10                1       /* Monochr. 1=White 0=Black */
57
#define FB_VISUAL_TRUECOLOR             2       /* True color   */
58
#define FB_VISUAL_PSEUDOCOLOR           3       /* Pseudo color (like atari) */
59
#define FB_VISUAL_DIRECTCOLOR           4       /* Direct color */
60
#define FB_VISUAL_STATIC_PSEUDOCOLOR    5       /* Pseudo color readonly */
61
 
62
#define FB_ACCEL_NONE           0       /* no hardware accelerator      */
63
#define FB_ACCEL_ATARIBLITT     1       /* Atari Blitter                */
64
#define FB_ACCEL_AMIGABLITT     2       /* Amiga Blitter                */
65
#define FB_ACCEL_S3_TRIO64      3       /* Cybervision64 (S3 Trio64)    */
66
#define FB_ACCEL_NCR_77C32BLT   4       /* RetinaZ3 (NCR 77C32BLT)      */
67
#define FB_ACCEL_S3_VIRGE       5       /* Cybervision64/3D (S3 ViRGE)  */
68
#define FB_ACCEL_ATI_MACH64GX   6       /* ATI Mach 64GX family         */
69
#define FB_ACCEL_DEC_TGA        7       /* DEC 21030 TGA                */
70
#define FB_ACCEL_ATI_MACH64CT   8       /* ATI Mach 64CT family         */
71
#define FB_ACCEL_ATI_MACH64VT   9       /* ATI Mach 64CT family VT class */
72
#define FB_ACCEL_ATI_MACH64GT   10      /* ATI Mach 64CT family GT class */
73
#define FB_ACCEL_SUN_CREATOR    11      /* Sun Creator/Creator3D        */
74
#define FB_ACCEL_SUN_CGSIX      12      /* Sun cg6                      */
75
#define FB_ACCEL_SUN_LEO        13      /* Sun leo/zx                   */
76
#define FB_ACCEL_IMS_TWINTURBO  14      /* IMS Twin Turbo               */
77
#define FB_ACCEL_3DLABS_PERMEDIA2 15    /* 3Dlabs Permedia 2            */
78
#define FB_ACCEL_MATROX_MGA2064W 16     /* Matrox MGA2064W (Millenium)  */
79
#define FB_ACCEL_MATROX_MGA1064SG 17    /* Matrox MGA1064SG (Mystique)  */
80
#define FB_ACCEL_MATROX_MGA2164W 18     /* Matrox MGA2164W (Millenium II) */
81
#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
82
#define FB_ACCEL_MATROX_MGAG100 20      /* Matrox G100 (Productiva G100) */
83
#define FB_ACCEL_MATROX_MGAG200 21      /* Matrox G200 (Myst, Mill, ...) */
84
#define FB_ACCEL_SUN_CG14       22      /* Sun cgfourteen                */
85
#define FB_ACCEL_SUN_BWTWO      23      /* Sun bwtwo                    */
86
#define FB_ACCEL_SUN_CGTHREE    24      /* Sun cgthree                  */
87
#define FB_ACCEL_SUN_TCX        25      /* Sun tcx                      */
88
#define FB_ACCEL_MATROX_MGAG400 26      /* Matrox G400                  */
89
#define FB_ACCEL_NV3            27      /* nVidia RIVA 128              */
90
#define FB_ACCEL_NV4            28      /* nVidia RIVA TNT              */
91
#define FB_ACCEL_NV5            29      /* nVidia RIVA TNT2             */
92
#define FB_ACCEL_CT_6555x       30      /* C&T 6555x                    */
93
#define FB_ACCEL_3DFX_BANSHEE   31      /* 3Dfx Banshee                 */
94
#define FB_ACCEL_ATI_RAGE128    32      /* ATI Rage128 family           */
95
#define FB_ACCEL_IGS_CYBER2000  33      /* CyberPro 2000                */
96
#define FB_ACCEL_IGS_CYBER2010  34      /* CyberPro 2010                */
97
#define FB_ACCEL_IGS_CYBER5000  35      /* CyberPro 5000                */
98
#define FB_ACCEL_SIS_GLAMOUR    36      /* SiS 300/630/540              */
99
#define FB_ACCEL_3DLABS_PERMEDIA3 37    /* 3Dlabs Permedia 3            */
100
#define FB_ACCEL_ATI_RADEON     38      /* ATI Radeon family            */
101
#define FB_ACCEL_I810           39      /* Intel 810/815                */
102
#define FB_ACCEL_SIS_GLAMOUR_2  40      /* SiS 315, 650, 740            */
103
#define FB_ACCEL_SIS_XABRE      41      /* SiS 330 ("Xabre")            */
104
 
105
#define FB_ACCEL_NEOMAGIC_NM2070 90     /* NeoMagic NM2070              */
106
#define FB_ACCEL_NEOMAGIC_NM2090 91     /* NeoMagic NM2090              */
107
#define FB_ACCEL_NEOMAGIC_NM2093 92     /* NeoMagic NM2093              */
108
#define FB_ACCEL_NEOMAGIC_NM2097 93     /* NeoMagic NM2097              */
109
#define FB_ACCEL_NEOMAGIC_NM2160 94     /* NeoMagic NM2160              */
110
#define FB_ACCEL_NEOMAGIC_NM2200 95     /* NeoMagic NM2200              */
111
#define FB_ACCEL_NEOMAGIC_NM2230 96     /* NeoMagic NM2230              */
112
#define FB_ACCEL_NEOMAGIC_NM2360 97     /* NeoMagic NM2360              */
113
#define FB_ACCEL_NEOMAGIC_NM2380 98     /* NeoMagic NM2380              */
114
 
115
 
116
struct fb_fix_screeninfo {
117
        char id[16];                    /* identification string eg "TT Builtin" */
118
        unsigned long smem_start;       /* Start of frame buffer mem */
119
                                        /* (physical address) */
120
        __u32 smem_len;                 /* Length of frame buffer mem */
121
        __u32 type;                     /* see FB_TYPE_*                */
122
        __u32 type_aux;                 /* Interleave for interleaved Planes */
123
        __u32 visual;                   /* see FB_VISUAL_*              */
124
        __u16 xpanstep;                 /* zero if no hardware panning  */
125
        __u16 ypanstep;                 /* zero if no hardware panning  */
126
        __u16 ywrapstep;                /* zero if no hardware ywrap    */
127
        __u32 line_length;              /* length of a line in bytes    */
128
        unsigned long mmio_start;       /* Start of Memory Mapped I/O   */
129
                                        /* (physical address) */
130
        __u32 mmio_len;                 /* Length of Memory Mapped I/O  */
131
        __u32 accel;                    /* Type of acceleration available */
132
        __u16 reserved[3];              /* Reserved for future compatibility */
133
};
134
 
135
/* Interpretation of offset for color fields: All offsets are from the right,
136
 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
137
 * can use the offset as right argument to <<). A pixel afterwards is a bit
138
 * stream and is written to video memory as that unmodified. This implies
139
 * big-endian byte order if bits_per_pixel is greater than 8.
140
 */
141
struct fb_bitfield {
142
        __u32 offset;                   /* beginning of bitfield        */
143
        __u32 length;                   /* length of bitfield           */
144
        __u32 msb_right;                /* != 0 : Most significant bit is */
145
                                        /* right */
146
};
147
 
148
#define FB_NONSTD_HAM           1       /* Hold-And-Modify (HAM)        */
149
 
150
#define FB_ACTIVATE_NOW         0       /* set values immediately (or vbl)*/
151
#define FB_ACTIVATE_NXTOPEN     1       /* activate on next open        */
152
#define FB_ACTIVATE_TEST        2       /* don't set, round up impossible */
153
#define FB_ACTIVATE_MASK       15
154
                                        /* values                       */
155
#define FB_ACTIVATE_VBL        16       /* activate values on next vbl  */
156
#define FB_CHANGE_CMAP_VBL     32       /* change colormap on vbl       */
157
#define FB_ACTIVATE_ALL        64       /* change all VCs on this fb    */
158
 
159
#define FB_ACCELF_TEXT          1       /* text mode acceleration */
160
 
161
#define FB_SYNC_HOR_HIGH_ACT    1       /* horizontal sync high active  */
162
#define FB_SYNC_VERT_HIGH_ACT   2       /* vertical sync high active    */
163
#define FB_SYNC_EXT             4       /* external sync                */
164
#define FB_SYNC_COMP_HIGH_ACT   8       /* composite sync high active   */
165
#define FB_SYNC_BROADCAST       16      /* broadcast video timings      */
166
                                        /* vtotal = 144d/288n/576i => PAL  */
167
                                        /* vtotal = 121d/242n/484i => NTSC */
168
#define FB_SYNC_ON_GREEN        32      /* sync on green */
169
 
170
#define FB_VMODE_NONINTERLACED  0       /* non interlaced */
171
#define FB_VMODE_INTERLACED     1       /* interlaced   */
172
#define FB_VMODE_DOUBLE         2       /* double scan */
173
#define FB_VMODE_MASK           255
174
 
175
#define FB_VMODE_YWRAP          256     /* ywrap instead of panning     */
176
#define FB_VMODE_SMOOTH_XPAN    512     /* smooth xpan possible (internally used) */
177
#define FB_VMODE_CONUPDATE      512     /* don't update x/yoffset       */
178
 
179
#define PICOS2KHZ(a) (1000000000UL/(a))
180
#define KHZ2PICOS(a) (1000000000UL/(a))
181
 
182
struct fb_var_screeninfo {
183
        __u32 xres;                     /* visible resolution           */
184
        __u32 yres;
185
        __u32 xres_virtual;             /* virtual resolution           */
186
        __u32 yres_virtual;
187
        __u32 xoffset;                  /* offset from virtual to visible */
188
        __u32 yoffset;                  /* resolution                   */
189
 
190
        __u32 bits_per_pixel;           /* guess what                   */
191
        __u32 grayscale;                /* != 0 Graylevels instead of colors */
192
 
193
        struct fb_bitfield red;         /* bitfield in fb mem if true color, */
194
        struct fb_bitfield green;       /* else only length is significant */
195
        struct fb_bitfield blue;
196
        struct fb_bitfield transp;      /* transparency                 */     
197
 
198
        __u32 nonstd;                   /* != 0 Non standard pixel format */
199
 
200
        __u32 activate;                 /* see FB_ACTIVATE_*            */
201
 
202
        __u32 height;                   /* height of picture in mm    */
203
        __u32 width;                    /* width of picture in mm     */
204
 
205
        __u32 accel_flags;              /* acceleration flags (hints)   */
206
 
207
        /* Timing: All values in pixclocks, except pixclock (of course) */
208
        __u32 pixclock;                 /* pixel clock in ps (pico seconds) */
209
        __u32 left_margin;              /* time from sync to picture    */
210
        __u32 right_margin;             /* time from picture to sync    */
211
        __u32 upper_margin;             /* time from sync to picture    */
212
        __u32 lower_margin;
213
        __u32 hsync_len;                /* length of horizontal sync    */
214
        __u32 vsync_len;                /* length of vertical sync      */
215
        __u32 sync;                     /* see FB_SYNC_*                */
216
        __u32 vmode;                    /* see FB_VMODE_*               */
217
        __u32 rotate;                   /* angle we rotate counter clockwise */
218
        __u32 reserved[5];              /* Reserved for future compatibility */
219
};
220
 
221
struct fb_cmap {
222
        __u32 start;                    /* First entry  */
223
        __u32 len;                      /* Number of entries */
224
        __u16 *red;                     /* Red values   */
225
        __u16 *green;
226
        __u16 *blue;
227
        __u16 *transp;                  /* transparency, can be NULL */
228
};
229
 
230
struct fb_con2fbmap {
231
        __u32 console;
232
        __u32 framebuffer;
233
};
234
 
235
/* VESA Blanking Levels */
236
#define VESA_NO_BLANKING        0
237
#define VESA_VSYNC_SUSPEND      1
238
#define VESA_HSYNC_SUSPEND      2
239
#define VESA_POWERDOWN          3
240
 
241
struct fb_monspecs {
242
        __u32 hfmin;                    /* hfreq lower limit (Hz) */
243
        __u32 hfmax;                    /* hfreq upper limit (Hz) */
244
        __u16 vfmin;                    /* vfreq lower limit (Hz) */
245
        __u16 vfmax;                    /* vfreq upper limit (Hz) */
246
        __u32 dclkmin;                  /* pixelclock lower limit (Hz) */
247
        __u32 dclkmax;                  /* pixelclock upper limit (Hz) */
248
        unsigned gtf  : 1;              /* supports GTF */
249
        unsigned dpms : 1;              /* supports DPMS */
250
};
251
 
252
#define FB_VBLANK_VBLANKING     0x001   /* currently in a vertical blank */
253
#define FB_VBLANK_HBLANKING     0x002   /* currently in a horizontal blank */
254
#define FB_VBLANK_HAVE_VBLANK   0x004   /* vertical blanks can be detected */
255
#define FB_VBLANK_HAVE_HBLANK   0x008   /* horizontal blanks can be detected */
256
#define FB_VBLANK_HAVE_COUNT    0x010   /* global retrace counter is available */
257
#define FB_VBLANK_HAVE_VCOUNT   0x020   /* the vcount field is valid */
258
#define FB_VBLANK_HAVE_HCOUNT   0x040   /* the hcount field is valid */
259
#define FB_VBLANK_VSYNCING      0x080   /* currently in a vsync */
260
#define FB_VBLANK_HAVE_VSYNC    0x100   /* verical syncs can be detected */
261
 
262
struct fb_vblank {
263
        __u32 flags;                    /* FB_VBLANK flags */
264
        __u32 count;                    /* counter of retraces since boot */
265
        __u32 vcount;                   /* current scanline position */
266
        __u32 hcount;                   /* current scandot position */
267
        __u32 reserved[4];              /* reserved for future compatibility */
268
};
269
 
270
/* Internal HW accel */
271
#define ROP_COPY 0
272
#define ROP_XOR  1
273
 
274
struct fb_copyarea {
275
        __u32 dx;
276
        __u32 dy;
277
        __u32 width;
278
        __u32 height;
279
        __u32 sx;
280
        __u32 sy;
281
};
282
 
283
struct fb_fillrect {
284
        __u32 dx;       /* screen-relative */
285
        __u32 dy;
286
        __u32 width;
287
        __u32 height;
288
        __u32 color;
289
        __u32 rop;
290
};
291
 
292
struct fb_image {
293
        __u32 dx;               /* Where to place image */
294
        __u32 dy;
295
        __u32 width;            /* Size of image */
296
        __u32 height;
297
        __u32 fg_color;         /* Only used when a mono bitmap */
298
        __u32 bg_color;
299
        __u8  depth;            /* Depth of the image */
300
        const char *data;       /* Pointer to image data */
301
        struct fb_cmap cmap;    /* color map info */
302
};
303
 
304
/*
305
 * hardware cursor control
306
 */
307
 
308
#define FB_CUR_SETCUR   0x01
309
#define FB_CUR_SETPOS   0x02
310
#define FB_CUR_SETHOT   0x04
311
#define FB_CUR_SETCMAP  0x08
312
#define FB_CUR_SETSHAPE 0x10
313
#define FB_CUR_SETSIZE  0x20
314
#define FB_CUR_SETALL   0xFF
315
 
316
struct fbcurpos {
317
        __u16 x, y;
318
};
319
 
320
struct fb_cursor {
321
        __u16 set;              /* what to set */
322
        __u16 enable;           /* cursor on/off */
323
        __u16 rop;              /* bitop operation */
324
        char *mask;             /* cursor mask bits */
325
        struct fbcurpos hot;    /* cursor hot spot */
326
        struct fb_image image;  /* Cursor image */
327
};
328
 
329
#define FB_PIXMAP_DEFAULT 1     /* used internally by fbcon */
330
#define FB_PIXMAP_SYSTEM  2     /* memory is in system RAM  */
331
#define FB_PIXMAP_IO      4     /* memory is iomapped       */
332
#define FB_PIXMAP_SYNC    256   /* set if GPU can DMA       */
333
 
334
struct fb_pixmap {
335
        __u8  *addr;                      /* pointer to memory             */  
336
        __u32 size;                       /* size of buffer in bytes       */
337
        __u32 offset;                     /* current offset to buffer      */
338
        __u32 buf_align;                  /* byte alignment of each bitmap */
339
        __u32 scan_align;                 /* alignment per scanline        */
340
        __u32 flags;                      /* see FB_PIXMAP_*               */
341
                                          /* access methods                */
342
        void (*outbuf)(u8 *dst, u8 *addr, unsigned int size);
343
        u8   (*inbuf) (u8 *addr);
344
        spinlock_t lock;                  /* spinlock                      */
345
        atomic_t count;
346
};
347
#ifdef __KERNEL__
348
 
349
#include <linux/fs.h>
350
#include <linux/init.h>
351
 
352
struct fb_info;
353
struct vm_area_struct;
354
struct file;
355
 
356
    /*
357
     *  Frame buffer operations
358
     */
359
 
360
struct fb_ops {
361
    /* open/release and usage marking */
362
    struct module *owner;
363
    int (*fb_open)(struct fb_info *info, int user);
364
    int (*fb_release)(struct fb_info *info, int user);
365
    /* For framebuffers with strange non linear layouts */     
366
    ssize_t (*fb_read)(struct file *file, char *buf, size_t count, loff_t *ppos);
367
    ssize_t (*fb_write)(struct file *file, const char *buf, size_t count, loff_t *ppos);       
368
    /* checks var and creates a par based on it */
369
    int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
370
    /* set the video mode according to par */
371
    int (*fb_set_par)(struct fb_info *info);
372
    /* set color register */
373
    int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
374
                        unsigned blue, unsigned transp, struct fb_info *info);
375
    /* blank display */
376
    int (*fb_blank)(int blank, struct fb_info *info);
377
    /* pan display */
378
    int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
379
    /* draws a rectangle */
380
    void (*fb_fillrect)(struct fb_info *info, const struct fb_fillrect *rect);
381
    /* Copy data from area to another */
382
    void (*fb_copyarea)(struct fb_info *info,const struct fb_copyarea *region);
383
    /* Draws a image to the display */
384
    void (*fb_imageblit)(struct fb_info *info, const struct fb_image *image);
385
    /* Draws cursor */
386
    int (*fb_cursor)(struct fb_info *info, struct fb_cursor *cursor);
387
    /* Rotates the display */
388
    void (*fb_rotate)(struct fb_info *info, int angle);
389
    /* wait for blit idle, optional */
390
    int (*fb_sync)(struct fb_info *info);              
391
    /* perform fb specific ioctl (optional) */
392
    int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
393
                    unsigned long arg, struct fb_info *info);
394
    /* perform fb specific mmap */
395
    int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
396
};
397
 
398
struct fb_info {
399
   int node;
400
   int flags;
401
   int open;                            /* Has this been open already ? */
402
#define FBINFO_FLAG_MODULE      1       /* Low-level driver is a module */
403
   struct fb_var_screeninfo var;        /* Current var */
404
   struct fb_fix_screeninfo fix;        /* Current fix */
405
   struct fb_monspecs monspecs;         /* Current Monitor specs */
406
   struct fb_cursor cursor;             /* Current cursor */   
407
   struct work_struct queue;            /* Framebuffer event queue */
408
   struct fb_pixmap pixmap;             /* Current pixmap */
409
   struct fb_cmap cmap;                 /* Current cmap */
410
   struct fb_ops *fbops;
411
   char *screen_base;                   /* Virtual address */
412
   struct vc_data *display_fg;          /* Console visible on this display */
413
   int currcon;                         /* Current VC. */      
414
   void *pseudo_palette;                /* Fake palette of 16 colors */
415
   /* From here on everything is device dependent */
416
   void *par;  
417
};
418
 
419
#ifdef MODULE
420
#define FBINFO_FLAG_DEFAULT     FBINFO_FLAG_MODULE
421
#else
422
#define FBINFO_FLAG_DEFAULT     0
423
#endif
424
 
425
#if defined(__sparc__)
426
 
427
/* We map all of our framebuffers such that big-endian accesses
428
 * are what we want, so the following is sufficient.
429
 */
430
 
431
#define fb_readb sbus_readb
432
#define fb_readw sbus_readw
433
#define fb_readl sbus_readl
434
#define fb_readq sbus_readq
435
#define fb_writeb sbus_writeb
436
#define fb_writew sbus_writew
437
#define fb_writel sbus_writel
438
#define fb_writeq sbus_writeq
439
#define fb_memset sbus_memset_io
440
 
441
#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__)
442
 
443
#define fb_readb __raw_readb
444
#define fb_readw __raw_readw
445
#define fb_readl __raw_readl
446
#define fb_readq __raw_readq
447
#define fb_writeb __raw_writeb
448
#define fb_writew __raw_writew
449
#define fb_writel __raw_writel
450
#define fb_writeq __raw_writeq
451
#define fb_memset memset_io
452
 
453
#else
454
 
455
#define fb_readb(addr) (*(volatile u8 *) (addr))
456
#define fb_readw(addr) (*(volatile u16 *) (addr))
457
#define fb_readl(addr) (*(volatile u32 *) (addr))
458
#define fb_readq(addr) (*(volatile u64 *) (addr))
459
#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
460
#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
461
#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
462
#define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
463
#define fb_memset memset
464
 
465
#endif
466
 
467
    /*
468
     *  `Generic' versions of the frame buffer device operations
469
     */
470
 
471
extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var);
472
extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var);
473
extern int fb_blank(struct fb_info *info, int blank);
474
extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
475
extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
476
extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
477
extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
478
 
479
/* drivers/video/fbmem.c */
480
extern int register_framebuffer(struct fb_info *fb_info);
481
extern int unregister_framebuffer(struct fb_info *fb_info);
482
extern int fb_prepare_logo(struct fb_info *fb_info);
483
extern int fb_show_logo(struct fb_info *fb_info);
484
extern u32 fb_get_buffer_offset(struct fb_info *info, u32 size);
485
extern void move_buf_unaligned(struct fb_info *info, u8 *dst, u8 *src, u32 d_pitch,
486
                                u32 height, u32 mask, u32 shift_high, u32 shift_low,
487
                                u32 mod, u32 idx);
488
extern void move_buf_aligned(struct fb_info *info, u8 *dst, u8 *src, u32 d_pitch,
489
                             u32 s_pitch, u32 height);
490
extern struct fb_info *registered_fb[FB_MAX];
491
extern int num_registered_fb;
492
 
493
/* drivers/video/fbmon.c */
494
#define FB_MAXTIMINGS       0
495
#define FB_VSYNCTIMINGS     1
496
#define FB_HSYNCTIMINGS     2
497
#define FB_DCLKTIMINGS      3
498
#define FB_IGNOREMON    0x100
499
 
500
extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
501
                               const struct fb_info *fb_info);
502
extern int fbmon_dpms(const struct fb_info *fb_info);
503
extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
504
                       struct fb_info *info);
505
extern int fb_validate_mode(struct fb_var_screeninfo *var,
506
                            struct fb_info *info);
507
extern int parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
508
extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
509
extern struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize);
510
extern void fb_destroy_modedb(struct fb_videomode *modedb);
511
extern void show_edid(unsigned char *edid);
512
 
513
/* drivers/video/modedb.c */
514
#define VESA_MODEDB_SIZE 34
515
 
516
/* drivers/video/fbcmap.c */
517
extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
518
extern void fb_dealloc_cmap(struct fb_cmap *cmap);
519
extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to,
520
                        int fsfromto);
521
extern int fb_set_cmap(struct fb_cmap *cmap, int kspc, struct fb_info *fb_info);
522
extern struct fb_cmap *fb_default_cmap(int len);
523
extern void fb_invert_cmaps(void);
524
 
525
struct fb_videomode {
526
    const char *name;   /* optional */
527
    u32 refresh;        /* optional */
528
    u32 xres;
529
    u32 yres;
530
    u32 pixclock;
531
    u32 left_margin;
532
    u32 right_margin;
533
    u32 upper_margin;
534
    u32 lower_margin;
535
    u32 hsync_len;
536
    u32 vsync_len;
537
    u32 sync;
538
    u32 vmode;
539
};
540
 
1056 tullio 541
// moved here for gcc4 compatibility
542
extern const struct fb_videomode vesa_modes[];
543
 
422 giacomo 544
#ifdef MODULE
545
static inline int fb_find_mode(struct fb_var_screeninfo *var,
546
                               struct fb_info *info, const char *mode_option,
547
                               const struct fb_videomode *db,
548
                               unsigned int dbsize,
549
                               const struct fb_videomode *default_mode,
550
                               unsigned int default_bpp)
551
{
552
    extern int __fb_try_mode(struct fb_var_screeninfo *var,
553
                             struct fb_info *info,
554
                             const struct fb_videomode *mode,
555
                             unsigned int bpp);
556
    /*
557
     *  FIXME: How to make the compiler optimize vga640x400 away if
558
     *         default_mode is non-NULL?
559
     */
560
    static const struct fb_videomode vga640x400 = {
561
        /* 640x400 @ 70 Hz, 31.5 kHz hsync */
562
        NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
563
        0, FB_VMODE_NONINTERLACED
564
    };
565
    if (!default_mode)
566
        default_mode = &vga640x400;
567
    if (!default_bpp)
568
        default_bpp = 8;
569
    return __fb_try_mode(var, info, default_mode, default_bpp);
570
}
571
#else
572
extern int __init fb_find_mode(struct fb_var_screeninfo *var,
573
                               struct fb_info *info, const char *mode_option,
574
                               const struct fb_videomode *db,
575
                               unsigned int dbsize,
576
                               const struct fb_videomode *default_mode,
577
                               unsigned int default_bpp);
578
#endif
579
 
580
#endif /* __KERNEL__ */
581
 
582
#endif /* _LINUX_FB_H */