0

the question is about linux framebuffer, the graphic is tearing.

recently i work for the output desktop to SDI graphic card, then i catch the idea that using framebuffer. That's ok, it output success, but it has a big problem, the graphic is tearing. i want use the FBIO_WAITFORVSYNC and FBIOPAN_DISPLAY to resolve it, but both of them return -1. ioctl(fd, FBIO_WAITFORVSYNC, 0) errno: 25 (Inappropriate ioctl for device) ioctl(fb, FBIOPAN_DISPLAY, &vi) ,errno: 22 (invalid argument)

the OS i using is Ubuntu 12.04, after install the fbset, i find both of ioctl command is including in the fb.h. now the problem is how to get FBIO_WAITFORVSYNC and FBIOPAN_DISPLAY work well. has some suggestion?

SimpleDrunk
  • 1
  • 1
  • 4

1 Answers1

0

aren't the error codes swapped ? if so, you could try:

    int zero = 0;
    ioctl(fd, FBIO_WAITFORVSYNC, &zero);

if FBIOPAN_DISPLAY is not supported and the frame-buffer size is at least 2 screens (check fixInfo.smem_len against the resolution and pixel depth) then try:

    static int bufferNumber = 0;
    //Assume the frame buffer has more memory than
    //just just 1 screen - either set xoffset or 
    //yoffset to flip to another page. 
    varInfo.yoffset = varInfo.yres * bufferNumber;
    ioctl(fd, FBIOPUT_VSCREENINFO, &varInfo);
    //now flip the buffer to which to render to
    bufferNumber = 1 - bufferNumber;
    //now render to appropriate frame-buffer page
    //assuming we change yoffset to switch pages
    pageBuffer = fixInfo.smem_start + 
                 (bufferNumber * 
                 (fixInfo.line_length / (varInfo.bits_per_pixel / 8) * 
                 varInfo.yres ));
ole
  • 1