Skip to content

glframebuffer: call glFlush() after drawing a frame

Michael Olbrich requested to merge mol/gstreamer:glflush into main

Without this, the previous draw commands are buffered until later commands flush them out. As a result, actual rendering on the GPU is delayed for an arbitrary amount of time. Call glFlush() to ensure that the frame is rendered as soon as possible.

As a side effect, this fixes a rendering issue when a gldownload element exports DMA-BUFs to a vaapipostproc element: The commands may still be buffered when VA-API receives the buffer. As a result, the VA-API commands may be executed before the GL draw commands.

The glFlush() ensures that the GL draw commands are already queued in the kernel before VA-API receives the buffer. Implicit fences will now ensure that the following VA-API commands will be executed after the GL commands.

Merge request reports