mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-02 05:12:02 +00:00
[client] wayland: serialize surface commits with EGL swaps
NVIDIA's Wayland EGL implementation sets explicit-sync acquire and release points while presenting a frame. The requests emitted by eglSwapBuffers and its final surface commit must be treated as one logical transaction. The pointer-warp path can commit the main surface from the input thread while the render thread is inside eglSwapBuffers. If this occurs between the explicit-sync requests, the cursor commit applies incomplete pending state and the compositor disconnects the client with: explicit sync is used, but no release point is set Add a surface lock and hold it across EGL presentation. Use the same lock for direct commits, frame callback registration, and pointer-constraint updates, replacing the narrower confinement lock. This prevents another thread from splitting the EGL transaction and removes the need for __NV_DISABLE_EXPLICIT_SYNC=1.
This commit is contained in:
@@ -154,7 +154,10 @@ bool waylandWindowInit(const char * title, const char * appId, bool fullscreen,
|
||||
title, appId, fullscreen, maximize, borderless, resizable))
|
||||
return false;
|
||||
|
||||
wl_surface_commit(wlWm.surface);
|
||||
INTERLOCKED_SECTION(wlWm.surfaceLock,
|
||||
{
|
||||
wl_surface_commit(wlWm.surface);
|
||||
});
|
||||
|
||||
// The initial configure supplies the compositor-selected size for states
|
||||
// such as fullscreen. It must be received before the first buffer is made.
|
||||
@@ -214,9 +217,12 @@ bool waylandWaitFrame(void)
|
||||
{
|
||||
lgWaitEvent(wlWm.frameEvent, TIMEOUT_INFINITE);
|
||||
|
||||
struct wl_callback * callback = wl_surface_frame(wlWm.surface);
|
||||
if (callback)
|
||||
wl_callback_add_listener(callback, &frame_listener, NULL);
|
||||
INTERLOCKED_SECTION(wlWm.surfaceLock,
|
||||
{
|
||||
struct wl_callback * callback = wl_surface_frame(wlWm.surface);
|
||||
if (callback)
|
||||
wl_callback_add_listener(callback, &frame_listener, NULL);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -224,7 +230,10 @@ bool waylandWaitFrame(void)
|
||||
void waylandSkipFrame(void)
|
||||
{
|
||||
// If we decided to not render, we must commit the surface so that the callback is registered.
|
||||
wl_surface_commit(wlWm.surface);
|
||||
INTERLOCKED_SECTION(wlWm.surfaceLock,
|
||||
{
|
||||
wl_surface_commit(wlWm.surface);
|
||||
});
|
||||
}
|
||||
|
||||
void waylandStopWaitFrame(void)
|
||||
|
||||
Reference in New Issue
Block a user