Present synchronization using xshmfences
Erik Kurzinger
ekurzinger at nvidia.com
Thu Dec 16 20:47:42 UTC 2021
Hi Everyone,
I'm trying to get a sense for how to properly use Xorg's shared memory
fence objects and wanted to see if anyone might have some advice.
This is in an attempt to resolve a visual corruption issue with the
NVIDIA OpenGL driver when running on Xwayland on a PRIME system caused
by us not properly synchronizing our PresentPixmap requests with the
GPU's rendering.
The idea we had was to use pass a shared memory fence as the wait-fence
arguemnt, and have the backing futex be triggered asynchronously in
response to a notification from the GPU. This would avoid any potential
issues with multiple thread trying to use the Display connection, which
is the reason we can't just issue a normal SyncTriggerFence request.
The issue seems to be that if the PresentPixmap request arrives before
the futex is triggered, it will be set as a callback for the fence.
However, simple triggering the underlying futex doesn't actually prompt
the server to run this callback. As a result, the Present request never
gets executed, and we end up waiting forever for the Pixmap to become
idle (which is never will).
So I suppose I just wanted to check if the above is an inherent
limitation of these types of synchronization objects, or alternately if
we're just not using them correctly and there might be a way to get
around the problem after all. Of course, all input is greatly
appreciated, and please ask if additional clarification is needed.
Thanks,
Erik
More information about the xorg-devel
mailing list