tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2b39f4b459162fc01e40c8e0ed4bfea7108c4ab1
parent 56ba5001437fe16c76bb718206e88ad6813018a9
Author: Martin Stransky <stransky@redhat.com>
Date:   Fri,  5 Dec 2025 13:44:41 +0000

Bug 2004002 [Wayland] Skip explicit commit to wl_surface and deffer it to glSwapBuffer() operation r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D275056

Diffstat:
Mwidget/gtk/WaylandSurface.cpp | 3++-
Mwidget/gtk/WaylandSurfaceLock.cpp | 8+++++---
Mwidget/gtk/WaylandSurfaceLock.h | 3++-
3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/widget/gtk/WaylandSurface.cpp b/widget/gtk/WaylandSurface.cpp @@ -994,7 +994,8 @@ void WaylandSurface::SetSize(DesktopIntSize aSize) { } void WaylandSurface::ApplyEGLWindowSize(LayoutDeviceIntSize aEGLWindowSize) { - WaylandSurfaceLock lock(this); + // Apply the surface changes by OpenGL swap buffer operation. + WaylandSurfaceLock lock(this, /* aSkipCommit */ true); auto scale = GetScale(); auto surfaceSize = GetScaledSize(mSize); diff --git a/widget/gtk/WaylandSurfaceLock.cpp b/widget/gtk/WaylandSurfaceLock.cpp @@ -15,11 +15,11 @@ namespace mozilla::widget { WaylandSurfaceLock::WaylandSurfaceLock(RefPtr<WaylandSurface> aWaylandSurface, - bool aForceCommit) { + bool aSkipCommit) { #ifdef MOZ_WAYLAND MOZ_DIAGNOSTIC_ASSERT(aWaylandSurface); mWaylandSurface = std::move(aWaylandSurface); - mForceCommit = aForceCommit; + mSkipCommit = aSkipCommit; if (GdkIsWaylandDisplay()) { mSurface = mWaylandSurface->Lock(this); } @@ -38,7 +38,9 @@ void WaylandSurfaceLock::Commit() { WaylandSurfaceLock::~WaylandSurfaceLock() { #ifdef MOZ_WAYLAND if (GdkIsWaylandDisplay()) { - Commit(); + if (mForceCommit || !mSkipCommit) { + Commit(); + } mWaylandSurface->Unlock(&mSurface, this); } #endif diff --git a/widget/gtk/WaylandSurfaceLock.h b/widget/gtk/WaylandSurfaceLock.h @@ -25,7 +25,7 @@ class WaylandSurface; class WaylandSurfaceLock final { public: explicit WaylandSurfaceLock(RefPtr<WaylandSurface> aWaylandSurface, - bool aForceCommit = false); + bool aSkipCommit = false); ~WaylandSurfaceLock(); WaylandSurface* GetWaylandSurface() const; @@ -44,6 +44,7 @@ class WaylandSurfaceLock final { RefPtr<WaylandSurface> mWaylandSurface; wl_surface* mSurface = nullptr; bool mForceCommit = false; + bool mSkipCommit = false; #endif };