你好,游客 登录 注册 搜索
背景:
阅读新闻

FrameBuffer在Linux中的实现和机制

[日期:2012-07-31] 来源:Linux社区  作者:yiluohuanghun [字体:大 中 小]
4) fb_info
定义当显卡的当前状态;fb_info结构仅在内核中可见,在这个结构中有一个fb_ops指针, 指向驱动设备工作所需的函数集。
  1. struct fb_info {  
  2. char modename[40]; /* default video mode */  
  3. kdev_t node;  
  4. int flags;  
  5. int open; /* Has this been open already ? */  
  6. #define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */  
  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 fb_cmap cmap; /* Current cmap */  
  11. struct fb_ops *fbops;  
  12. char *screen_base; /* Virtual address */  
  13. struct display *disp; /* initial display variable */  
  14. struct vc_data *display_fg; /* Console visible on this display */  
  15. char fontname[40]; /* default font name */  
  16. devfs_handle_t devfs_handle; /* Devfs handle for new name */  
  17. devfs_handle_t devfs_lhandle; /* Devfs handle for compat. symlink */  
  18. int (*changevar)(int); /* tell console var has changed */  
  19. int (*switch_con)(int, struct fb_info*);  
  20. /* tell fb to switch consoles */  
  21. int (*updatevar)(int, struct fb_info*);  
  22. /* tell fb to update the vars */  
  23. void (*blank)(int, struct fb_info*); /* tell fb to (un)blank the screen */  
  24. /* arg = 0: unblank */  
  25. /* arg > 0: VESA level (arg-1) */  
  26. void *pseudo_palette; /* Fake palette of 16 colors and  
  27. the cursor's color for non  
  28. palette mode */  
  29. /* From here on everything is device dependent */  
  30. void *par;  
  31. };  



5) struct fb_ops
用户应用可以使用ioctl()系统调用来操作设备,这个结构就是用一支持ioctl()的这些操作的。

  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. /* get non settable parameters */  
  7. int (*fb_get_fix)(struct fb_fix_screeninfo *fix, int con,  
  8. struct fb_info *info);  
  9. /* get settable parameters */  
  10. int (*fb_get_var)(struct fb_var_screeninfo *var, int con,  
  11. struct fb_info *info);  
  12. /* set settable parameters */  
  13. int (*fb_set_var)(struct fb_var_screeninfo *var, int con,  
  14. struct fb_info *info);  
  15. /* get colormap */  
  16. int (*fb_get_cmap)(struct fb_cmap *cmap, int kspc, int con, 
  17. struct fb_info *info);  
  18. /* set colormap */  
  19. int (*fb_set_cmap)(struct fb_cmap *cmap, int kspc, int con, 
  20. struct fb_info *info);  
  21. /* pan display (optional) */  
  22. int (*fb_pan_display)(struct fb_var_screeninfo *var, int con,  
  23. struct fb_info *info);  
  24. /* perform fb specific ioctl (optional) */  
  25. int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,  
  26. unsigned long arg, int con, struct fb_info *info);  
  27. /* perform fb specific mmap */  
  28. int (*fb_mmap)(struct fb_info *info, struct file *file, struct  
  29. vm_area_struct *vma);  
  30. /* switch to/from raster image mode */  
  31. int (*fb_rasterimg)(struct fb_info *info, int start);  
  32. };  



6) structure map
struct fb_info_gen | struct fb_info | fb_var_screeninfo
| | fb_fix_screeninfo
| | fb_cmap
| | modename[40]
| | fb_ops ---|--->ops on var
| | ... | fb_open
| | | fb_release
| | | fb_ioctl
| | | fb_mmap
| struct fbgen_hwswitch -|-> detect
| | encode_fix
| | encode_var
| | decode_fix
| | decode_var
| | get_var
| | set_var
| | getcolreg
| | setcolreg
| | pan_display
| | blank
| | set_disp
[编排有点困难,第一行的第一条竖线和下面的第一列竖线对齐,第一行的第二条竖线和下面的第二列竖���对齐就可以了]
这个结构 fbgen_hwswitch抽象了硬件的操作.虽然它不是必需的,但有时候很有用.

linux
相关资讯       FrameBuffer 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款