文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>frame buffer test

frame buffer test

时间:2010-03-13  来源:zhwe1028


/*
* Android framebuffer info test
* file name: fb_test.c
* compile cmd: arm-none-linux-gnueabi-gcc -static -o fb_test fb_test.c
*
* zhangwei
* [email protected]
* 2010-03-13
*/

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>

int main (void)
{
    int fp=0;
    struct fb_var_screeninfo vinfo;
    struct fb_fix_screeninfo finfo;

    fp = open ("/dev/graphics/fb0",O_RDWR);
    if (fp < 0){
        printf("Error : Can not open framebuffer device\n");
        return 1;
    }

    if (ioctl(fp,FBIOGET_FSCREENINFO,&finfo)){
        printf("Error reading fixed information\n");
        return 2;
    }
    
    if (ioctl(fp,FBIOGET_VSCREENINFO,&vinfo)){
        printf("Error reading variable information\n");
        return 3;
    }

    printf(">>>> fb_var_screeninfo\n");
    printf("xres :%d\n",vinfo.xres);
    printf("yres :%d\n",vinfo.yres);
    printf("xres_virtual :%d\n",vinfo.xres_virtual);
    printf("yres_virtual :%d\n",vinfo.yres_virtual);
    printf("xoffset :%d\n",vinfo.xoffset);
    printf("yoffset :%d\n",vinfo.yoffset);
    printf("bits_per_pixel :%d\n",vinfo.bits_per_pixel);
    printf("grayscale :%d\n",vinfo.grayscale);
    printf("nonstd :%d\n",vinfo.nonstd);
    printf("activate :%d\n",vinfo.activate);
    printf("height :%d\n",vinfo.height);
    printf("width :%d\n",vinfo.width);
    printf("accel_flags :%d\n",vinfo.accel_flags);
    printf("pixclock :%d\n",vinfo.pixclock);
    printf("left_margin :%d\n",vinfo.left_margin);
    printf("right_margin :%d\n",vinfo.right_margin);
    printf("upper_margin :%d\n",vinfo.upper_margin);
    printf("lower_margin :%d\n",vinfo.lower_margin);
    printf("hsync_len :%d\n",vinfo.hsync_len);
    printf("vsync_len :%d\n",vinfo.vsync_len);
    printf("sync :%d\n",vinfo.sync);
    printf("vmode :%d\n",vinfo.vmode);
    printf("rotate :%d\n",vinfo.rotate);

    printf("\n");
    printf(">>>> fb_fix_screeninfo\n");
    printf("smem_len :%d\n",finfo.smem_len);
    printf("type :%d\n",finfo.type);
    printf("type_aux :%d\n",finfo.type_aux);
    printf("visual :%d\n",finfo.visual);
    printf("xpanstep :%d\n",finfo.xpanstep);
    printf("ypanstep :%d\n",finfo.ypanstep);
    printf("ywrapstep :%d\n",finfo.ywrapstep);
    printf("line_length :%d\n",finfo.line_length);
    printf("mmio_len :%d\n",finfo.mmio_len);
    printf("accel :%d\n",finfo.accel);

    close (fp);

    return 0;
}


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载