Explicit GPU Synchronization for DRI3, Present, and Xwayland
Here is our proposal for adding explicit GPU synchronization to the DRI3 and Present extensions, along with an implementation for Xwayland. While we at NVIDIA may be particularly keen to have this in place, since our driver lacks implicit sync support, a general consensus seems to be forming around the idea that explicit sync is the best path forward for the Linux graphics stack. Xwayland will likely remain an important component in that stack for some time yet, and therefore I feel that this work will be of long-term benefit to the community more broadly.
The design takes inspiration from the proposed Wayland wp_linux_explicit_sync_v2 protocol [1], making use of DRM syncobjs as the main primitive. I believe this offers a few benefits. One, having both X11 and Wayland use a similar mechanism for explicit sync will simplify development for client-side drivers, and two, it will also hopefully make it fairly straight-forward for Xwayland itself to add support for the Wayland explicit sync protocol, presumably once it's more widely implemented by compositors.
I've tried to keep this initial proposal focused on getting a usable GPU synchronization primitive in place, and adding support for it to the PresentPixmap request, believing this to be the most important part of the presentation pipeline. Other use-cases for this primitive are conceivable, for instance perhaps in the Damage extension, but I feel that those are best left for later.
Any and all feedback is appreciated.