From 8f6a5e7dc4925a90a570bf2f5e310af8ac8f37ad Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 31 Mar 2021 18:05:14 +0200 Subject: Added fix for mozbz#1693472 - Wayland/KDE rendering issues --- firefox.spec | 7 +++- mozilla-1693472.patch | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 mozilla-1693472.patch diff --git a/firefox.spec b/firefox.spec index f18da5e..126efae 100644 --- a/firefox.spec +++ b/firefox.spec @@ -176,7 +176,7 @@ ExcludeArch: armv7hl Summary: Mozilla Firefox Web browser Name: firefox Version: 87.0 -Release: 5%{?pre_tag}%{?dist} +Release: 6%{?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 @@ -256,6 +256,7 @@ Patch402: mozilla-1196777.patch Patch407: mozilla-1667096.patch Patch408: mozilla-1663844.patch Patch415: mozilla-1670333.patch +Patch416: mozilla-1693472.patch # PGO/LTO patches Patch600: pgo.patch @@ -505,6 +506,7 @@ This package contains results of tests executed during build. %patch407 -p1 -b .1667096 %patch408 -p1 -b .1663844 %patch415 -p1 -b .1670333 +%patch416 -p1 -b .1693472 # PGO patches %if %{build_with_pgo} @@ -1080,6 +1082,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Mar 31 2021 Martin Stransky - 87.0-6 +- Added fix for mozbz#1693472 - Wayland/KDE rendering issues. + * Tue Mar 30 2021 Martin Stransky - 87.0-5 - Reftest fix diff --git a/mozilla-1693472.patch b/mozilla-1693472.patch new file mode 100644 index 0000000..79a4009 --- /dev/null +++ b/mozilla-1693472.patch @@ -0,0 +1,111 @@ +changeset: 576074:12385afb25c9 +tag: tip +parent: 576071:a3bc2d23debb +user: stransky +date: Wed Mar 31 16:37:22 2021 +0200 +files: modules/libpref/init/StaticPrefList.yaml widget/gtk/WindowSurfaceWayland.cpp widget/gtk/WindowSurfaceWayland.h +description: +Bug 1693472 [Wayland] Always use direct drawing on KWim, r?jhorak + +Differential Revision: https://phabricator.services.mozilla.com/D110427 + + +diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml +--- a/modules/libpref/init/StaticPrefList.yaml ++++ b/modules/libpref/init/StaticPrefList.yaml +@@ -10991,10 +10991,13 @@ + mirror: always + #endif + +-# Use smooth rendering for Wayland basic compositor. ++# Smooth rendering mode for Wayland basic compositor. ++# 0 - direct draw ++# 1 - basic caching ++# 2 - all caching + - name: widget.wayland-smooth-rendering +- type: RelaxedAtomicBool +- value: false ++ type: RelaxedAtomicUint32 ++ value: 1 + mirror: always + + # Use DMABuf backend for WebGL. +diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp +--- a/widget/gtk/WindowSurfaceWayland.cpp ++++ b/widget/gtk/WindowSurfaceWayland.cpp +@@ -487,6 +487,11 @@ WindowSurfaceWayland::WindowSurfaceWayla + for (int i = 0; i < BACK_BUFFER_NUM; i++) { + mShmBackupBuffer[i] = nullptr; + } ++ // Use slow compositing on KDE only. ++ const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP"); ++ if (currentDesktop && strstr(currentDesktop, "KDE") != nullptr) { ++ mSmoothRendering = CACHE_NONE; ++ } + } + + WindowSurfaceWayland::~WindowSurfaceWayland() { +@@ -817,13 +822,12 @@ already_AddRefed Window + mMozContainerRect = mozContainerSize; + } + +- // We can draw directly only when we redraw significant part of the window +- // to avoid flickering or do only fullscreen updates in smooth mode. +- mDrawToWaylandBufferDirectly = +- mSmoothRendering +- ? windowRedraw +- : (windowRedraw || (lockSize.width * 2 > mozContainerSize.width && +- lockSize.height * 2 > mozContainerSize.height)); ++ mDrawToWaylandBufferDirectly = windowRedraw || mSmoothRendering == CACHE_NONE; ++ if (!mDrawToWaylandBufferDirectly && mSmoothRendering == CACHE_SMALL) { ++ mDrawToWaylandBufferDirectly = ++ (lockSize.width * 2 > mozContainerSize.width && ++ lockSize.height * 2 > mozContainerSize.height); ++ } + + if (!mDrawToWaylandBufferDirectly) { + // Don't switch wl_buffers when we cache drawings. +diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h +--- a/widget/gtk/WindowSurfaceWayland.h ++++ b/widget/gtk/WindowSurfaceWayland.h +@@ -149,19 +149,6 @@ class WindowSurfaceWayland : public Wind + + RefPtr GetWaylandDisplay() { return mWaylandDisplay; }; + +- // Image cache mode can be set by widget.wayland_cache_mode +- typedef enum { +- // Cache and clip all drawings, default. It's slowest +- // but also without any rendered artifacts. +- CACHE_ALL = 0, +- // Cache drawing only when back buffer is missing. May produce +- // some rendering artifacts and flickering when partial screen update +- // is rendered. +- CACHE_MISSING = 1, +- // Don't cache anything, draw only when back buffer is available. +- CACHE_NONE = 2 +- } RenderingCacheMode; +- + private: + WindowBackBuffer* GetWaylandBuffer(); + WindowBackBuffer* SetNewWaylandBuffer(); +@@ -251,9 +238,18 @@ class WindowSurfaceWayland : public Wind + // This typically apply to popup windows. + bool mBufferNeedsClear; + ++ typedef enum { ++ // Don't cache anything, always draw directly to wl_buffer ++ CACHE_NONE = 0, ++ // Cache only small paints (smaller than 1/2 of screen). ++ CACHE_SMALL = 1, ++ // Cache all painting except fullscreen updates. ++ CACHE_ALL = 2, ++ } RenderingCacheMode; ++ + // Cache all drawings except fullscreen updates. + // Avoid any rendering artifacts for significant performance penality. +- bool mSmoothRendering; ++ unsigned int mSmoothRendering; + + gint mSurfaceReadyTimerID; + mozilla::Mutex mSurfaceLock; + -- cgit