From fb305223b001679d94bb6d12dc98d911ce8109e0 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 17 Sep 2019 21:16:42 +0200 Subject: Enable Wayland cache mode control (mozbz#1577024) --- firefox.spec | 7 ++++- mozilla-1577024.patch | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 mozilla-1577024.patch diff --git a/firefox.spec b/firefox.spec index 3e96df4..2ec91ba 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 7%{?pre_tag}%{?dist} +Release: 8%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz @@ -169,6 +169,7 @@ Patch585: mozilla-1579849.patch Patch586: mozilla-1579823.patch Patch587: mozilla-1580152.patch Patch588: mozilla-1581748.patch +Patch589: mozilla-1577024.patch # PGO/LTO patches Patch600: pgo.patch @@ -390,6 +391,7 @@ This package contains results of tests executed during build. %patch586 -p1 -b .mozilla-1579823 %patch587 -p1 -b .mozilla-1580152 %patch588 -p1 -b .mozilla-1581748 +%patch589 -p1 -b .mozilla-1577024 # PGO patches %patch600 -p1 -b .pgo @@ -966,6 +968,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Sep 17 2019 Martin Stransky - 69.0-8 +- Enable Wayland cache mode control (mozbz#1577024) + * Tue Sep 17 2019 Martin Stransky - 69.0-7 - Added fixes for mozbz#1581748 diff --git a/mozilla-1577024.patch b/mozilla-1577024.patch new file mode 100644 index 0000000..c7789f1 --- /dev/null +++ b/mozilla-1577024.patch @@ -0,0 +1,85 @@ +diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1577024 firefox-69.0/widget/gtk/nsWaylandDisplay.cpp +--- firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1577024 2019-09-17 21:09:15.817764591 +0200 ++++ firefox-69.0/widget/gtk/nsWaylandDisplay.cpp 2019-09-17 21:09:15.822764568 +0200 +@@ -13,10 +13,15 @@ namespace widget { + #define GBMLIB_NAME "libgbm.so.1" + #define DRMLIB_NAME "libdrm.so.2" + ++#define DMABUF_PREF "widget.wayland_dmabuf_backend.enabled" ++// See WindowSurfaceWayland::RenderingCacheMode for details. ++#define CACHE_MODE_PREF "widget.wayland_cache_mode" ++ + bool nsWaylandDisplay::mIsDMABufEnabled = false; + // -1 mean the pref was not loaded yet + int nsWaylandDisplay::mIsDMABufPrefState = -1; + bool nsWaylandDisplay::mIsDMABufConfigured = false; ++int nsWaylandDisplay::mRenderingCacheModePref = -1; + + wl_display* WaylandDisplayGetWLDisplay(GdkDisplay* aGdkDisplay) { + if (!aGdkDisplay) { +@@ -373,14 +378,15 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di + wl_registry_add_listener(mRegistry, ®istry_listener, this); + + if (NS_IsMainThread()) { +- // We can't load the preference from compositor/render thread, +- // only from main one. So we can't call it directly from +- // nsWaylandDisplay::IsDMABufEnabled() as it can be called from various +- // threads. ++ // We can't load the preference from compositor/render thread ++ // so load all Wayland prefs here. + if (mIsDMABufPrefState == -1) { +- mIsDMABufPrefState = +- Preferences::GetBool("widget.wayland_dmabuf_backend.enabled", false); ++ mIsDMABufPrefState = Preferences::GetBool(DMABUF_PREF, false); ++ } ++ if (mRenderingCacheModePref == -1) { ++ mRenderingCacheModePref = Preferences::GetInt(CACHE_MODE_PREF, 0); + } ++ + // Use default event queue in main thread operated by Gtk+. + mEventQueue = nullptr; + wl_display_roundtrip(mDisplay); +diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1577024 firefox-69.0/widget/gtk/nsWaylandDisplay.h +--- firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1577024 2019-09-17 21:09:15.818764586 +0200 ++++ firefox-69.0/widget/gtk/nsWaylandDisplay.h 2019-09-17 21:09:15.822764568 +0200 +@@ -83,6 +83,9 @@ class nsWaylandDisplay { + uint32_t mModifierLo); + static bool IsDMABufEnabled(); + ++ // See WindowSurfaceWayland::CacheMode for details. ++ int GetRenderingCacheModePref() { return mRenderingCacheModePref; }; ++ + private: + bool ConfigureGbm(); + +@@ -108,6 +111,7 @@ class nsWaylandDisplay { + static bool mIsDMABufEnabled; + static int mIsDMABufPrefState; + static bool mIsDMABufConfigured; ++ static int mRenderingCacheModePref; + }; + + void WaylandDispatchDisplays(); +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1577024 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1577024 2019-09-17 21:09:15.820764577 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-17 21:09:15.822764568 +0200 +@@ -192,7 +192,7 @@ It owns wl_buffer object, owns WaylandDM + (which provides the DMA Buffer) and ties them together. + + WindowBackBufferDMABuf backend is used only when WaylandDMABufSurface is +-available and gfx.wayland_dmabuf_backend.enabled preference is set. ++available and widget.wayland_dmabuf_backend.enabled preference is set. + + */ + +diff -up firefox-69.0/modules/libpref/init/all.js.old firefox-69.0/modules/libpref/init/all.js +--- firefox-69.0/modules/libpref/init/all.js.old 2019-09-17 21:14:06.794677172 +0200 ++++ firefox-69.0/modules/libpref/init/all.js 2019-09-17 21:14:33.030571836 +0200 +@@ -4807,6 +4807,7 @@ pref("widget.content.allow-gtk-dark-them + #endif + #ifdef MOZ_WAYLAND + pref("widget.wayland_dmabuf_backend.enabled", false); ++pref("widget.wayland_cache_mode", 0); + #endif + + pref("widget.window-transforms.disabled", false); -- cgit