Play image sequence to /dev/fb0

Hi,

I have a sequence of 1280x720 raw files in BGRA32 format and I want
to play them on the display at 25fps.
I wrote a simple C program that reads each file into the memory mapped
from the screen.

fd = open("/dev/fb0", O_RDWR);
screen_buffer = (unsigned char*) mmap(0, screen_size , PROT_WRITE,
MAP_SHARED, fd, 0);

....

for (i = 0; i < frames_cnt; i++)
  {
    ioctl(fd, FBIO_WAITFORVSYNC, 0);
    fread(screen_buffer, filename[i], screen_size);
    screeninfo.activate |= FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
    ret = ioctl(fd, FBIOPAN_DISPLAY, &screeninfo);
  }

The code above runs in the main function.
The code within the for loop takes 25milliseconds, which is enough.
The problem is that the resulting movie is very slow on the display
(about 7 fps),
which means that there is a huge delay between the moment when I write
in the mapped memory and the moment the picture is dumped to the
screen.

My question is what parameters should I use in order to display the
images faster on the screen.
Is there any more efficient alternative?

I don't have X-Server running.

Thank you

Hi,

I have a sequence of 1280x720 raw files in BGRA32 format and I want
to play them on the display at 25fps.
I wrote a simple C program that reads each file into the memory mapped
from the screen.

fd = open("/dev/fb0", O_RDWR);
screen_buffer = (unsigned char*) mmap(0, screen_size , PROT_WRITE,
MAP_SHARED, fd, 0);

....

for (i = 0; i< frames_cnt; i++)
   {
     ioctl(fd, FBIO_WAITFORVSYNC, 0);
     fread(screen_buffer, filename[i], screen_size);
     screeninfo.activate |= FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
     ret = ioctl(fd, FBIOPAN_DISPLAY,&screeninfo);
   }
   

May be you can read the images from the fs before you are waiting for the sync. Then you've a memory copy only if time is critical. But I have no idea if it would make it that faster, I would just give it a try.

I'am doing something similar for a project related to active 3d scanning. I have a sequence of images to display in a short time, but that images are quite small (VGA). I used libdirectfb for that. You can give it a try too.

  Sascha

Hi,
1280x720 raw BGRA @25fps is nearly 90MByte/sec, non of beagle’s peripherals are capable of that.

Regards,
Gyorgy

how many pics do you have? May be load them to RAM before you show them?

2011/2/3 Gyorgy Szekely <hoditohod@gmail.com>

The code that reads from the movie file and displays on fb0 takes
about 30-40ms, which is reasonably ok.
Though the frames are still played very slowly on the screen.

Does anyone know how much is the delay of memory transfer to the GPU?

Ionut wrote:

The code that reads from the movie file and displays on fb0 takes
about 30-40ms, which is reasonably ok.

40ms equals 25fps

Though the frames are still played very slowly on the screen.

how fast is your code just reading the data into a fixed buffer?

Does anyone know how much is the delay of memory transfer to the GPU?

you are writing directly into the frame buffer memory and there is no
GPU involved.

Hey,

I have the same requirement. Can you please share your code?

Regards