fbvarscreeninfo解析.docx_第1页
fbvarscreeninfo解析.docx_第2页
fbvarscreeninfo解析.docx_第3页
fbvarscreeninfo解析.docx_第4页
fbvarscreeninfo解析.docx_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

fb_var_screeninfo解析structfb_var_screeninfo _u32xres;/* visible resolution */_u32 yres;_u32xres_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*/structfb_bitfield red;/*bitfield in fb mem if true color, */structfb_bitfield green;/*else only length is significant */structfb_bitfield blue;structfb_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 (ofcourse) */_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 reserved6;/* Reserved for future compatibility*/;前几个成员决定了分辨率。xres和yres是在屏幕上可见的实际分辨率,在通常的vga模式将为640和400(也许是480,by highbar)。*res-virtual决定了构建屏幕时视频卡读取屏幕内存的方式。当实际的垂直分辨率为400,虚拟分辨率可以是800。这意味着800行的数据被保存在了屏幕内存区中。因为只有400行可以被显示,决定从那一行开始显示就是你的事了。这个可以通过设置*offset来实现。给yoffset赋0将显示前400行,赋35将显示第36行到第435行,如此重复。这个功能在许多情形下非常方便实用。它可以用来做双缓冲。双缓冲就是你的程序分配了可以填充两个屏幕的内存。将offset设为0,将显示前400行(假设是标准的vga),同时可以秘密的在400行到799行构建另一个屏幕,当构建结束时,将yoffset设为400,新的屏幕将立刻显示出来。现在将开始在第一块内存区中构建下一个屏幕的数据,如此继续。这在动画中十分有用。另外一个应用就是用来平滑的滚动整个屏幕。就像在前面屏幕中一样,在内存分配800行的空间。每隔10毫秒设定一个定时器(timer,见man settimer和mansignal / man sigaction),将offset设为1或是比上次更多,瞧,你看到了一个平滑滚动的屏幕。确保你的信号(signal)不要因为最佳输出的原因被信号处理程序阻塞。将bits_per_pixel 设为1,2,4,8,16,24或32来改变颜色深度(color depth)。不是所有的视频卡和驱动都支持全部颜色深度。当颜色深度改变,驱动将自动改变fb-bitfields。这些指出,在一个特定的颜色基准上,多少和哪些比特被哪种颜色使用。如果bits-per-pixel小于8,则fb-bitfields将无定义而且颜色映射将启用。在fb-var-screeninfo结构结尾的定时的设置是当你选择一个新的分辨率的时候用来设定视频定时的。(EXAMINE AND EXPLAIN TIMINGS! )帧缓冲设备最重要的数据结构体struct fb_info,其中,重要的是struct fb_var_screeninfo var; /* 可变参数 */struct fb_fix_screeninfo fix; /* 固定参数 */struct fb_ops *fbops; /帧缓冲操作编写帧缓冲驱动的主要工作就是编写fb_ops各个成员函数编写具体驱动方法步骤:1、构建具体驱动的fb_fix_screeninfo;2、构建具体驱动的fb_info;3、构建具体驱动的struct fb_ops,并定义相关的操作函数;4、定义具体驱动的XXX_fb_probe附件:=struct fb_info 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_curveFB_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 similiar 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; ranges0; *apertures;=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 reserved5; /* Reserved for future compatibility */;其中:struct fb_bitfield _u32 offset; /* beginning of bitfield */ _u32 length; /* length of bitfield */ _u32 msb_right; /* != 0 : Most significant bit is right */ ;=struct fb_fix_screeninfo char id16; /* 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 reserved3; /* Reserved for future compatibility */;=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); /* checks var and eventually tweaks it to something supported, DO NOT MODIFY PAR */ int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info); /* set the video mode according to info-var */ int (*fb_set_par)(struct fb_info *info); /* set color register */ 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

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论