Chinaunix首页 | 论坛 | 博客
  • 博客访问: 619915
  • 博文数量: 112
  • 博客积分: 5011
  • 博客等级: 大校
  • 技术积分: 1406
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-25 18:46
文章分类
文章存档

2011年(1)

2010年(5)

2009年(25)

2008年(81)

我的朋友

分类: LINUX

2008-04-26 11:16:17

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


 

 

framebuffer驱动全篇(四)

阅读(1611) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~