2013-02-25 2 views
3

프레임 버퍼/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; 줄을 제거 할 때 이중 버퍼링없이 잘 실행됩니다.

누군가 내가 뭘 잘못 보았습니까?

+1

혹시 이것을 알아 냈습니까? 현재 비슷한 문제가 있습니다. –

답변

0

이것은 일반적인 질문이며 비디오 드라이버의 제한 때문에 발생합니다. 예를 들어 Intel의 810 칩셋은 640x480 해상도 만 지원하며 Broadcom의 폭은 1200 (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=29968) 이하로 제한됩니다.

가능한 경우 드라이버 또는 비디오 카드 자체를 변경하지 않으면 여기에서 할 수있는 일은 많지 않습니다.

편집 : PC를 사용하는 경우 인텔의 드라이버가 아닌 vesafb을 사용해보십시오.

여기에 힌트가 있습니다. http://www.mail-archive.com/[email protected]/msg27725.html

+1

Nvidea Quadro 200M은 더 큰 프레임 버퍼를 처리 할 수 ​​없다는 것은 비합리적입니다. 내가 사용하는 화면은 1600x900이고, 1600x901의 가상 화면 크기는 이미 오류를 제공합니다. 가상 화면의 최대 크기를 실제로 볼 수있는 방법이 있습니까? – STS