Linux中LCD设备驱动(三)

2014-11-24 12:49:14 · 作者: · 浏览: 11
reeninfo结构体中存储了用户可以修改的显示器控制参数,例如屏幕分辨率、透明度等等。

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 */


每像素位数,BPP
__u32 grayscale;/* != 0 Graylevels instead of colors */


非0时指灰度


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


fb缓存的R\G\B位域
struct fb_bitfield transp;/* transparency */


透明度

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


!= 0 非标准像素格式

__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 */
fb_info的标志

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


(5)、


fb_cmap结构体中记录了颜色板信息,即调色板信息。,用户空间可以通过ioctl()的FBIOGETCMAP和 FBIOPUTCMAP命令读取或设定颜色表。

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 */透明度
};





上面这些结构体之间有什么关系呢?看下图:






(6)、


fb_bitfield 结构体描述每一像素显示缓冲区的组织方式,包含位域偏移、位域长度和MSB 指示,


struct fb_bitfield {
__u32 offset; /* beginning of bitfield */


位域偏移
__u32 length; /* length of bitfield */


位域长度
__u32 msb_right;/* != 0 : Most significant bit is */
/* right */


MSB
};