加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

在Linux中实现FrameBuffer

发布时间:2013-10-07 16:57:44 所属栏目:Linux 来源:站长网
导读:Framebuffer对应的源文件在linux/drivers/video/目录下。总的抽象设备文件为fbcon.c,在这个目录下还有与各种显卡驱动相关的源文件。 (一)、分析Framebuffer设
Framebuffer对应的源文件在linux/drivers/video/目录下。总的抽象设备文件为fbcon.c,在这个目录下还有与各种显卡驱动相关的源文件。

(一)、分析Framebuffer设备驱动

需要特别提出的是在INTEL平台上,老式的VESA1.2卡,如CGA/EGA卡,是不能支持Framebuffer的,因为Framebuffer要求显卡支持线性帧缓冲,即CPU可以访问显缓冲中的每一位, 但是VESA1.2 卡只能允许CPU一次访问64K的地址空间。

FrameBuffer设备驱动基于如下两个文件:

1) linux/include/linux/fb.h

2) linux/drivers/video/fbmem.c 下面分析这两个文件。

1、fb.h

几乎主要的结构都是在这个中文件定义的。这些结构包括:

1)fb_var_screeninfo

这个结构描述了显示卡的特性:

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 resolution */     
__u32 yoffset;     
__u32 bits_per_pixel; /* guess what */     
__u32 grayscale; /* != 0 Gray levels 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; /* acceleration flags (hints) */     
/* 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 reserved[6]; /* Reserved for future compatibility */ 
};

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读