LCD驱动

视频卡的各个属性保存在struct fb_var_screeninfo

  1. struct fb_var_screeninfo {
  2. __u32 xres; /* visible resolution 可视分辨率*/
  3. __u32 yres;
  4. __u32 xres_virtual; /* virtual resolution 虚拟分辨率*/
  5. __u32 yres_virtual;
  6. __u32 xoffset; /* offset from virtual to visible */
  7. __u32 yoffset; /* resolution 从虚拟到可见分辨率偏移*/
  8. __u32 bits_per_pixel; /* guess what */
  9. __u32 grayscale; /* != 0 Graylevels instead of colors */
  10. struct fb_bitfield red; /* bitfield in fb mem if true color, */
  11. struct fb_bitfield green; /* else only length is significant */
  12. struct fb_bitfield blue;
  13. struct fb_bitfield transp; /* transparency */
  14. __u32 nonstd; /* != 0 Non standard pixel format */
  15. __u32 activate; /* see FB_ACTIVATE_* */
  16. __u32 height; /* height of picture in mm 图片以毫米为单位高度 */
  17. __u32 width; /* width of picture in mm 图片以毫米为单位宽度 */
  18. __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */
  19. /* Timing: All values in pixclocks, except pixclock (of course) */
  20. __u32 pixclock; /* pixel clock in ps (pico seconds) */
  21. __u32 left_margin; /* time from sync to picture 左同步到图片的时间*/
  22. __u32 right_margin; /* time from picture to sync 图片到右同步的时间*/
  23. __u32 upper_margin; /* time from sync to picture 上同步到图片的时间*/
  24. __u32 lower_margin;
  25. __u32 hsync_len; /* length of horizontal sync 水平同步信号的长度*/
  26. __u32 vsync_len; /* length of vertical sync 垂直同步信号的长度*/
  27. __u32 sync; /* see FB_SYNC_* */
  28. __u32 vmode; /* see FB_VMODE_* */
  29. __u32 rotate; /* angle we rotate counter clockwise 角度逆时针旋转*/
  30. __u32 reserved[5]; /* Reserved for future compatibility */
  31. };
struct fb_var_screeninfo {
	__u32 xres;			/* visible resolution 可视分辨率*/
	__u32 yres;
	__u32 xres_virtual;		/* virtual resolution 虚拟分辨率*/
	__u32 yres_virtual;
	__u32 xoffset;			/* offset from virtual to visible */
	__u32 yoffset;			/* resolution 从虚拟到可见分辨率偏移*/

	__u32 bits_per_pixel;		/* guess what			*/
	__u32 grayscale;		/* != 0 Graylevels instead of colors */

	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
	struct fb_bitfield green;	/* else only length is significant */
	struct fb_bitfield blue;
	struct fb_bitfield transp;	/* transparency			*/	

	__u32 nonstd;			/* != 0 Non standard pixel format */

	__u32 activate;			/* see FB_ACTIVATE_*		*/

	__u32 height;			/* height of picture in mm 图片以毫米为单位高度 */
	__u32 width;			/* width of picture in mm    图片以毫米为单位宽度  */

	__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) */
	__u32 left_margin;		/* time from sync to picture 左同步到图片的时间*/
	__u32 right_margin;		/* time from picture to sync  图片到右同步的时间*/
	__u32 upper_margin;		/* time from sync to picture 上同步到图片的时间*/
	__u32 lower_margin;
	__u32 hsync_len;		/* length of horizontal sync 水平同步信号的长度*/
	__u32 vsync_len;		/* length of vertical sync	垂直同步信号的长度*/
	__u32 sync;			/* see FB_SYNC_*		*/
	__u32 vmode;			/* see FB_VMODE_*		*/
	__u32 rotate;			/* angle we rotate counter clockwise  角度逆时针旋转*/
	__u32 reserved[5];		/* Reserved for future compatibility */
};


视频硬件的固定信息

  1. struct fb_fix_screeninfo {
  2. char id[16]; /* identification string eg "TT Builtin" */
  3. unsigned long smem_start; /* Start of frame buffer mem 开始的帧缓冲存储器*/
  4. /* (physical address) */
  5. __u32 smem_len; /* Length of frame buffer mem 帧缓冲存储器的长度*/
  6. __u32 type; /* see FB_TYPE_* */
  7. __u32 type_aux; /* Interleave for interleaved Planes */
  8. __u32 visual; /* see FB_VISUAL_* */
  9. __u16 xpanstep; /* zero if no hardware panning */
  10. __u16 ypanstep; /* zero if no hardware panning */
  11. __u16 ywrapstep; /* zero if no hardware ywrap */
  12. __u32 line_length; /* length of a line in bytes */
  13. unsigned long mmio_start; /* Start of Memory Mapped I/O */
  14. /* (physical address) */
  15. __u32 mmio_len; /* Length of Memory Mapped I/O */
  16. __u32 accel; /* Indicate to driver which */
  17. /* specific chip/card we have */
  18. __u16 reserved[3]; /* Reserved for future compatibility */
  19. };
struct fb_fix_screeninfo {
	char id[16];			/* identification string eg "TT Builtin" */
	unsigned long smem_start;	/* Start of frame buffer mem 开始的帧缓冲存储器*/
					/* (physical address) */
	__u32 smem_len;			/* Length of frame buffer mem  帧缓冲存储器的长度*/
	__u32 type;			/* see FB_TYPE_*		*/
	__u32 type_aux;			/* Interleave for interleaved Planes */
	__u32 visual;			/* see FB_VISUAL_*		*/ 
	__u16 xpanstep;			/* zero if no hardware panning  */
	__u16 ypanstep;			/* zero if no hardware panning  */
	__u16 ywrapstep;		/* zero if no hardware ywrap    */
	__u32 line_length;		/* length of a line in bytes    */
	unsigned long mmio_start;	/* Start of Memory Mapped I/O   */
					/* (physical address) */
	__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 */
};


fb_cmap规定了颜色映射

  1. struct fb_cmap {
  2. __u32 start; /* First entry */
  3. __u32 len; /* Number of entries */
  4. __u16 *red; /* Red values */
  5. __u16 *green;
  6. __u16 *blue;
  7. __u16 *transp; /* transparency, can be NULL 透明度,可以为NULL*/
  8. };
struct fb_cmap {
	__u32 start;			/* First entry	*/
	__u32 len;			/* Number of entries */
	__u16 *red;			/* Red values	*/
	__u16 *green;
	__u16 *blue;
	__u16 *transp;			/* transparency, can be NULL  透明度,可以为NULL*/
};

帧缓冲关键数据结构

  1. struct fb_info {
  2. atomic_t count;
  3. int node;
  4. int flags;
  5. struct mutex lock; /* Lock for open/release/ioctl funcs */
  6. struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */
  7. struct fb_var_screeninfo var; /* Current var */
  8. struct fb_fix_screeninfo fix; /* Current fix */
  9. struct fb_monspecs monspecs; /* Current Monitor specs */
  10. struct work_struct queue; /* Framebuffer event queue */
  11. struct fb_pixmap pixmap; /* Image hardware mapper */
  12. struct fb_pixmap sprite; /* Cursor hardware mapper */
  13. struct fb_cmap cmap; /* Current cmap */
  14. struct list_head modelist; /* mode list */
  15. struct fb_videomode *mode; /* current mode */
  16. #ifdef CONFIG_FB_BACKLIGHT
  17. /* assigned backlight device */
  18. /* set before framebuffer registration,
  19. remove after unregister */
  20. struct backlight_device *bl_dev;
  21. /* Backlight level curve */
  22. struct mutex bl_curve_mutex;
  23. u8 bl_curve[FB_BACKLIGHT_LEVELS];
  24. #endif
  25. #ifdef CONFIG_FB_DEFERRED_IO
  26. struct delayed_work deferred_work;
  27. struct fb_deferred_io *fbdefio;
  28. #endif
  29. struct fb_ops *fbops;
  30. struct device *device; /* This is the parent */
  31. struct device *dev; /* This is this fb device */
  32. int class_flag; /* private sysfs flags */
  33. #ifdef CONFIG_FB_TILEBLITTING
  34. struct fb_tile_ops *tileops; /* Tile Blitting */
  35. #endif
  36. char __iomem *screen_base; /* Virtual address */
  37. unsigned long screen_size; /* Amount of ioremapped VRAM or 0 */
  38. void *pseudo_palette; /* Fake palette of 16 colors */
  39. #define FBINFO_STATE_RUNNING 0
  40. #define FBINFO_STATE_SUSPENDED 1
  41. u32 state; /* Hardware state i.e suspend */
  42. void *fbcon_par; /* fbcon use-only private area */
  43. /* From here on everything is device dependent */
  44. void *par;
  45. /* we need the PCI or similar aperture base/size not
  46. smem_start/size as smem_start may just be an object
  47. allocated inside the aperture so may not actually overlap */
  48. struct apertures_struct {
  49. unsigned int count;
  50. struct aperture {
  51. resource_size_t base;
  52. resource_size_t size;
  53. } ranges[0];
  54. } *apertures;
  55. };
struct fb_info {
	atomic_t count;
	int node;
	int flags;
	struct mutex lock;		/* Lock for open/release/ioctl funcs */
	struct mutex mm_lock;		/* Lock for fb_mmap and smem_* fields */
	struct fb_var_screeninfo var;	/* Current var */
	struct fb_fix_screeninfo fix;	/* Current fix */
	struct fb_monspecs monspecs;	/* Current Monitor specs */
	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
	/* assigned backlight device */
	/* set before framebuffer registration, 
	   remove after unregister */
	struct backlight_device *bl_dev;

	/* Backlight level curve */
	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 */
	struct device *dev;		/* This is this fb device */
	int class_flag;                    /* private sysfs flags */
#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;
	/* 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 */
	struct apertures_struct {
		unsigned int count;
		struct aperture {
			resource_size_t base;
			resource_size_t size;
		} ranges[0];
	} *apertures;
};

帧缓冲操作

  1. struct fb_ops {
  2. /* open/release and usage marking */
  3. struct module *owner;
  4. int (*fb_open)(struct fb_info *info, int user);
  5. int (*fb_release)(struct fb_info *info, int user);
  6. /* For framebuffers with strange non linear layouts or that do not
  7. * work with normal memory mapped access
  8. */
  9. ssize_t (*fb_read)(struct fb_info *info, char __user *buf,
  10. size_t count, loff_t *ppos);
  11. ssize_t (*fb_write)(struct fb_info *info, const char __user *buf,
  12. size_t count, loff_t *ppos);
  13. /*sanity check on video parameters*/ //视频参数的合法性检查
  14. int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
  15. /* configure the video controller registers */ //配置视频控制寄存器
  16. int (*fb_set_par)(struct fb_info *info);
  17. /* create pseudo color palette map */ //创建伪调色板地图
  18. int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
  19. unsigned blue, unsigned transp, struct fb_info *info);
  20. /* set color registers in batch */
  21. int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);
  22. /* blank display */ //空白显示
  23. int (*fb_blank)(int blank, struct fb_info *info);
  24. /* pan display */ //泛显示器
  25. int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
  26. /* Draws a rectangle */ //绘制一个矩形
  27. void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
  28. /* Copy data from area to another */ //将数据从区域复制到另一个
  29. void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
  30. /* Draws a image to the display */ //绘制图像显示
  31. void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
  32. /* Draws cursor */ //绘制光标
  33. int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
  34. /* Rotates the display */ //旋转显示
  35. void (*fb_rotate)(struct fb_info *info, int angle);
  36. /* wait for blit idle, optional */ //等待了位图的闲置,可选
  37. int (*fb_sync)(struct fb_info *info);
  38. /* perform fb specific ioctl (optional) */
  39. int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
  40. unsigned long arg);
  41. /* Handle 32bit compat ioctl (optional) */
  42. int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
  43. unsigned long arg);
  44. /* perform fb specific mmap */ //执行FB特定的mmap
  45. int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
  46. /* get capability given var */
  47. void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
  48. struct fb_var_screeninfo *var);
  49. /* teardown any resources to do with this framebuffer */
  50. void (*fb_destroy)(struct fb_info *info);
  51. /* called at KDB enter and leave time to prepare the console */
  52. int (*fb_debug_enter)(struct fb_info *info);
  53. int (*fb_debug_leave)(struct fb_info *info);
  54. };
struct fb_ops {
	/* open/release and usage marking */
	struct module *owner;
	int (*fb_open)(struct fb_info *info, int user);
	int (*fb_release)(struct fb_info *info, int user);

	/* For framebuffers with strange non linear layouts or that do not
	 * work with normal memory mapped access
	 */
	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);

	/*sanity check on video parameters*/ //视频参数的合法性检查
	int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);

	/* configure the video controller registers */ //配置视频控制寄存器
	int (*fb_set_par)(struct fb_info *info);

	/* create pseudo color palette map */ //创建伪调色板地图
	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);

	/* pan display */ //泛显示器
	int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);

	/* Draws a rectangle */ //绘制一个矩形
	void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
	/* Copy data from area to another */ //将数据从区域复制到另一个
	void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
	/* Draws a image to the display */ //绘制图像显示
	void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);

	/* Draws cursor */  //绘制光标
	int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);

	/* Rotates the display */ //旋转显示
	void (*fb_rotate)(struct fb_info *info, int angle);

	/* wait for blit idle, optional */ //等待了位图的闲置,可选
	int (*fb_sync)(struct fb_info *info);

	/* perform fb specific ioctl (optional) */
	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 */ //执行FB特定的mmap
	int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);

	/* get capability given var */
	void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
			    struct fb_var_screeninfo *var);

	/* 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);
};


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值