深海的小鱼儿

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

在FrameBuffer编程中最重要的和经常用到的数据结构有以下几个:

struct fb_bitfield;

struct fb_fix_screeninfo;

struct fb_var_screeninfo;

在友善之臂的源代码里面还有其他数据结构例如:

struct fb_cmap;

struct fb_con2fbmap;

struct fb_vblank;

struct fb_copyarea;

struct fb_image;

struct fbcurpos;

struct fb_cursor;

这些基本的数据结构,要是用到话,具体的就去源代码里面去找相对于的平台的fb.h的头文件里面的内容。

现在重点介绍这几个重要的数据结构:

struct fb_fix_screeninfo {
    char id[16];            /* identification string eg "TT Builtin" */
    unsigned long smem_start;    /* Start of frame buffer mem */
                    /* (physical address) */
    __u32 smem_len;            /* Length of frame buffer mem */
    __u32 type;            /* see FB_TYPE_*        */
    __u32 type_aux;            /* Interleave for interleaved Planes */
    __u32 visual;            /* see FB_VISUAL_*        */
    __u16 xpanstep;            /* zero if no hardware panning  */
    __u16 ypanstep;            /* zero if no hardware panning  */
    __u16 ywrapstep;        /* zero if no hardware ywrap    */
    __u32 line_length;        /* length of a line in bytes    */
    unsigned long mmio_start;    /* Start of Memory Mapped I/O   */
                    /* (physical address) */
    __u32 mmio_len;            /* Length of Memory Mapped I/O  */
    __u32 accel;            /* Indicate to driver which    */
                    /*  specific chip/card we have    */
    __u16 reserved[3];        /* Reserved for future compatibility */
};

struct fb_var_screeninfo {
    __u32 xres;            /* visible resolution        */
    __u32 yres;
    __u32 xres_virtual;        /* virtual resolution        */
    __u32 yres_virtual;
    __u32 xoffset;            /* offset from virtual to visible */
    __u32 yoffset;            /* resolution            */

    __u32 bits_per_pixel;        /* guess what            */
    __u32 grayscale;        /* != 0 Graylevels instead of colors */

    struct fb_bitfield red;        /* bitfield in fb mem if true color, */
    struct fb_bitfield green;    /* else only length is significant */
    struct fb_bitfield blue;
    struct fb_bitfield transp;    /* transparency            */   

    __u32 nonstd;            /* != 0 Non standard pixel format */

    __u32 activate;            /* see FB_ACTIVATE_*        */

    __u32 height;            /* height of picture in mm    */
    __u32 width;            /* width of picture in mm     */

    __u32 accel_flags;        /* (OBSOLETE) see fb_info.flags */

    /* Timing: All values in pixclocks, except pixclock (of course) */
    __u32 pixclock;            /* pixel clock in ps (pico seconds) */
    __u32 left_margin;        /* time from sync to picture    */
    __u32 right_margin;        /* time from picture to sync    */
    __u32 upper_margin;        /* time from sync to picture    */
    __u32 lower_margin;
    __u32 hsync_len;        /* length of horizontal sync    */
    __u32 vsync_len;        /* length of vertical sync    */
    __u32 sync;            /* see FB_SYNC_*        */
    __u32 vmode;            /* see FB_VMODE_*        */
    __u32 rotate;            /* angle we rotate counter clockwise */
    __u32 reserved[5];        /* Reserved for future compatibility */
};

struct fb_bitfield {
    __u32 offset;            /* beginning of bitfield    */
    __u32 length;            /* length of bitfield        */
    __u32 msb_right;        /* != 0 : Most significant bit is */
                    /* right */
};

posted on 2011-08-18 15:16  深海的小鱼儿  阅读(1698)  评论(0编辑  收藏  举报