video/fb: cleanup FB_MAJOR usage
[safe/jmp/linux-2.6] / include / linux / fb.h
index be913ec..3b8870e 100644 (file)
@@ -4,9 +4,10 @@
 #include <asm/types.h>
 #include <linux/i2c.h>
 
+struct dentry;
+
 /* Definitions of frame buffers                                                */
 
-#define FB_MAJOR               29
 #define FB_MAX                 32      /* sufficient for now */
 
 /* ioctls
 #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_OMAP1610      49      /* TI OMAP16xx                  */
+#define FB_ACCEL_TRIDENT_TGUI  50      /* Trident TGUI                 */
+#define FB_ACCEL_TRIDENT_3DIMAGE 51    /* Trident 3DImage              */
+#define FB_ACCEL_TRIDENT_BLADE3D 52    /* Trident Blade3D              */
+#define FB_ACCEL_TRIDENT_BLADEXP 53    /* Trident BladeXP              */
 #define FB_ACCEL_NEOMAGIC_NM2070 90    /* NeoMagic NM2070              */
 #define FB_ACCEL_NEOMAGIC_NM2090 91    /* NeoMagic NM2090              */
 #define FB_ACCEL_NEOMAGIC_NM2093 92    /* NeoMagic NM2093              */
@@ -177,6 +183,7 @@ struct fb_bitfield {
 };
 
 #define FB_NONSTD_HAM          1       /* Hold-And-Modify (HAM)        */
+#define FB_NONSTD_REV_PIX_IN_B 2       /* order of pixels in each byte is reversed */
 
 #define FB_ACTIVATE_NOW                0       /* set values immediately (or vbl)*/
 #define FB_ACTIVATE_NXTOPEN    1       /* activate on next open        */
@@ -203,6 +210,7 @@ struct fb_bitfield {
 #define FB_VMODE_NONINTERLACED  0      /* non interlaced */
 #define FB_VMODE_INTERLACED    1       /* interlaced   */
 #define FB_VMODE_DOUBLE                2       /* double scan */
+#define FB_VMODE_ODD_FLD_FIRST 4       /* interlaced: top line first */
 #define FB_VMODE_MASK          255
 
 #define FB_VMODE_YWRAP         256     /* ywrap instead of panning     */
@@ -525,12 +533,22 @@ struct fb_cursor_user {
 #define FB_EVENT_MODE_CHANGE_ALL       0x0B
 /*     A software display blank change occured */
 #define FB_EVENT_CONBLANK               0x0C
+/*      Get drawing requirements        */
+#define FB_EVENT_GET_REQ                0x0D
+/*      Unbind from the console if possible */
+#define FB_EVENT_FB_UNBIND              0x0E
 
 struct fb_event {
        struct fb_info *info;
        void *data;
 };
 
+struct fb_blit_caps {
+       u32 x;
+       u32 y;
+       u32 len;
+       u32 flags;
+};
 
 extern int fb_register_client(struct notifier_block *nb);
 extern int fb_unregister_client(struct notifier_block *nb);
@@ -556,11 +574,25 @@ struct fb_pixmap {
        u32 scan_align;         /* alignment per scanline               */
        u32 access_align;       /* alignment per read/write (bits)      */
        u32 flags;              /* see FB_PIXMAP_*                      */
+       u32 blit_x;             /* supported bit block dimensions (1-32)*/
+       u32 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
+                               /*         blit_y = 1 << (height - 1)   */
+                               /* if 0, will be set to 0xffffffff (all)*/
        /* access methods */
        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);
 };
 
+#ifdef CONFIG_FB_DEFERRED_IO
+struct fb_deferred_io {
+       /* delay between mkwrite and deferred handler */
+       unsigned long delay;
+       struct mutex lock; /* mutex that protects the page list */
+       struct list_head pagelist; /* list of touched pages */
+       /* callback */
+       void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
+};
+#endif
 
 /*
  * Frame buffer operations
@@ -579,8 +611,10 @@ 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 __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);
+       ssize_t (*fb_read)(struct fb_info *info, char __user *buf,
+                          size_t count, loff_t *ppos);
+       ssize_t (*fb_write)(struct fb_info *info, const char __user *buf,
+                           size_t count, loff_t *ppos);
 
        /* checks var and eventually tweaks it to something supported,
         * DO NOT MODIFY PAR */
@@ -634,10 +668,13 @@ struct fb_ops {
 
        /* restore saved state */
        void (*fb_restore_state)(struct fb_info *info);
+
+       /* get capability given var */
+       void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
+                           struct fb_var_screeninfo *var);
 };
 
 #ifdef CONFIG_FB_TILEBLITTING
-
 #define FB_TILE_CURSOR_NONE        0
 #define FB_TILE_CURSOR_UNDERLINE   1
 #define FB_TILE_CURSOR_LOWER_THIRD 2
@@ -709,6 +746,8 @@ struct fb_tile_ops {
        /* cursor */
        void (*fb_tilecursor)(struct fb_info *info,
                              struct fb_tilecursor *cursor);
+       /* get maximum length of the tile map */
+       int (*fb_get_tilemax)(struct fb_info *info);
 };
 #endif /* CONFIG_FB_TILEBLITTING */
 
@@ -755,6 +794,17 @@ struct fb_tile_ops {
  */
 #define FBINFO_MISC_ALWAYS_SETPAR   0x40000
 
+/*
+ * Host and GPU endianness differ.
+ */
+#define FBINFO_FOREIGN_ENDIAN  0x100000
+/*
+ * Big endian math. This is the same flags as above, but with different
+ * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
+ * and host endianness. Drivers should not use this flag.
+ */
+#define FBINFO_BE_MATH  0x100000
+
 struct fb_info {
        int node;
        int flags;
@@ -778,6 +828,10 @@ struct fb_info {
        struct mutex bl_curve_mutex;    
        u8 bl_curve[FB_BACKLIGHT_LEVELS];
 #endif
+#ifdef CONFIG_FB_DEFERRED_IO
+       struct delayed_work deferred_work;
+       struct fb_deferred_io *fbdefio;
+#endif
 
        struct fb_ops *fbops;
        struct device *device;          /* This is the parent */
@@ -833,7 +887,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(__SH5__)) || defined(__powerpc__)
+#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__) || defined(__avr32__)
 
 #define fb_readb __raw_readb
 #define fb_readw __raw_readw
@@ -859,15 +913,11 @@ struct fb_info {
 
 #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
+#define FB_LEFT_POS(p, bpp)          (fb_be_math(p) ? (32 - (bpp)) : 0)
+#define FB_SHIFT_HIGH(p, val, bits)  (fb_be_math(p) ? (val) >> (bits) : \
+                                                     (val) << (bits))
+#define FB_SHIFT_LOW(p, val, bits)   (fb_be_math(p) ? (val) << (bits) : \
+                                                     (val) >> (bits))
 
     /*
      *  `Generic' versions of the frame buffer device operations
@@ -879,6 +929,16 @@ extern int fb_blank(struct fb_info *info, int blank);
 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);
+/*
+ * Drawing operations where framebuffer is in system RAM
+ */
+extern void sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
+extern void sys_copyarea(struct fb_info *info, const struct fb_copyarea *area);
+extern void sys_imageblit(struct fb_info *info, const struct fb_image *image);
+extern ssize_t fb_sys_read(struct fb_info *info, char __user *buf,
+                          size_t count, loff_t *ppos);
+extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
+                           size_t count, loff_t *ppos);
 
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
@@ -897,6 +957,7 @@ extern int fb_new_modelist(struct fb_info *info);
 
 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
+extern struct class *fb_class;
 
 static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
                                           u8 *src, u32 s_pitch, u32 height)
@@ -913,6 +974,31 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
        }
 }
 
+/* drivers/video/fb_defio.c */
+extern void fb_deferred_io_init(struct fb_info *info);
+extern void fb_deferred_io_cleanup(struct fb_info *info);
+extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
+                               int datasync);
+
+static inline bool fb_be_math(struct fb_info *info)
+{
+#ifdef CONFIG_FB_FOREIGN_ENDIAN
+#if defined(CONFIG_FB_BOTH_ENDIAN)
+       return info->flags & FBINFO_BE_MATH;
+#elif defined(CONFIG_FB_BIG_ENDIAN)
+       return true;
+#elif defined(CONFIG_FB_LITTLE_ENDIAN)
+       return false;
+#endif /* CONFIG_FB_BOTH_ENDIAN */
+#else
+#ifdef __BIG_ENDIAN
+       return true;
+#else
+       return false;
+#endif /* __BIG_ENDIAN */
+#endif /* CONFIG_FB_FOREIGN_ENDIAN */
+}
+
 /* drivers/video/fbsysfs.c */
 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
 extern void framebuffer_release(struct fb_info *info);
@@ -999,6 +1085,7 @@ struct fb_videomode {
        u32 flag;
 };
 
+extern const char *fb_mode_option;
 extern const struct fb_videomode vesa_modes[];
 
 struct fb_modelist {