免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 624 | 回复: 0
打印 上一主题 下一主题

framebuffer驱动全篇(三) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-11 19:03 |只看该作者 |倒序浏览

Color Map 剖析
在framebuffer驱动程序设计中,cmap这个东东太晕了。现在我要把他赤裸裸的剖析给大家:)
1. struct fb_cmap


/*颜色映射表*/
struct fb_cmap {
       __u32 start;                  /* First entry   */
       __u32 len;                    /* Number of entries */
       __u16 *red;                  /* 红色   */
       __u16 *green;               /*绿色*/
       __u16 *blue;                 /*蓝色*/
       __u16 *transp;                     /* 透明度,允许 NULL */
};
该结构在fb.h文件中定义,在struct fb_ops结构中有两个成员函数与其相关:
    /*获取颜色表*/
    int (*fb_get_cmap)(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info);
    /*设定颜色表*/
    int (*fb_set_cmap)(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info);

在struct fb_info结构中有变量:
  struct fb_cmap cmap;                 /* Current cmap */

在fpgen基础操作下提供:
extern int fbgen_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info);
extern int fbgen_set_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info);



在文件/* drivers/video/fbcmap.c */中提供更多的cmap应用
extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
extern void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto);
extern int fb_get_cmap(struct fb_cmap *cmap, int kspc,
int (*getcolreg)(u_int, u_int *, u_int *, u_int *,u_int *, struct fb_info *),
                                struct fb_info *fb_info);
extern int fb_set_cmap(struct fb_cmap *cmap, int kspc,
                              int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,struct fb_info *),
                              struct fb_info *fb_info);
extern struct fb_cmap *fb_default_cmap(int len);
extern void fb_invert_cmaps(void);
2. 通过文件解析
anakinfb.c文件中,cmap如图





在stifb.c





本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/62910/showart_527513.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP