- include/linux/fb.h
-
- struct fb_info {
- int node;
-
-
- int flags;
- struct fb_var_screeninfo var;
- struct fb_fix_screeninfo fix;
- struct fb_monspecs monspecs;
- struct work_struct queue;
- struct fb_pixmap pixmap;
- struct fb_pixmap sprite;
- struct fb_cmap cmap;
- struct list_head modelist;
- struct fb_videomode *mode;
-
- #ifdef CONFIG_FB_BACKLIGHT /* assigned backlight device */
-
-
-
-
- struct backlight_device *bl_dev;
- struct mutex bl_curve_mutex;
- u8 bl_curve[FB_BACKLIGHT_LEVELS];
- #endif
-
- #ifdef CONFIG_FB_DEFERRED_IO /* 延迟IO */
- struct delayed_work deferred_work;
- struct fb_deferred_io *fbdefio;
- #endif
-
- struct fb_ops *fbops;
- struct device *device;
- struct device *dev;
- int class_flag;
-
- #ifdef CONFIG_FB_TILEBLITTING
- struct fb_tile_ops *tileops;
- #endif
-
- char __iomem *screen_base;
- unsigned long screen_size;
- void *pseudo_palette;
-
- #define FBINFO_STATE_RUNNING 0
- #define FBINFO_STATE_SUSPENDED 1
- u32 state;
- void *fbcon_par;
-
- void *par;
-
- };
-
-
- struct fb_var_screeninfo {
- __u32 xres;
- __u32 yres;
- __u32 xres_virtual;
- __u32 yres_virtual;
- __u32 xoffset;
- __u32 yoffset;
-
- __u32 bits_per_pixel;
- __u32 grayscale;
-
- struct fb_bitfield red;
-
-
- struct fb_bitfield green;
- struct fb_bitfield blue;
- struct fb_bitfield transp;
-
- __u32 nonstd;
-
- __u32 activate;
-
- __u32 height;
- __u32 width;
-
- __u32 accel_flags;
-
-
-
- __u32 pixclock;
- __u32 left_margin;
- __u32 right_margin;
- __u32 upper_margin;
- __u32 lower_margin;
- __u32 hsync_len;
- __u32 vsync_len;
- __u32 sync;
- __u32 vmode;
- __u32 rotate;
- __u32 reserved[5];
-
- };
-
-
-
-
-
-
-
-
- struct fb_bitfield {
- __u32 offset;
- __u32 length;
- __u32 msb_right;
- };
-
-
- struct fb_fix_screeninfo {
- char id[16];
- unsigned long smem_start;
-
- __u32 smem_len;
- __u32 type;
- __u32 type_aux;
- __u32 visual;
- __u16 xpanstep;
- __u16 ypanstep;
- __u16 ywrapstep;
- __u32 line_length;
- unsigned long mmio_start;
-
- __u32 mmio_len;
- __u32 accel;
-
- __u16 reserved[3];
-
- };
-
-
- struct fb_monspecs {
- struct fb_chroma chroma;
- struct fb_videomode *modedb;
- __u8 manufacturer[4];
- __u8 monitor[14];
- __u8 serial_no[14];
- __u8 ascii[14];
- __u32 modedb_len;
- __u32 model;
- __u32 serial;
- __u32 year;
- __u32 week;
- __u32 hfmin;
- __u32 hfmax;
- __u32 dclkmin;
- __u32 dclkmax;
- __u16 input;
- __u16 dpms;
- __u16 signal;
- __u16 vfmin;
- __u16 vfmax;
- __u16 gamma;
- __u16 gtf : 1;
- __u16 misc;
- __u8 version;
- __u8 revision;
- __u8 max_x;
- __u8 max_y;
-
- };
-
-
- struct fb_pixmap {
- u8 *addr;
- u32 size;
- u32 offset;
- u32 buf_align;
- u32 scan_align;
- u32 access_align;
- u32 flags;
- u32 blit_x;
- u32 blit_y;
-
-
-
- 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);
-
- };
-
-
- struct fb_cmap {
- __u32 start;
- __u32 len;
- __u16 *red;
- __u16 *green;
- __u16 *blue;
- __u16 *transp;
- };
-
-
- struct fb_videomode {
- const char *name;
- u32 refresh;
- u32 xres;
- u32 yres;
- u32 pixclock;
- u32 left_margin;
- u32 right_margin;
- u32 upper_margin;
- u32 lower_margin;
- u32 hsync_len;
- u32 vsync_len;
- u32 sync;
- u32 vmode;
- u32 flag;
- };
-
-
- struct backlight_device {
-
- struct backlight_properties props;
-
-
- struct mutex update_lock;
-
-
-
-
- struct mutex ops_lock;
- struct backlight_ops *ops;
-
-
- struct notifier_block fb_notif;
- struct device dev;
- };
-
-
- struct mutex {
-
- atomic_t count;
- spinlock_t wait_lock;
- struct list_head wait_list;
-
- #ifdef CONFIG_DEBUG_MUTEXES
- struct thread_info *owner;
- const char *name;
- void *magic;
- #endif
-
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map dep_map;
- #endif
- };
-
-
-
-
-
-
-
-
-
- struct fb_ops {
-
- struct module *owner;
- int (*fb_open)(struct fb_info *info, int user);
- int (*fb_release)(struct fb_info *info, int user);
-
-
-
-
- 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);
-
-
-
- int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
-
-
- int (*fb_set_par)(struct fb_info *info);
-
-
- int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
- unsigned blue, unsigned transp, struct fb_info *info);
-
-
- int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);
-
-
- int (*fb_blank)(int blank, struct fb_info *info);
-
-
- int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
-
-
- void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
-
- void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
-
- void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
-
-
- int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
-
-
- void (*fb_rotate)(struct fb_info *info, int angle);
-
-
- int (*fb_sync)(struct fb_info *info);
-
-
- int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
- unsigned long arg);
-
-
- int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
- unsigned long arg);
-
-
- int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
-
-
- void (*fb_save_state)(struct fb_info *info);
-
-
- void (*fb_restore_state)(struct fb_info *info);
-
-
- void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
- struct fb_var_screeninfo *var);
-
- };
/***********************************************
***********************************************
***********************************************/
*transp = 0; //表示不支持透明度
fix->accel = FB_ACCEL_NONE; //表示显卡无硬件加速
var->xres = 400; ////表示x 方向分辨率
var->yres = 234; //表示y 方向分辨率
//虚拟分辨率,不支持 pan,故和实际分辨率一致
var->xres_virtual = 400;
var->yres_virtual = 234;
//色深 16 位,5:6:5 结构
var->bits_per_pixel = 16;
//彩色,非灰度,bpp<8,grayscale=1
var->grayscale = 0;
//每行字节数,每行 400 象素,16 位色深,故 400*2
display.line_length = 400 * 2;
调用函数“fb_videomode_to_var(&var, &video_modes[0])”将屏幕显示参数转换为var结构变量的相关成员,