- Updated to 3.4-rc1.
[linux-flexiantxendom0-3.2.10.git] / include / linux / fb.h
index c5958b3..707b36b 100644 (file)
@@ -3,8 +3,9 @@
 
 #include <linux/types.h>
 #include <linux/i2c.h>
-
-struct dentry;
+#ifdef __KERNEL__
+#include <linux/kgdb.h>
+#endif /* __KERNEL__ */
 
 /* Definitions of frame buffers                                                */
 
@@ -37,13 +38,14 @@ struct dentry;
 #define FBIOGET_HWCINFO         0x4616
 #define FBIOPUT_MODEINFO        0x4617
 #define FBIOGET_DISPINFO        0x4618
-
+#define FBIO_WAITFORVSYNC      _IOW('F', 0x20, __u32)
 
 #define FB_TYPE_PACKED_PIXELS          0       /* Packed Pixels        */
 #define FB_TYPE_PLANES                 1       /* Non interleaved planes */
 #define FB_TYPE_INTERLEAVED_PLANES     2       /* Interleaved planes   */
 #define FB_TYPE_TEXT                   3       /* Text/attributes      */
 #define FB_TYPE_VGA_PLANES             4       /* EGA/VGA planes       */
+#define FB_TYPE_FOURCC                 5       /* Type identified by a V4L2 FOURCC */
 
 #define FB_AUX_TEXT_MDA                0       /* Monochrome text */
 #define FB_AUX_TEXT_CGA                1       /* CGA/EGA/VGA Color text */
@@ -68,6 +70,7 @@ struct dentry;
 #define FB_VISUAL_PSEUDOCOLOR          3       /* Pseudo color (like atari) */
 #define FB_VISUAL_DIRECTCOLOR          4       /* Direct color */
 #define FB_VISUAL_STATIC_PSEUDOCOLOR   5       /* Pseudo color readonly */
+#define FB_VISUAL_FOURCC               6       /* Visual identified by a V4L2 FOURCC */
 
 #define FB_ACCEL_NONE          0       /* no hardware accelerator      */
 #define FB_ACCEL_ATARIBLITT    1       /* Atari Blitter                */
@@ -151,6 +154,10 @@ struct dentry;
 #define FB_ACCEL_PROSAVAGE_DDR  0x8d   /* S3 ProSavage DDR             */
 #define FB_ACCEL_PROSAVAGE_DDRK 0x8e   /* S3 ProSavage DDR-K           */
 
+#define FB_ACCEL_PUV3_UNIGFX   0xa0    /* PKUnity-v3 Unigfx            */
+
+#define FB_CAP_FOURCC          1       /* Device supports FOURCC-based formats */
+
 struct fb_fix_screeninfo {
        char id[16];                    /* identification string eg "TT Builtin" */
        unsigned long smem_start;       /* Start of frame buffer mem */
@@ -168,7 +175,8 @@ struct fb_fix_screeninfo {
        __u32 mmio_len;                 /* Length of Memory Mapped I/O  */
        __u32 accel;                    /* Indicate to driver which     */
                                        /*  specific chip/card we have  */
-       __u16 reserved[3];              /* Reserved for future compatibility */
+       __u16 capabilities;             /* see FB_CAP_*                 */
+       __u16 reserved[2];              /* Reserved for future compatibility */
 };
 
 /* Interpretation of offset for color fields: All offsets are from the right,
@@ -243,8 +251,8 @@ struct fb_var_screeninfo {
        __u32 yoffset;                  /* resolution                   */
 
        __u32 bits_per_pixel;           /* guess what                   */
-       __u32 grayscale;                /* != 0 Graylevels instead of colors */
-
+       __u32 grayscale;                /* 0 = color, 1 = grayscale,    */
+                                       /* >1 = FOURCC                  */
        struct fb_bitfield red;         /* bitfield in fb mem if true color, */
        struct fb_bitfield green;       /* else only length is significant */
        struct fb_bitfield blue;
@@ -270,7 +278,8 @@ struct fb_var_screeninfo {
        __u32 sync;                     /* see FB_SYNC_*                */
        __u32 vmode;                    /* see FB_VMODE_*               */
        __u32 rotate;                   /* angle we rotate counter clockwise */
-       __u32 reserved[5];              /* Reserved for future compatibility */
+       __u32 colorspace;               /* colorspace for FOURCC-based modes */
+       __u32 reserved[4];              /* Reserved for future compatibility */
 };
 
 struct fb_cmap {
@@ -398,11 +407,11 @@ struct fb_cursor {
 
 #include <linux/fs.h>
 #include <linux/init.h>
-#include <linux/device.h>
 #include <linux/workqueue.h>
 #include <linux/notifier.h>
 #include <linux/list.h>
 #include <linux/backlight.h>
+#include <linux/slab.h>
 #include <asm/io.h>
 
 struct vm_area_struct;
@@ -530,19 +539,21 @@ struct fb_cursor_user {
 #define FB_EVENT_GET_CONSOLE_MAP        0x07
 /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
 #define FB_EVENT_SET_CONSOLE_MAP        0x08
-/*      A hardware display blank change occured */
+/*      A hardware display blank change occurred */
 #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
-/*     A software display blank change occured */
+/*     A software display blank change occurred */
 #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
+/*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */
+#define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
 
 struct fb_event {
        struct fb_info *info;
@@ -606,6 +617,12 @@ struct fb_deferred_io {
  * LOCKING NOTE: those functions must _ALL_ be called with the console
  * 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.
+ *
+ * The exception to this is the debug related hooks.  Putting the fb
+ * into a debug state (e.g. flipping to the kernel console) and restoring
+ * it must be done in a lock-free manner, so low level drivers should
+ * keep track of the initial console (if applicable) and may need to
+ * perform direct, unlocked hardware writes in these hooks.
  */
 
 struct fb_ops {
@@ -675,6 +692,10 @@ struct fb_ops {
 
        /* teardown any resources to do with this framebuffer */
        void (*fb_destroy)(struct fb_info *info);
+
+       /* called at KDB enter and leave time to prepare the console */
+       int (*fb_debug_enter)(struct fb_info *info);
+       int (*fb_debug_leave)(struct fb_info *info);
 };
 
 #ifdef CONFIG_FB_TILEBLITTING
@@ -763,6 +784,7 @@ struct fb_tile_ops {
         *  takes over; acceleration engine should be in a quiescent state */
 
 /* hints */
+#define FBINFO_VIRTFB          0x0004 /* FB is System RAM, not device. */
 #define FBINFO_PARTIAL_PAN_OK  0x0040 /* otw use pan only for double-buffering */
 #define FBINFO_READS_FAST      0x0080 /* soft-copy faster than rendering */
 
@@ -784,13 +806,11 @@ struct fb_tile_ops {
 #define FBINFO_MISC_USEREVENT          0x10000 /* event request
                                                  from userspace */
 #define FBINFO_MISC_TILEBLITTING       0x20000 /* use tile blitting */
-#define FBINFO_MISC_FIRMWARE           0x40000 /* a replaceable firmware
-                                                 inited framebuffer */
 
 /* 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
+ * any of the functions dependent 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
@@ -799,6 +819,8 @@ struct fb_tile_ops {
  */
 #define FBINFO_MISC_ALWAYS_SETPAR   0x40000
 
+/* where the fb is a firmware driver, and can be replaced with a proper one */
+#define FBINFO_MISC_FIRMWARE        0x80000
 /*
  * Host and GPU endianness differ.
  */
@@ -810,7 +832,12 @@ struct fb_tile_ops {
  */
 #define FBINFO_BE_MATH  0x100000
 
+/* report to the VT layer that this fb driver can accept forced console
+   output like oopses */
+#define FBINFO_CAN_FORCE_OUTPUT     0x200000
+
 struct fb_info {
+       atomic_t count;
        int node;
        int flags;
        struct mutex lock;              /* Lock for open/release/ioctl funcs */
@@ -858,18 +885,29 @@ struct fb_info {
        void *par;
 #ifdef CONFIG_BOOTSPLASH
        struct splash_data *splash_data;
-       unsigned char *splash_pic;
-       int splash_pic_size;
-       int splash_pic_stride;
        char fb_cursordata[64];
 #endif
-       /* we need the PCI or similiar aperture base/size not
+       /* we need the PCI or similar aperture base/size not
           smem_start/size as smem_start may just be an object
           allocated inside the aperture so may not actually overlap */
-       resource_size_t aperture_base;
-       resource_size_t aperture_size;
+       struct apertures_struct {
+               unsigned int count;
+               struct aperture {
+                       resource_size_t base;
+                       resource_size_t size;
+               } ranges[0];
+       } *apertures;
 };
 
+static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
+       struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
+                       + max_num * sizeof(struct aperture), GFP_KERNEL);
+       if (!a)
+               return NULL;
+       a->count = max_num;
+       return a;
+}
+
 #ifdef MODULE
 #define FBINFO_DEFAULT FBINFO_MODULE
 #else
@@ -905,6 +943,8 @@ struct fb_info {
 #define fb_writel sbus_writel
 #define fb_writeq sbus_writeq
 #define fb_memset sbus_memset_io
+#define fb_memcpy_fromfb sbus_memcpy_fromio
+#define fb_memcpy_tofb sbus_memcpy_toio
 
 #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
 
@@ -917,6 +957,8 @@ struct fb_info {
 #define fb_writel __raw_writel
 #define fb_writeq __raw_writeq
 #define fb_memset memset_io
+#define fb_memcpy_fromfb memcpy_fromio
+#define fb_memcpy_tofb memcpy_toio
 
 #else
 
@@ -929,6 +971,8 @@ struct fb_info {
 #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
 #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
 #define fb_memset memset
+#define fb_memcpy_fromfb memcpy
+#define fb_memcpy_tofb memcpy
 
 #endif
 
@@ -962,6 +1006,9 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
 extern int unregister_framebuffer(struct fb_info *fb_info);
+extern int unlink_framebuffer(struct fb_info *fb_info);
+extern void remove_conflicting_framebuffers(struct apertures_struct *a,
+                               const char *name, bool primary);
 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);
@@ -1006,8 +1053,8 @@ extern void fb_deferred_io_open(struct fb_info *info,
                                struct inode *inode,
                                struct file *file);
 extern void fb_deferred_io_cleanup(struct fb_info *info);
-extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
-                               int datasync);
+extern int fb_deferred_io_fsync(struct file *file, loff_t start,
+                               loff_t end, int datasync);
 
 static inline bool fb_be_math(struct fb_info *info)
 {
@@ -1059,6 +1106,8 @@ extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
 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_edid_add_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);
 extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
@@ -1089,6 +1138,7 @@ extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs
 
 /* drivers/video/fbcmap.c */
 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
+extern int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags);
 extern void fb_dealloc_cmap(struct fb_cmap *cmap);
 extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to);
 extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to);
@@ -1116,6 +1166,7 @@ struct fb_videomode {
 
 extern const char *fb_mode_option;
 extern const struct fb_videomode vesa_modes[];
+extern const struct fb_videomode cea_modes[64];
 
 struct fb_modelist {
        struct list_head list;