프레임 버퍼/dev/fb0에 직접 쓰는 Linux 용 응용 프로그램을 만들려고합니다. 더블 버퍼링을 위해 가상 스크린을 화면 크기의 두 배로 만들려고합니다. 오류 잘못된 인수를보고 ioctl(fb0, FBIOPUT_VSCREENINFO, &screeninfo_var)
에fb_var_screeninfo에서 yres_virtual을 설정할 때 잘못된 인수 오류가 발생했습니다.
struct fb_var_screeninfo screeninfo_var;
struct fb_fix_screeninfo screeninfo_fixed;
unsigned int* screenbuffer;
void gfx_init()
{
fb0 = open("/dev/fb0", O_RDWR);
if(fb0 == 0)
error("Could not open framebuffer located in /dev/fb0!");
if (ioctl(fb0, FBIOGET_FSCREENINFO, &screeninfo_fixed) == -1)
error("Could not retrive fixed screen info!");
if (ioctl(fb0, FBIOGET_VSCREENINFO, &screeninfo_var) == -1)
error("Could not retrive variable screen info!");
screeninfo_var.xres_virtual = screeninfo_var.xres;
screeninfo_var.yres_virtual = screeninfo_var.yres * 2;
screeninfo_var.width = screeninfo_var.xres;
screeninfo_var.height = screeninfo_var.yres;
screeninfo_var.xoffset = 0;
screeninfo_var.yoffset = 0;
if (ioctl(fb0, FBIOPUT_VSCREENINFO, &screeninfo_var) == -1)
error("Could not set variable screen info!");
info("Detected monitor of %ix%i pixels using %i bit colors.",screeninfo_var.xres, screeninfo_var.yres, screeninfo_var.bits_per_pixel);
screenbuffersize = screeninfo_var.xres_virtual * screeninfo_var.yres_virtual * screeninfo_var.bits_per_pixel/8;
screenbuffer = (unsigned int *)mmap(0, screenbuffersize, PROT_READ | PROT_WRITE, MAP_SHARED, fb0, 0);
if((long)screenbuffer == 0 || (long)screenbuffer == -1)
error("Failed to map framebuffer to device memory!");
}
프로그램도 실패한 : 이것은 내가 쓴 프로그램입니다. screeninfo_var.yres_virtual = screeninfo_var.yres * 2;
줄을 제거 할 때 이중 버퍼링없이 잘 실행됩니다.
누군가 내가 뭘 잘못 보았습니까?
혹시 이것을 알아 냈습니까? 현재 비슷한 문제가 있습니다. –