Limit DRI2Drawable reference leak

Chris Wilson chris at
Sat Feb 21 13:31:07 PST 2015

With the current protocol and implementations, we have to often call
DRI2CreateDrawable but can never call DRI2DestroyDrawable. This ends up
with us leaking references to DRI2Drawables based on the assumption that
the references have identical lifetimes to the Drawable going astray.
This was spotted by Daniel Drake as the mali driver would create a new
reference to the DRI2Drawable on every GetBuffers, but it can also be
observed in mesa when running synthetic benchmarks (creating lots of
contexts/glxdrawables for each window) and to a lesser extent with
normal composited operation.

The first two patches implement the capping of the unnamed internal
reference used by DRI2CreateDrawable to just one per Client. The third
patch uses a pair of new DRI2 requests to allow the Client to explicitly
manage the lifetime via use of a named reference to the DRI2Drawable.

More information about the xorg-devel mailing list