Thank you for the reply and information.
I tried vc_dispmanx_snapshot
before, but had no luck initially - it just hung on the second call. After some searching and trial and errors it appeared that vc_dispmanx_snapshot
with the VC_IMAGE_RGB565, VC_IMAGE_RGB888
So I was able to use it with RGBA32 and then moved to RGB565 for performance reasons. It works much better then glReadPixel (and it can be run in a separate thread, so has much less influence on the main graphics thread, especially when the sheduler type and priorities are carefully chosen). But it seems it still does some unnecessary memory moves. I have to investigate it further. Currenty it runs with 1024x600pixel RGB565 frames, and it looks like there are some dropped frames. The goal is to capture 1280x800 RGB565 frames at 30fps.
I saw another approach here https://www.raspberrypi.org/forums/view ... 8&t=222930
. I moved a bit into those direction, so I successfully created the input port with the necessary parameters and it requests the expected buffer with 24bytes size ( OMX_BRCMVEGLIMAGETYPE
structure, there is not equivalent in the MMAL, at least I could not find it). The only problem is getting the necessary EGL image memory handle. I saw how that was done in those thread, but as far as I understand the OpenGL part it that thread draws on the offscreen framebuffer and then that framebuffer has to be copied to the screen FB (if you want to show it also, not just encode). It probably will compromise the performance of the main graphics thread that is not acceptable for me.
Anyway I will probably try it too a bit later.