我正在使用运行在RHEL 6.0操作系统上的内置图形加速器GMA-HD的i5内核.我需要测试图形驱动程序的图形加速功能(我发现在我的电脑中是i915).我使用下面的代码(我从互联网上得到了一些修改)来写入帧缓冲区.
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
int main()
{
int fbfd = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char *fbp = 0;
int x = 0, y = 0;
long int location = 0;
int count ;
/* Open the file for reading and writing */
fbfd = open("/dev/fb0", O_RDWR);
if (!fbfd) {
printf("Error: cannot open framebuffer device.\n");
exit(1);
}
printf("The framebuffer device was opened successfully.\n");
/* Get …Run Code Online (Sandbox Code Playgroud)