From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: stransky Date: Wed, 10 Jul 2024 10:59:53 +0000 Subject: [PATCH] Bug 1898476 [Wayland] Lock Wayland surface before Swap buffers in RenderCompositorEGL r=emilio Depends on D214884 Differential Revision: https://phabricator.services.mozilla.com/D214885 --- gfx/webrender_bindings/RenderCompositorEGL.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gfx/webrender_bindings/RenderCompositorEGL.cpp b/gfx/webrender_bindings/RenderCompositorEGL.cpp index ccabfd375f37..ba10c40657d9 100644 --- a/gfx/webrender_bindings/RenderCompositorEGL.cpp +++ b/gfx/webrender_bindings/RenderCompositorEGL.cpp @@ -154,6 +154,16 @@ RenderedFrameId RenderCompositorEGL::EndFrame( } gl()->SetDamage(bufferInvalid); } + +#ifdef MOZ_WIDGET_GTK + // Rendering on Wayland has to be atomic (buffer attach + commit) and + // wayland surface is also used by main thread so lock it before + // we paint at SwapBuffers(). + UniquePtr lock; + if (auto* gtkWidget = mWidget->AsGTK()) { + lock = gtkWidget->LockSurface(); + } +#endif gl()->SwapBuffers(); return frameId; }