Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4260012
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: 嵌入式

2011-05-02 22:14: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

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