GLX_EXT_buffer_age Patches For Mesa DRI2
Chris Wilson of Intel's Open-Source Technology Center wrote to the Mesa mailing list this week, "In order to suport GLX_EXT_buffer_age in DRI2, we need to pass back the last swap buffer count that the back buffer was defined for. For simplicity, we can reuse an existing field in the DRI2GetBuffers reply that is not used by current drivers, the flags. Since we change the interpretation of this flag, we also declare the semantic change with a DRI2 parameter and depend upon the DDX to enable the change responsibility (which is just a matter of reviewing whether the flags field has ever been used for a non-zero value)."
Chris implemented the support along the necessary Mesa code-paths and implemented the DRI2 BufferAge support for the Radeon and Nouveau drivers. These patches have yet to be merged for mainline Mesa Git but would be likely material for Mesa 10.5.
GLX_EXT_buffer_age allows for more efficient use by compositors and applications. The OpenGL.org specification describes:
The aim of this extension is to expose enough information to applications about how the driver manages the set of front and back buffers associated with a given surface to allow applications to re-use the contents of old frames and minimize how much must be redrawn for the next frame.
There are lots of different ways for a driver to manage these buffers, from double buffering, different styles of triple buffering and even n-buffering or simply single buffer rendering. We also need to consider that power management events or memory pressure events might also result in some of the buffers not currently in-use being freed.
This extension lets applications query the age of the back buffer contents for a GLX surface as the number of frames elapsed since the contents were most recently defined. The back buffer can either be reported as invalid (has an age of 0) or it may be reported to contain the contents from n frames prior to the current frame.