Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / linux / fb.h
index 99d3db0..2f335e9 100644 (file)
 #define FBIOGETCMAP            0x4604
 #define FBIOPUTCMAP            0x4605
 #define FBIOPAN_DISPLAY                0x4606
+#ifdef __KERNEL__
+#define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor_user)
+#else
 #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor)
+#endif
 /* 0x4607-0x460B are defined below */
 /* #define FBIOGET_MONITORSPEC 0x460C */
 /* #define FBIOPUT_MONITORSPEC 0x460D */
 #define FB_ACCEL_I810           39      /* Intel 810/815                */
 #define FB_ACCEL_SIS_GLAMOUR_2  40     /* SiS 315, 650, 740            */
 #define FB_ACCEL_SIS_XABRE      41     /* SiS 330 ("Xabre")            */
-
+#define FB_ACCEL_I830           42      /* Intel 830M/845G/85x/865G     */
+#define FB_ACCEL_NV_10          43      /* nVidia Arch 10               */
+#define FB_ACCEL_NV_20          44      /* nVidia Arch 20               */
+#define FB_ACCEL_NV_30          45      /* nVidia Arch 30               */
+#define FB_ACCEL_NV_40          46      /* nVidia Arch 40               */
+#define FB_ACCEL_XGI_VOLARI_V  47      /* XGI Volari V3XT, V5, V8      */
+#define FB_ACCEL_XGI_VOLARI_Z  48      /* XGI Volari Z7                */
 #define FB_ACCEL_NEOMAGIC_NM2070 90    /* NeoMagic NM2070              */
 #define FB_ACCEL_NEOMAGIC_NM2090 91    /* NeoMagic NM2090              */
 #define FB_ACCEL_NEOMAGIC_NM2093 92    /* NeoMagic NM2093              */
 #define FB_ACCEL_NEOMAGIC_NM2360 97    /* NeoMagic NM2360              */
 #define FB_ACCEL_NEOMAGIC_NM2380 98    /* NeoMagic NM2380              */
 
+#define FB_ACCEL_SAVAGE4        0x80   /* S3 Savage4                   */
+#define FB_ACCEL_SAVAGE3D       0x81   /* S3 Savage3D                  */
+#define FB_ACCEL_SAVAGE3D_MV    0x82   /* S3 Savage3D-MV               */
+#define FB_ACCEL_SAVAGE2000     0x83   /* S3 Savage2000                */
+#define FB_ACCEL_SAVAGE_MX_MV   0x84   /* S3 Savage/MX-MV              */
+#define FB_ACCEL_SAVAGE_MX      0x85   /* S3 Savage/MX                 */
+#define FB_ACCEL_SAVAGE_IX_MV   0x86   /* S3 Savage/IX-MV              */
+#define FB_ACCEL_SAVAGE_IX      0x87   /* S3 Savage/IX                 */
+#define FB_ACCEL_PROSAVAGE_PM   0x88   /* S3 ProSavage PM133           */
+#define FB_ACCEL_PROSAVAGE_KM   0x89   /* S3 ProSavage KM133           */
+#define FB_ACCEL_S3TWISTER_P    0x8a   /* S3 Twister                   */
+#define FB_ACCEL_S3TWISTER_K    0x8b   /* S3 TwisterK                  */
+#define FB_ACCEL_SUPERSAVAGE    0x8c    /* S3 Supersavage               */
+#define FB_ACCEL_PROSAVAGE_DDR  0x8d   /* S3 ProSavage DDR             */
+#define FB_ACCEL_PROSAVAGE_DDRK 0x8e   /* S3 ProSavage DDR-K           */
 
 struct fb_fix_screeninfo {
        char id[16];                    /* identification string eg "TT Builtin" */
@@ -125,7 +150,8 @@ struct fb_fix_screeninfo {
        unsigned long mmio_start;       /* Start of Memory Mapped I/O   */
                                        /* (physical address) */
        __u32 mmio_len;                 /* Length of Memory Mapped I/O  */
-       __u32 accel;                    /* Type of acceleration available */
+       __u32 accel;                    /* Indicate to driver which     */
+                                       /*  specific chip/card we have  */
        __u16 reserved[3];              /* Reserved for future compatibility */
 };
 
@@ -153,8 +179,9 @@ struct fb_bitfield {
 #define FB_CHANGE_CMAP_VBL     32      /* change colormap on vbl       */
 #define FB_ACTIVATE_ALL               64       /* change all VCs on this fb    */
 #define FB_ACTIVATE_FORCE     128      /* force apply even when no change*/
+#define FB_ACTIVATE_INV_MODE  256       /* invalidate videomode */
 
-#define FB_ACCELF_TEXT         1       /* text mode acceleration */
+#define FB_ACCELF_TEXT         1       /* (OBSOLETE) see fb_info.flags and vc_mode */
 
 #define FB_SYNC_HOR_HIGH_ACT   1       /* horizontal sync high active  */
 #define FB_SYNC_VERT_HIGH_ACT  2       /* vertical sync high active    */
@@ -174,6 +201,14 @@ struct fb_bitfield {
 #define FB_VMODE_SMOOTH_XPAN   512     /* smooth xpan possible (internally used) */
 #define FB_VMODE_CONUPDATE     512     /* don't update x/yoffset       */
 
+/*
+ * Display rotation support
+ */
+#define FB_ROTATE_UR      0
+#define FB_ROTATE_CW      1
+#define FB_ROTATE_UD      2
+#define FB_ROTATE_CCW     3
+
 #define PICOS2KHZ(a) (1000000000UL/(a))
 #define KHZ2PICOS(a) (1000000000UL/(a))
 
@@ -200,7 +235,7 @@ struct fb_var_screeninfo {
        __u32 height;                   /* height of picture in mm    */
        __u32 width;                    /* width of picture in mm     */
 
-       __u32 accel_flags;              /* acceleration flags (hints)   */
+       __u32 accel_flags;              /* (OBSOLETE) see fb_info.flags */
 
        /* Timing: All values in pixclocks, except pixclock (of course) */
        __u32 pixclock;                 /* pixel clock in ps (pico seconds) */
@@ -236,71 +271,22 @@ struct fb_con2fbmap {
 #define VESA_HSYNC_SUSPEND      2
 #define VESA_POWERDOWN          3
 
-/* Definitions below are used in the parsed monitor specs */
-#define FB_DPMS_ACTIVE_OFF     1
-#define FB_DPMS_SUSPEND                2
-#define FB_DPMS_STANDBY                4
 
-#define FB_DISP_DDI            1
-#define FB_DISP_ANA_700_300    2
-#define FB_DISP_ANA_714_286    4
-#define FB_DISP_ANA_1000_400   8
-#define FB_DISP_ANA_700_000    16
+enum {
+       /* screen: unblanked, hsync: on,  vsync: on */
+       FB_BLANK_UNBLANK       = VESA_NO_BLANKING,
 
-#define FB_DISP_MONO           32
-#define FB_DISP_RGB            64
-#define FB_DISP_MULTI          128
-#define FB_DISP_UNKNOWN                256
+       /* screen: blanked,   hsync: on,  vsync: on */
+       FB_BLANK_NORMAL        = VESA_NO_BLANKING + 1,
 
-#define FB_SIGNAL_NONE         0
-#define FB_SIGNAL_BLANK_BLANK  1
-#define FB_SIGNAL_SEPARATE     2
-#define FB_SIGNAL_COMPOSITE    4
-#define FB_SIGNAL_SYNC_ON_GREEN        8
-#define FB_SIGNAL_SERRATION_ON 16
+       /* screen: blanked,   hsync: on,  vsync: off */
+       FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
 
-#define FB_MISC_PRIM_COLOR     1
-#define FB_MISC_1ST_DETAIL     2       /* First Detailed Timing is preferred */
+       /* screen: blanked,   hsync: off, vsync: on */
+       FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
 
-struct fb_chroma {
-       __u32 redx;     /* in fraction of 1024 */
-       __u32 greenx;
-       __u32 bluex;
-       __u32 whitex;
-       __u32 redy;
-       __u32 greeny;
-       __u32 bluey;
-       __u32 whitey;
-};
-
-struct fb_monspecs {
-       struct fb_chroma chroma;
-       struct fb_videomode *modedb;    /* mode database */
-       __u8  manufacturer[4];          /* Manufacturer */
-       __u8  monitor[14];              /* Monitor String */
-       __u8  serial_no[14];            /* Serial Number */
-       __u8  ascii[14];                /* ? */
-       __u32 modedb_len;               /* mode database length */
-       __u32 model;                    /* Monitor Model */
-       __u32 serial;                   /* Serial Number - Integer */
-       __u32 year;                     /* Year manufactured */
-       __u32 week;                     /* Week Manufactured */
-       __u32 hfmin;                    /* hfreq lower limit (Hz) */
-       __u32 hfmax;                    /* hfreq upper limit (Hz) */
-       __u32 dclkmin;                  /* pixelclock lower limit (Hz) */
-       __u32 dclkmax;                  /* pixelclock upper limit (Hz) */
-       __u16 input;                    /* display type - see FB_DISP_* */
-       __u16 dpms;                     /* DPMS support - see FB_DPMS_ */
-       __u16 signal;                   /* Signal Type - see FB_SIGNAL_* */
-       __u16 vfmin;                    /* vfreq lower limit (Hz) */
-       __u16 vfmax;                    /* vfreq upper limit (Hz) */
-       __u16 gamma;                    /* Gamma - in fractions of 100 */
-       __u16 gtf       : 1;            /* supports GTF */
-       __u16 misc;                     /* Misc flags - see FB_MISC_* */
-       __u8  version;                  /* EDID version... */
-       __u8  revision;                 /* ...and revision */
-       __u8  max_x;                    /* Maximum horizontal size (cm) */
-       __u8  max_y;                    /* Maximum vertical size (cm) */
+       /* screen: blanked,   hsync: off, vsync: off */
+       FB_BLANK_POWERDOWN     = VESA_POWERDOWN + 1
 };
 
 #define FB_VBLANK_VBLANKING    0x001   /* currently in a vertical blank */
@@ -359,7 +345,7 @@ struct fb_image {
  * hardware cursor control
  */
 
-#define FB_CUR_SETCUR   0x01
+#define FB_CUR_SETIMAGE 0x01
 #define FB_CUR_SETPOS   0x02
 #define FB_CUR_SETHOT   0x04
 #define FB_CUR_SETCMAP  0x08
@@ -375,20 +361,26 @@ struct fb_cursor {
        __u16 set;              /* what to set */
        __u16 enable;           /* cursor on/off */
        __u16 rop;              /* bitop operation */
-       char *mask;             /* cursor mask bits */
+       const char *mask;       /* cursor mask bits */
        struct fbcurpos hot;    /* cursor hot spot */
        struct fb_image image;  /* Cursor image */
 };
 
+#ifdef CONFIG_FB_BACKLIGHT
+/* Settings for the generic backlight code */
+#define FB_BACKLIGHT_LEVELS    128
+#define FB_BACKLIGHT_MAX       0xFF
+#endif
+
 #ifdef __KERNEL__
 
 #include <linux/fs.h>
 #include <linux/init.h>
-#include <linux/tty.h>
 #include <linux/device.h>
 #include <linux/workqueue.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/notifier.h>
+#include <linux/list.h>
+#include <linux/backlight.h>
 #include <asm/io.h>
 
 struct vm_area_struct;
@@ -396,6 +388,102 @@ struct fb_info;
 struct device;
 struct file;
 
+/* Definitions below are used in the parsed monitor specs */
+#define FB_DPMS_ACTIVE_OFF     1
+#define FB_DPMS_SUSPEND                2
+#define FB_DPMS_STANDBY                4
+
+#define FB_DISP_DDI            1
+#define FB_DISP_ANA_700_300    2
+#define FB_DISP_ANA_714_286    4
+#define FB_DISP_ANA_1000_400   8
+#define FB_DISP_ANA_700_000    16
+
+#define FB_DISP_MONO           32
+#define FB_DISP_RGB            64
+#define FB_DISP_MULTI          128
+#define FB_DISP_UNKNOWN                256
+
+#define FB_SIGNAL_NONE         0
+#define FB_SIGNAL_BLANK_BLANK  1
+#define FB_SIGNAL_SEPARATE     2
+#define FB_SIGNAL_COMPOSITE    4
+#define FB_SIGNAL_SYNC_ON_GREEN        8
+#define FB_SIGNAL_SERRATION_ON 16
+
+#define FB_MISC_PRIM_COLOR     1
+#define FB_MISC_1ST_DETAIL     2       /* First Detailed Timing is preferred */
+struct fb_chroma {
+       __u32 redx;     /* in fraction of 1024 */
+       __u32 greenx;
+       __u32 bluex;
+       __u32 whitex;
+       __u32 redy;
+       __u32 greeny;
+       __u32 bluey;
+       __u32 whitey;
+};
+
+struct fb_monspecs {
+       struct fb_chroma chroma;
+       struct fb_videomode *modedb;    /* mode database */
+       __u8  manufacturer[4];          /* Manufacturer */
+       __u8  monitor[14];              /* Monitor String */
+       __u8  serial_no[14];            /* Serial Number */
+       __u8  ascii[14];                /* ? */
+       __u32 modedb_len;               /* mode database length */
+       __u32 model;                    /* Monitor Model */
+       __u32 serial;                   /* Serial Number - Integer */
+       __u32 year;                     /* Year manufactured */
+       __u32 week;                     /* Week Manufactured */
+       __u32 hfmin;                    /* hfreq lower limit (Hz) */
+       __u32 hfmax;                    /* hfreq upper limit (Hz) */
+       __u32 dclkmin;                  /* pixelclock lower limit (Hz) */
+       __u32 dclkmax;                  /* pixelclock upper limit (Hz) */
+       __u16 input;                    /* display type - see FB_DISP_* */
+       __u16 dpms;                     /* DPMS support - see FB_DPMS_ */
+       __u16 signal;                   /* Signal Type - see FB_SIGNAL_* */
+       __u16 vfmin;                    /* vfreq lower limit (Hz) */
+       __u16 vfmax;                    /* vfreq upper limit (Hz) */
+       __u16 gamma;                    /* Gamma - in fractions of 100 */
+       __u16 gtf       : 1;            /* supports GTF */
+       __u16 misc;                     /* Misc flags - see FB_MISC_* */
+       __u8  version;                  /* EDID version... */
+       __u8  revision;                 /* ...and revision */
+       __u8  max_x;                    /* Maximum horizontal size (cm) */
+       __u8  max_y;                    /* Maximum vertical size (cm) */
+};
+
+struct fb_cmap_user {
+       __u32 start;                    /* First entry  */
+       __u32 len;                      /* Number of entries */
+       __u16 __user *red;              /* Red values   */
+       __u16 __user *green;
+       __u16 __user *blue;
+       __u16 __user *transp;           /* transparency, can be NULL */
+};
+
+struct fb_image_user {
+       __u32 dx;                       /* Where to place image */
+       __u32 dy;
+       __u32 width;                    /* Size of image */
+       __u32 height;
+       __u32 fg_color;                 /* Only used when a mono bitmap */
+       __u32 bg_color;
+       __u8  depth;                    /* Depth of the image */
+       const char __user *data;        /* Pointer to image data */
+       struct fb_cmap_user cmap;       /* color map info */
+};
+
+struct fb_cursor_user {
+       __u16 set;                      /* what to set */
+       __u16 enable;                   /* cursor on/off */
+       __u16 rop;                      /* bitop operation */
+       const char __user *mask;        /* cursor mask bits */
+       struct fbcurpos hot;            /* cursor hot spot */
+       struct fb_image_user image;     /* Cursor image */
+};
+
 /*
  * Register/unregister for framebuffer events
  */
@@ -410,10 +498,33 @@ struct file;
  *     if you own it
  */
 #define FB_EVENT_RESUME                        0x03
+/*      An entry from the modelist was removed */
+#define FB_EVENT_MODE_DELETE            0x04
+/*      A driver registered itself */
+#define FB_EVENT_FB_REGISTERED          0x05
+/*      A driver unregistered itself */
+#define FB_EVENT_FB_UNREGISTERED        0x06
+/*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
+#define FB_EVENT_GET_CONSOLE_MAP        0x07
+/*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
+#define FB_EVENT_SET_CONSOLE_MAP        0x08
+/*      A display blank is requested       */
+#define FB_EVENT_BLANK                  0x09
+/*      Private modelist is to be replaced */
+#define FB_EVENT_NEW_MODELIST           0x0A
+/*     The resolution of the passed in fb_info about to change and
+        all vc's should be changed         */
+#define FB_EVENT_MODE_CHANGE_ALL       0x0B
+
+struct fb_event {
+       struct fb_info *info;
+       void *data;
+};
+
 
 extern int fb_register_client(struct notifier_block *nb);
 extern int fb_unregister_client(struct notifier_block *nb);
-
+extern int fb_notifier_call_chain(unsigned long val, void *v);
 /*
  * Pixmap structure definition
  *
@@ -433,11 +544,11 @@ struct fb_pixmap {
        u32 offset;             /* current offset to buffer             */
        u32 buf_align;          /* byte alignment of each bitmap        */
        u32 scan_align;         /* alignment per scanline               */
-       u32 access_align;       /* alignment per read/write             */
+       u32 access_align;       /* alignment per read/write (bits)      */
        u32 flags;              /* see FB_PIXMAP_*                      */
        /* access methods */
-       void (*outbuf)(struct fb_info *info, u8 *addr, u8 *src, unsigned int size);
-       u8   (*inbuf) (struct fb_info *info, u8 *addr);
+       void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
+       void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
 };
 
 
@@ -445,7 +556,7 @@ struct fb_pixmap {
  * Frame buffer operations
  *
  * LOCKING NOTE: those functions must _ALL_ be called with the console
- * semaphore held, this is the only suitable locking mecanism we have
+ * semaphore held, this is the only suitable locking mechanism we have
  * in 2.6. Some may be called at interrupt time at this point though.
  */
 
@@ -458,8 +569,8 @@ struct fb_ops {
        /* For framebuffers with strange non linear layouts or that do not
         * work with normal memory mapped access
         */
-       ssize_t (*fb_read)(struct file *file, char *buf, size_t count, loff_t *ppos);
-       ssize_t (*fb_write)(struct file *file, const char *buf, size_t count, loff_t *ppos);
+       ssize_t (*fb_read)(struct file *file, char __user *buf, size_t count, loff_t *ppos);
+       ssize_t (*fb_write)(struct file *file, const char __user *buf, size_t count, loff_t *ppos);
 
        /* checks var and eventually tweaks it to something supported,
         * DO NOT MODIFY PAR */
@@ -472,6 +583,9 @@ struct fb_ops {
        int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
                            unsigned blue, unsigned transp, struct fb_info *info);
 
+       /* set color registers in batch */
+       int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);
+
        /* blank display */
        int (*fb_blank)(int blank, struct fb_info *info);
 
@@ -495,44 +609,204 @@ struct fb_ops {
        int (*fb_sync)(struct fb_info *info);
 
        /* perform fb specific ioctl (optional) */
-       int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
-                       unsigned long arg, struct fb_info *info);
+       int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
+                       unsigned long arg);
+
+       /* Handle 32bit compat ioctl (optional) */
+       int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
+                       unsigned long arg);
 
        /* perform fb specific mmap */
-       int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
+       int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
+
+       /* save current hardware state */
+       void (*fb_save_state)(struct fb_info *info);
+
+       /* restore saved state */
+       void (*fb_restore_state)(struct fb_info *info);
+};
+
+#ifdef CONFIG_FB_TILEBLITTING
+
+#define FB_TILE_CURSOR_NONE        0
+#define FB_TILE_CURSOR_UNDERLINE   1
+#define FB_TILE_CURSOR_LOWER_THIRD 2
+#define FB_TILE_CURSOR_LOWER_HALF  3
+#define FB_TILE_CURSOR_TWO_THIRDS  4
+#define FB_TILE_CURSOR_BLOCK       5
+
+struct fb_tilemap {
+       __u32 width;                /* width of each tile in pixels */
+       __u32 height;               /* height of each tile in scanlines */
+       __u32 depth;                /* color depth of each tile */
+       __u32 length;               /* number of tiles in the map */
+       const __u8 *data;           /* actual tile map: a bitmap array, packed
+                                      to the nearest byte */
+};
+
+struct fb_tilerect {
+       __u32 sx;                   /* origin in the x-axis */
+       __u32 sy;                   /* origin in the y-axis */
+       __u32 width;                /* number of tiles in the x-axis */
+       __u32 height;               /* number of tiles in the y-axis */
+       __u32 index;                /* what tile to use: index to tile map */
+       __u32 fg;                   /* foreground color */
+       __u32 bg;                   /* background color */
+       __u32 rop;                  /* raster operation */
+};
+
+struct fb_tilearea {
+       __u32 sx;                   /* source origin in the x-axis */
+       __u32 sy;                   /* source origin in the y-axis */
+       __u32 dx;                   /* destination origin in the x-axis */
+       __u32 dy;                   /* destination origin in the y-axis */
+       __u32 width;                /* number of tiles in the x-axis */
+       __u32 height;               /* number of tiles in the y-axis */
+};
+
+struct fb_tileblit {
+       __u32 sx;                   /* origin in the x-axis */
+       __u32 sy;                   /* origin in the y-axis */
+       __u32 width;                /* number of tiles in the x-axis */
+       __u32 height;               /* number of tiles in the y-axis */
+       __u32 fg;                   /* foreground color */
+       __u32 bg;                   /* background color */
+       __u32 length;               /* number of tiles to draw */
+       __u32 *indices;             /* array of indices to tile map */
+};
+
+struct fb_tilecursor {
+       __u32 sx;                   /* cursor position in the x-axis */
+       __u32 sy;                   /* cursor position in the y-axis */
+       __u32 mode;                 /* 0 = erase, 1 = draw */
+       __u32 shape;                /* see FB_TILE_CURSOR_* */
+       __u32 fg;                   /* foreground color */
+       __u32 bg;                   /* background color */
 };
 
+struct fb_tile_ops {
+       /* set tile characteristics */
+       void (*fb_settile)(struct fb_info *info, struct fb_tilemap *map);
+
+       /* all dimensions from hereon are in terms of tiles */
+
+       /* move a rectangular region of tiles from one area to another*/
+       void (*fb_tilecopy)(struct fb_info *info, struct fb_tilearea *area);
+       /* fill a rectangular region with a tile */
+       void (*fb_tilefill)(struct fb_info *info, struct fb_tilerect *rect);
+       /* copy an array of tiles */
+       void (*fb_tileblit)(struct fb_info *info, struct fb_tileblit *blit);
+       /* cursor */
+       void (*fb_tilecursor)(struct fb_info *info,
+                             struct fb_tilecursor *cursor);
+};
+#endif /* CONFIG_FB_TILEBLITTING */
+
+/* FBINFO_* = fb_info.flags bit flags */
+#define FBINFO_MODULE          0x0001  /* Low-level driver is a module */
+#define FBINFO_HWACCEL_DISABLED        0x0002
+       /* When FBINFO_HWACCEL_DISABLED is set:
+        *  Hardware acceleration is turned off.  Software implementations
+        *  of required functions (copyarea(), fillrect(), and imageblit())
+        *  takes over; acceleration engine should be in a quiescent state */
+
+/* hints */
+#define FBINFO_PARTIAL_PAN_OK  0x0040 /* otw use pan only for double-buffering */
+#define FBINFO_READS_FAST      0x0080 /* soft-copy faster than rendering */
+
+/* hardware supported ops */
+/*  semantics: when a bit is set, it indicates that the operation is
+ *   accelerated by hardware.
+ *  required functions will still work even if the bit is not set.
+ *  optional functions may not even exist if the flag bit is not set.
+ */
+#define FBINFO_HWACCEL_NONE            0x0000
+#define FBINFO_HWACCEL_COPYAREA                0x0100 /* required */
+#define FBINFO_HWACCEL_FILLRECT                0x0200 /* required */
+#define FBINFO_HWACCEL_IMAGEBLIT       0x0400 /* required */
+#define FBINFO_HWACCEL_ROTATE          0x0800 /* optional */
+#define FBINFO_HWACCEL_XPAN            0x1000 /* optional */
+#define FBINFO_HWACCEL_YPAN            0x2000 /* optional */
+#define FBINFO_HWACCEL_YWRAP           0x4000 /* optional */
+
+#define FBINFO_MISC_USEREVENT          0x10000 /* event request
+                                                 from userspace */
+#define FBINFO_MISC_TILEBLITTING       0x20000 /* use tile blitting */
+
+/* A driver may set this flag to indicate that it does want a set_par to be
+ * called every time when fbcon_switch is executed. The advantage is that with
+ * this flag set you can really be sure that set_par is always called before
+ * any of the functions dependant on the correct hardware state or altering
+ * that state, even if you are using some broken X releases. The disadvantage
+ * is that it introduces unwanted delays to every console switch if set_par
+ * is slow. It is a good idea to try this flag in the drivers initialization
+ * code whenever there is a bug report related to switching between X and the
+ * framebuffer console.
+ */
+#define FBINFO_MISC_ALWAYS_SETPAR   0x40000
+
 struct fb_info {
        int node;
        int flags;
-#define FBINFO_FLAG_MODULE     1       /* Low-level driver is a module */
        struct fb_var_screeninfo var;   /* Current var */
        struct fb_fix_screeninfo fix;   /* Current fix */
        struct fb_monspecs monspecs;    /* Current Monitor specs */
-       struct fb_cursor cursor;        /* Current cursor */    
        struct work_struct queue;       /* Framebuffer event queue */
        struct fb_pixmap pixmap;        /* Image hardware mapper */
        struct fb_pixmap sprite;        /* Cursor hardware mapper */
        struct fb_cmap cmap;            /* Current cmap */
+       struct list_head modelist;      /* mode list */
+       struct fb_videomode *mode;      /* current mode */
+
+#ifdef CONFIG_FB_BACKLIGHT
+       /* Lock ordering:
+        * bl_mutex (protects bl_dev and bl_curve)
+        *   bl_dev->sem (backlight class)
+        */
+       struct mutex bl_mutex;
+
+       /* assigned backlight device */
+       struct backlight_device *bl_dev;
+
+       /* Backlight level curve */
+       u8 bl_curve[FB_BACKLIGHT_LEVELS];
+#endif
+
        struct fb_ops *fbops;
-       char *screen_base;              /* Virtual address */
-       struct vc_data *display_fg;     /* Console visible on this display */
-       int currcon;                    /* Current VC. */
+       struct device *device;
+       struct class_device *class_device; /* sysfs per device attrs */
+#ifdef CONFIG_FB_TILEBLITTING
+       struct fb_tile_ops *tileops;    /* Tile Blitting */
+#endif
+       char __iomem *screen_base;      /* Virtual address */
+       unsigned long screen_size;      /* Amount of ioremapped VRAM or 0 */ 
        void *pseudo_palette;           /* Fake palette of 16 colors */ 
 #define FBINFO_STATE_RUNNING   0
 #define FBINFO_STATE_SUSPENDED 1
        u32 state;                      /* Hardware state i.e suspend */
-
+       void *fbcon_par;                /* fbcon use-only private area */
        /* From here on everything is device dependent */
        void *par;      
 };
 
 #ifdef MODULE
-#define FBINFO_FLAG_DEFAULT    FBINFO_FLAG_MODULE
+#define FBINFO_DEFAULT FBINFO_MODULE
 #else
-#define FBINFO_FLAG_DEFAULT    0
+#define FBINFO_DEFAULT 0
 #endif
 
+// This will go away
+#define FBINFO_FLAG_MODULE     FBINFO_MODULE
+#define FBINFO_FLAG_DEFAULT    FBINFO_DEFAULT
+
+/* This will go away
+ * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags
+ * when it wants to turn the acceleration engine on.  This is
+ * really a separate operation, and should be modified via sysfs.
+ *  But for now, we leave it broken with the following define
+ */
+#define STUPID_ACCELF_TEXT_SHIT
+
 // This will go away
 #if defined(__sparc__)
 
@@ -551,7 +825,7 @@ struct fb_info {
 #define fb_writeq sbus_writeq
 #define fb_memset sbus_memset_io
 
-#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__)
+#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__)
 
 #define fb_readb __raw_readb
 #define fb_readw __raw_readw
@@ -575,6 +849,16 @@ struct fb_info {
 #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
 #define fb_memset memset
 
+#endif
+
+#if defined (__BIG_ENDIAN)
+#define FB_LEFT_POS(bpp)          (32 - bpp)
+#define FB_SHIFT_HIGH(val, bits)  ((val) >> (bits))
+#define FB_SHIFT_LOW(val, bits)   ((val) << (bits))
+#else
+#define FB_LEFT_POS(bpp)          (0)
+#define FB_SHIFT_HIGH(val, bits)  ((val) << (bits))
+#define FB_SHIFT_LOW(val, bits)   ((val) >> (bits))
 #endif
 
     /*
@@ -584,7 +868,6 @@ struct fb_info {
 extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); 
 extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); 
 extern int fb_blank(struct fb_info *info, int blank);
-extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
 extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); 
 extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); 
 extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
@@ -592,24 +875,42 @@ extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
 extern int unregister_framebuffer(struct fb_info *fb_info);
-extern int fb_prepare_logo(struct fb_info *fb_info);
-extern int fb_show_logo(struct fb_info *fb_info);
+extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
+extern int fb_show_logo(struct fb_info *fb_info, int rotate);
 extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
-extern void fb_move_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
-                               u8 *dst, u32 d_pitch, u8 *src, u32 idx,
+extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
                                u32 height, u32 shift_high, u32 shift_low, u32 mod);
-extern void fb_move_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
-                               u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
-                               u32 height);
-extern void fb_load_cursor_image(struct fb_info *);
+extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
 extern void fb_set_suspend(struct fb_info *info, int state);
+extern int fb_get_color_depth(struct fb_var_screeninfo *var,
+                             struct fb_fix_screeninfo *fix);
+extern int fb_get_options(char *name, char **option);
+extern int fb_new_modelist(struct fb_info *info);
 
 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
 
+static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
+                                          u8 *src, u32 s_pitch, u32 height)
+{
+       int i, j;
+
+       d_pitch -= s_pitch;
+
+       for (i = height; i--; ) {
+               /* s_pitch is a few bytes at the most, memcpy is suboptimal */
+               for (j = 0; j < s_pitch; j++)
+                       *dst++ = *src++;
+               dst += d_pitch;
+       }
+}
+
 /* drivers/video/fbsysfs.c */
 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
 extern void framebuffer_release(struct fb_info *info);
+extern int fb_init_class_device(struct fb_info *fb_info);
+extern void fb_cleanup_class_device(struct fb_info *head);
+extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
 
 /* drivers/video/fbmon.c */
 #define FB_MAXTIMINGS          0
@@ -624,6 +925,7 @@ extern void framebuffer_release(struct fb_info *info);
 #define FB_MODE_IS_VESA                4
 #define FB_MODE_IS_CALCULATED  8
 #define FB_MODE_IS_FIRST       16
+#define FB_MODE_IS_FROM_VAR     32
 
 extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
                               const struct fb_info *fb_info);
@@ -633,21 +935,42 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
                            struct fb_info *info);
 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
-extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
-extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs);
-extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
-extern struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize);
+extern const unsigned char *fb_firmware_edid(struct device *device);
+extern void fb_edid_to_monspecs(unsigned char *edid,
+                               struct fb_monspecs *specs);
 extern void fb_destroy_modedb(struct fb_videomode *modedb);
+extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
 
 /* drivers/video/modedb.c */
 #define VESA_MODEDB_SIZE 34
-extern const struct fb_videomode vesa_modes[];
+extern void fb_var_to_videomode(struct fb_videomode *mode,
+                               struct fb_var_screeninfo *var);
+extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
+                               struct fb_videomode *mode);
+extern int fb_mode_is_equal(struct fb_videomode *mode1,
+                           struct fb_videomode *mode2);
+extern int fb_add_videomode(struct fb_videomode *mode, struct list_head *head);
+extern void fb_delete_videomode(struct fb_videomode *mode,
+                               struct list_head *head);
+extern struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var,
+                                         struct list_head *head);
+extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
+                                             struct list_head *head);
+extern struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode,
+                                                struct list_head *head);
+extern void fb_destroy_modelist(struct list_head *head);
+extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
+                                    struct list_head *head);
+extern struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs,
+                                                struct list_head *head);
 
 /* drivers/video/fbcmap.c */
 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
 extern void fb_dealloc_cmap(struct fb_cmap *cmap);
-extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto);
-extern int fb_set_cmap(struct fb_cmap *cmap, int kspc, struct fb_info *fb_info);
+extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to);
+extern int fb_cmap_to_user(struct fb_cmap *from, struct fb_cmap_user *to);
+extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info);
+extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info);
 extern struct fb_cmap *fb_default_cmap(int len);
 extern void fb_invert_cmaps(void);
 
@@ -668,6 +991,13 @@ struct fb_videomode {
        u32 flag;
 };
 
+extern const struct fb_videomode vesa_modes[];
+
+struct fb_modelist {
+       struct list_head list;
+       struct fb_videomode mode;
+};
+
 extern int fb_find_mode(struct fb_var_screeninfo *var,
                        struct fb_info *info, const char *mode_option,
                        const struct fb_videomode *db,