OpenGL performance issues on Raspberry Pi 4
I'm writing a video player that decodes H.264 videos using v4l2 into dmabufs and then passes those to OpenGL ES textures and renders it into a Wayland window in Weston.
I can't get it to render at 60 fps.
After some digging I know this:
- If I reduce the window size, the performance improves. Around 1600x1080 it runs at 60 fps. At 1700x1080 it starts dropping frames.
- If I reduce the resolution of the video, the performance also improves. I tried to resize the video to 1280x720 and it ran at 60 fps without a problem.
- If I change the fragment shader to just set all fragments to red color instead of taking it from the texture, it also runs at 60 fps.
It seems to me that the issue either OpenGL or Weston. This example program can render a 4K HEVC video at 60 fps without a problem and the only real difference is that it doesn't use OpenGL but rather it sends the dmabufs straight to DRM.
I'm not sure if this is even Weston related but I'll give it a shot. Maybe someone will have some ideas.