Chinaunix首页 | 论坛 | 博客
  • 博客访问: 519287
  • 博文数量: 174
  • 博客积分: 4177
  • 博客等级: 上校
  • 技术积分: 1827
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-15 14:12
文章分类

全部博文(174)

文章存档

2018年(1)

2017年(1)

2013年(3)

2012年(9)

2010年(12)

2009年(5)

2008年(106)

2007年(37)

我的朋友

分类: LINUX

2008-12-10 11:44:55

framebuffer驱动全篇(三)(转载)


转载地址:
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

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