[Mesa-dev] [PATCH 0/8] Implement GL_KHR_flush_control

Neil Roberts neil at linux.intel.com
Wed Oct 1 12:00:43 PDT 2014

Here's a series of patches to implement GL_KHR_flush_control and
GLX_ARB_flush_control. The idea of the extension is quite simple and
just makes it so that the GL doesn't implicitly flush the context when
the context is unbound. This should be a speed improvement for
applications that are using multiple contexts and have to switch
between them often.

The actual work of the extension is just to stop calling _mesa_flush
in _mesa_make_current when the attribute is specified. However the
patch is a bit more fiddly because it involves a new attribute for
glXCreateContextAttribs which needs modifications on quite a few

Sadly the X server needs patching as well because the server side of
GLX seems to verify the attributes passed to glXCreateContextAttribs
as well even for direct contexts. I'll post the patches for the X
server and glproto shortly.

I've written an example of using the extension here:


The example renders a grid of rectangles to three different windows
with three different contexts. The rendering of each frame of each
window is interleaved so that the context is switched after every row
of rectangles. If I set the release behaviour to flush then the FPS is
80 FPS whereas if I set it to none then it is 192 FPS. Hopefully that
should be convincing enough that I haven't missed some flush

There is already a Piglit test proposed by Fredrik Höglund which I
think would be enough to test the extension if we can fix it up a bit.


I've run the patch series against all of the existing Piglit tests on
Ivybridge and there are no regressions.

More information about the mesa-dev mailing list