From 60336f10c47acbd3ee327c7275be7f7d919e4a62 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 11 Apr 2019 13:27:11 +0200 Subject: [PATCH 0001/1136] Rebuild From 7edd26f80ca86d98c67c9c1a77ebaf242fab2441 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Fri, 31 May 2019 16:13:47 +0200 Subject: [PATCH 0002/1136] Fix external app handling in flatpak --- firefox.sh.in | 3 +++ firefox.spec | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/firefox.sh.in b/firefox.sh.in index 5cd169d..29bd738 100644 --- a/firefox.sh.in +++ b/firefox.sh.in @@ -248,6 +248,9 @@ do esac done +# Flatpak specific environment variables +%FLATPAK_ENV_VARS% + # Run the browser debugging=0 if [ $debugging = 1 ] diff --git a/firefox.spec b/firefox.spec index c4c847c..4051cdf 100644 --- a/firefox.spec +++ b/firefox.spec @@ -667,6 +667,13 @@ desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE29} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE21} > %{buildroot}%{_bindir}/firefox %{__chmod} 755 %{buildroot}%{_bindir}/firefox + +%if 0%{?flatpak} +sed -i -e 's|%FLATPAK_ENV_VARS%|export TMPDIR=$XDG_CACHE_HOME/tmp"|' %{buildroot}%{_bindir}/firefox +%else +sed -i -e 's|%FLATPAK_ENV_VARS%||' %{buildroot}%{_bindir}/firefox +%endif + %if 0%{?wayland_backend_default} %{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE30} > %{buildroot}%{_bindir}/firefox-x11 %{__chmod} 755 %{buildroot}%{_bindir}/firefox-x11 From f1dfc1369f4f6d21a43a3a987523102370ee7da5 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Wed, 5 Jun 2019 11:05:50 +0200 Subject: [PATCH 0003/1136] Fix mismatching " in the launcher script when built for flatpak --- firefox.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 4051cdf..7627c50 100644 --- a/firefox.spec +++ b/firefox.spec @@ -669,7 +669,7 @@ desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE29} %if 0%{?flatpak} -sed -i -e 's|%FLATPAK_ENV_VARS%|export TMPDIR=$XDG_CACHE_HOME/tmp"|' %{buildroot}%{_bindir}/firefox +sed -i -e 's|%FLATPAK_ENV_VARS%|export TMPDIR="$XDG_CACHE_HOME/tmp"|' %{buildroot}%{_bindir}/firefox %else sed -i -e 's|%FLATPAK_ENV_VARS%||' %{buildroot}%{_bindir}/firefox %endif From 5209397ee2d3abcb0c643f117dea87a80763610c Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 11 Jun 2019 12:57:51 +0200 Subject: [PATCH 0004/1136] Updated to 67.0.2 --- .gitignore | 2 ++ firefox.spec | 9 ++++++--- sources | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ae1175a..72f527e 100644 --- a/.gitignore +++ b/.gitignore @@ -345,3 +345,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-67.0.source.tar.xz /firefox-langpacks-67.0-20190515.tar.xz /firefox-langpacks-67.0-20190517.tar.xz +/firefox-67.0.2.source.tar.xz +/firefox-langpacks-67.0.2-20190611.tar.xz diff --git a/firefox.spec b/firefox.spec index 7627c50..dc41b3d 100644 --- a/firefox.spec +++ b/firefox.spec @@ -98,13 +98,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 67.0 -Release: 4%{?pre_tag}%{?dist} +Version: 67.0.2 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190517.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190611.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -945,6 +945,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Jun 11 2019 Martin Stransky - 67.0.2-1 +- Updated to 67.0.2 Build 2 + * Thu May 23 2019 Martin Stransky - 67.0-4 - Added wayland buffer optimization (mozilla#1553747). diff --git a/sources b/sources index 2cd09d2..3cc242c 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-67.0.source.tar.xz) = a1000d6ca8146a9a3c74a3f69041b755c0c5014c8a608298d9c4cbe39577939d43139a7ad742983697ae90b635d3f5d8f9a008fcc2b3778adaadc25acc49ca29 -SHA512 (firefox-langpacks-67.0-20190517.tar.xz) = f8406332e5bf841ae78b1ff57a4eebb11110f94b0ecdac629ac6935c9f0feddfde4de33b18310b7693015b7ae5b438df86a67f7a0bdf8fa36a3bcccbea15d13e +SHA512 (firefox-67.0.2.source.tar.xz) = 14da0aa23571c83dfd4cf1b33027434425c99c4b8838d335cfbd93ef60ad936cd7e7f60ad84be688f434371c9b49142e1020df63ac3e65f78b6595f5a8c19590 +SHA512 (firefox-langpacks-67.0.2-20190611.tar.xz) = ebe5454a5bdbc962d0013e2a4b3683cd4844872ed00dc3215c4eb8db628fc3eff3e6be4b1906640fcca93c558f8199270c64bd5d28d0bd6e349b8797cf476906 From 92e37b0a30e4da51935af67f1fae044d41706be1 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 11 Jun 2019 14:45:43 +0200 Subject: [PATCH 0005/1136] build fix - debug_build --- firefox.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index dc41b3d..d473fd9 100644 --- a/firefox.spec +++ b/firefox.spec @@ -40,7 +40,6 @@ ExcludeArch: s390x %endif %bcond_without debug_build %if %{with debug_build} -%else %global debug_build 1 %else %global debug_build 0 From c545b67dfc57033134762e53219bf2b4e1f46a7b Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 13 Jun 2019 20:58:52 +0200 Subject: [PATCH 0006/1136] Try to fix linking with libraries in /app/lib64 When building a flatpak module, make sure to pass -L%{_libdir} to ld so that it can find libraries installed in /app/lib64. Normally, this is set through the %{__global_ldflags} macro, but firefox doesn't use that, so we need to pass the correct -L manually. This should hopefully fix the issue with pipewire-0.2 linking that recent firefox flatpak builds have run into. --- firefox.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firefox.spec b/firefox.spec index d473fd9..7f65b9e 100644 --- a/firefox.spec +++ b/firefox.spec @@ -542,6 +542,11 @@ MOZ_LINK_FLAGS="-Wl,--no-keep-memory" echo "ac_add_options --enable-linker=gold" >> .mozconfig %endif %endif +%if 0%{?flatpak} +# Make sure the linker can find libraries in /app/lib64 as we don't use +# __global_ldflags that normally sets this. +MOZ_LINK_FLAGS="$MOZ_LINK_FLAGS -L%{_libdir}" +%endif %ifarch %{arm} %{ix86} export RUSTFLAGS="-Cdebuginfo=0" %endif From 1dacd1e877fdbc6c258665d0df52ab44eaec9305 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 18 Jun 2019 14:31:38 -0700 Subject: [PATCH 0007/1136] Updated to 67.0.3 --- .gitignore | 2 ++ firefox.spec | 7 +++++-- sources | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 72f527e..543e296 100644 --- a/.gitignore +++ b/.gitignore @@ -347,3 +347,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-67.0-20190517.tar.xz /firefox-67.0.2.source.tar.xz /firefox-langpacks-67.0.2-20190611.tar.xz +/firefox-langpacks-67.0.3-20190618.tar.xz +/firefox-67.0.3.source.tar.xz diff --git a/firefox.spec b/firefox.spec index d473fd9..45f3c22 100644 --- a/firefox.spec +++ b/firefox.spec @@ -97,13 +97,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 67.0.2 +Version: 67.0.3 Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190611.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190618.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -944,6 +944,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Jun 18 2019 Martin Stransky - 67.0.3-1 +- Updated to 67.0.3 + * Tue Jun 11 2019 Martin Stransky - 67.0.2-1 - Updated to 67.0.2 Build 2 diff --git a/sources b/sources index 3cc242c..7e756cc 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-67.0.2.source.tar.xz) = 14da0aa23571c83dfd4cf1b33027434425c99c4b8838d335cfbd93ef60ad936cd7e7f60ad84be688f434371c9b49142e1020df63ac3e65f78b6595f5a8c19590 -SHA512 (firefox-langpacks-67.0.2-20190611.tar.xz) = ebe5454a5bdbc962d0013e2a4b3683cd4844872ed00dc3215c4eb8db628fc3eff3e6be4b1906640fcca93c558f8199270c64bd5d28d0bd6e349b8797cf476906 +SHA512 (firefox-langpacks-67.0.3-20190618.tar.xz) = 855c6e28970556be60ac696ad0de20e23d430aa7927a1cdb18af09b918f3123a9fa4dcf993d982ecd6dfd28583bcdf039df0d6341e9b4136d9687cf299b0d2a4 +SHA512 (firefox-67.0.3.source.tar.xz) = c75075a48d950decdac295c879d0d9d75a17fdc5d32d1fd4b0ec9141f09f97603e2c5c1266257a21f7ccc53b919869f09e5829ab742811d040b4ecad29998682 From c02fc39cdc2bef8d89a42d34e85fc6bb25445051 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 18 Jun 2019 17:34:20 -0700 Subject: [PATCH 0008/1136] Disable debug builds by default --- firefox.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 45f3c22..9864d27 100644 --- a/firefox.spec +++ b/firefox.spec @@ -38,8 +38,8 @@ ExcludeArch: s390x %ifarch ppc64 s390x %global big_endian 1 %endif -%bcond_without debug_build -%if %{with debug_build} +%bcond_without debug +%if %{with debug} %global debug_build 1 %else %global debug_build 0 From c66793c7cf91b73bb2ee1fca385596054a7e8325 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 19 Jun 2019 01:59:51 -0700 Subject: [PATCH 0009/1136] removed bcond for debug build as it causes failures on koji --- firefox.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/firefox.spec b/firefox.spec index 9864d27..72f888e 100644 --- a/firefox.spec +++ b/firefox.spec @@ -38,12 +38,7 @@ ExcludeArch: s390x %ifarch ppc64 s390x %global big_endian 1 %endif -%bcond_without debug -%if %{with debug} -%global debug_build 1 -%else %global debug_build 0 -%endif %if 0%{?build_with_pgo} %global use_xvfb 1 From e80004137499a7e9e32a44779c6c39002af83423 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 19 Jun 2019 11:40:00 -0700 Subject: [PATCH 0010/1136] Disabled ppc64le PGO builds --- firefox.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 27eaece..bf67c86 100644 --- a/firefox.spec +++ b/firefox.spec @@ -20,7 +20,7 @@ ExcludeArch: s390x %global disable_elfhack 1 %global build_with_clang 0 %global use_bundled_cbindgen 1 -%ifnarch %{ix86} ppc64 s390x +%ifnarch %{ix86} ppc64 s390 ppc64le %if %{release_build} %global build_with_pgo 1 %else From 25b842803d0bab1be964ebacd5afabd9236ca94d Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 20 Jun 2019 10:26:20 -0700 Subject: [PATCH 0011/1136] Updated to 67.0.4 --- .gitignore | 2 ++ firefox.spec | 7 +++++-- sources | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 543e296..141c0c2 100644 --- a/.gitignore +++ b/.gitignore @@ -349,3 +349,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-67.0.2-20190611.tar.xz /firefox-langpacks-67.0.3-20190618.tar.xz /firefox-67.0.3.source.tar.xz +/firefox-67.0.4.source.tar.xz +/firefox-langpacks-67.0.4-20190620.tar.xz diff --git a/firefox.spec b/firefox.spec index bf67c86..c1c3014 100644 --- a/firefox.spec +++ b/firefox.spec @@ -92,13 +92,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 67.0.3 +Version: 67.0.4 Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190618.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190620.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -944,6 +944,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Jun 20 2019 Martin Stransky - 67.0.4-1 +- Updated to 67.0.4 + * Tue Jun 18 2019 Martin Stransky - 67.0.3-1 - Updated to 67.0.3 diff --git a/sources b/sources index 7e756cc..274916a 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-langpacks-67.0.3-20190618.tar.xz) = 855c6e28970556be60ac696ad0de20e23d430aa7927a1cdb18af09b918f3123a9fa4dcf993d982ecd6dfd28583bcdf039df0d6341e9b4136d9687cf299b0d2a4 -SHA512 (firefox-67.0.3.source.tar.xz) = c75075a48d950decdac295c879d0d9d75a17fdc5d32d1fd4b0ec9141f09f97603e2c5c1266257a21f7ccc53b919869f09e5829ab742811d040b4ecad29998682 +SHA512 (firefox-67.0.4.source.tar.xz) = 42abc837b5808a55e68273db6aa45fa73f8fe1df3c9072c94d8d049b6803ce8758745cc0a68af64c4ce9f86e5dd3b3619824ba67fabddce428204605894d9ee7 +SHA512 (firefox-langpacks-67.0.4-20190620.tar.xz) = 99a0528d7be28a26352dc43ef0090b38a83959af2b68d9b08015c83f523bbc9f364199a9016d13b5a039a2d8aaa164f8b4b0a210d0c62d209d5261dbfa9ada1f From ec241d8209f52813a2e99fd0abd1567aa2b46115 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 2 Jul 2019 12:23:46 +0200 Subject: [PATCH 0012/1136] Updated to 68.0 --- .gitignore | 2 + firefox-pipewire.patch | 43 - firefox.spec | 50 +- mozilla-1196777.patch | 10 +- mozilla-1423598-popup.patch | 203 --- mozilla-1467127.patch | 256 ---- mozilla-1468911.patch | 276 ---- mozilla-1508378.patch | 92 -- mozilla-1517205.patch | 209 --- mozilla-1526243.patch | 340 ----- mozilla-1532643-popup.patch | 71 - mozilla-1535567.patch | 136 -- mozilla-1539471.patch | 206 --- mozilla-1540145.patch | 156 -- mozilla-1552590.patch | 2701 ----------------------------------- sources | 4 +- 16 files changed, 19 insertions(+), 4736 deletions(-) delete mode 100644 mozilla-1423598-popup.patch delete mode 100644 mozilla-1467127.patch delete mode 100644 mozilla-1468911.patch delete mode 100644 mozilla-1508378.patch delete mode 100644 mozilla-1517205.patch delete mode 100644 mozilla-1526243.patch delete mode 100644 mozilla-1532643-popup.patch delete mode 100644 mozilla-1535567.patch delete mode 100644 mozilla-1539471.patch delete mode 100644 mozilla-1540145.patch delete mode 100644 mozilla-1552590.patch diff --git a/.gitignore b/.gitignore index 141c0c2..f3093a9 100644 --- a/.gitignore +++ b/.gitignore @@ -351,3 +351,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-67.0.3.source.tar.xz /firefox-67.0.4.source.tar.xz /firefox-langpacks-67.0.4-20190620.tar.xz +/firefox-68.0.source.tar.xz +/firefox-langpacks-68.0-20190702.tar.xz diff --git a/firefox-pipewire.patch b/firefox-pipewire.patch index aa1541b..816010e 100644 --- a/firefox-pipewire.patch +++ b/firefox-pipewire.patch @@ -17,49 +17,6 @@ diff -up firefox-66.0/config/system-headers.mozbuild.firefox-pipewire firefox-66 'pixman.h', 'pk11func.h', 'pk11pqg.h', -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc.firefox-pipewire 2019-03-12 15:27:37.675285710 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc 2019-03-12 15:27:37.675285710 +0100 -@@ -0,0 +1,39 @@ -+/* -+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+ -+#if defined(USE_X11) -+#include "modules/desktop_capture/app_capturer_x11.h" -+#endif // defined(USE_X11) -+ -+namespace webrtc { -+ -+// static -+AppCapturer* AppCapturer::Create(const DesktopCaptureOptions& options) { -+#if defined(USE_X11) -+ return AppCapturerX11::Create(options); -+#endif // defined(USE_X11) -+ -+ return nullptr; -+} -+ -+// static -+std::unique_ptr DesktopCapturer::CreateRawAppCapturer( -+ const DesktopCaptureOptions& options) { -+#if defined(USE_X11) -+ return AppCapturerX11::CreateRawAppCapturer(options); -+#endif // defined(USE_X11) -+ -+ return nullptr; -+} -+ -+} // namespace webrtc diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc --- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100 +++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc 2019-03-12 15:27:37.675285710 +0100 diff --git a/firefox.spec b/firefox.spec index c1c3014..57d88ba 100644 --- a/firefox.spec +++ b/firefox.spec @@ -76,15 +76,8 @@ ExcludeArch: s390x %bcond_without langpacks +# Disable crashreporter as we want to collect Wayland crashes. %global enable_mozilla_crashreporter 0 -%if !%{debug_build} -%ifarch %{ix86} x86_64 -# Disable crashreporter sa we want to collect Wayland crashes. -%if 0%{?fedora} < 28 -%global enable_mozilla_crashreporter 1 -%endif -%endif -%endif %if !%{release_build} %global pre_tag .test @@ -92,13 +85,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 67.0.4 +Version: 68.0 Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190620.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190702.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -142,23 +135,12 @@ Patch227: firefox-locale-debug.patch # Upstream patches Patch402: mozilla-1196777.patch Patch412: mozilla-1337988.patch -Patch413: mozilla-1353817.patch +#Patch413: mozilla-1353817.patch Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch Patch417: bug1375074-save-restore-x28.patch -Patch418: mozilla-1526243.patch -Patch419: mozilla-1540145.patch # Wayland specific upstream patches -Patch574: firefox-pipewire.patch -Patch575: mozilla-1423598-popup.patch -Patch576: mozilla-1532643-popup.patch -Patch577: mozilla-1535567.patch -Patch579: mozilla-1468911.patch -Patch580: mozilla-1539471.patch -Patch581: mozilla-1517205.patch -Patch582: mozilla-1508378.patch -Patch583: mozilla-1467127.patch -Patch584: mozilla-1552590.patch +#Patch574: firefox-pipewire.patch # PGO/LTO patches Patch600: pgo.patch @@ -204,9 +186,7 @@ BuildRequires: clang-libs %if 0%{?build_with_clang} BuildRequires: lld %endif -%if 0%{?fedora} > 28 BuildRequires: pipewire-devel -%endif %if !0%{?use_bundled_cbindgen} BuildRequires: cbindgen %endif @@ -351,7 +331,7 @@ This package contains results of tests executed during build. %patch227 -p1 -b .locale-debug %patch402 -p1 -b .1196777 -%patch413 -p1 -b .1353817 +#%patch413 -p1 -b .1353817 %ifarch %{arm} %patch415 -p1 -b .1238661 %endif @@ -359,22 +339,9 @@ This package contains results of tests executed during build. %if 0%{?big_endian} %patch26 -p1 -b .icu %endif -%patch418 -p1 -b .mozilla-1526243 -%patch419 -p1 -b .mozilla-1540145 # Wayland specific upstream patches -%if 0%{?fedora} > 28 -%patch574 -p1 -b .firefox-pipewire -%endif -%patch575 -p1 -b .mozilla-1423598-popup -%patch576 -p1 -b .mozilla-1532643-popup -%patch577 -p1 -b .mozilla-1535567 -%patch579 -p1 -b .mozilla-1468911 -%patch580 -p1 -b .mozilla-1539471 -%patch581 -p1 -b .mozilla-1517205 -%patch582 -p1 -b .mozilla-1508378 -#%patch583 -p1 -b .mozilla-1467127 -#%patch584 -p1 -b .mozilla-1552590 +#%patch574 -p1 -b .firefox-pipewire # PGO patches %patch600 -p1 -b .pgo @@ -944,6 +911,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Jul 2 2019 Martin Stransky - 68.0-1 +- Updated to 68.0 + * Thu Jun 20 2019 Martin Stransky - 67.0.4-1 - Updated to 67.0.4 diff --git a/mozilla-1196777.patch b/mozilla-1196777.patch index 6606fe3..ed3ab16 100644 --- a/mozilla-1196777.patch +++ b/mozilla-1196777.patch @@ -1,6 +1,6 @@ -diff -up firefox-65.0/widget/gtk/nsWindow.cpp.1196777 firefox-65.0/widget/gtk/nsWindow.cpp ---- firefox-65.0/widget/gtk/nsWindow.cpp.1196777 2019-01-28 14:37:27.470163867 +0100 -+++ firefox-65.0/widget/gtk/nsWindow.cpp 2019-01-28 14:41:52.479064393 +0100 +diff -up firefox-68.0/widget/gtk/nsWindow.cpp.1196777 firefox-68.0/widget/gtk/nsWindow.cpp +--- firefox-68.0/widget/gtk/nsWindow.cpp.1196777 2019-07-02 11:47:06.864726826 +0200 ++++ firefox-68.0/widget/gtk/nsWindow.cpp 2019-07-02 11:48:09.896544339 +0200 @@ -156,7 +156,8 @@ const gint kEvents = #if GTK_CHECK_VERSION(3, 4, 0) GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK | @@ -9,5 +9,5 @@ diff -up firefox-65.0/widget/gtk/nsWindow.cpp.1196777 firefox-65.0/widget/gtk/ns + GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK | + GDK_FOCUS_CHANGE_MASK; - /* utility functions */ - static bool is_mouse_in_window(GdkWindow *aWindow, gdouble aMouseX, + #if !GTK_CHECK_VERSION(3, 22, 0) + typedef enum { diff --git a/mozilla-1423598-popup.patch b/mozilla-1423598-popup.patch deleted file mode 100644 index bacac7d..0000000 --- a/mozilla-1423598-popup.patch +++ /dev/null @@ -1,203 +0,0 @@ -diff -up firefox-67.0/widget/gtk/nsWindow.cpp.mozilla-1423598-popup firefox-67.0/widget/gtk/nsWindow.cpp ---- firefox-67.0/widget/gtk/nsWindow.cpp.mozilla-1423598-popup 2019-05-15 15:21:25.590222702 +0200 -+++ firefox-67.0/widget/gtk/nsWindow.cpp 2019-05-15 15:24:26.925439991 +0200 -@@ -1115,13 +1115,89 @@ void nsWindow::Move(double aX, double aY - NotifyRollupGeometryChange(); - } - -+#ifdef DEBUG -+static void NativeMoveResizeWaylandPopupCallback(GdkWindow *window, -+ const GdkRectangle *flipped_rect, const GdkRectangle *final_rect, -+ gboolean flipped_x, gboolean flipped_y, void *unused) -+{ -+ LOG(("NativeMoveResizeWaylandPopupCallback flipped %d %d\n", -+ flipped_rect->x, flipped_rect->y)); -+ LOG(("NativeMoveResizeWaylandPopupCallback final %d %d\n", -+ final_rect->x, final_rect->y)); -+} -+#endif -+ -+void nsWindow::NativeMoveResizeWaylandPopup(GdkPoint* aPosition, GdkRectangle* aSize) { -+ // Available as of GTK 3.24+ -+ static auto sGdkWindowMoveToRect = -+ (void (*)(GdkWindow *, const GdkRectangle *, GdkGravity, GdkGravity, -+ GdkAnchorHints, gint, gint)) -+ dlsym(RTLD_DEFAULT, "gdk_window_move_to_rect"); -+ -+ if (aSize) { -+ gtk_window_resize(GTK_WINDOW(mShell), aSize->width, aSize->height); -+ } -+ if (!sGdkWindowMoveToRect) { -+ gtk_window_move(GTK_WINDOW(mShell), aPosition->x, aPosition->y); -+ return; -+ } -+ -+ GdkWindow *gdkWindow = gtk_widget_get_window(GTK_WIDGET(mShell)); -+ if (!gdkWindow) { -+ return; -+ } -+ -+ GtkWidget* parentWidget = -+ GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); -+ -+ int x_parent, y_parent; -+ gdk_window_get_origin(gtk_widget_get_window(parentWidget), &x_parent, &y_parent); -+ -+ GdkRectangle rect = { aPosition->x - x_parent, -+ aPosition->y - y_parent, -+ 1, 1}; -+ if (aSize) { -+ rect.width = aSize->width; -+ rect.height = aSize->height; -+ } -+ -+#ifdef DEBUG -+ LOG(("NativeMoveResizeWaylandPopup request position %d,%d\n", -+ aPosition->x, aPosition->y)); -+ if (aSize) { -+ LOG(("NativeMoveResizeWaylandPopup request size %d,%d\n", -+ aSize->width, aSize->height)); -+ } -+ LOG(("NativeMoveResizeWaylandPopup result %d %d\n", rect.x, rect.y)); -+ g_signal_connect(gdkWindow, "moved-to-rect", -+ G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this); -+#endif -+ -+ GdkGravity rectAnchor = GDK_GRAVITY_NORTH_WEST; -+ GdkGravity menuAnchor = GDK_GRAVITY_NORTH_WEST; -+ if (GetTextDirection() == GTK_TEXT_DIR_RTL) { -+ rectAnchor = GDK_GRAVITY_NORTH_EAST; -+ menuAnchor = GDK_GRAVITY_NORTH_EAST; -+ } -+ -+ GdkAnchorHints hints = GdkAnchorHints(GDK_ANCHOR_SLIDE | GDK_ANCHOR_FLIP); -+ if (aSize) { -+ hints = GdkAnchorHints(hints|GDK_ANCHOR_RESIZE); -+ } -+ -+ sGdkWindowMoveToRect(gdkWindow, &rect, rectAnchor, menuAnchor, hints, 0, 0); -+} -+ - void nsWindow::NativeMove() { - GdkPoint point = DevicePixelsToGdkPointRoundDown(mBounds.TopLeft()); -- -- if (mIsTopLevel) { -- gtk_window_move(GTK_WINDOW(mShell), point.x, point.y); -- } else if (mGdkWindow) { -- gdk_window_move(mGdkWindow, point.x, point.y); -+ if (!mIsX11Display && mIsTopLevel && mWindowType == eWindowType_popup) { -+ NativeMoveResizeWaylandPopup(&point, nullptr); -+ } else { -+ if (mIsTopLevel) { -+ gtk_window_move(GTK_WINDOW(mShell), point.x, point.y); -+ } else if (mGdkWindow) { -+ gdk_window_move(mGdkWindow, point.x, point.y); -+ } - } - } - -@@ -3412,11 +3488,6 @@ nsresult nsWindow::Create(nsIWidget *aPa - GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); - } else if (mWindowType == eWindowType_popup) { -- // With popup windows, we want to control their position, so don't -- // wait for the window manager to place them (which wouldn't -- // happen with override-redirect windows anyway). -- NativeMove(); -- - gtk_window_set_wmclass(GTK_WINDOW(mShell), "Popup", - gdk_get_program_class()); - -@@ -3475,6 +3546,14 @@ nsresult nsWindow::Create(nsIWidget *aPa - if (topLevelParent) { - gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); - } -+ -+ // We need realized mShell at NativeMove(). -+ gtk_widget_realize(mShell); -+ -+ // With popup windows, we want to control their position, so don't -+ // wait for the window manager to place them (which wouldn't -+ // happen with override-redirect windows anyway). -+ NativeMove(); - } else { // must be eWindowType_toplevel - SetDefaultIcon(); - gtk_window_set_wmclass(GTK_WINDOW(mShell), "Toplevel", -@@ -3918,23 +3997,27 @@ void nsWindow::NativeMoveResize() { - LOG(("nsWindow::NativeMoveResize [%p] %d %d %d %d\n", (void *)this, topLeft.x, - topLeft.y, size.width, size.height)); - -- if (mIsTopLevel) { -- // x and y give the position of the window manager frame top-left. -- gtk_window_move(GTK_WINDOW(mShell), topLeft.x, topLeft.y); -- // This sets the client window size. -- MOZ_ASSERT(size.width > 0 && size.height > 0, -- "Can't resize window smaller than 1x1."); -- gtk_window_resize(GTK_WINDOW(mShell), size.width, size.height); -- } else if (mContainer) { -- GtkAllocation allocation; -- allocation.x = topLeft.x; -- allocation.y = topLeft.y; -- allocation.width = size.width; -- allocation.height = size.height; -- gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation); -- } else if (mGdkWindow) { -- gdk_window_move_resize(mGdkWindow, topLeft.x, topLeft.y, size.width, -- size.height); -+ if (!mIsX11Display && mIsTopLevel && mWindowType == eWindowType_popup) { -+ NativeMoveResizeWaylandPopup(&topLeft, &size); -+ } else { -+ if (mIsTopLevel) { -+ // x and y give the position of the window manager frame top-left. -+ gtk_window_move(GTK_WINDOW(mShell), topLeft.x, topLeft.y); -+ // This sets the client window size. -+ MOZ_ASSERT(size.width > 0 && size.height > 0, -+ "Can't resize window smaller than 1x1."); -+ gtk_window_resize(GTK_WINDOW(mShell), size.width, size.height); -+ } else if (mContainer) { -+ GtkAllocation allocation; -+ allocation.x = topLeft.x; -+ allocation.y = topLeft.y; -+ allocation.width = size.width; -+ allocation.height = size.height; -+ gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation); -+ } else if (mGdkWindow) { -+ gdk_window_move_resize(mGdkWindow, topLeft.x, topLeft.y, size.width, -+ size.height); -+ } - } - - #ifdef MOZ_X11 -@@ -6818,3 +6901,18 @@ void nsWindow::ForceTitlebarRedraw(void) - RestyleHint{0}, nsChangeHint_RepaintFrame); - } - } -+ -+GtkTextDirection nsWindow::GetTextDirection() { -+ nsView *view = nsView::GetViewFor(this); -+ if (!view) { -+ return GTK_TEXT_DIR_LTR; -+ } -+ nsIFrame *frame = view->GetFrame(); -+ if (!frame) { -+ return GTK_TEXT_DIR_LTR; -+ } -+ -+ WritingMode wm = frame->GetWritingMode(); -+ bool isFrameRTL = !(wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR()); -+ return isFrameRTL ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR; -+} -diff -up firefox-67.0/widget/gtk/nsWindow.h.mozilla-1423598-popup firefox-67.0/widget/gtk/nsWindow.h ---- firefox-67.0/widget/gtk/nsWindow.h.mozilla-1423598-popup 2019-05-14 01:08:37.000000000 +0200 -+++ firefox-67.0/widget/gtk/nsWindow.h 2019-05-15 15:21:25.890221541 +0200 -@@ -460,6 +460,10 @@ class nsWindow final : public nsBaseWidg - nsWindow* GetTransientForWindowIfPopup(); - bool IsHandlingTouchSequence(GdkEventSequence* aSequence); - -+ void NativeMoveResizeWaylandPopup(GdkPoint* aPosition, GdkRectangle* aSize); -+ -+ GtkTextDirection GetTextDirection(); -+ - #ifdef MOZ_X11 - typedef enum {GTK_WIDGET_COMPOSIDED_DEFAULT = 0, - GTK_WIDGET_COMPOSIDED_DISABLED = 1, diff --git a/mozilla-1467127.patch b/mozilla-1467127.patch deleted file mode 100644 index 69a8903..0000000 --- a/mozilla-1467127.patch +++ /dev/null @@ -1,256 +0,0 @@ -diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp ---- a/gfx/thebes/gfxPlatform.cpp -+++ b/gfx/thebes/gfxPlatform.cpp -@@ -70,6 +70,10 @@ - # include "mozilla/gfx/DeviceManagerDx.h" - #endif - -+#ifdef MOZ_WAYLAND -+# include "mozilla/widget/nsWaylandDisplayShutdown.h" -+#endif -+ - #include "nsGkAtoms.h" - #include "gfxPlatformFontList.h" - #include "gfxContext.h" -@@ -1276,6 +1280,9 @@ - layers::PaintThread::Shutdown(); - } - } else if (XRE_IsParentProcess()) { -+#ifdef MOZ_WAYLAND -+ widget::WaylandDisplayShutdown(); -+#endif - gfx::VRManagerChild::ShutDown(); - layers::CompositorManagerChild::Shutdown(); - layers::ImageBridgeChild::ShutDown(); -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -144,6 +144,8 @@ - (wl_buffer/wl_surface). - */ - -+#define EVENT_LOOP_DELAY (1000 / 240) -+ - #define BUFFER_BPP 4 - gfx::SurfaceFormat WindowBackBuffer::mFormat = gfx::SurfaceFormat::B8G8R8A8; - -diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build ---- a/widget/gtk/moz.build -+++ b/widget/gtk/moz.build -@@ -101,6 +101,9 @@ - 'nsWaylandDisplay.cpp', - 'WindowSurfaceWayland.cpp', - ] -+ EXPORTS.mozilla.widget += [ -+ 'nsWaylandDisplayShutdown.h' -+ ] - - if CONFIG['ACCESSIBILITY']: - UNIFIED_SOURCES += [ -diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp ---- a/widget/gtk/nsAppShell.cpp -+++ b/widget/gtk/nsAppShell.cpp -@@ -27,6 +27,9 @@ - #include "ScreenHelperGTK.h" - #include "HeadlessScreenHelper.h" - #include "mozilla/widget/ScreenManager.h" -+#ifdef MOZ_WAYLAND -+# include "nsWaylandDisplay.h" -+#endif - - using mozilla::LazyLogModule; - using mozilla::Unused; -@@ -267,5 +270,9 @@ - } - - bool nsAppShell::ProcessNextNativeEvent(bool mayWait) { -- return g_main_context_iteration(nullptr, mayWait); -+ bool ret = g_main_context_iteration(nullptr, mayWait); -+#ifdef MOZ_WAYLAND -+ WaylandDispatchDisplays(); -+#endif -+ return ret; - } -diff --git a/widget/gtk/nsWaylandDisplay.h b/widget/gtk/nsWaylandDisplay.h ---- a/widget/gtk/nsWaylandDisplay.h -+++ b/widget/gtk/nsWaylandDisplay.h -@@ -14,10 +14,6 @@ - namespace mozilla { - namespace widget { - --// TODO: Bug 1467125 - We need to integrate wl_display_dispatch_queue_pending() --// with compositor event loop. --#define EVENT_LOOP_DELAY (1000 / 240) -- - // Our general connection to Wayland display server, - // holds our display connection and runs event loop. - class nsWaylandDisplay { -@@ -25,9 +21,10 @@ - explicit nsWaylandDisplay(wl_display* aDisplay); - virtual ~nsWaylandDisplay(); - -- bool DisplayLoop(); -+ bool DispatchEventQueue(); - bool Matches(wl_display* aDisplay); - -+ MessageLoop* GetDispatcherThreadLoop() { return mDispatcherThreadLoop; } - wl_display* GetDisplay() { return mDisplay; }; - wl_event_queue* GetEventQueue() { return mEventQueue; }; - wl_subcompositor* GetSubcompositor(void) { return mSubcompositor; }; -@@ -47,7 +44,10 @@ - void SetPrimarySelectionDeviceManager( - gtk_primary_selection_device_manager* aPrimarySelectionDeviceManager); - -+ void Shutdown(); -+ - private: -+ MessageLoop* mDispatcherThreadLoop; - PRThread* mThreadId; - wl_display* mDisplay; - wl_event_queue* mEventQueue; -@@ -59,6 +59,7 @@ - wl_registry* mRegistry; - }; - -+void WaylandDispatchDisplays(); - nsWaylandDisplay* WaylandDisplayGet(GdkDisplay* aGdkDisplay = nullptr); - - } // namespace widget -diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp ---- a/widget/gtk/nsWaylandDisplay.cpp -+++ b/widget/gtk/nsWaylandDisplay.cpp -@@ -21,6 +21,15 @@ - static nsWaylandDisplay *gWaylandDisplays[MAX_DISPLAY_CONNECTIONS]; - static StaticMutex gWaylandDisplaysMutex; - -+void WaylandDisplayShutdown() { -+ StaticMutexAutoLock lock(gWaylandDisplaysMutex); -+ for (auto &display : gWaylandDisplays) { -+ if (display) { -+ display->Shutdown(); -+ } -+ } -+} -+ - static void ReleaseDisplaysAtExit() { - for (int i = 0; i < MAX_DISPLAY_CONNECTIONS; i++) { - delete gWaylandDisplays[i]; -@@ -28,6 +37,10 @@ - } - } - -+static void DispatchDisplay(nsWaylandDisplay *aDisplay) { -+ aDisplay->DispatchEventQueue(); -+} -+ - // Each thread which is using wayland connection (wl_display) has to operate - // its own wl_event_queue. Main Firefox thread wl_event_queue is handled - // by Gtk main loop, other threads/wl_event_queue has to be handled by us. -@@ -35,7 +48,15 @@ - // nsWaylandDisplay is our interface to wayland compositor. It provides wayland - // global objects as we need (wl_display, wl_shm) and operates wl_event_queue on - // compositor (not the main) thread. --static void WaylandDisplayLoop(wl_display *aDisplay); -+void WaylandDispatchDisplays() { -+ StaticMutexAutoLock lock(gWaylandDisplaysMutex); -+ for (auto &display : gWaylandDisplays) { -+ if (display && display->GetDispatcherThreadLoop()) { -+ display->GetDispatcherThreadLoop()->PostTask(NewRunnableFunction( -+ "WaylandDisplayDispatch", &DispatchDisplay, display)); -+ } -+ } -+} - - // Get WaylandDisplay for given wl_display and actual calling thread. - static nsWaylandDisplay *WaylandDisplayGetLocked(GdkDisplay *aGdkDisplay, -@@ -73,27 +94,6 @@ - return WaylandDisplayGetLocked(aGdkDisplay, lock); - } - --static void WaylandDisplayLoopLocked(wl_display *aDisplay, -- const StaticMutexAutoLock &) { -- for (auto &display : gWaylandDisplays) { -- if (display && display->Matches(aDisplay)) { -- if (display->DisplayLoop()) { -- MessageLoop::current()->PostDelayedTask( -- NewRunnableFunction("WaylandDisplayLoop", &WaylandDisplayLoop, -- aDisplay), -- EVENT_LOOP_DELAY); -- } -- break; -- } -- } --} -- --static void WaylandDisplayLoop(wl_display *aDisplay) { -- MOZ_ASSERT(!NS_IsMainThread()); -- StaticMutexAutoLock lock(gWaylandDisplaysMutex); -- WaylandDisplayLoopLocked(aDisplay, lock); --} -- - void nsWaylandDisplay::SetShm(wl_shm *aShm) { mShm = aShm; } - - void nsWaylandDisplay::SetSubcompositor(wl_subcompositor *aSubcompositor) { -@@ -158,7 +158,7 @@ - static const struct wl_registry_listener registry_listener = { - global_registry_handler, global_registry_remover}; - --bool nsWaylandDisplay::DisplayLoop() { -+bool nsWaylandDisplay::DispatchEventQueue() { - wl_display_dispatch_queue_pending(mDisplay, mEventQueue); - return true; - } -@@ -168,7 +168,8 @@ - } - - nsWaylandDisplay::nsWaylandDisplay(wl_display *aDisplay) -- : mThreadId(PR_GetCurrentThread()), -+ : mDispatcherThreadLoop(nullptr), -+ mThreadId(PR_GetCurrentThread()), - mDisplay(aDisplay), - mEventQueue(nullptr), - mDataDeviceManager(nullptr), -@@ -186,15 +187,16 @@ - wl_display_roundtrip(mDisplay); - wl_display_roundtrip(mDisplay); - } else { -+ mDispatcherThreadLoop = MessageLoop::current(); - mEventQueue = wl_display_create_queue(mDisplay); -- MessageLoop::current()->PostTask(NewRunnableFunction( -- "WaylandDisplayLoop", &WaylandDisplayLoop, mDisplay)); - wl_proxy_set_queue((struct wl_proxy *)mRegistry, mEventQueue); - wl_display_roundtrip_queue(mDisplay, mEventQueue); - wl_display_roundtrip_queue(mDisplay, mEventQueue); - } - } - -+void nsWaylandDisplay::Shutdown() { mDispatcherThreadLoop = nullptr; } -+ - nsWaylandDisplay::~nsWaylandDisplay() { - // Owned by Gtk+, we don't need to release - mDisplay = nullptr; -diff --git a/widget/gtk/nsWaylandDisplayShutdown.h b/widget/gtk/nsWaylandDisplayShutdown.h -new file mode 100644 ---- /dev/null -+++ b/widget/gtk/nsWaylandDisplayShutdown.h -@@ -0,0 +1,19 @@ -+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -+/* vim:expandtab:shiftwidth=4:tabstop=4: -+ */ -+/* This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -+ -+#ifndef __MOZ_WAYLAND_DISPLAY_SHUTDOWN_H__ -+#define __MOZ_WAYLAND_DISPLAY_SHUTDOWN_H__ -+ -+namespace mozilla { -+namespace widget { -+ -+void WaylandDisplayShutdown(); -+ -+} // namespace widget -+} // namespace mozilla -+ -+#endif // __MOZ_WAYLAND_DISPLAY_SHUTDOWN_H__ - diff --git a/mozilla-1468911.patch b/mozilla-1468911.patch deleted file mode 100644 index 209a5a7..0000000 --- a/mozilla-1468911.patch +++ /dev/null @@ -1,276 +0,0 @@ -changeset: 465236:be9a6c98a4a7 -tag: tip -user: Martin Stransky -date: Mon Mar 18 10:42:48 2019 +0100 -summary: tearing - - -diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp ---- a/widget/gtk/nsAppShell.cpp -+++ b/widget/gtk/nsAppShell.cpp -@@ -35,16 +35,17 @@ using mozilla::widget::ScreenHelperGTK; - using mozilla::widget::ScreenManager; - - #define NOTIFY_TOKEN 0xFA - - LazyLogModule gWidgetLog("Widget"); - LazyLogModule gWidgetFocusLog("WidgetFocus"); - LazyLogModule gWidgetDragLog("WidgetDrag"); - LazyLogModule gWidgetDrawLog("WidgetDraw"); -+LazyLogModule gWidgetWaylandLog("WidgetWayland"); - - static GPollFunc sPollFunc; - - // Wrapper function to disable hang monitoring while waiting in poll(). - static gint PollWrapper(GPollFD* ufds, guint nfsd, gint timeout_) { - mozilla::BackgroundHangMonitor().NotifyWait(); - gint result; - { - -diff -up firefox-66.0/widget/gtk/WindowSurfaceWayland.cpp.old firefox-66.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-66.0/widget/gtk/WindowSurfaceWayland.cpp.old 2019-03-20 15:48:52.265966904 +0100 -+++ firefox-66.0/widget/gtk/WindowSurfaceWayland.cpp 2019-03-20 14:48:21.082035284 +0100 -@@ -20,6 +20,18 @@ - #include - #include - -+#undef LOG -+#ifdef MOZ_LOGGING -+# include "mozilla/Logging.h" -+# include "nsTArray.h" -+# include "Units.h" -+extern mozilla::LazyLogModule gWidgetWaylandLog; -+# define LOGWAYLAND(args) \ -+ MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Debug, args) -+#else -+# define LOGWAYLAND(args) -+#endif /* MOZ_LOGGING */ -+ - namespace mozilla { - namespace widget { - -@@ -241,7 +253,7 @@ WaylandShmPool::~WaylandShmPool() { - - static void buffer_release(void* data, wl_buffer* buffer) { - auto surface = reinterpret_cast(data); -- surface->Detach(); -+ surface->Detach(buffer); - } - - static const struct wl_buffer_listener buffer_listener = {buffer_release}; -@@ -261,9 +273,16 @@ void WindowBackBuffer::Create(int aWidth - - mWidth = aWidth; - mHeight = aHeight; -+ -+ LOGWAYLAND(( -+ "%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, -+ (void*)mWaylandBuffer, -+ mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); - } - - void WindowBackBuffer::Release() { -+ LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); -+ - wl_buffer_destroy(mWaylandBuffer); - mWidth = mHeight = 0; - } -@@ -288,6 +307,9 @@ WindowBackBuffer::~WindowBackBuffer() { - bool WindowBackBuffer::Resize(int aWidth, int aHeight) { - if (aWidth == mWidth && aHeight == mHeight) return true; - -+ LOGWAYLAND( -+ ("%s [%p] %d %d\n", __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); -+ - Release(); - Create(aWidth, aHeight); - -@@ -295,13 +317,26 @@ bool WindowBackBuffer::Resize(int aWidth - } - - void WindowBackBuffer::Attach(wl_surface* aSurface) { -+ LOGWAYLAND(( -+ "%s [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ (void*)this, (void*)aSurface, -+ aSurface ? wl_proxy_get_id((struct wl_proxy*)aSurface) : -1, -+ (void*)mWaylandBuffer, -+ mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); -+ - wl_surface_attach(aSurface, mWaylandBuffer, 0, 0); - wl_surface_commit(aSurface); - wl_display_flush(mWaylandDisplay->GetDisplay()); - mAttached = true; - } - --void WindowBackBuffer::Detach() { mAttached = false; } -+void WindowBackBuffer::Detach(wl_buffer* aBuffer) { -+ LOGWAYLAND(("%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, -+ (void*)aBuffer, -+ aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1)); -+ -+ mAttached = false; -+} - - bool WindowBackBuffer::SetImageDataFromBuffer( - class WindowBackBuffer* aSourceBuffer) { -@@ -316,6 +351,11 @@ bool WindowBackBuffer::SetImageDataFromB - } - - already_AddRefed WindowBackBuffer::Lock() { -+ LOGWAYLAND(( -+ "%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ (void*)this, mWidth, mHeight, (void*)mWaylandBuffer, -+ mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); -+ - gfx::IntSize lockSize(mWidth, mHeight); - return gfxPlatform::CreateDrawTargetForData( - static_cast(mShmPool.GetImageData()), lockSize, -@@ -345,7 +385,8 @@ WindowSurfaceWayland::WindowSurfaceWayla - mPendingCommit(false), - mWaylandBufferFullScreenDamage(false), - mIsMainThread(NS_IsMainThread()), -- mNeedScaleFactorUpdate(true) { -+ mNeedScaleFactorUpdate(true), -+ mWaitToFullScreenUpdate(true) { - for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; - } - -@@ -387,7 +428,11 @@ WindowSurfaceWayland::~WindowSurfaceWayl - WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(int aWidth, - int aHeight) { - if (!mWaylandBuffer) { -+ LOGWAYLAND(("%s [%p] Create [%d x %d]\n", __PRETTY_FUNCTION__, (void*)this, -+ aWidth, aHeight)); -+ - mWaylandBuffer = new WindowBackBuffer(mWaylandDisplay, aWidth, aHeight); -+ mWaitToFullScreenUpdate = true; - return mWaylandBuffer; - } - -@@ -396,8 +441,11 @@ WindowBackBuffer* WindowSurfaceWayland:: - mWaylandBuffer->Resize(aWidth, aHeight); - // There's a chance that scale factor has been changed - // when buffer size changed -- mNeedScaleFactorUpdate = true; -+ mWaitToFullScreenUpdate = true; - } -+ LOGWAYLAND(("%s [%p] Reuse buffer [%d x %d]\n", __PRETTY_FUNCTION__, -+ (void*)this, aWidth, aHeight)); -+ - return mWaylandBuffer; - } - -@@ -420,6 +468,8 @@ WindowBackBuffer* WindowSurfaceWayland:: - } - - if (MOZ_UNLIKELY(availableBuffer == BACK_BUFFER_NUM)) { -+ LOGWAYLAND(("%s [%p] No drawing buffer available!\n", __PRETTY_FUNCTION__, -+ (void*)this)); - NS_WARNING("No drawing buffer available"); - return nullptr; - } -@@ -429,6 +479,8 @@ WindowBackBuffer* WindowSurfaceWayland:: - mBackupBuffer[availableBuffer] = lastWaylandBuffer; - - if (lastWaylandBuffer->IsMatchingSize(aWidth, aHeight)) { -+ LOGWAYLAND(("%s [%p] Copy from old buffer [%d x %d]\n", __PRETTY_FUNCTION__, -+ (void*)this, aWidth, aHeight)); - // Former front buffer has the same size as a requested one. - // Gecko may expect a content already drawn on screen so copy - // existing data to the new buffer. -@@ -437,9 +489,12 @@ WindowBackBuffer* WindowSurfaceWayland:: - // (https://bugzilla.redhat.com/show_bug.cgi?id=1418260) - mWaylandBufferFullScreenDamage = true; - } else { -+ LOGWAYLAND(("%s [%p] Resize to [%d x %d]\n", __PRETTY_FUNCTION__, -+ (void*)this, aWidth, aHeight)); - // Former buffer has different size from the new request. Only resize - // the new buffer and leave gecko to render new whole content. - mWaylandBuffer->Resize(aWidth, aHeight); -+ mWaitToFullScreenUpdate = true; - } - - return mWaylandBuffer; -@@ -499,6 +554,10 @@ already_AddRefed Window - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); - gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); - -+ LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", -+ __PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height, -+ screenRect.width, lockSize.height)); -+ - // Are we asked for entire nsWindow to draw? - mDrawToWaylandBufferDirectly = - (aRegion.GetNumRects() == 1 && bounds.x == 0 && bounds.y == 0 && -@@ -510,6 +569,13 @@ already_AddRefed Window - LockWaylandBuffer(screenRect.width, screenRect.height, - mWindow->WaylandSurfaceNeedsClear()); - if (dt) { -+ // When we have a request to update whole screen at once -+ // (surface was created, resized or changed somehow) -+ // we also need update scale factor of the screen. -+ if (mWaitToFullScreenUpdate) { -+ mWaitToFullScreenUpdate = false; -+ mNeedScaleFactorUpdate = true; -+ } - return dt.forget(); - } - -@@ -576,6 +642,10 @@ static void WaylandBufferDelayCommitHand - void WindowSurfaceWayland::CommitWaylandBuffer() { - MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); - -+ if (mWaitToFullScreenUpdate) { -+ return; -+ } -+ - wl_surface* waylandSurface = mWindow->GetWaylandSurface(); - if (!waylandSurface) { - // Target window is not created yet - delay the commit. This can happen only -@@ -619,6 +689,7 @@ void WindowSurfaceWayland::CommitWayland - LayoutDeviceIntRect rect = mWindow->GetBounds(); - wl_surface_damage(waylandSurface, 0, 0, rect.width, rect.height); - mWaylandBufferFullScreenDamage = false; -+ mNeedScaleFactorUpdate = true; - } else { - gint scaleFactor = mWindow->GdkScaleFactor(); - for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); -@@ -653,6 +724,18 @@ void WindowSurfaceWayland::CommitWayland - void WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); - -+#ifdef DEBUG -+ { -+ LayoutDeviceIntRect screenRect = mWindow->GetBounds(); -+ gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); -+ gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); -+ -+ LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", -+ __PRETTY_FUNCTION__, (void*)this, lockSize.width, -+ lockSize.height, screenRect.width, lockSize.height)); -+ } -+#endif -+ - // We have new content at mImageSurface - copy data to mWaylandBuffer first. - if (!mDrawToWaylandBufferDirectly) { - CommitImageSurfaceToWaylandBuffer(aInvalidRegion); -diff -up firefox-66.0/widget/gtk/WindowSurfaceWayland.h.old firefox-66.0/widget/gtk/WindowSurfaceWayland.h ---- firefox-66.0/widget/gtk/WindowSurfaceWayland.h.old 2019-03-20 15:48:56.218949138 +0100 -+++ firefox-66.0/widget/gtk/WindowSurfaceWayland.h 2019-03-20 14:48:21.082035284 +0100 -@@ -46,7 +46,7 @@ class WindowBackBuffer { - already_AddRefed Lock(); - - void Attach(wl_surface* aSurface); -- void Detach(); -+ void Detach(wl_buffer* aBuffer); - bool IsAttached() { return mAttached; } - - void Clear(); -@@ -118,6 +118,7 @@ class WindowSurfaceWayland : public Wind - bool mWaylandBufferFullScreenDamage; - bool mIsMainThread; - bool mNeedScaleFactorUpdate; -+ bool mWaitToFullScreenUpdate; - }; - - } // namespace widget diff --git a/mozilla-1508378.patch b/mozilla-1508378.patch deleted file mode 100644 index bbbce4b..0000000 --- a/mozilla-1508378.patch +++ /dev/null @@ -1,92 +0,0 @@ -changeset: 468935:3b964face103 -tag: tip -user: Martin Stransky -date: Wed Apr 10 15:14:32 2019 +0200 -summary: Bug 1508378 - Fix round error when damage rect size/position is odd number and scale factor is used, r=lsalzman - -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -624,16 +624,33 @@ static void WaylandBufferDelayCommitHand - } else { - // Referenced WindowSurfaceWayland is already deleted. - // Do nothing but just release the mDelayedCommitHandle allocated at - // WindowSurfaceWayland::CommitWaylandBuffer(). - free(aSurface); - } - } - -+void WindowSurfaceWayland::CalcRectScale(LayoutDeviceIntRect& aRect, int aScale) { -+ if (aRect.x & 0x1) { -+ aRect.width += 1; -+ } -+ aRect.x = aRect.x / aScale; -+ -+ if (aRect.y & 0x1) { -+ aRect.height += 1; -+ } -+ aRect.y = aRect.y / aScale; -+ -+ aRect.width = (aRect.width & 0x1) ? aRect.width / aScale + 1 : -+ aRect.width / aScale; -+ aRect.height = (aRect.height & 0x1) ? aRect.height / aScale + 1 : -+ aRect.height / aScale; -+} -+ - void WindowSurfaceWayland::CommitWaylandBuffer() { - MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); - - if (mWaitToFullScreenUpdate) { - return; - } - - wl_surface* waylandSurface = mWindow->GetWaylandSurface(); -@@ -679,21 +696,23 @@ void WindowSurfaceWayland::CommitWayland - LayoutDeviceIntRect rect = mWindow->GetBounds(); - wl_surface_damage(waylandSurface, 0, 0, rect.width, rect.height); - mWaylandBufferFullScreenDamage = false; - mNeedScaleFactorUpdate = true; - } else { - gint scaleFactor = mWindow->GdkScaleFactor(); - for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); - iter.Next()) { -- const mozilla::LayoutDeviceIntRect& r = iter.Get(); -+ mozilla::LayoutDeviceIntRect r = iter.Get(); - // We need to remove the scale factor because the wl_surface_damage - // also multiplies by current scale factor. -- wl_surface_damage(waylandSurface, r.x / scaleFactor, r.y / scaleFactor, -- r.width / scaleFactor, r.height / scaleFactor); -+ if (scaleFactor > 1) { -+ CalcRectScale(r, scaleFactor); -+ } -+ wl_surface_damage(waylandSurface, r.x, r.y, r.width, r.height); - } - } - - // Clear all back buffer damage as we're committing - // all requested regions. - mWaylandBufferDamage.SetEmpty(); - - mFrameCallback = wl_surface_frame(waylandSurface); -diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h ---- a/widget/gtk/WindowSurfaceWayland.h -+++ b/widget/gtk/WindowSurfaceWayland.h -@@ -96,16 +96,17 @@ class WindowSurfaceWayland : public Wind - WindowBackBuffer* GetWaylandBufferToDraw(int aWidth, int aHeight); - - already_AddRefed LockWaylandBuffer(int aWidth, int aHeight, - bool aClearBuffer); - already_AddRefed LockImageSurface( - const gfx::IntSize& aLockSize); - bool CommitImageSurfaceToWaylandBuffer(const LayoutDeviceIntRegion& aRegion); - void CommitWaylandBuffer(); -+ void CalcRectScale(LayoutDeviceIntRect& aRect, int scale); - - // TODO: Do we need to hold a reference to nsWindow object? - nsWindow* mWindow; - nsWaylandDisplay* mWaylandDisplay; - WindowBackBuffer* mWaylandBuffer; - LayoutDeviceIntRegion mWaylandBufferDamage; - WindowBackBuffer* mBackupBuffer[BACK_BUFFER_NUM]; - RefPtr mImageSurface; - diff --git a/mozilla-1517205.patch b/mozilla-1517205.patch deleted file mode 100644 index f200cbe..0000000 --- a/mozilla-1517205.patch +++ /dev/null @@ -1,209 +0,0 @@ -diff -up firefox-67.0/widget/gtk/mozcontainer.cpp.mozilla-1517205 firefox-67.0/widget/gtk/mozcontainer.cpp ---- firefox-67.0/widget/gtk/mozcontainer.cpp.mozilla-1517205 2019-05-15 16:00:23.366366060 +0200 -+++ firefox-67.0/widget/gtk/mozcontainer.cpp 2019-05-15 16:02:01.596967825 +0200 -@@ -567,8 +567,7 @@ struct wl_surface *moz_container_get_wl_ - moz_container_get_scale(container)); - - wl_surface_commit(container->surface); -- wl_display_flush(waylandDisplay->GetDisplay()); -- WaylandDisplayRelease(waylandDisplay); -+ wl_display_flush(waylandDisplay->GetDisplay()); - } - - return container->surface; -diff -up firefox-67.0/widget/gtk/nsClipboardWayland.cpp.mozilla-1517205 firefox-67.0/widget/gtk/nsClipboardWayland.cpp ---- firefox-67.0/widget/gtk/nsClipboardWayland.cpp.mozilla-1517205 2019-05-14 01:08:37.000000000 +0200 -+++ firefox-67.0/widget/gtk/nsClipboardWayland.cpp 2019-05-15 16:00:23.367366056 +0200 -@@ -639,7 +639,6 @@ static gboolean offer_hash_remove(gpoint - nsRetrievalContextWayland::~nsRetrievalContextWayland(void) { - g_hash_table_foreach_remove(mActiveOffers, offer_hash_remove, nullptr); - g_hash_table_destroy(mActiveOffers); -- WaylandDisplayRelease(mDisplay); - } - - GdkAtom *nsRetrievalContextWayland::GetTargets(int32_t aWhichClipboard, -diff -up firefox-67.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1517205 firefox-67.0/widget/gtk/nsWaylandDisplay.cpp ---- firefox-67.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1517205 2019-05-14 01:08:37.000000000 +0200 -+++ firefox-67.0/widget/gtk/nsWaylandDisplay.cpp 2019-05-15 16:00:23.368366052 +0200 -@@ -21,6 +21,13 @@ namespace widget { - static nsWaylandDisplay *gWaylandDisplays[MAX_DISPLAY_CONNECTIONS]; - static StaticMutex gWaylandDisplaysMutex; - -+static void ReleaseDisplaysAtExit() { -+ for (int i = 0; i < MAX_DISPLAY_CONNECTIONS; i++) { -+ delete gWaylandDisplays[i]; -+ gWaylandDisplays[i] = nullptr; -+ } -+} -+ - // Each thread which is using wayland connection (wl_display) has to operate - // its own wl_event_queue. Main Firefox thread wl_event_queue is handled - // by Gtk main loop, other threads/wl_event_queue has to be handled by us. -@@ -35,7 +42,6 @@ static nsWaylandDisplay *WaylandDisplayG - const StaticMutexAutoLock &) { - for (auto &display : gWaylandDisplays) { - if (display && display->Matches(aDisplay)) { -- NS_ADDREF(display); - return display; - } - } -@@ -43,7 +49,7 @@ static nsWaylandDisplay *WaylandDisplayG - for (auto &display : gWaylandDisplays) { - if (display == nullptr) { - display = new nsWaylandDisplay(aDisplay); -- NS_ADDREF(display); -+ atexit(ReleaseDisplaysAtExit); - return display; - } - } -@@ -67,26 +73,6 @@ nsWaylandDisplay *WaylandDisplayGet(GdkD - return WaylandDisplayGetLocked(display, lock); - } - --static bool WaylandDisplayReleaseLocked(nsWaylandDisplay *aDisplay, -- const StaticMutexAutoLock &) { -- for (auto &display : gWaylandDisplays) { -- if (display == aDisplay) { -- int rc = display->Release(); -- if (rc == 0) { -- display = nullptr; -- } -- return true; -- } -- } -- MOZ_ASSERT(false, "Missing nsWaylandDisplay for this thread!"); -- return false; --} -- --void WaylandDisplayRelease(nsWaylandDisplay *aDisplay) { -- StaticMutexAutoLock lock(gWaylandDisplaysMutex); -- WaylandDisplayReleaseLocked(aDisplay, lock); --} -- - static void WaylandDisplayLoopLocked(wl_display *aDisplay, - const StaticMutexAutoLock &) { - for (auto &display : gWaylandDisplays) { -@@ -130,6 +116,8 @@ static void global_registry_handler(void - uint32_t id, const char *interface, - uint32_t version) { - auto display = reinterpret_cast(data); -+ if (!display) -+ return; - - if (strcmp(interface, "wl_shm") == 0) { - auto shm = static_cast( -@@ -180,9 +168,7 @@ bool nsWaylandDisplay::Matches(wl_displa - return mThreadId == PR_GetCurrentThread() && aDisplay == mDisplay; - } - --NS_IMPL_ISUPPORTS(nsWaylandDisplay, nsISupports); -- --nsWaylandDisplay::nsWaylandDisplay(wl_display *aDisplay) -+nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay) - : mThreadId(PR_GetCurrentThread()), - mDisplay(aDisplay), - mEventQueue(nullptr), -@@ -190,9 +176,10 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di - mSubcompositor(nullptr), - mSeat(nullptr), - mShm(nullptr), -- mPrimarySelectionDeviceManager(nullptr) { -- wl_registry *registry = wl_display_get_registry(mDisplay); -- wl_registry_add_listener(registry, ®istry_listener, this); -+ mPrimarySelectionDeviceManager(nullptr), -+ mRegistry(nullptr) { -+ mRegistry = wl_display_get_registry(mDisplay); -+ wl_registry_add_listener(mRegistry, ®istry_listener, this); - - if (NS_IsMainThread()) { - // Use default event queue in main thread operated by Gtk+. -@@ -203,17 +190,19 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di - mEventQueue = wl_display_create_queue(mDisplay); - MessageLoop::current()->PostTask(NewRunnableFunction( - "WaylandDisplayLoop", &WaylandDisplayLoop, mDisplay)); -- wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue); -+ wl_proxy_set_queue((struct wl_proxy *)mRegistry, mEventQueue); - wl_display_roundtrip_queue(mDisplay, mEventQueue); - wl_display_roundtrip_queue(mDisplay, mEventQueue); - } - } - - nsWaylandDisplay::~nsWaylandDisplay() { -- MOZ_ASSERT(mThreadId == PR_GetCurrentThread()); - // Owned by Gtk+, we don't need to release - mDisplay = nullptr; - -+ wl_registry_destroy(mRegistry); -+ mRegistry = nullptr; -+ - if (mEventQueue) { - wl_event_queue_destroy(mEventQueue); - mEventQueue = nullptr; -diff -up firefox-67.0/widget/gtk/nsWaylandDisplay.h.mozilla-1517205 firefox-67.0/widget/gtk/nsWaylandDisplay.h ---- firefox-67.0/widget/gtk/nsWaylandDisplay.h.mozilla-1517205 2019-05-14 01:08:27.000000000 +0200 -+++ firefox-67.0/widget/gtk/nsWaylandDisplay.h 2019-05-15 16:00:23.368366052 +0200 -@@ -20,11 +20,10 @@ namespace widget { - - // Our general connection to Wayland display server, - // holds our display connection and runs event loop. --class nsWaylandDisplay : public nsISupports { -- NS_DECL_THREADSAFE_ISUPPORTS -- -+class nsWaylandDisplay { - public: - explicit nsWaylandDisplay(wl_display* aDisplay); -+ virtual ~nsWaylandDisplay(); - - bool DisplayLoop(); - bool Matches(wl_display* aDisplay); -@@ -41,7 +40,6 @@ class nsWaylandDisplay : public nsISuppo - return mPrimarySelectionDeviceManager; - }; - -- public: - void SetShm(wl_shm* aShm); - void SetSubcompositor(wl_subcompositor* aSubcompositor); - void SetDataDeviceManager(wl_data_device_manager* aDataDeviceManager); -@@ -49,9 +47,7 @@ class nsWaylandDisplay : public nsISuppo - void SetPrimarySelectionDeviceManager( - gtk_primary_selection_device_manager* aPrimarySelectionDeviceManager); - -- private: -- virtual ~nsWaylandDisplay(); -- -+private: - PRThread* mThreadId; - wl_display* mDisplay; - wl_event_queue* mEventQueue; -@@ -60,10 +56,10 @@ class nsWaylandDisplay : public nsISuppo - wl_seat* mSeat; - wl_shm* mShm; - gtk_primary_selection_device_manager* mPrimarySelectionDeviceManager; -+ wl_registry *mRegistry; - }; - - nsWaylandDisplay* WaylandDisplayGet(GdkDisplay* aGdkDisplay = nullptr); --void WaylandDisplayRelease(nsWaylandDisplay* aDisplay); - - } // namespace widget - } // namespace mozilla -diff -up firefox-67.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1517205 firefox-67.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-67.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1517205 2019-05-15 16:00:23.335366185 +0200 -+++ firefox-67.0/widget/gtk/WindowSurfaceWayland.cpp 2019-05-15 16:00:23.368366052 +0200 -@@ -413,16 +413,6 @@ WindowSurfaceWayland::~WindowSurfaceWayl - delete mBackupBuffer[i]; - } - } -- -- if (!mIsMainThread) { -- // We can be destroyed from main thread even though we was created/used -- // in compositor thread. We have to unref/delete WaylandDisplay in -- // compositor thread then and we can't use MessageLoop::current() here. -- mDisplayThreadMessageLoop->PostTask(NewRunnableFunction( -- "WaylandDisplayRelease", &WaylandDisplayRelease, mWaylandDisplay)); -- } else { -- WaylandDisplayRelease(mWaylandDisplay); -- } - } - - WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(int aWidth, diff --git a/mozilla-1526243.patch b/mozilla-1526243.patch deleted file mode 100644 index 2d12378..0000000 --- a/mozilla-1526243.patch +++ /dev/null @@ -1,340 +0,0 @@ -changeset: 465480:a86f3560fb17 -parent: 465477:26d9b7ffbd6b -user: Martin Stransky -date: Fri Mar 29 15:30:15 2019 +0100 -summary: Bug 1526243 - [Linux] Don't use nsGConfService in nsGNOMEShellService.cpp, r=glandium - -diff --git a/browser/components/shell/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp ---- a/browser/components/shell/nsGNOMEShellService.cpp -+++ b/browser/components/shell/nsGNOMEShellService.cpp -@@ -10,17 +10,16 @@ - #include "nsShellService.h" - #include "nsIServiceManager.h" - #include "nsIFile.h" - #include "nsIProperties.h" - #include "nsDirectoryServiceDefs.h" - #include "nsIPrefService.h" - #include "prenv.h" - #include "nsString.h" --#include "nsIGConfService.h" - #include "nsIGIOService.h" - #include "nsIGSettingsService.h" - #include "nsIStringBundle.h" - #include "nsIOutputStream.h" - #include "nsIProcess.h" - #include "nsServiceManagerUtils.h" - #include "nsComponentManagerUtils.h" - #include "nsIImageLoadingContent.h" -@@ -65,48 +64,39 @@ static const ProtocolAssociation appProt - - static const MimeTypeAssociation appTypes[] = { - // clang-format off - { "text/html", "htm html shtml" }, - { "application/xhtml+xml", "xhtml xht" } - // clang-format on - }; - --// GConf registry key constants --#define DG_BACKGROUND "/desktop/gnome/background" -- --#define kDesktopImageKey DG_BACKGROUND "/picture_filename" --#define kDesktopOptionsKey DG_BACKGROUND "/picture_options" --#define kDesktopDrawBGKey DG_BACKGROUND "/draw_background" --#define kDesktopColorKey DG_BACKGROUND "/primary_color" -- - #define kDesktopBGSchema "org.gnome.desktop.background" - #define kDesktopImageGSKey "picture-uri" - #define kDesktopOptionGSKey "picture-options" - #define kDesktopDrawBGGSKey "draw-background" - #define kDesktopColorGSKey "primary-color" - - static bool IsRunningAsASnap() { return (PR_GetEnv("SNAP") != nullptr); } - - nsresult nsGNOMEShellService::Init() { - nsresult rv; - - if (gfxPlatform::IsHeadless()) { - return NS_ERROR_NOT_AVAILABLE; - } - -- // GConf, GSettings or GIO _must_ be available, or we do not allow -+ // GSettings or GIO _must_ be available, or we do not allow - // CreateInstance to succeed. - -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); - nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - nsCOMPtr gsettings = - do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); - -- if (!gconf && !giovfs && !gsettings) return NS_ERROR_NOT_AVAILABLE; -+ if (!giovfs && !gsettings) return NS_ERROR_NOT_AVAILABLE; - - // Check G_BROKEN_FILENAMES. If it's set, then filenames in glib use - // the locale encoding. If it's not set, they use UTF-8. - mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nullptr; - - if (GetAppPathFromLauncher()) return NS_OK; - - nsCOMPtr dirSvc( -@@ -212,35 +202,23 @@ nsGNOMEShellService::IsDefaultBrowser(bo - } - if (strcmp(output, "yes\n") == 0) { - *aIsDefaultBrowser = true; - } - g_free(output); - return NS_OK; - } - -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); - nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); -- -- bool enabled; - nsAutoCString handler; - nsCOMPtr gioApp; - - for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) { - if (!appProtocols[i].essential) continue; - -- if (gconf) { -- handler.Truncate(); -- gconf->GetAppForProtocol(nsDependentCString(appProtocols[i].name), -- &enabled, handler); -- -- if (!CheckHandlerMatchesAppName(handler) || !enabled) -- return NS_OK; // the handler is disabled or set to another app -- } -- - if (giovfs) { - handler.Truncate(); - nsCOMPtr handlerApp; - giovfs->GetAppForURIScheme(nsDependentCString(appProtocols[i].name), - getter_AddRefs(handlerApp)); - gioApp = do_QueryInterface(handlerApp); - if (!gioApp) return NS_OK; - -@@ -270,39 +248,17 @@ nsGNOMEShellService::SetDefaultBrowser(b - GSpawnFlags flags = static_cast(G_SPAWN_SEARCH_PATH | - G_SPAWN_STDOUT_TO_DEV_NULL | - G_SPAWN_STDERR_TO_DEV_NULL); - g_spawn_sync(nullptr, (gchar **)argv, nullptr, flags, nullptr, nullptr, - nullptr, nullptr, nullptr, nullptr); - return NS_OK; - } - -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); - nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); -- if (gconf) { -- nsAutoCString appKeyValue; -- if (mAppIsInPath) { -- // mAppPath is in the users path, so use only the basename as the launcher -- gchar *tmp = g_path_get_basename(mAppPath.get()); -- appKeyValue = tmp; -- g_free(tmp); -- } else { -- appKeyValue = mAppPath; -- } -- -- appKeyValue.AppendLiteral(" %s"); -- -- for (unsigned int i = 0; i < ArrayLength(appProtocols); ++i) { -- if (appProtocols[i].essential || aClaimAllTypes) { -- gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name), -- appKeyValue); -- } -- } -- } -- - if (giovfs) { - nsresult rv; - nsCOMPtr bundleService = - do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr brandBundle; - rv = bundleService->CreateBundle(BRAND_PROPERTIES, -@@ -353,19 +309,21 @@ nsGNOMEShellService::SetDefaultBrowser(b - } - - return NS_OK; - } - - NS_IMETHODIMP - nsGNOMEShellService::GetCanSetDesktopBackground(bool *aResult) { - // setting desktop background is currently only supported -- // for Gnome or desktops using the same GSettings and GConf keys -- const char *gnomeSession = getenv("GNOME_DESKTOP_SESSION_ID"); -- if (gnomeSession) { -+ // for Gnome or desktops using the same GSettings keys -+ const char *currentDesktop = getenv("XDG_CURRENT_DESKTOP"); -+ if (currentDesktop && -+ (strstr(currentDesktop, "GNOME-Flashback:GNOME") != nullptr || -+ strstr(currentDesktop, "GNOME") != nullptr)) { - *aResult = true; - } else { - *aResult = false; - } - - return NS_OK; - } - -@@ -439,20 +397,16 @@ nsGNOMEShellService::SetDesktopBackgroun - filePath.Append('/'); - filePath.Append(NS_ConvertUTF16toUTF8(brandName)); - filePath.AppendLiteral("_wallpaper.png"); - - // write the image to a file in the home dir - rv = WriteImage(filePath, container); - NS_ENSURE_SUCCESS(rv, rv); - -- // Try GSettings first. If we don't have GSettings or the right schema, fall -- // back to using GConf instead. Note that if GSettings works ok, the changes -- // get mirrored to GConf by the gsettings->gconf bridge in -- // gnome-settings-daemon - nsCOMPtr gsettings = - do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); - if (gsettings) { - nsCOMPtr background_settings; - gsettings->GetCollectionForSchema(NS_LITERAL_CSTRING(kDesktopBGSchema), - getter_AddRefs(background_settings)); - if (background_settings) { - gchar *file_uri = g_filename_to_uri(filePath.get(), nullptr, nullptr); -@@ -465,32 +419,17 @@ nsGNOMEShellService::SetDesktopBackgroun - nsDependentCString(file_uri)); - g_free(file_uri); - background_settings->SetBoolean(NS_LITERAL_CSTRING(kDesktopDrawBGGSKey), - true); - return rv; - } - } - -- // if the file was written successfully, set it as the system wallpaper -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); -- -- if (gconf) { -- gconf->SetString(NS_LITERAL_CSTRING(kDesktopOptionsKey), options); -- -- // Set the image to an empty string first to force a refresh -- // (since we could be writing a new image on top of an existing -- // Firefox_wallpaper.png and nautilus doesn't monitor the file for changes) -- gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), EmptyCString()); -- -- gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), filePath); -- gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), true); -- } -- -- return rv; -+ return NS_ERROR_FAILURE; - } - - #define COLOR_16_TO_8_BIT(_c) ((_c) >> 8) - #define COLOR_8_TO_16_BIT(_c) ((_c) << 8 | (_c)) - - NS_IMETHODIMP - nsGNOMEShellService::GetDesktopBackgroundColor(uint32_t *aColor) { - nsCOMPtr gsettings = -@@ -502,22 +441,16 @@ nsGNOMEShellService::GetDesktopBackgroun - gsettings->GetCollectionForSchema(NS_LITERAL_CSTRING(kDesktopBGSchema), - getter_AddRefs(background_settings)); - if (background_settings) { - background_settings->GetString(NS_LITERAL_CSTRING(kDesktopColorGSKey), - background); - } - } - -- if (!background_settings) { -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); -- if (gconf) -- gconf->GetString(NS_LITERAL_CSTRING(kDesktopColorKey), background); -- } -- - if (background.IsEmpty()) { - *aColor = 0; - return NS_OK; - } - - GdkColor color; - gboolean success = gdk_color_parse(background.get(), &color); - -@@ -555,23 +488,17 @@ nsGNOMEShellService::SetDesktopBackgroun - getter_AddRefs(background_settings)); - if (background_settings) { - background_settings->SetString(NS_LITERAL_CSTRING(kDesktopColorGSKey), - colorString); - return NS_OK; - } - } - -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); -- -- if (gconf) { -- gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), colorString); -- } -- -- return NS_OK; -+ return NS_ERROR_FAILURE; - } - - NS_IMETHODIMP - nsGNOMEShellService::OpenApplication(int32_t aApplication) { - nsAutoCString scheme; - if (aApplication == APPLICATION_MAIL) - scheme.AssignLiteral("mailto"); - else if (aApplication == APPLICATION_NEWS) -@@ -581,55 +508,17 @@ nsGNOMEShellService::OpenApplication(int - - nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - if (giovfs) { - nsCOMPtr handlerApp; - giovfs->GetAppForURIScheme(scheme, getter_AddRefs(handlerApp)); - if (handlerApp) return handlerApp->LaunchWithURI(nullptr, nullptr); - } - -- nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); -- if (!gconf) return NS_ERROR_FAILURE; -- -- bool enabled; -- nsAutoCString appCommand; -- gconf->GetAppForProtocol(scheme, &enabled, appCommand); -- -- if (!enabled) return NS_ERROR_FAILURE; -- -- // XXX we don't currently handle launching a terminal window. -- // If the handler requires a terminal, bail. -- bool requiresTerminal; -- gconf->HandlerRequiresTerminal(scheme, &requiresTerminal); -- if (requiresTerminal) return NS_ERROR_FAILURE; -- -- // Perform shell argument expansion -- int argc; -- char **argv; -- if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, nullptr)) -- return NS_ERROR_FAILURE; -- -- char **newArgv = new char *[argc + 1]; -- int newArgc = 0; -- -- // Run through the list of arguments. Copy all of them to the new -- // argv except for %s, which we skip. -- for (int i = 0; i < argc; ++i) { -- if (strcmp(argv[i], "%s") != 0) newArgv[newArgc++] = argv[i]; -- } -- -- newArgv[newArgc] = nullptr; -- -- gboolean err = g_spawn_async(nullptr, newArgv, nullptr, G_SPAWN_SEARCH_PATH, -- nullptr, nullptr, nullptr, nullptr); -- -- g_strfreev(argv); -- delete[] newArgv; -- -- return err ? NS_OK : NS_ERROR_FAILURE; -+ return NS_ERROR_FAILURE; - } - - NS_IMETHODIMP - nsGNOMEShellService::OpenApplicationWithURI(nsIFile *aApplication, - const nsACString &aURI) { - nsresult rv; - nsCOMPtr process = - do_CreateInstance("@mozilla.org/process/util;1", &rv); - diff --git a/mozilla-1532643-popup.patch b/mozilla-1532643-popup.patch deleted file mode 100644 index 3b870a2..0000000 --- a/mozilla-1532643-popup.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff -up firefox-67.0/layout/xul/moz.build.mozilla-1532643-popup firefox-67.0/layout/xul/moz.build ---- firefox-67.0/layout/xul/moz.build.mozilla-1532643-popup 2019-05-14 01:08:24.000000000 +0200 -+++ firefox-67.0/layout/xul/moz.build 2019-05-15 15:31:39.714299754 +0200 -@@ -88,3 +88,6 @@ LOCAL_INCLUDES += [ - - if CONFIG['CC_TYPE'] in ('clang', 'gcc'): - CXXFLAGS += ['-Wno-error=shadow'] -+ -+CFLAGS += CONFIG['TK_CFLAGS'] -+CXXFLAGS += CONFIG['TK_CFLAGS'] -diff -up firefox-67.0/layout/xul/nsMenuPopupFrame.cpp.mozilla-1532643-popup firefox-67.0/layout/xul/nsMenuPopupFrame.cpp ---- firefox-67.0/layout/xul/nsMenuPopupFrame.cpp.mozilla-1532643-popup 2019-05-14 01:08:24.000000000 +0200 -+++ firefox-67.0/layout/xul/nsMenuPopupFrame.cpp 2019-05-15 15:37:01.121215863 +0200 -@@ -55,6 +55,10 @@ - #include "mozilla/dom/KeyboardEvent.h" - #include "mozilla/dom/KeyboardEventBinding.h" - #include -+#ifdef MOZ_WAYLAND -+#include -+#include -+#endif /* MOZ_WAYLAND */ - - using namespace mozilla; - using mozilla::dom::Document; -@@ -301,11 +305,29 @@ nsresult nsMenuPopupFrame::CreateWidgetF - !(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist); - widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide); - -+ static bool waylandBackend = -+#ifdef MOZ_WAYLAND -+ !GDK_IS_X11_DISPLAY(gdk_display_get_default()); -+#else -+ false; -+#endif -+ - // panels which have a parent level need a parent widget. This allows them to - // always appear in front of the parent window but behind other windows that - // should be in front of it. - nsCOMPtr parentWidget; -- if (widgetData.mPopupLevel != ePopupLevelTop) { -+ if (waylandBackend) { -+ // On Wayland we always need to connect menu to its parent menu widget -+ // otherwise it's not shown. -+ nsMenuFrame* menuFrame = do_QueryFrame(GetParent()); -+ if (menuFrame) { -+ nsMenuParent* parentPopup = menuFrame->GetMenuParent(); -+ if (parentPopup && parentPopup->IsMenu()) { -+ parentWidget = -+ static_cast(parentPopup)->GetWidget(); -+ } -+ } -+ } else if (widgetData.mPopupLevel != ePopupLevelTop) { - nsCOMPtr dsti = PresContext()->GetDocShell(); - if (!dsti) return NS_ERROR_FAILURE; - -diff -up firefox-67.0/widget/gtk/nsWindow.cpp.mozilla-1532643-popup firefox-67.0/widget/gtk/nsWindow.cpp ---- firefox-67.0/widget/gtk/nsWindow.cpp.mozilla-1532643-popup 2019-05-15 15:31:39.712299764 +0200 -+++ firefox-67.0/widget/gtk/nsWindow.cpp 2019-05-15 15:31:39.716299744 +0200 -@@ -3527,11 +3527,7 @@ nsresult nsWindow::Create(nsIWidget *aPa - } else { - switch (aInitData->mPopupHint) { - case ePopupTypeMenu: -- // Use GDK_WINDOW_TYPE_HINT_UTILITY on Wayland which -- // guides Gtk to create the popup as subsurface -- // instead of xdg_shell popup (see Bug 1423598). -- gtkTypeHint = mIsX11Display ? GDK_WINDOW_TYPE_HINT_POPUP_MENU -- : GDK_WINDOW_TYPE_HINT_UTILITY; -+ gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU; - break; - case ePopupTypeTooltip: - gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP; diff --git a/mozilla-1535567.patch b/mozilla-1535567.patch deleted file mode 100644 index 43b606c..0000000 --- a/mozilla-1535567.patch +++ /dev/null @@ -1,136 +0,0 @@ -diff -up firefox-67.0/widget/gtk/mozcontainer.cpp.mozilla-1535567 firefox-67.0/widget/gtk/mozcontainer.cpp ---- firefox-67.0/widget/gtk/mozcontainer.cpp.mozilla-1535567 2019-05-14 01:08:37.000000000 +0200 -+++ firefox-67.0/widget/gtk/mozcontainer.cpp 2019-05-15 15:56:19.645336209 +0200 -@@ -157,6 +157,7 @@ void moz_container_init(MozContainer *co - container->subsurface = nullptr; - container->eglwindow = nullptr; - container->frame_callback_handler = nullptr; -+ container->frame_callback_handler_surface_id = -1; - // We can draw to x11 window any time. - container->ready_to_draw = GDK_IS_X11_DISPLAY(gdk_display_get_default()); - container->surface_needs_clear = true; -@@ -165,6 +166,11 @@ void moz_container_init(MozContainer *co - } - - #if defined(MOZ_WAYLAND) -+void moz_container_set_initial_draw_callback( -+ MozContainer *container, std::function inital_draw_cb) { -+ container->inital_draw_cb = inital_draw_cb; -+} -+ - static wl_surface *moz_container_get_gtk_container_surface( - MozContainer *container) { - static auto sGdkWaylandWindowGetWlSurface = (wl_surface * (*)(GdkWindow *)) -@@ -178,37 +184,61 @@ static void frame_callback_handler(void - uint32_t time) { - MozContainer *container = MOZ_CONTAINER(data); - g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); -+ container->frame_callback_handler_surface_id = -1; - if (!container->ready_to_draw && container->inital_draw_cb) { - container->inital_draw_cb(); - } - container->ready_to_draw = true; - } - --void moz_container_set_initial_draw_callback( -- MozContainer *container, std::function inital_draw_cb) { -- container->inital_draw_cb = inital_draw_cb; --} -- - static const struct wl_callback_listener frame_listener = { - frame_callback_handler}; - --static gboolean moz_container_map_wayland(GtkWidget *widget, -- GdkEventAny *event) { -- MozContainer *container = MOZ_CONTAINER(widget); -- -- if (container->ready_to_draw || container->frame_callback_handler) { -- return FALSE; -- } -- -+static void moz_container_request_parent_frame_callback( -+ MozContainer *container) { - wl_surface *gtk_container_surface = - moz_container_get_gtk_container_surface(container); -+ int gtk_container_surface_id = -+ gtk_container_surface -+ ? wl_proxy_get_id((struct wl_proxy *)gtk_container_surface) -+ : -1; -+ -+ -+ -+ -+ -+ -+ -+ if (container->frame_callback_handler && -+ container->frame_callback_handler_surface_id == -+ gtk_container_surface_id) { -+ return; -+ } -+ -+ // If there's pending frame callback, delete it. -+ if (container->frame_callback_handler) { -+ g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); -+ } - - if (gtk_container_surface) { -+ container->frame_callback_handler_surface_id = gtk_container_surface_id; - container->frame_callback_handler = wl_surface_frame(gtk_container_surface); - wl_callback_add_listener(container->frame_callback_handler, &frame_listener, - container); -+ } else { -+ container->frame_callback_handler_surface_id = -1; -+ } -+} -+ -+static gboolean moz_container_map_wayland(GtkWidget *widget, -+ GdkEventAny *event) { -+ MozContainer *container = MOZ_CONTAINER(widget); -+ -+ if (container->ready_to_draw) { -+ return FALSE; - } - -+ moz_container_request_parent_frame_callback(MOZ_CONTAINER(widget)); - return FALSE; - } - -@@ -217,6 +247,7 @@ static void moz_container_unmap_wayland( - g_clear_pointer(&container->subsurface, wl_subsurface_destroy); - g_clear_pointer(&container->surface, wl_surface_destroy); - g_clear_pointer(&container->frame_callback_handler, wl_callback_destroy); -+ container->frame_callback_handler_surface_id = -1; - - container->surface_needs_clear = true; - container->ready_to_draw = false; -@@ -329,6 +360,10 @@ void moz_container_realize(GtkWidget *wi - : gtk_widget_get_visual(widget); - - window = gdk_window_new(parent, &attributes, attributes_mask); -+ -+ -+ -+ - gdk_window_set_user_data(window, widget); - } else { - window = parent; -@@ -498,6 +533,7 @@ static void moz_container_add(GtkContain - struct wl_surface *moz_container_get_wl_surface(MozContainer *container) { - if (!container->surface) { - if (!container->ready_to_draw) { -+ moz_container_request_parent_frame_callback(container); - return nullptr; - } - GdkDisplay *display = gtk_widget_get_display(GTK_WIDGET(container)); -diff -up firefox-67.0/widget/gtk/mozcontainer.h.mozilla-1535567 firefox-67.0/widget/gtk/mozcontainer.h ---- firefox-67.0/widget/gtk/mozcontainer.h.mozilla-1535567 2019-05-14 01:08:37.000000000 +0200 -+++ firefox-67.0/widget/gtk/mozcontainer.h 2019-05-15 15:50:59.440570372 +0200 -@@ -77,6 +77,7 @@ struct _MozContainer { - struct wl_subsurface *subsurface; - struct wl_egl_window *eglwindow; - struct wl_callback *frame_callback_handler; -+ int frame_callback_handler_surface_id; - gboolean surface_needs_clear; - gboolean ready_to_draw; - std::function inital_draw_cb; diff --git a/mozilla-1539471.patch b/mozilla-1539471.patch deleted file mode 100644 index 1a321d2..0000000 --- a/mozilla-1539471.patch +++ /dev/null @@ -1,206 +0,0 @@ -diff -up firefox-66.0.1/widget/gtk/nsWindow.cpp.mozilla-1539471 firefox-66.0.1/widget/gtk/nsWindow.cpp ---- firefox-66.0.1/widget/gtk/nsWindow.cpp.mozilla-1539471 2019-03-28 14:08:42.351128620 +0100 -+++ firefox-66.0.1/widget/gtk/nsWindow.cpp 2019-03-28 14:20:23.282890178 +0100 -@@ -312,6 +312,9 @@ static nsWindow *gFocusWindow = nullptr; - static bool gBlockActivateEvent = false; - static bool gGlobalsInitialized = false; - static bool gRaiseWindows = true; -+#ifdef MOZ_WAYLAND -+static GList *gCurrentPopupWindows = nullptr; -+#endif - - #if GTK_CHECK_VERSION(3, 4, 0) - static uint32_t gLastTouchID = 0; -@@ -1136,8 +1139,16 @@ void nsWindow::NativeMoveResizeWaylandPo - return; - } - -- GtkWidget* parentWidget = -- GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); -+ GtkWidget *parentWidget; -+ if (mPopupType == ePopupTypeTooltip && gCurrentPopupWindows) { -+ // Attach tooltip window to the latest popup window -+ // to have both visible. -+ parentWidget = GTK_WIDGET(gCurrentPopupWindows->data); -+ gtk_window_set_transient_for(GTK_WINDOW(mShell), -+ GTK_WINDOW(parentWidget)); -+ } else { -+ parentWidget = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); -+ } - - int x_parent, y_parent; - gdk_window_get_origin(gtk_widget_get_window(parentWidget), &x_parent, &y_parent); -@@ -3489,7 +3500,7 @@ nsresult nsWindow::Create(nsIWidget *aPa - gtkTypeHint = GDK_WINDOW_TYPE_HINT_DND; - mIsDragPopup = true; - } else { -- switch (aInitData->mPopupHint) { -+ switch (mPopupType) { - case ePopupTypeMenu: - gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU; - break; -@@ -3610,6 +3621,8 @@ nsresult nsWindow::Create(nsIWidget *aPa - return NS_ERROR_FAILURE; - - case eWindowType_child: { -+ MOZ_ASSERT(mIsX11Display, -+ "eWindowType_child is not supported on Wayland!"); - if (parentMozContainer) { - mGdkWindow = CreateGdkWindow(parentGdkWindow, parentMozContainer); - mHasMappedToplevel = parentnsWindow->mHasMappedToplevel; -@@ -3979,6 +3992,49 @@ void nsWindow::NativeMoveResize() { - } - } - -+#ifdef MOZ_WAYLAND -+void nsWindow::OpenToplevelWaylandWindow() { -+ // Wayland keeps strong popup window hierarchy. We need to track active -+ // (visible) popup windows and make sure we hide popup on the same level -+ // before we open another one on that level. It means that every open -+ // popup needs to have an unique parent. -+ if (mWindowType == eWindowType_popup) { -+ GtkWidget *parentWidget = -+ GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); -+ -+ if (gCurrentPopupWindows) { -+ do { -+ GtkWidget *widget = GTK_WIDGET(gCurrentPopupWindows->data); -+ if (widget == parentWidget) { -+ break; -+ } -+ nsWindow* window = get_window_for_gtk_widget(widget); -+ NS_ASSERTION(window, "Unknown window in popup widget list!"); -+ window->CloseToplevelWaylandWindow(); -+ -+ } while (gCurrentPopupWindows != nullptr); -+ } -+ gCurrentPopupWindows = g_list_prepend(gCurrentPopupWindows, mShell); -+ } -+ -+ gtk_widget_show(mShell); -+} -+ -+void nsWindow::CloseToplevelWaylandWindow() { -+ if (mContainer && moz_container_has_wl_egl_window(mContainer)) { -+ // Because wl_egl_window is destroyed on moz_container_unmap(), -+ // the current compositor cannot use it anymore. To avoid crash, -+ // destroy the compositor & recreate a new compositor on next -+ // expose event. -+ DestroyLayerManager(); -+ } -+ if (mWindowType == eWindowType_popup) { -+ gCurrentPopupWindows = g_list_remove(gCurrentPopupWindows, mShell); -+ } -+ gtk_widget_hide(mShell); -+} -+#endif -+ - void nsWindow::NativeShow(bool aAction) { - if (aAction) { - // unset our flag now that our window has been shown -@@ -3990,51 +4046,55 @@ void nsWindow::NativeShow(bool aAction) - SetUserTimeAndStartupIDForActivatedWindow(mShell); - } - -- gtk_widget_show(mShell); -+#ifdef MOZ_WAYLAND -+ if (!mIsX11Display) { -+ OpenToplevelWaylandWindow(); -+ } else -+#endif -+ { -+ gtk_widget_show(mShell); -+ } - } else if (mContainer) { - gtk_widget_show(GTK_WIDGET(mContainer)); - } else if (mGdkWindow) { - gdk_window_show_unraised(mGdkWindow); - } - } else { --#ifdef MOZ_WAYLAND -- if (mContainer && moz_container_has_wl_egl_window(mContainer)) { -- // Because wl_egl_window is destroyed on moz_container_unmap(), -- // the current compositor cannot use it anymore. To avoid crash, -- // destroy the compositor & recreate a new compositor on next -- // expose event. -- DestroyLayerManager(); -- } --#endif -- - if (mIsTopLevel) { -- // Workaround window freezes on GTK versions before 3.21.2 by -- // ensuring that configure events get dispatched to windows before -- // they are unmapped. See bug 1225044. -- if (gtk_check_version(3, 21, 2) != nullptr && mPendingConfigures > 0) { -- GtkAllocation allocation; -- gtk_widget_get_allocation(GTK_WIDGET(mShell), &allocation); -- -- GdkEventConfigure event; -- PodZero(&event); -- event.type = GDK_CONFIGURE; -- event.window = mGdkWindow; -- event.send_event = TRUE; -- event.x = allocation.x; -- event.y = allocation.y; -- event.width = allocation.width; -- event.height = allocation.height; -- -- auto shellClass = GTK_WIDGET_GET_CLASS(mShell); -- for (unsigned int i = 0; i < mPendingConfigures; i++) { -- Unused << shellClass->configure_event(mShell, &event); -+#ifdef MOZ_WAYLAND -+ if (!mIsX11Display) { -+ CloseToplevelWaylandWindow(); -+ } else -+#endif -+ { -+ // Workaround window freezes on GTK versions before 3.21.2 by -+ // ensuring that configure events get dispatched to windows before -+ // they are unmapped. See bug 1225044. -+ if (gtk_check_version(3, 21, 2) != nullptr && mPendingConfigures > 0) { -+ GtkAllocation allocation; -+ gtk_widget_get_allocation(GTK_WIDGET(mShell), &allocation); -+ -+ GdkEventConfigure event; -+ PodZero(&event); -+ event.type = GDK_CONFIGURE; -+ event.window = mGdkWindow; -+ event.send_event = TRUE; -+ event.x = allocation.x; -+ event.y = allocation.y; -+ event.width = allocation.width; -+ event.height = allocation.height; -+ -+ auto shellClass = GTK_WIDGET_GET_CLASS(mShell); -+ for (unsigned int i = 0; i < mPendingConfigures; i++) { -+ Unused << shellClass->configure_event(mShell, &event); -+ } -+ mPendingConfigures = 0; - } -- mPendingConfigures = 0; -- } - -- gtk_widget_hide(mShell); -+ gtk_widget_hide(mShell); - -- ClearTransparencyBitmap(); // Release some resources -+ ClearTransparencyBitmap(); // Release some resources -+ } - } else if (mContainer) { - gtk_widget_hide(GTK_WIDGET(mContainer)); - } else if (mGdkWindow) { -diff -up firefox-66.0.1/widget/gtk/nsWindow.h.mozilla-1539471 firefox-66.0.1/widget/gtk/nsWindow.h ---- firefox-66.0.1/widget/gtk/nsWindow.h.mozilla-1539471 2019-03-28 14:08:42.345128639 +0100 -+++ firefox-66.0.1/widget/gtk/nsWindow.h 2019-03-28 14:08:42.355128607 +0100 -@@ -603,6 +603,11 @@ class nsWindow final : public nsBaseWidg - - void ForceTitlebarRedraw(); - -+#ifdef MOZ_WAYLAND -+ void OpenToplevelWaylandWindow(); -+ void CloseToplevelWaylandWindow(); -+#endif -+ - /** - * |mIMContext| takes all IME related stuff. - * diff --git a/mozilla-1540145.patch b/mozilla-1540145.patch deleted file mode 100644 index 755aa13..0000000 --- a/mozilla-1540145.patch +++ /dev/null @@ -1,156 +0,0 @@ -diff -up firefox-67.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.mozilla-1540145 firefox-67.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp ---- firefox-67.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp.mozilla-1540145 2019-05-14 01:08:35.000000000 +0200 -+++ firefox-67.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 2019-05-15 15:20:13.365502186 +0200 -@@ -34,16 +34,10 @@ class nsUnixSystemProxySettings final : - private: - ~nsUnixSystemProxySettings() = default; - -- nsCOMPtr mGConf; -- nsCOMPtr mGSettings; -+ nsCOMPtr mGSettings; - nsCOMPtr mProxySettings; - nsInterfaceHashtable - mSchemeProxySettings; -- bool IsProxyMode(const char* aMode); -- nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, -- nsACString& aResult); -- nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, -- int32_t aPort, nsACString& aResult); - nsresult GetProxyFromGSettings(const nsACString& aScheme, - const nsACString& aHost, int32_t aPort, - nsACString& aResult); -@@ -68,16 +62,6 @@ void nsUnixSystemProxySettings::Init() { - NS_LITERAL_CSTRING("org.gnome.system.proxy"), - getter_AddRefs(mProxySettings)); - } -- if (!mProxySettings) { -- mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); -- } --} -- --bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) { -- nsAutoCString mode; -- return NS_SUCCEEDED(mGConf->GetString( -- NS_LITERAL_CSTRING("/system/proxy/mode"), mode)) && -- mode.EqualsASCII(aMode); - } - - nsresult nsUnixSystemProxySettings::GetPACURI(nsACString& aResult) { -@@ -92,14 +76,8 @@ nsresult nsUnixSystemProxySettings::GetP - } - /* The org.gnome.system.proxy schema has been found, but auto mode is not - * set. Don't try the GConf and return empty string. */ -- aResult.Truncate(); -- return NS_OK; - } - -- if (mGConf && IsProxyMode("auto")) { -- return mGConf->GetString(NS_LITERAL_CSTRING("/system/proxy/autoconfig_url"), -- aResult); -- } - // Return an empty string when auto mode is not set. - aResult.Truncate(); - return NS_OK; -@@ -217,30 +195,6 @@ static nsresult GetProxyFromEnvironment( - return NS_OK; - } - --nsresult nsUnixSystemProxySettings::SetProxyResultFromGConf( -- const char* aKeyBase, const char* aType, nsACString& aResult) { -- nsAutoCString hostKey; -- hostKey.AppendASCII(aKeyBase); -- hostKey.AppendLiteral("host"); -- nsAutoCString host; -- nsresult rv = mGConf->GetString(hostKey, host); -- NS_ENSURE_SUCCESS(rv, rv); -- if (host.IsEmpty()) return NS_ERROR_FAILURE; -- -- nsAutoCString portKey; -- portKey.AppendASCII(aKeyBase); -- portKey.AppendLiteral("port"); -- int32_t port; -- rv = mGConf->GetInt(portKey, &port); -- NS_ENSURE_SUCCESS(rv, rv); -- -- /* When port is 0, proxy is not considered as enabled even if host is set. */ -- if (port == 0) return NS_ERROR_FAILURE; -- -- SetProxyResult(aType, host, port, aResult); -- return NS_OK; --} -- - nsresult nsUnixSystemProxySettings::SetProxyResultFromGSettings( - const char* aKeyBase, const char* aType, nsACString& aResult) { - nsDependentCString key(aKeyBase); -@@ -366,63 +320,6 @@ static bool HostIgnoredByProxy(const nsA - return memcmp(&ignoreAddr, &hostAddr, sizeof(PRIPv6Addr)) == 0; - } - --nsresult nsUnixSystemProxySettings::GetProxyFromGConf(const nsACString& aScheme, -- const nsACString& aHost, -- int32_t aPort, -- nsACString& aResult) { -- bool masterProxySwitch = false; -- mGConf->GetBool(NS_LITERAL_CSTRING("/system/http_proxy/use_http_proxy"), -- &masterProxySwitch); -- // if no proxy is set in GConf return NS_ERROR_FAILURE -- if (!(IsProxyMode("manual") || masterProxySwitch)) { -- return NS_ERROR_FAILURE; -- } -- -- nsCOMPtr ignoreList; -- if (NS_SUCCEEDED(mGConf->GetStringList( -- NS_LITERAL_CSTRING("/system/http_proxy/ignore_hosts"), -- getter_AddRefs(ignoreList))) && -- ignoreList) { -- uint32_t len = 0; -- ignoreList->GetLength(&len); -- for (uint32_t i = 0; i < len; ++i) { -- nsCOMPtr str = do_QueryElementAt(ignoreList, i); -- if (str) { -- nsAutoString s; -- if (NS_SUCCEEDED(str->GetData(s)) && !s.IsEmpty()) { -- if (HostIgnoredByProxy(NS_ConvertUTF16toUTF8(s), aHost)) { -- aResult.AppendLiteral("DIRECT"); -- return NS_OK; -- } -- } -- } -- } -- } -- -- bool useHttpProxyForAll = false; -- // This setting sometimes doesn't exist, don't bail on failure -- mGConf->GetBool(NS_LITERAL_CSTRING("/system/http_proxy/use_same_proxy"), -- &useHttpProxyForAll); -- -- nsresult rv; -- if (!useHttpProxyForAll) { -- rv = SetProxyResultFromGConf("/system/proxy/socks_", "SOCKS", aResult); -- if (NS_SUCCEEDED(rv)) return rv; -- } -- -- if (aScheme.LowerCaseEqualsLiteral("http") || useHttpProxyForAll) { -- rv = SetProxyResultFromGConf("/system/http_proxy/", "PROXY", aResult); -- } else if (aScheme.LowerCaseEqualsLiteral("https")) { -- rv = SetProxyResultFromGConf("/system/proxy/secure_", "PROXY", aResult); -- } else if (aScheme.LowerCaseEqualsLiteral("ftp")) { -- rv = SetProxyResultFromGConf("/system/proxy/ftp_", "PROXY", aResult); -- } else { -- rv = NS_ERROR_FAILURE; -- } -- -- return rv; --} -- - nsresult nsUnixSystemProxySettings::GetProxyFromGSettings( - const nsACString& aScheme, const nsACString& aHost, int32_t aPort, - nsACString& aResult) { -@@ -494,7 +391,6 @@ nsresult nsUnixSystemProxySettings::GetP - nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult); - if (NS_SUCCEEDED(rv)) return rv; - } -- if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult); - - return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult); - } diff --git a/mozilla-1552590.patch b/mozilla-1552590.patch deleted file mode 100644 index 58d5b18..0000000 --- a/mozilla-1552590.patch +++ /dev/null @@ -1,2701 +0,0 @@ -changeset: 474982:24c0dda573b3 -parent: 474915:839cdad764d7 -user: Martin Stransky -date: Fri May 17 11:24:33 2019 +0200 -summary: Implement dmabuf surfaces - -diff --git a/gfx/2d/WaylandDMABufSurface.cpp b/gfx/2d/WaylandDMABufSurface.cpp -new file mode 100644 ---- /dev/null -+++ b/gfx/2d/WaylandDMABufSurface.cpp -@@ -0,0 +1,274 @@ -+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -+/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -+/* This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -+ -+// Based on weston/simple-dmabuf-egl.c -+ -+#include "WaylandDMABufSurface.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+using namespace mozilla; -+using namespace mozilla::widget; -+ -+#ifndef DRM_FORMAT_MOD_INVALID -+# define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1) -+#endif -+#define BUFFER_FLAGS 0 -+ -+bool WaylandDMABufSurface::mAvailable = false; -+bool WaylandDMABufSurface::mInitialized = false; -+ -+bool WaylandDMABufSurface::IsAvailable() { -+ if (!mInitialized) { -+ mInitialized = true; -+ if (!nsGbmLib::IsAvailable()) { -+ return false; -+ } -+ -+ // Test Alpha and non-alpha formats -+ nsWaylandDisplay* display = WaylandDisplayGet(); -+ if (!display->GetGbmFormat(false) || !display->GetGbmFormat(true)) { -+ return false; -+ } -+ mAvailable = true; -+ } -+ return static_cast(mAvailable); -+} -+ -+static void buffer_release(void* data, wl_buffer* buffer) { -+ auto surface = reinterpret_cast(data); -+ surface->WLBufferDetach(); -+} -+ -+static const struct wl_buffer_listener buffer_listener = {buffer_release}; -+ -+static void buffer_created(void* data, -+ struct zwp_linux_buffer_params_v1* params, -+ struct wl_buffer* new_buffer) { -+ auto surface = static_cast(data); -+ -+ surface->SetWLBuffer(new_buffer); -+ -+ nsWaylandDisplay* display = WaylandDisplayGet(); -+ /* When not using explicit synchronization listen to wl_buffer.release -+ * for release notifications, otherwise we are going to use -+ * zwp_linux_buffer_release_v1. */ -+ if (!display->IsExplicitSyncEnabled()) { -+ wl_buffer_add_listener(new_buffer, &buffer_listener, surface); -+ } -+ zwp_linux_buffer_params_v1_destroy(params); -+} -+ -+static void buffer_create_failed(void* data, -+ struct zwp_linux_buffer_params_v1* params) { -+ zwp_linux_buffer_params_v1_destroy(params); -+} -+ -+static const struct zwp_linux_buffer_params_v1_listener params_listener = { -+ buffer_created, buffer_create_failed}; -+ -+WaylandDMABufSurface::WaylandDMABufSurface() -+ : mWidth(0), -+ mHeight(0), -+ mGmbFormat(nullptr), -+ mWLBuffer(nullptr), -+ mMappedRegion(nullptr), -+ mGbmBufferObject(nullptr), -+ mBufferModifier(DRM_FORMAT_MOD_INVALID), -+ mBufferPlaneCount(1), -+ mWLBufferAttached(false), -+ mFastWLBufferCreation(true) { -+ for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) { -+ mDmabufFds[i] = -1; -+ mStrides[i] = 0; -+ mOffsets[i] = 0; -+ } -+} -+ -+WaylandDMABufSurface::~WaylandDMABufSurface() { Release(); } -+ -+bool WaylandDMABufSurface::Create(int aWidth, int aHeight, bool aHasAlpha) { -+ MOZ_ASSERT(mWLBuffer == nullptr); -+ -+ mWidth = aWidth; -+ mHeight = aHeight; -+ -+ nsWaylandDisplay* display = WaylandDisplayGet(); -+ mGmbFormat = display->GetGbmFormat(aHasAlpha); -+ if (!mGmbFormat) { -+ // Requested DRM format is not supposed. -+ return false; -+ } -+ -+#ifdef HAVE_GBM_MODIFIERS -+ if (nsGbmLib::IsModifierAvailable() && mGmbFormat->mModifiersCount > 0) { -+ mGbmBufferObject = nsGbmLib::CreateWithModifiers( -+ display->GetGbmDevice(), mWidth, mHeight, mGmbFormat->mFormat, -+ mGmbFormat->mModifiers, mGmbFormat->mModifiersCount); -+ if (mGbmBufferObject) { -+ mBufferModifier = nsGbmLib::GetModifier(mGbmBufferObject); -+ } -+ } -+#endif -+ -+ if (!mGbmBufferObject) { -+ mGbmBufferObject = -+ nsGbmLib::Create(display->GetGbmDevice(), mWidth, mHeight, -+ mGmbFormat->mFormat, GBM_BO_USE_RENDERING); -+ } -+ -+ if (!mGbmBufferObject) { -+ return false; -+ } -+ -+#ifdef HAVE_GBM_MODIFIERS -+ if (nsGbmLib::IsModifierAvailable()) { -+ mBufferPlaneCount = nsGbmLib::GetPlaneCount(mGbmBufferObject); -+ for (int i = 0; i < mBufferPlaneCount; i++) { -+ uint32_t handle = nsGbmLib::GetHandleForPlane(mGbmBufferObject, i).u32; -+ int ret = nsGbmLib::DrmPrimeHandleToFD(display->GetGbmDeviceFd(), handle, -+ 0, &mDmabufFds[i]); -+ if (ret < 0 || mDmabufFds[i] < 0) { -+ Release(); -+ return false; -+ } -+ mStrides[i] = nsGbmLib::GetStrideForPlane(mGbmBufferObject, i); -+ mOffsets[i] = nsGbmLib::GetOffset(mGbmBufferObject, i); -+ } -+ } else -+#endif -+ { -+ mBufferPlaneCount = 1; -+ mStrides[0] = nsGbmLib::GetStride(mGbmBufferObject); -+ mDmabufFds[0] = nsGbmLib::GetFd(mGbmBufferObject); -+ if (mDmabufFds[0] < 0) { -+ Release(); -+ return false; -+ } -+ } -+ -+ struct zwp_linux_buffer_params_v1* params = -+ zwp_linux_dmabuf_v1_create_params(display->GetDmabuf()); -+ for (int i = 0; i < mBufferPlaneCount; i++) { -+ zwp_linux_buffer_params_v1_add(params, mDmabufFds[i], i, mOffsets[i], -+ mStrides[i], mBufferModifier >> 32, -+ mBufferModifier & 0xffffffff); -+ } -+ zwp_linux_buffer_params_v1_add_listener(params, ¶ms_listener, this); -+ -+ if (mFastWLBufferCreation) { -+ mWLBuffer = zwp_linux_buffer_params_v1_create_immed( -+ params, mWidth, mHeight, mGmbFormat->mFormat, BUFFER_FLAGS); -+ /* When not using explicit synchronization listen to -+ * wl_buffer.release for release notifications, otherwise we -+ * are going to use zwp_linux_buffer_release_v1. */ -+ if (!display->IsExplicitSyncEnabled()) { -+ wl_buffer_add_listener(mWLBuffer, &buffer_listener, this); -+ } -+ } else { -+ zwp_linux_buffer_params_v1_create(params, mWidth, mHeight, -+ mGmbFormat->mFormat, BUFFER_FLAGS); -+ } -+ -+ return true; -+} -+ -+void WaylandDMABufSurface::Release() { -+ MOZ_ASSERT(!IsMapped(), "We can't release mapped buffer!"); -+ -+ if (mWLBuffer) { -+ wl_buffer_destroy(mWLBuffer); -+ mWLBuffer = nullptr; -+ } -+ -+ if (mGbmBufferObject) { -+ nsGbmLib::Destroy(mGbmBufferObject); -+ mGbmBufferObject = nullptr; -+ } -+ -+ for (int i = 0; i < mBufferPlaneCount; i++) { -+ if (mDmabufFds[i] >= 0) { -+ close(mDmabufFds[i]); -+ mDmabufFds[i] = 0; -+ } -+ } -+} -+ -+void* WaylandDMABufSurface::MapReadOnly(uint32_t aX, uint32_t aY, -+ uint32_t aWidth, uint32_t aHeight, -+ uint32_t* aStride) { -+ NS_ASSERTION(mMappedRegion == nullptr, "Already mapped?"); -+ void* map_data = nullptr; -+ *aStride = 0; -+ mMappedRegion = nsGbmLib::Map(mGbmBufferObject, aX, aY, aWidth, aHeight, -+ GBM_BO_TRANSFER_READ, aStride, &map_data); -+ return mMappedRegion; -+} -+ -+void* WaylandDMABufSurface::MapReadOnly(uint32_t* aStride) { -+ return MapReadOnly(0, 0, mWidth, mHeight, aStride); -+} -+ -+void* WaylandDMABufSurface::Map(uint32_t aX, uint32_t aY, uint32_t aWidth, -+ uint32_t aHeight, uint32_t* aStride) { -+ NS_ASSERTION(mMappedRegion == nullptr, "Already mapped?"); -+ void* map_data = nullptr; -+ *aStride = 0; -+ mMappedRegion = nsGbmLib::Map(mGbmBufferObject, aX, aY, aWidth, aHeight, -+ GBM_BO_TRANSFER_READ_WRITE, aStride, &map_data); -+ return mMappedRegion; -+} -+ -+void* WaylandDMABufSurface::Map(uint32_t* aStride) { -+ return Map(0, 0, mWidth, mHeight, aStride); -+} -+ -+void WaylandDMABufSurface::Unmap() { -+ if (mMappedRegion) { -+ nsGbmLib::Unmap(mGbmBufferObject, mMappedRegion); -+ mMappedRegion = nullptr; -+ } -+} -+ -+bool WaylandDMABufSurface::Resize(int aWidth, int aHeight) { -+ if (aWidth == mWidth && aHeight == mHeight) { -+ return true; -+ } -+ -+ if (IsMapped()) { -+ NS_WARNING("We can't resize mapped surface!"); -+ return false; -+ } -+ -+ Release(); -+ return Create(aWidth, aHeight, mGmbFormat->mHasAlpha); -+} -+ -+bool WaylandDMABufSurface::CopyFrom( -+ class WaylandDMABufSurface* aSourceSurface) { -+ // Not implemented - we should not call that. -+ MOZ_CRASH(); -+} -+ -+// TODO - EGL clear -+void WaylandDMABufSurface::Clear() { -+ uint32_t destStride; -+ void* destData = Map(&destStride); -+ memset(destData, 0, GetHeight() * destStride); -+ Unmap(); -+} -diff --git a/gfx/2d/WaylandDMABufSurface.h b/gfx/2d/WaylandDMABufSurface.h -new file mode 100644 ---- /dev/null -+++ b/gfx/2d/WaylandDMABufSurface.h -@@ -0,0 +1,73 @@ -+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -+/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -+/* This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -+ -+#ifndef WaylandDMABufSurface_h__ -+#define WaylandDMABufSurface_h__ -+ -+#include -+#include "mozilla/widget/nsWaylandDisplay.h" -+ -+#define DMABUF_BUFFER_PLANES 4 -+ -+class WaylandDMABufSurface { -+ public: -+ static bool IsAvailable(); -+ -+ bool CreateFrameBuffer(int aWidth, int aHeight); -+ bool CreateEGLImage(int aWidth, int aHeight); -+ -+ bool Create(int aWidth, int aHeight, bool aHasAlpha = true); -+ bool Resize(int aWidth, int aHeight); -+ void Release(); -+ void Clear(); -+ -+ bool CopyFrom(class WaylandDMABufSurface* aSourceSurface); -+ -+ int GetWidth() { return mWidth; }; -+ int GetHeight() { return mHeight; }; -+ -+ void* MapReadOnly(uint32_t aX, uint32_t aY, uint32_t aWidth, uint32_t aHeight, -+ uint32_t* aStride); -+ void* MapReadOnly(uint32_t* aStride); -+ void* Map(uint32_t aX, uint32_t aY, uint32_t aWidth, uint32_t aHeight, -+ uint32_t* aStride); -+ void* Map(uint32_t* aStride); -+ bool IsMapped() { return mMappedRegion; }; -+ void Unmap(); -+ -+ void SetWLBuffer(struct wl_buffer* aWLBuffer) { mWLBuffer = aWLBuffer; }; -+ wl_buffer* GetWLBuffer() { return mWLBuffer; }; -+ -+ void WLBufferDetach() { mWLBufferAttached = false; }; -+ bool WLBufferIsAttached() { return mWLBufferAttached; }; -+ void WLBufferSetAttached() { mWLBufferAttached = true; }; -+ -+ WaylandDMABufSurface(); -+ ~WaylandDMABufSurface(); -+ -+ private: -+ int mWidth; -+ int mHeight; -+ mozilla::widget::GbmFormat* mGmbFormat; -+ -+ wl_buffer* mWLBuffer; -+ void* mMappedRegion; -+ -+ struct gbm_bo* mGbmBufferObject; -+ uint64_t mBufferModifier; -+ int mBufferPlaneCount; -+ int mDmabufFds[DMABUF_BUFFER_PLANES]; -+ uint32_t mStrides[DMABUF_BUFFER_PLANES]; -+ uint32_t mOffsets[DMABUF_BUFFER_PLANES]; -+ -+ bool mWLBufferAttached; -+ bool mFastWLBufferCreation; -+ -+ static bool mAvailable; -+ static bool mInitialized; -+}; -+ -+#endif -diff --git a/gfx/2d/moz.build b/gfx/2d/moz.build ---- a/gfx/2d/moz.build -+++ b/gfx/2d/moz.build -@@ -255,8 +255,20 @@ if CONFIG['MOZ_ENABLE_SKIA']: - '/gfx/skia/skia/include/private', - '/gfx/skia/skia/src/core', - '/gfx/skia/skia/src/image', - ] - if CONFIG['MOZ_ENABLE_SKIA_GPU']: - LOCAL_INCLUDES += [ - '/gfx/skia/skia/src/gpu', - ] -+ -+#if CONFIG['MOZ_WAYLAND'] and CONFIG['HAVE_LIBDRM']: -+if CONFIG['HAVE_LIBDRM']: -+ SOURCES += [ -+ 'WaylandDMABufSurface.cpp', -+ ] -+ EXPORTS.mozilla.gfx += [ -+ 'WaylandDMABufSurface.h', -+ ] -+ CFLAGS += CONFIG['TK_CFLAGS'] -+ CXXFLAGS += CONFIG['TK_CFLAGS'] -+ -diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js ---- a/modules/libpref/init/all.js -+++ b/modules/libpref/init/all.js -@@ -5091,16 +5091,21 @@ pref("gfx.apitrace.enabled",false); - - #ifdef MOZ_X11 - #ifdef MOZ_WIDGET_GTK - pref("gfx.xrender.enabled",false); - pref("widget.chrome.allow-gtk-dark-theme", false); - pref("widget.content.allow-gtk-dark-theme", false); - #endif - #endif -+#ifdef MOZ_WAYLAND -+#ifdef HAVE_LIBDRM -+pref("gfx.wayland_dmabuf_backend.enabled", false); -+#endif -+#endif - - pref("widget.window-transforms.disabled", false); - - #ifdef XP_WIN - // Whether to disable the automatic detection and use of direct2d. - pref("gfx.direct2d.disabled", false); - - // Whether to attempt to enable Direct2D regardless of automatic detection or -diff --git a/toolkit/moz.configure b/toolkit/moz.configure ---- a/toolkit/moz.configure -+++ b/toolkit/moz.configure -@@ -260,16 +260,24 @@ def wayland_headers(wayland, toolkit_gtk - if toolkit_gtk and artifacts: - return True - return wayland - - - set_config('MOZ_WAYLAND', depends_if(wayland_headers)(lambda _: True)) - set_define('MOZ_WAYLAND', depends_if(wayland_headers)(lambda _: True)) - -+drm_headers = pkg_check_modules('HAVE_LIBDRM', 'libdrm > 2.4', when=wayland_headers) -+set_config('HAVE_LIBDRM', depends_if(drm_headers)(lambda _: True)) -+set_define('HAVE_LIBDRM', depends_if(drm_headers)(lambda _: True)) -+ -+gbm_modifiers = pkg_check_modules('HAVE_GBM_MODIFIERS', 'gbm >= 17.1', when=drm_headers) -+set_config('HAVE_GBM_MODIFIERS', depends_if(gbm_modifiers)(lambda _: True)) -+set_define('HAVE_GBM_MODIFIERS', depends_if(gbm_modifiers)(lambda _: True)) -+ - # GL Provider - # ============================================================== - option('--with-gl-provider', nargs=1, help='Set GL provider backend type') - - @depends('--with-gl-provider') - def gl_provider(value): - if value: - return value[0] -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -30,16 +30,19 @@ extern mozilla::LazyLogModule gWidgetWay - MOZ_LOG(gWidgetWaylandLog, mozilla::LogLevel::Debug, args) - #else - # define LOGWAYLAND(args) - #endif /* MOZ_LOGGING */ - - namespace mozilla { - namespace widget { - -+bool WindowSurfaceWayland::mUseDMABuf = false; -+bool WindowSurfaceWayland::mUseDMABufInitialized = false; -+ - /* - Wayland multi-thread rendering scheme - - Every rendering thread (main thread, compositor thread) contains its own - nsWaylandDisplay object connected to Wayland compositor (Mutter, Weston, etc.) - - WindowSurfaceWayland implements WindowSurface class and draws nsWindow by - WindowSurface interface (Lock, Commit) to screen through nsWaylandDisplay. -@@ -255,120 +258,183 @@ WaylandShmPool::~WaylandShmPool() { - - static void buffer_release(void* data, wl_buffer* buffer) { - auto surface = reinterpret_cast(data); - surface->Detach(buffer); - } - - static const struct wl_buffer_listener buffer_listener = {buffer_release}; - --void WindowBackBuffer::Create(int aWidth, int aHeight) { -+void WindowBackBufferShm::Create(int aWidth, int aHeight) { - MOZ_ASSERT(!IsAttached(), "We can't resize attached buffers."); - - int newBufferSize = aWidth * aHeight * BUFFER_BPP; - mShmPool.Resize(newBufferSize); - - mWaylandBuffer = - wl_shm_pool_create_buffer(mShmPool.GetShmPool(), 0, aWidth, aHeight, - aWidth * BUFFER_BPP, WL_SHM_FORMAT_ARGB8888); - wl_proxy_set_queue((struct wl_proxy*)mWaylandBuffer, -- mWaylandDisplay->GetEventQueue()); -+ GetWaylandDisplay()->GetEventQueue()); - wl_buffer_add_listener(mWaylandBuffer, &buffer_listener, this); - - mWidth = aWidth; - mHeight = aHeight; - - LOGWAYLAND(( - "%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, - (void*)mWaylandBuffer, - mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); - } - --void WindowBackBuffer::Release() { -+void WindowBackBufferShm::Release() { - LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); - - wl_buffer_destroy(mWaylandBuffer); - mWidth = mHeight = 0; - } - --void WindowBackBuffer::Clear() { -+void WindowBackBufferShm::Clear() { - memset(mShmPool.GetImageData(), 0, mHeight * mWidth * BUFFER_BPP); - } - --WindowBackBuffer::WindowBackBuffer(nsWaylandDisplay* aWaylandDisplay, -- int aWidth, int aHeight) -- : mShmPool(aWaylandDisplay, aWidth * aHeight * BUFFER_BPP), -+WindowBackBufferShm::WindowBackBufferShm(nsWaylandDisplay* aWaylandDisplay, -+ int aWidth, int aHeight) -+ : WindowBackBuffer(aWaylandDisplay), -+ mShmPool(aWaylandDisplay, aWidth * aHeight * BUFFER_BPP), - mWaylandBuffer(nullptr), - mWidth(aWidth), - mHeight(aHeight), -- mAttached(false), -- mWaylandDisplay(aWaylandDisplay) { -+ mAttached(false) { - Create(aWidth, aHeight); - } - --WindowBackBuffer::~WindowBackBuffer() { Release(); } -+WindowBackBufferShm::~WindowBackBufferShm() { Release(); } - --bool WindowBackBuffer::Resize(int aWidth, int aHeight) { -+bool WindowBackBufferShm::Resize(int aWidth, int aHeight) { - if (aWidth == mWidth && aHeight == mHeight) return true; - - LOGWAYLAND( - ("%s [%p] %d %d\n", __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); - - Release(); - Create(aWidth, aHeight); - - return (mWaylandBuffer != nullptr); - } - - void WindowBackBuffer::Attach(wl_surface* aSurface) { -- LOGWAYLAND(( -- "%s [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -- (void*)this, (void*)aSurface, -- aSurface ? wl_proxy_get_id((struct wl_proxy*)aSurface) : -1, -- (void*)mWaylandBuffer, -- mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); -+ LOGWAYLAND( -+ ("%s [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ (void*)this, (void*)aSurface, -+ aSurface ? wl_proxy_get_id((struct wl_proxy*)aSurface) : -1, -+ (void*)GetWlBuffer(), -+ GetWlBuffer() ? wl_proxy_get_id((struct wl_proxy*)GetWlBuffer()) : -1)); - -- wl_surface_attach(aSurface, mWaylandBuffer, 0, 0); -+ wl_surface_attach(aSurface, GetWlBuffer(), 0, 0); - wl_surface_commit(aSurface); -- wl_display_flush(mWaylandDisplay->GetDisplay()); -- mAttached = true; -+ wl_display_flush(GetWaylandDisplay()->GetDisplay()); -+ SetAttached(); - } - --void WindowBackBuffer::Detach(wl_buffer* aBuffer) { -+void WindowBackBufferShm::Detach(wl_buffer* aBuffer) { - LOGWAYLAND(("%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, - (void*)aBuffer, - aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1)); - - mAttached = false; - } - --bool WindowBackBuffer::SetImageDataFromBuffer( -+bool WindowBackBufferShm::SetImageDataFromBuffer( - class WindowBackBuffer* aSourceBuffer) { -- if (!IsMatchingSize(aSourceBuffer)) { -- Resize(aSourceBuffer->mWidth, aSourceBuffer->mHeight); -+ auto sourceBuffer = static_cast(aSourceBuffer); -+ if (!IsMatchingSize(sourceBuffer)) { -+ Resize(sourceBuffer->mWidth, sourceBuffer->mHeight); - } - - mShmPool.SetImageDataFromPool( -- &aSourceBuffer->mShmPool, -- aSourceBuffer->mWidth * aSourceBuffer->mHeight * BUFFER_BPP); -+ &sourceBuffer->mShmPool, -+ sourceBuffer->mWidth * sourceBuffer->mHeight * BUFFER_BPP); - return true; - } - --already_AddRefed WindowBackBuffer::Lock() { -+already_AddRefed WindowBackBufferShm::Lock() { - LOGWAYLAND(( - "%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, - (void*)this, mWidth, mHeight, (void*)mWaylandBuffer, - mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); - - gfx::IntSize lockSize(mWidth, mHeight); - return gfxPlatform::CreateDrawTargetForData( - static_cast(mShmPool.GetImageData()), lockSize, -- BUFFER_BPP * mWidth, mFormat); -+ BUFFER_BPP * mWidth, GetSurfaceFormat()); -+} -+ -+#ifdef HAVE_LIBDRM -+WindowBackBufferDMABuf::WindowBackBufferDMABuf( -+ nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight) -+ : WindowBackBuffer(aWaylandDisplay) { -+ mDMAbufSurface.Create(aWidth, aHeight); -+} -+ -+WindowBackBufferDMABuf::~WindowBackBufferDMABuf() { mDMAbufSurface.Release(); } -+ -+already_AddRefed WindowBackBufferDMABuf::Lock() { -+ LOGWAYLAND( -+ ("%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ (void*)this, GetWidth(), GetHeight(), (void*)GetWlBuffer(), -+ GetWlBuffer() ? wl_proxy_get_id((struct wl_proxy*)GetWlBuffer()) : -1)); -+ -+ uint32_t stride; -+ void* pixels = mDMAbufSurface.Map(&stride); -+ gfx::IntSize lockSize(GetWidth(), GetHeight()); -+ return gfxPlatform::CreateDrawTargetForData( -+ static_cast(pixels), lockSize, stride, -+ GetSurfaceFormat()); -+} -+ -+void WindowBackBufferDMABuf::Unlock() { mDMAbufSurface.Unmap(); } -+ -+bool WindowBackBufferDMABuf::IsAttached() { -+ return mDMAbufSurface.WLBufferIsAttached(); - } - -+void WindowBackBufferDMABuf::SetAttached() { -+ return mDMAbufSurface.WLBufferSetAttached(); -+} -+ -+int WindowBackBufferDMABuf::GetWidth() { return mDMAbufSurface.GetWidth(); } -+ -+int WindowBackBufferDMABuf::GetHeight() { return mDMAbufSurface.GetHeight(); } -+ -+wl_buffer* WindowBackBufferDMABuf::GetWlBuffer() { -+ return mDMAbufSurface.GetWLBuffer(); -+} -+ -+bool WindowBackBufferDMABuf::IsLocked() { return mDMAbufSurface.IsMapped(); } -+ -+bool WindowBackBufferDMABuf::Resize(int aWidth, int aHeight) { -+ return mDMAbufSurface.Resize(aWidth, aHeight); -+} -+ -+bool WindowBackBufferDMABuf::SetImageDataFromBuffer( -+ class WindowBackBuffer* aSourceBuffer) { -+ WindowBackBufferDMABuf* source = -+ static_cast(aSourceBuffer); -+ mDMAbufSurface.CopyFrom(&source->mDMAbufSurface); -+ return true; -+} -+ -+void WindowBackBufferDMABuf::Detach(wl_buffer* aBuffer) { -+ mDMAbufSurface.WLBufferDetach(); -+} -+ -+void WindowBackBufferDMABuf::Clear() { mDMAbufSurface.Clear(); } -+#endif -+ - static void frame_callback_handler(void* data, struct wl_callback* callback, - uint32_t time) { - auto surface = reinterpret_cast(data); - surface->FrameCallbackHandler(); - - gfxPlatformGtk::GetPlatform()->SetWaylandLastVsync(time); - } - -@@ -412,23 +478,60 @@ WindowSurfaceWayland::~WindowSurfaceWayl - - for (int i = 0; i < BACK_BUFFER_NUM; i++) { - if (mBackupBuffer[i]) { - delete mBackupBuffer[i]; - } - } - } - --WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw(int aWidth, -- int aHeight) { -+bool WindowSurfaceWayland::UseDMABufBackend() { -+ if (!mUseDMABufInitialized) { -+#ifdef HAVE_LIBDRM -+ if (WaylandDMABufSurface::IsAvailable()) { -+ mUseDMABuf = -+ Preferences::GetBool("gfx.wayland_dmabuf_backend.enabled", false); -+ } -+#endif -+ mUseDMABufInitialized = true; -+ } -+ return mUseDMABuf; -+} -+ -+WindowBackBuffer* WindowSurfaceWayland::CreateWaylandBuffer(int aWidth, -+ int aHeight) { -+ if (UseDMABufBackend()) { -+ static bool sDMABufBufferCreated = false; -+ WindowBackBuffer* buffer = -+ new WindowBackBufferDMABuf(mWaylandDisplay, aWidth, aHeight); -+ if (buffer) { -+ sDMABufBufferCreated = true; -+ return buffer; -+ } -+ // If this is the first failure and there's no dmabuf already active -+ // we can safely fallback to Shm. Otherwise we can't mix DMAbuf and -+ // SHM buffers so just fails now. -+ if (sDMABufBufferCreated) { -+ NS_WARNING("Failed to allocate DMABuf buffer!"); -+ return nullptr; -+ } else { -+ NS_WARNING("Wayland DMABuf failed, switched back to Shm backend!"); -+ mUseDMABuf = false; -+ } -+ } -+ return new WindowBackBufferShm(mWaylandDisplay, aWidth, aHeight); -+} -+ -+WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( -+ int aWidth, int aHeight, bool aFullScreenUpdate, bool aNoBackBufferCopy) { - if (!mWaylandBuffer) { - LOGWAYLAND(("%s [%p] Create [%d x %d]\n", __PRETTY_FUNCTION__, (void*)this, - aWidth, aHeight)); - -- mWaylandBuffer = new WindowBackBuffer(mWaylandDisplay, aWidth, aHeight); -+ mWaylandBuffer = CreateWaylandBuffer(aWidth, aHeight); - mWaitToFullScreenUpdate = true; - return mWaylandBuffer; - } - - if (!mWaylandBuffer->IsAttached()) { - if (!mWaylandBuffer->IsMatchingSize(aWidth, aHeight)) { - mWaylandBuffer->Resize(aWidth, aHeight); - // There's a chance that scale factor has been changed -@@ -444,75 +547,89 @@ WindowBackBuffer* WindowSurfaceWayland:: - MOZ_ASSERT(!mPendingCommit, - "Uncommitted buffer switch, screen artifacts ahead."); - - // Front buffer is used by compositor, select a back buffer - int availableBuffer; - for (availableBuffer = 0; availableBuffer < BACK_BUFFER_NUM; - availableBuffer++) { - if (!mBackupBuffer[availableBuffer]) { -- mBackupBuffer[availableBuffer] = -- new WindowBackBuffer(mWaylandDisplay, aWidth, aHeight); -+ mBackupBuffer[availableBuffer] = CreateWaylandBuffer(aWidth, aHeight); - break; - } - - if (!mBackupBuffer[availableBuffer]->IsAttached()) { - break; - } - } - - if (MOZ_UNLIKELY(availableBuffer == BACK_BUFFER_NUM)) { - LOGWAYLAND(("%s [%p] No drawing buffer available!\n", __PRETTY_FUNCTION__, - (void*)this)); - NS_WARNING("No drawing buffer available"); - return nullptr; - } - -+ bool bufferFlip = mWaylandBuffer->IsMatchingSize(aWidth, aHeight); -+ if (bufferFlip && aNoBackBufferCopy && !aFullScreenUpdate) { -+ LOGWAYLAND(("%s [%p] Delayed hard copy from old buffer [%d x %d]\n", -+ __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); -+ return nullptr; -+ } -+ - WindowBackBuffer* lastWaylandBuffer = mWaylandBuffer; - mWaylandBuffer = mBackupBuffer[availableBuffer]; - mBackupBuffer[availableBuffer] = lastWaylandBuffer; - -- if (lastWaylandBuffer->IsMatchingSize(aWidth, aHeight)) { -- LOGWAYLAND(("%s [%p] Copy from old buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, aWidth, aHeight)); -+ if (bufferFlip) { - // Former front buffer has the same size as a requested one. - // Gecko may expect a content already drawn on screen so copy -- // existing data to the new buffer. -- mWaylandBuffer->SetImageDataFromBuffer(lastWaylandBuffer); -+ // existing data to the new buffer if we don't do fullscreen redraw. -+ if (!aFullScreenUpdate) { -+ LOGWAYLAND(("%s [%p] Copy from old buffer [%d x %d]\n", -+ __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); -+ mWaylandBuffer->SetImageDataFromBuffer(lastWaylandBuffer); -+ } - // When buffer switches we need to damage whole screen - // (https://bugzilla.redhat.com/show_bug.cgi?id=1418260) - mWaylandBufferFullScreenDamage = true; - } else { - LOGWAYLAND(("%s [%p] Resize to [%d x %d]\n", __PRETTY_FUNCTION__, - (void*)this, aWidth, aHeight)); - // Former buffer has different size from the new request. Only resize - // the new buffer and leave gecko to render new whole content. - mWaylandBuffer->Resize(aWidth, aHeight); - mWaitToFullScreenUpdate = true; - } - - return mWaylandBuffer; - } - - already_AddRefed WindowSurfaceWayland::LockWaylandBuffer( -- int aWidth, int aHeight, bool aClearBuffer) { -- WindowBackBuffer* buffer = GetWaylandBufferToDraw(aWidth, aHeight); -+ int aWidth, int aHeight, bool aClearBuffer, bool aFullScreenUpdate, -+ bool aNoBackBufferCopy) { -+ WindowBackBuffer* buffer = GetWaylandBufferToDraw( -+ aWidth, aHeight, aFullScreenUpdate, aNoBackBufferCopy); - if (!buffer) { -- NS_WARNING( -- "WindowSurfaceWayland::LockWaylandBuffer(): No buffer available"); -+ if (!aNoBackBufferCopy) { -+ NS_WARNING( -+ "WindowSurfaceWayland::LockWaylandBuffer(): No buffer available"); -+ } - return nullptr; - } - - if (aClearBuffer) { - buffer->Clear(); - } - - return buffer->Lock(); - } - -+void WindowSurfaceWayland::UnlockWaylandBuffer() { mWaylandBuffer->Unlock(); } -+ - already_AddRefed WindowSurfaceWayland::LockImageSurface( - const gfx::IntSize& aLockSize) { - if (!mImageSurface || mImageSurface->CairoStatus() || - !(aLockSize <= mImageSurface->GetSize())) { - mImageSurface = new gfxImageSurface( - aLockSize, - SurfaceFormatToImageFormat(WindowBackBuffer::GetSurfaceFormat())); - if (mImageSurface->CairoStatus()) { -@@ -552,20 +669,28 @@ already_AddRefed Window - - // Are we asked for entire nsWindow to draw? - mDrawToWaylandBufferDirectly = - (aRegion.GetNumRects() == 1 && bounds.x == 0 && bounds.y == 0 && - lockSize.width == screenRect.width && - lockSize.height == screenRect.height); - - if (mDrawToWaylandBufferDirectly) { -- RefPtr dt = -- LockWaylandBuffer(screenRect.width, screenRect.height, -- mWindow->WaylandSurfaceNeedsClear()); -+ // If there's any pending image commit scratch them as we're going -+ // to redraw the whole sceen anyway. -+ mDelayedImageCommits.Clear(); -+ -+ bool needsClear = mWindow->WaylandSurfaceNeedsClear(); -+ RefPtr dt = LockWaylandBuffer( -+ screenRect.width, screenRect.height, needsClear, -+ /* aFullScreenUpdate */ true, /* aNoBackBufferCopy */ true); - if (dt) { -+ if (needsClear) { -+ mWindow->WaylandSurfaceCleared(); -+ } - // When we have a request to update whole screen at once - // (surface was created, resized or changed somehow) - // we also need update scale factor of the screen. - if (mWaitToFullScreenUpdate) { - mWaitToFullScreenUpdate = false; - mNeedScaleFactorUpdate = true; - } - return dt.forget(); -@@ -574,52 +699,94 @@ already_AddRefed Window - // We don't have any front buffer available. Try indirect drawing - // to mImageSurface which is mirrored to front buffer at commit. - mDrawToWaylandBufferDirectly = false; - } - - return LockImageSurface(lockSize); - } - -+void WindowImageSurface::Draw(gfx::SourceSurface* aSurface, -+ gfx::DrawTarget* aDest, -+ const LayoutDeviceIntRegion& aRegion) { -+ uint32_t numRects = aRegion.GetNumRects(); -+ if (numRects != 1) { -+ AutoTArray rects; -+ rects.SetCapacity(numRects); -+ for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { -+ rects.AppendElement(iter.Get().ToUnknownRect()); -+ } -+ aDest->PushDeviceSpaceClipRects(rects.Elements(), rects.Length()); -+ } -+ -+ gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -+ gfx::Rect rect(bounds); -+ aDest->DrawSurface(aSurface, rect, rect); -+ -+ if (numRects != 1) { -+ aDest->PopClip(); -+ } -+} -+ -+void WindowImageSurface::Draw(gfx::DrawTarget* aDest, -+ LayoutDeviceIntRegion& aWaylandBufferDamage) { -+ Draw(mSurface.get(), aDest, mUpdateRegion); -+ aWaylandBufferDamage.OrWith(mUpdateRegion); -+} -+ -+WindowImageSurface::WindowImageSurface( -+ gfx::SourceSurface* aSurface, const LayoutDeviceIntRegion& aUpdateRegion) -+ : mSurface(aSurface), mUpdateRegion(aUpdateRegion){}; -+ -+void WindowSurfaceWayland::DrawDelayedImageCommits( -+ gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { -+ for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { -+ mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); -+ } -+ mDelayedImageCommits.Clear(); -+} -+ - bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer( -- const LayoutDeviceIntRegion& aRegion) { -+ const LayoutDeviceIntRegion& aRegion, -+ LayoutDeviceIntRegion& aWaylandBufferDamage) { - MOZ_ASSERT(!mDrawToWaylandBufferDirectly); - - LayoutDeviceIntRect screenRect = mWindow->GetBounds(); - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); - - gfx::Rect rect(bounds); - if (rect.IsEmpty()) { - return false; - } - -- RefPtr dt = LockWaylandBuffer( -- screenRect.width, screenRect.height, mWindow->WaylandSurfaceNeedsClear()); - RefPtr surf = - gfx::Factory::CreateSourceSurfaceForCairoSurface( - mImageSurface->CairoSurface(), mImageSurface->GetSize(), - mImageSurface->Format()); -- if (!dt || !surf) { -+ if (!surf) { - return false; - } - -- uint32_t numRects = aRegion.GetNumRects(); -- if (numRects != 1) { -- AutoTArray rects; -- rects.SetCapacity(numRects); -- for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { -- rects.AppendElement(iter.Get().ToUnknownRect()); -+ bool needsClear = mWindow->WaylandSurfaceNeedsClear(); -+ RefPtr dt = LockWaylandBuffer( -+ screenRect.width, screenRect.height, needsClear, -+ /* fullscreenDrawing */ false, /* aNoBackBufferCopy */ true); -+ if (dt) { -+ if (needsClear) { -+ mWindow->WaylandSurfaceCleared(); - } -- dt->PushDeviceSpaceClipRects(rects.Elements(), rects.Length()); -- } -- -- dt->DrawSurface(surf, rect, rect); -- -- if (numRects != 1) { -- dt->PopClip(); -+ // Draw any delayed image commits first -+ DrawDelayedImageCommits(dt, aWaylandBufferDamage); -+ WindowImageSurface::Draw(surf, dt, aRegion); -+ // Submit all drawing to final Wayland buffer upload -+ aWaylandBufferDamage.OrWith(aRegion); -+ UnlockWaylandBuffer(); -+ } else { -+ mDelayedImageCommits.AppendElement(WindowImageSurface(surf, aRegion)); -+ return false; - } - - return true; - } - - static void WaylandBufferDelayCommitHandler(WindowSurfaceWayland** aSurface) { - if (*aSurface) { - (*aSurface)->DelayedCommitHandler(); -@@ -643,16 +810,34 @@ void WindowSurfaceWayland::CalcRectScale - - void WindowSurfaceWayland::CommitWaylandBuffer() { - MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); - - if (mWaitToFullScreenUpdate) { - return; - } - -+ if (!mDrawToWaylandBufferDirectly) { -+ // There's some cached drawings - try to flush them now. -+ LayoutDeviceIntRect screenRect = mWindow->GetBounds(); -+ bool needsClear = mWindow->WaylandSurfaceNeedsClear(); -+ RefPtr dt = -+ LockWaylandBuffer(screenRect.width, screenRect.height, needsClear, -+ /* fullscreenInvalidate */ false, -+ /* aNoBackBufferCopy */ true); -+ if (dt) { -+ if (needsClear) { -+ mWindow->WaylandSurfaceCleared(); -+ } -+ DrawDelayedImageCommits(dt, mWaylandBufferDamage); -+ UnlockWaylandBuffer(); -+ mDrawToWaylandBufferDirectly = true; -+ } -+ } -+ - wl_surface* waylandSurface = mWindow->GetWaylandSurface(); - if (!waylandSurface) { - // Target window is not created yet - delay the commit. This can happen only - // when the window is newly created and there's no active - // frame callback pending. - MOZ_ASSERT(!mFrameCallback || waylandSurface != mLastCommittedSurface, - "Missing wayland surface at frame callback!"); - -@@ -735,24 +920,31 @@ void WindowSurfaceWayland::Commit(const - gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); - - LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", - __PRETTY_FUNCTION__, (void*)this, lockSize.width, - lockSize.height, screenRect.width, lockSize.height)); - } - #endif - -- // We have new content at mImageSurface - copy data to mWaylandBuffer first. -- if (!mDrawToWaylandBufferDirectly) { -- CommitImageSurfaceToWaylandBuffer(aInvalidRegion); -- } -- -- // If we're not at fullscreen damage add drawing area from aInvalidRegion -- if (!mWaylandBufferFullScreenDamage) { -- mWaylandBufferDamage.OrWith(aInvalidRegion); -+ if (mDrawToWaylandBufferDirectly) { -+ MOZ_ASSERT(mWaylandBuffer->IsLocked()); -+ // If we're not at fullscreen damage add drawing area from aInvalidRegion -+ if (!mWaylandBufferFullScreenDamage) { -+ mWaylandBufferDamage.OrWith(aInvalidRegion); -+ } -+ UnlockWaylandBuffer(); -+ } else { -+ MOZ_ASSERT(!mWaylandBuffer->IsLocked(), -+ "Drawing to already locked buffer?"); -+ if (CommitImageSurfaceToWaylandBuffer(aInvalidRegion, -+ mWaylandBufferDamage)) { -+ // Our cached drawing is flushed, we can draw fullscreen again. -+ mDrawToWaylandBufferDirectly = true; -+ } - } - - // We're ready to commit. - mPendingCommit = true; - CommitWaylandBuffer(); - } - - void WindowSurfaceWayland::FrameCallbackHandler() { -diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h ---- a/widget/gtk/WindowSurfaceWayland.h -+++ b/widget/gtk/WindowSurfaceWayland.h -@@ -5,16 +5,19 @@ - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - #ifndef _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H - #define _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H - - #include - #include "mozilla/gfx/Types.h" - #include "nsWaylandDisplay.h" -+#ifdef HAVE_LIBDRM -+# include "mozilla/gfx/WaylandDMABufSurface.h" -+#endif - - #define BACK_BUFFER_NUM 2 - - namespace mozilla { - namespace widget { - - // Allocates and owns shared memory for Wayland drawing surface - class WaylandShmPool { -@@ -35,94 +38,192 @@ class WaylandShmPool { - int mShmPoolFd; - int mAllocatedSize; - void* mImageData; - }; - - // Holds actual graphics data for wl_surface - class WindowBackBuffer { - public: -- WindowBackBuffer(nsWaylandDisplay* aDisplay, int aWidth, int aHeight); -- ~WindowBackBuffer(); -+ virtual already_AddRefed Lock() = 0; -+ virtual void Unlock(){}; -+ virtual bool IsLocked() { return false; }; -+ -+ void Attach(wl_surface* aSurface); -+ virtual void Detach(wl_buffer* aBuffer) = 0; -+ virtual bool IsAttached() = 0; -+ -+ virtual void Clear() = 0; -+ virtual bool Resize(int aWidth, int aHeight) = 0; -+ -+ virtual int GetWidth() = 0; -+ virtual int GetHeight() = 0; -+ virtual wl_buffer* GetWlBuffer() = 0; -+ virtual void SetAttached() = 0; -+ -+ virtual bool SetImageDataFromBuffer( -+ class WindowBackBuffer* aSourceBuffer) = 0; -+ -+ bool IsMatchingSize(int aWidth, int aHeight) { -+ return aWidth == GetWidth() && aHeight == GetHeight(); -+ } -+ bool IsMatchingSize(class WindowBackBuffer* aBuffer) { -+ return aBuffer->IsMatchingSize(GetWidth(), GetHeight()); -+ } -+ -+ static gfx::SurfaceFormat GetSurfaceFormat() { return mFormat; } -+ -+ nsWaylandDisplay* GetWaylandDisplay() { return mWaylandDisplay; }; -+ -+ WindowBackBuffer(nsWaylandDisplay* aWaylandDisplay) -+ : mWaylandDisplay(aWaylandDisplay){}; -+ virtual ~WindowBackBuffer(){}; -+ -+ private: -+ static gfx::SurfaceFormat mFormat; -+ nsWaylandDisplay* mWaylandDisplay; -+}; -+ -+class WindowBackBufferShm : public WindowBackBuffer { -+ public: -+ WindowBackBufferShm(nsWaylandDisplay* aWaylandDisplay, int aWidth, -+ int aHeight); -+ ~WindowBackBufferShm(); - - already_AddRefed Lock(); - -- void Attach(wl_surface* aSurface); - void Detach(wl_buffer* aBuffer); - bool IsAttached() { return mAttached; } - - void Clear(); - bool Resize(int aWidth, int aHeight); - bool SetImageDataFromBuffer(class WindowBackBuffer* aSourceBuffer); - -- bool IsMatchingSize(int aWidth, int aHeight) { -- return aWidth == mWidth && aHeight == mHeight; -- } -- bool IsMatchingSize(class WindowBackBuffer* aBuffer) { -- return aBuffer->mWidth == mWidth && aBuffer->mHeight == mHeight; -- } -+ int GetWidth() { return mWidth; }; -+ int GetHeight() { return mHeight; }; - -- static gfx::SurfaceFormat GetSurfaceFormat() { return mFormat; } -+ wl_buffer* GetWlBuffer() { return mWaylandBuffer; }; -+ void SetAttached() { mAttached = true; }; - - private: - void Create(int aWidth, int aHeight); - void Release(); - - // WaylandShmPool provides actual shared memory we draw into - WaylandShmPool mShmPool; - - // wl_buffer is a wayland object that encapsulates the shared memory - // and passes it to wayland compositor by wl_surface object. - wl_buffer* mWaylandBuffer; - int mWidth; - int mHeight; - bool mAttached; -- nsWaylandDisplay* mWaylandDisplay; -- static gfx::SurfaceFormat mFormat; -+}; -+ -+#ifdef HAVE_LIBDRM -+class WindowBackBufferDMABuf : public WindowBackBuffer { -+ public: -+ WindowBackBufferDMABuf(nsWaylandDisplay* aWaylandDisplay, int aWidth, -+ int aHeight); -+ ~WindowBackBufferDMABuf(); -+ -+ bool IsAttached(); -+ void SetAttached(); -+ -+ int GetWidth(); -+ int GetHeight(); -+ wl_buffer* GetWlBuffer(); -+ -+ bool SetImageDataFromBuffer(class WindowBackBuffer* aSourceBuffer); -+ -+ already_AddRefed Lock(); -+ bool IsLocked(); -+ void Unlock(); -+ -+ void Clear(); -+ void Detach(wl_buffer* aBuffer); -+ bool Resize(int aWidth, int aHeight); -+ -+ private: -+ WaylandDMABufSurface mDMAbufSurface; -+}; -+#endif -+ -+class WindowImageSurface { -+ public: -+ static void Draw(gfx::SourceSurface* aSurface, gfx::DrawTarget* aDest, -+ const LayoutDeviceIntRegion& aRegion); -+ -+ void Draw(gfx::DrawTarget* aDest, -+ LayoutDeviceIntRegion& aWaylandBufferDamage); -+ -+ WindowImageSurface(gfx::SourceSurface* aSurface, -+ const LayoutDeviceIntRegion& aUpdateRegion); -+ -+ private: -+ RefPtr mSurface; -+ const LayoutDeviceIntRegion mUpdateRegion; - }; - - // WindowSurfaceWayland is an abstraction for wl_surface - // and related management - class WindowSurfaceWayland : public WindowSurface { - public: - explicit WindowSurfaceWayland(nsWindow* aWindow); - ~WindowSurfaceWayland(); - - already_AddRefed Lock( - const LayoutDeviceIntRegion& aRegion) override; - void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final; - void FrameCallbackHandler(); - void DelayedCommitHandler(); - - private: -- WindowBackBuffer* GetWaylandBufferToDraw(int aWidth, int aHeight); -+ WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); -+ WindowBackBuffer* GetWaylandBufferToDraw(int aWidth, int aHeight, -+ bool aFullScreenUpdate, -+ bool aNoBackBufferCopy); - - already_AddRefed LockWaylandBuffer(int aWidth, int aHeight, -- bool aClearBuffer); -+ bool aClearBuffer, -+ bool aFullScreenUpdate, -+ bool aNoBackBufferCopy); -+ void UnlockWaylandBuffer(); -+ - already_AddRefed LockImageSurface( - const gfx::IntSize& aLockSize); -- bool CommitImageSurfaceToWaylandBuffer(const LayoutDeviceIntRegion& aRegion); -+ bool CommitImageSurfaceToWaylandBuffer( -+ const LayoutDeviceIntRegion& aRegion, -+ LayoutDeviceIntRegion& aWaylandBufferDamage); - void CommitWaylandBuffer(); - void CalcRectScale(LayoutDeviceIntRect& aRect, int scale); - -+ void DrawDelayedImageCommits(gfx::DrawTarget* aDrawTarget, -+ LayoutDeviceIntRegion& aWaylandBufferDamage); -+ - // TODO: Do we need to hold a reference to nsWindow object? - nsWindow* mWindow; - nsWaylandDisplay* mWaylandDisplay; - WindowBackBuffer* mWaylandBuffer; - LayoutDeviceIntRegion mWaylandBufferDamage; - WindowBackBuffer* mBackupBuffer[BACK_BUFFER_NUM]; -- RefPtr mImageSurface; - wl_callback* mFrameCallback; - wl_surface* mLastCommittedSurface; - MessageLoop* mDisplayThreadMessageLoop; - WindowSurfaceWayland** mDelayedCommitHandle; -+ RefPtr mImageSurface; -+ AutoTArray mDelayedImageCommits; - bool mDrawToWaylandBufferDirectly; - bool mPendingCommit; - bool mWaylandBufferFullScreenDamage; - bool mIsMainThread; - bool mNeedScaleFactorUpdate; - bool mWaitToFullScreenUpdate; -+ -+ static bool UseDMABufBackend(); -+ static bool mUseDMABufInitialized; -+ static bool mUseDMABuf; - }; - - } // namespace widget - } // namespace mozilla - - #endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H -diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build ---- a/widget/gtk/moz.build -+++ b/widget/gtk/moz.build -@@ -97,17 +97,18 @@ if CONFIG['MOZ_X11']: - - if CONFIG['MOZ_WAYLAND']: - UNIFIED_SOURCES += [ - 'nsClipboardWayland.cpp', - 'nsWaylandDisplay.cpp', - 'WindowSurfaceWayland.cpp', - ] - EXPORTS.mozilla.widget += [ -- 'nsWaylandDisplayShutdown.h' -+ 'nsWaylandDisplay.h', -+ 'nsWaylandDisplayShutdown.h', - ] - - if CONFIG['ACCESSIBILITY']: - UNIFIED_SOURCES += [ - 'maiRedundantObjectFactory.c', - ] - - UNIFIED_SOURCES += [ -diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp ---- a/widget/gtk/mozcontainer.cpp -+++ b/widget/gtk/mozcontainer.cpp -@@ -641,17 +641,19 @@ struct wl_egl_window* moz_container_get_ - return container->eglwindow; - } - - gboolean moz_container_has_wl_egl_window(MozContainer* container) { - return container->eglwindow ? true : false; - } - - gboolean moz_container_surface_needs_clear(MozContainer* container) { -- gboolean state = container->surface_needs_clear; -+ return container->surface_needs_clear; -+} -+ -+void moz_container_surface_cleared(MozContainer* container) { - container->surface_needs_clear = false; -- return state; - } - #endif - - void moz_container_force_default_visual(MozContainer* container) { - container->force_default_visual = true; - } -diff --git a/widget/gtk/mozcontainer.h b/widget/gtk/mozcontainer.h ---- a/widget/gtk/mozcontainer.h -+++ b/widget/gtk/mozcontainer.h -@@ -96,15 +96,16 @@ void moz_container_put(MozContainer* con - void moz_container_force_default_visual(MozContainer* container); - - #ifdef MOZ_WAYLAND - struct wl_surface* moz_container_get_wl_surface(MozContainer* container); - struct wl_egl_window* moz_container_get_wl_egl_window(MozContainer* container); - - gboolean moz_container_has_wl_egl_window(MozContainer* container); - gboolean moz_container_surface_needs_clear(MozContainer* container); -+void moz_container_surface_cleared(MozContainer* container); - void moz_container_scale_changed(MozContainer* container, - GtkAllocation* aAllocation); - void moz_container_set_initial_draw_callback( - MozContainer* container, std::function inital_draw_cb); - #endif - - #endif /* __MOZ_CONTAINER_H__ */ -diff --git a/widget/gtk/mozwayland/moz.build b/widget/gtk/mozwayland/moz.build ---- a/widget/gtk/mozwayland/moz.build -+++ b/widget/gtk/mozwayland/moz.build -@@ -2,12 +2,16 @@ - # vim: set filetype=python: - # This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - - SOURCES += [ - 'mozwayland.c', - ] -+EXPORTS.mozilla.widget += [ -+ 'mozwayland.h', -+] - - SharedLibrary('mozwayland') - - CFLAGS += CONFIG['TK_CFLAGS'] -+ -diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp ---- a/widget/gtk/nsWaylandDisplay.cpp -+++ b/widget/gtk/nsWaylandDisplay.cpp -@@ -2,20 +2,16 @@ - /* vim:expandtab:shiftwidth=4:tabstop=4: - */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - #include "nsWaylandDisplay.h" - --#include "base/message_loop.h" // for MessageLoop --#include "base/task.h" // for NewRunnableMethod, etc --#include "mozilla/StaticMutex.h" -- - namespace mozilla { - namespace widget { - - // nsWaylandDisplay needs to be created for each calling thread(main thread, - // compositor thread and render thread) - #define MAX_DISPLAY_CONNECTIONS 3 - - static nsWaylandDisplay* gWaylandDisplays[MAX_DISPLAY_CONNECTIONS]; -@@ -107,16 +103,67 @@ void nsWaylandDisplay::SetDataDeviceMana - - void nsWaylandDisplay::SetSeat(wl_seat* aSeat) { mSeat = aSeat; } - - void nsWaylandDisplay::SetPrimarySelectionDeviceManager( - gtk_primary_selection_device_manager* aPrimarySelectionDeviceManager) { - mPrimarySelectionDeviceManager = aPrimarySelectionDeviceManager; - } - -+#ifdef HAVE_LIBDRM -+void nsWaylandDisplay::SetDmabuf(zwp_linux_dmabuf_v1* aDmabuf) { -+ mDmabuf = aDmabuf; -+} -+ -+GbmFormat* nsWaylandDisplay::GetGbmFormat(bool aHasAlpha) { -+ GbmFormat* format = aHasAlpha ? &mARGBFormat : &mXRGBFormat; -+ return format->mIsSupported ? format : nullptr; -+} -+ -+void nsWaylandDisplay::AddFormatModifier(bool aHasAlpha, int aFormat, -+ uint32_t mModifierHi, -+ uint32_t mModifierLo) { -+ GbmFormat* format = aHasAlpha ? &mARGBFormat : &mXRGBFormat; -+ format->mIsSupported = true; -+ format->mHasAlpha = aHasAlpha; -+ format->mFormat = aFormat; -+ format->mModifiersCount++; -+ format->mModifiers = -+ (uint64_t*)realloc(format->mModifiers, -+ format->mModifiersCount * sizeof(*format->mModifiers)); -+ format->mModifiers[format->mModifiersCount - 1] = -+ ((uint64_t)mModifierHi << 32) | mModifierLo; -+} -+ -+static void dmabuf_modifiers(void* data, -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf, -+ uint32_t format, uint32_t modifier_hi, -+ uint32_t modifier_lo) { -+ auto display = reinterpret_cast(data); -+ switch (format) { -+ case DRM_FORMAT_ARGB8888: -+ display->AddFormatModifier(true, format, modifier_hi, modifier_lo); -+ break; -+ case DRM_FORMAT_XRGB8888: -+ display->AddFormatModifier(false, format, modifier_hi, modifier_lo); -+ break; -+ default: -+ break; -+ } -+} -+ -+static void dmabuf_format(void* data, -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf, -+ uint32_t format) { -+ // XXX: deprecated -+} -+ -+static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = { -+ dmabuf_format, dmabuf_modifiers}; -+ - static void global_registry_handler(void* data, wl_registry* registry, - uint32_t id, const char* interface, - uint32_t version) { - auto display = reinterpret_cast(data); - if (!display) return; - - if (strcmp(interface, "wl_shm") == 0) { - auto shm = static_cast( -@@ -144,16 +191,21 @@ static void global_registry_handler(void - display->GetEventQueue()); - display->SetPrimarySelectionDeviceManager(primary_selection_device_manager); - } else if (strcmp(interface, "wl_subcompositor") == 0) { - auto subcompositor = static_cast( - wl_registry_bind(registry, id, &wl_subcompositor_interface, 1)); - wl_proxy_set_queue((struct wl_proxy*)subcompositor, - display->GetEventQueue()); - display->SetSubcompositor(subcompositor); -+ } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version > 2) { -+ auto dmabuf = static_cast( -+ wl_registry_bind(registry, id, &zwp_linux_dmabuf_v1_interface, 3)); -+ display->SetDmabuf(dmabuf); -+ zwp_linux_dmabuf_v1_add_listener(dmabuf, &dmabuf_listener, data); - } - } - - static void global_registry_remover(void* data, wl_registry* registry, - uint32_t id) {} - - static const struct wl_registry_listener registry_listener = { - global_registry_handler, global_registry_remover}; -@@ -162,27 +214,85 @@ bool nsWaylandDisplay::DispatchEventQueu - wl_display_dispatch_queue_pending(mDisplay, mEventQueue); - return true; - } - - bool nsWaylandDisplay::Matches(wl_display* aDisplay) { - return mThreadId == PR_GetCurrentThread() && aDisplay == mDisplay; - } - -+bool nsWaylandDisplay::ConfigureGbm() { -+ if (!nsGbmLib::IsAvailable()) { -+ return false; -+ } -+ -+ // TODO -+ const char* drm_render_node = getenv("MOZ_WAYLAND_DRM_DEVICE"); -+ if (!drm_render_node) { -+ drm_render_node = "/dev/dri/renderD128"; -+ } -+ -+ mGbmFd = open(drm_render_node, O_RDWR); -+ if (mGbmFd < 0) { -+ NS_WARNING( -+ nsPrintfCString("Failed to open drm render node %s\n", drm_render_node) -+ .get()); -+ return false; -+ } -+ -+ mGbmDevice = nsGbmLib::CreateDevice(mGbmFd); -+ if (mGbmDevice == nullptr) { -+ NS_WARNING(nsPrintfCString("Failed to create drm render device %s\n", -+ drm_render_node) -+ .get()); -+ close(mGbmFd); -+ return false; -+ } -+ -+ return true; -+} -+ -+gbm_device* nsWaylandDisplay::GetGbmDevice() { -+ if (!mGdmConfigured) { -+ ConfigureGbm(); -+ mGdmConfigured = true; -+ } -+ return mGbmDevice; -+} -+ -+int nsWaylandDisplay::GetGbmDeviceFd() { -+ if (!mGdmConfigured) { -+ ConfigureGbm(); -+ mGdmConfigured = true; -+ } -+ return mGbmFd; -+} -+#endif -+ - nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay) - : mDispatcherThreadLoop(nullptr), - mThreadId(PR_GetCurrentThread()), - mDisplay(aDisplay), - mEventQueue(nullptr), - mDataDeviceManager(nullptr), - mSubcompositor(nullptr), - mSeat(nullptr), - mShm(nullptr), - mPrimarySelectionDeviceManager(nullptr), -- mRegistry(nullptr) { -+ mRegistry(nullptr) -+#ifdef HAVE_LIBDRM -+ , -+ mGbmDevice(nullptr), -+ mGbmFd(-1), -+ mGdmConfigured(false), -+ mExplicitSync(false), -+ mXRGBFormat({false, false, -1, nullptr, 0}), -+ mARGBFormat({false, false, -1, nullptr, 0}) -+#endif -+{ - mRegistry = wl_display_get_registry(mDisplay); - wl_registry_add_listener(mRegistry, ®istry_listener, this); - - if (NS_IsMainThread()) { - // Use default event queue in main thread operated by Gtk+. - mEventQueue = nullptr; - wl_display_roundtrip(mDisplay); - wl_display_roundtrip(mDisplay); -@@ -205,10 +315,84 @@ nsWaylandDisplay::~nsWaylandDisplay() { - mRegistry = nullptr; - - if (mEventQueue) { - wl_event_queue_destroy(mEventQueue); - mEventQueue = nullptr; - } - } - -+#ifdef HAVE_LIBDRM -+void* nsGbmLib::sGbmLibHandle = nullptr; -+void* nsGbmLib::sXf86DrmLibHandle = nullptr; -+bool nsGbmLib::sLibLoaded = false; -+CreateDeviceFunc nsGbmLib::sCreateDevice; -+CreateFunc nsGbmLib::sCreate; -+CreateWithModifiersFunc nsGbmLib::sCreateWithModifiers; -+GetModifierFunc nsGbmLib::sGetModifier; -+GetStrideFunc nsGbmLib::sGetStride; -+GetFdFunc nsGbmLib::sGetFd; -+DestroyFunc nsGbmLib::sDestroy; -+MapFunc nsGbmLib::sMap; -+UnmapFunc nsGbmLib::sUnmap; -+GetPlaneCountFunc nsGbmLib::sGetPlaneCount; -+GetHandleForPlaneFunc nsGbmLib::sGetHandleForPlane; -+GetStrideForPlaneFunc nsGbmLib::sGetStrideForPlane; -+GetOffsetFunc nsGbmLib::sGetOffset; -+DrmPrimeHandleToFDFunc nsGbmLib::sDrmPrimeHandleToFD; -+ -+bool nsGbmLib::IsAvailable() { -+ if (!Load()) { -+ return false; -+ } -+ return sCreateDevice != nullptr && sCreate != nullptr && -+ sCreateWithModifiers != nullptr && sGetModifier != nullptr && -+ sGetStride != nullptr && sGetFd != nullptr && sDestroy != nullptr && -+ sMap != nullptr && sUnmap != nullptr; -+} -+ -+bool nsGbmLib::IsModifierAvailable() { -+ if (!Load()) { -+ return false; -+ } -+ return sDrmPrimeHandleToFD != nullptr; -+} -+ -+bool nsGbmLib::Load() { -+ if (!sGbmLibHandle && !sLibLoaded) { -+ sLibLoaded = true; -+ -+ sGbmLibHandle = dlopen("libgbm.so", RTLD_LAZY | RTLD_LOCAL); -+ if (!sGbmLibHandle) { -+ return false; -+ } -+ -+ sCreateDevice = (CreateDeviceFunc)dlsym(sGbmLibHandle, "gbm_create_device"); -+ sCreate = (CreateFunc)dlsym(sGbmLibHandle, "gbm_bo_create"); -+ sCreateWithModifiers = (CreateWithModifiersFunc)dlsym( -+ sGbmLibHandle, "gbm_bo_create_with_modifiers"); -+ sGetModifier = (GetModifierFunc)dlsym(sGbmLibHandle, "gbm_bo_get_modifier"); -+ sGetStride = (GetStrideFunc)dlsym(sGbmLibHandle, "gbm_bo_get_stride"); -+ sGetFd = (GetFdFunc)dlsym(sGbmLibHandle, "gbm_bo_get_fd"); -+ sDestroy = (DestroyFunc)dlsym(sGbmLibHandle, "gbm_bo_destroy"); -+ sMap = (MapFunc)dlsym(sGbmLibHandle, "gbm_bo_map"); -+ sUnmap = (UnmapFunc)dlsym(sGbmLibHandle, "gbm_bo_unmap"); -+ sGetPlaneCount = -+ (GetPlaneCountFunc)dlsym(sGbmLibHandle, "gbm_bo_get_plane_count"); -+ sGetHandleForPlane = (GetHandleForPlaneFunc)dlsym( -+ sGbmLibHandle, "gbm_bo_get_handle_for_plane"); -+ sGetStrideForPlane = (GetStrideForPlaneFunc)dlsym( -+ sGbmLibHandle, "gbm_bo_get_stride_for_plane"); -+ sGetOffset = (GetOffsetFunc)dlsym(sGbmLibHandle, "gbm_bo_get_offset"); -+ -+ sXf86DrmLibHandle = dlopen("libdrm.so", RTLD_LAZY | RTLD_LOCAL); -+ if (sXf86DrmLibHandle) { -+ sDrmPrimeHandleToFD = (DrmPrimeHandleToFDFunc)dlsym(sXf86DrmLibHandle, -+ "drmPrimeHandleToFD"); -+ } -+ } -+ -+ return sGbmLibHandle; -+} -+#endif -+ - } // namespace widget - } // namespace mozilla -diff --git a/widget/gtk/nsWaylandDisplay.h b/widget/gtk/nsWaylandDisplay.h ---- a/widget/gtk/nsWaylandDisplay.h -+++ b/widget/gtk/nsWaylandDisplay.h -@@ -1,24 +1,43 @@ - /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ - /* vim:expandtab:shiftwidth=4:tabstop=4: - */ - /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - --#ifndef __MOZ_WAYLAND_REGISTRY_H__ --#define __MOZ_WAYLAND_REGISTRY_H__ -+#ifndef __MOZ_WAYLAND_DISPLAY_H__ -+#define __MOZ_WAYLAND_DISPLAY_H__ -+ -+#include "mozilla/widget/mozwayland.h" -+#include "mozilla/widget/gtk-primary-selection-client-protocol.h" - --#include "mozwayland/mozwayland.h" --#include "wayland/gtk-primary-selection-client-protocol.h" -+#include "base/message_loop.h" // for MessageLoop -+#include "base/task.h" // for NewRunnableMethod, etc -+#include "mozilla/StaticMutex.h" -+ -+#ifdef HAVE_LIBDRM -+# include -+# include -+# include -+# include "mozilla/widget/linux-dmabuf-unstable-v1-client-protocol.h" -+#endif - - namespace mozilla { - namespace widget { - -+struct GbmFormat { -+ bool mIsSupported; -+ bool mHasAlpha; -+ int mFormat; -+ uint64_t* mModifiers; -+ int mModifiersCount; -+}; -+ - // Our general connection to Wayland display server, - // holds our display connection and runs event loop. - class nsWaylandDisplay { - public: - explicit nsWaylandDisplay(wl_display* aDisplay); - virtual ~nsWaylandDisplay(); - - bool DispatchEventQueue(); -@@ -41,28 +60,143 @@ class nsWaylandDisplay { - void SetSubcompositor(wl_subcompositor* aSubcompositor); - void SetDataDeviceManager(wl_data_device_manager* aDataDeviceManager); - void SetSeat(wl_seat* aSeat); - void SetPrimarySelectionDeviceManager( - gtk_primary_selection_device_manager* aPrimarySelectionDeviceManager); - - void Shutdown(); - -+#ifdef HAVE_LIBDRM -+ void SetDmabuf(zwp_linux_dmabuf_v1* aDmabuf); -+ zwp_linux_dmabuf_v1* GetDmabuf() { return mDmabuf; }; -+ gbm_device* GetGbmDevice(); -+ int GetGbmDeviceFd(); -+ bool IsExplicitSyncEnabled() { return mExplicitSync; } -+ GbmFormat* GetGbmFormat(bool aHasAlpha); -+ void AddFormatModifier(bool aHasAlpha, int aFormat, uint32_t mModifierHi, -+ uint32_t mModifierLo); -+#endif -+ - private: -+#ifdef HAVE_LIBDRM -+ bool ConfigureGbm(); -+#endif -+ - MessageLoop* mDispatcherThreadLoop; - PRThread* mThreadId; - wl_display* mDisplay; - wl_event_queue* mEventQueue; - wl_data_device_manager* mDataDeviceManager; - wl_subcompositor* mSubcompositor; - wl_seat* mSeat; - wl_shm* mShm; - gtk_primary_selection_device_manager* mPrimarySelectionDeviceManager; - wl_registry* mRegistry; -+#ifdef HAVE_LIBDRM -+ zwp_linux_dmabuf_v1* mDmabuf; -+ gbm_device* mGbmDevice; -+ int mGbmFd; -+ bool mGdmConfigured; -+ bool mExplicitSync; -+ GbmFormat mXRGBFormat; -+ GbmFormat mARGBFormat; -+#endif - }; - - void WaylandDispatchDisplays(); - nsWaylandDisplay* WaylandDisplayGet(GdkDisplay* aGdkDisplay = nullptr); - -+#ifdef HAVE_LIBDRM -+typedef struct gbm_device* (*CreateDeviceFunc)(int); -+typedef struct gbm_bo* (*CreateFunc)(struct gbm_device*, uint32_t, uint32_t, -+ uint32_t, uint32_t); -+typedef struct gbm_bo* (*CreateFunc)(struct gbm_device*, uint32_t, uint32_t, -+ uint32_t, uint32_t); -+typedef struct gbm_bo* (*CreateWithModifiersFunc)(struct gbm_device*, uint32_t, -+ uint32_t, uint32_t, -+ const uint64_t*, -+ const unsigned int); -+typedef uint64_t (*GetModifierFunc)(struct gbm_bo*); -+typedef uint32_t (*GetStrideFunc)(struct gbm_bo*); -+typedef int (*GetFdFunc)(struct gbm_bo*); -+typedef void (*DestroyFunc)(struct gbm_bo*); -+typedef void* (*MapFunc)(struct gbm_bo*, uint32_t, uint32_t, uint32_t, uint32_t, -+ uint32_t, uint32_t*, void**); -+typedef void (*UnmapFunc)(struct gbm_bo*, void*); -+typedef int (*GetPlaneCountFunc)(struct gbm_bo*); -+typedef union gbm_bo_handle (*GetHandleForPlaneFunc)(struct gbm_bo*, int); -+typedef uint32_t (*GetStrideForPlaneFunc)(struct gbm_bo*, int); -+typedef uint32_t (*GetOffsetFunc)(struct gbm_bo*, int); -+ -+typedef int (*DrmPrimeHandleToFDFunc)(int, uint32_t, uint32_t, int*); -+ -+class nsGbmLib { -+ public: -+ static bool Load(); -+ static bool IsAvailable(); -+ static bool IsModifierAvailable(); -+ -+ static struct gbm_device* CreateDevice(int fd) { return sCreateDevice(fd); }; -+ static struct gbm_bo* Create(struct gbm_device* gbm, uint32_t width, -+ uint32_t height, uint32_t format, -+ uint32_t flags) { -+ return sCreate(gbm, width, height, format, flags); -+ } -+ static void Destroy(struct gbm_bo* bo) { sDestroy(bo); } -+ static uint32_t GetStride(struct gbm_bo* bo) { return sGetStride(bo); } -+ static int GetFd(struct gbm_bo* bo) { return sGetFd(bo); } -+ static void* Map(struct gbm_bo* bo, uint32_t x, uint32_t y, uint32_t width, -+ uint32_t height, uint32_t flags, uint32_t* stride, -+ void** map_data) { -+ return sMap(bo, x, y, width, height, flags, stride, map_data); -+ } -+ static void Unmap(struct gbm_bo* bo, void* map_data) { sUnmap(bo, map_data); } -+ static struct gbm_bo* CreateWithModifiers(struct gbm_device* gbm, -+ uint32_t width, uint32_t height, -+ uint32_t format, -+ const uint64_t* modifiers, -+ const unsigned int count) { -+ return sCreateWithModifiers(gbm, width, height, format, modifiers, count); -+ } -+ static uint64_t GetModifier(struct gbm_bo* bo) { return sGetModifier(bo); } -+ static int GetPlaneCount(struct gbm_bo* bo) { return sGetPlaneCount(bo); } -+ static union gbm_bo_handle GetHandleForPlane(struct gbm_bo* bo, int plane) { -+ return sGetHandleForPlane(bo, plane); -+ } -+ static uint32_t GetStrideForPlane(struct gbm_bo* bo, int plane) { -+ return sGetStrideForPlane(bo, plane); -+ } -+ static uint32_t GetOffset(struct gbm_bo* bo, int plane) { -+ return sGetOffset(bo, plane); -+ } -+ -+ static int DrmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, -+ int* prime_fd) { -+ return sDrmPrimeHandleToFD(fd, handle, flags, prime_fd); -+ } -+ -+ private: -+ static CreateDeviceFunc sCreateDevice; -+ static CreateFunc sCreate; -+ static CreateWithModifiersFunc sCreateWithModifiers; -+ static GetModifierFunc sGetModifier; -+ static GetStrideFunc sGetStride; -+ static GetFdFunc sGetFd; -+ static DestroyFunc sDestroy; -+ static MapFunc sMap; -+ static UnmapFunc sUnmap; -+ static GetPlaneCountFunc sGetPlaneCount; -+ static GetHandleForPlaneFunc sGetHandleForPlane; -+ static GetStrideForPlaneFunc sGetStrideForPlane; -+ static GetOffsetFunc sGetOffset; -+ static DrmPrimeHandleToFDFunc sDrmPrimeHandleToFD; -+ -+ static void* sGbmLibHandle; -+ static void* sXf86DrmLibHandle; -+ static bool sLibLoaded; -+}; -+#endif -+ - } // namespace widget - } // namespace mozilla - --#endif // __MOZ_WAYLAND_REGISTRY_H__ -+#endif // __MOZ_WAYLAND_DISPLAY_H__ -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -4237,17 +4237,18 @@ LayoutDeviceIntSize nsWindow::GetSafeWin - // reads it as CARD16. Sizes of pixmaps, used for drawing, are (unsigned) - // CARD16 in the protocol, but the server's ProcCreatePixmap returns - // BadAlloc if dimensions cannot be represented by signed shorts. - // Because we are creating Cairo surfaces to represent window buffers, - // we also must ensure that the window can fit in a Cairo surface. - LayoutDeviceIntSize result = aSize; - int32_t maxSize = 32767; - if (mLayerManager && mLayerManager->AsKnowsCompositor()) { -- maxSize = std::min(maxSize, mLayerManager->AsKnowsCompositor()->GetMaxTextureSize()); -+ maxSize = std::min(maxSize, -+ mLayerManager->AsKnowsCompositor()->GetMaxTextureSize()); - } - if (result.width > maxSize) { - result.width = maxSize; - } - if (result.height > maxSize) { - result.height = maxSize; - } - return result; -@@ -6827,21 +6828,24 @@ wl_surface* nsWindow::GetWaylandSurface( - "drawing!"); - return nullptr; - } - - bool nsWindow::WaylandSurfaceNeedsClear() { - if (mContainer) { - return moz_container_surface_needs_clear(MOZ_CONTAINER(mContainer)); - } -- -- NS_WARNING( -- "nsWindow::WaylandSurfaceNeedsClear(): We don't have any mContainer!"); - return false; - } -+ -+void nsWindow::WaylandSurfaceCleared() { -+ if (mContainer) { -+ return moz_container_surface_cleared(MOZ_CONTAINER(mContainer)); -+ } -+} - #endif - - #ifdef MOZ_X11 - /* XApp progress support currently works by setting a property - * on a window with this Atom name. A supporting window manager - * will notice this and pass it along to whatever handling has - * been implemented on that end (e.g. passing it on to a taskbar - * widget.) There is no issue if WM support is lacking, this is -diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h ---- a/widget/gtk/nsWindow.h -+++ b/widget/gtk/nsWindow.h -@@ -341,16 +341,17 @@ class nsWindow final : public nsBaseWidg - - #ifdef MOZ_X11 - Display* XDisplay() { return mXDisplay; } - #endif - #ifdef MOZ_WAYLAND - wl_display* GetWaylandDisplay(); - wl_surface* GetWaylandSurface(); - bool WaylandSurfaceNeedsClear(); -+ void WaylandSurfaceCleared(); - #endif - virtual void GetCompositorWidgetInitData( - mozilla::widget::CompositorWidgetInitData* aInitData) override; - - virtual nsresult SetNonClientMargins( - LayoutDeviceIntMargin& aMargins) override; - void SetDrawsInTitlebar(bool aState) override; - virtual void UpdateWindowDraggingRegion( -diff --git a/widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h b/widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h -new file mode 100644 ---- /dev/null -+++ b/widget/gtk/wayland/linux-dmabuf-unstable-v1-client-protocol.h -@@ -0,0 +1,650 @@ -+/* Generated by wayland-scanner 1.17.0 */ -+ -+#ifndef LINUX_DMABUF_UNSTABLE_V1_CLIENT_PROTOCOL_H -+#define LINUX_DMABUF_UNSTABLE_V1_CLIENT_PROTOCOL_H -+ -+#include -+#include -+#include "wayland-client.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** -+ * @page page_linux_dmabuf_unstable_v1 The linux_dmabuf_unstable_v1 protocol -+ * @section page_ifaces_linux_dmabuf_unstable_v1 Interfaces -+ * - @subpage page_iface_zwp_linux_dmabuf_v1 - factory for creating dmabuf-based -+ * wl_buffers -+ * - @subpage page_iface_zwp_linux_buffer_params_v1 - parameters for creating a -+ * dmabuf-based wl_buffer -+ * @section page_copyright_linux_dmabuf_unstable_v1 Copyright -+ *
-+ *
-+ * Copyright © 2014, 2015 Collabora, Ltd.
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a
-+ * copy of this software and associated documentation files (the "Software"),
-+ * to deal in the Software without restriction, including without limitation
-+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
-+ * and/or sell copies of the Software, and to permit persons to whom the
-+ * Software is furnished to do so, subject to the following conditions:
-+ *
-+ * The above copyright notice and this permission notice (including the next
-+ * paragraph) shall be included in all copies or substantial portions of the
-+ * Software.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-+ * DEALINGS IN THE SOFTWARE.
-+ * 
-+ */ -+struct wl_buffer; -+struct zwp_linux_buffer_params_v1; -+struct zwp_linux_dmabuf_v1; -+ -+/** -+ * @page page_iface_zwp_linux_dmabuf_v1 zwp_linux_dmabuf_v1 -+ * @section page_iface_zwp_linux_dmabuf_v1_desc Description -+ * -+ * Following the interfaces from: -+ * https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt -+ * and the Linux DRM sub-system's AddFb2 ioctl. -+ * -+ * This interface offers ways to create generic dmabuf-based -+ * wl_buffers. Immediately after a client binds to this interface, -+ * the set of supported formats and format modifiers is sent with -+ * 'format' and 'modifier' events. -+ * -+ * The following are required from clients: -+ * -+ * - Clients must ensure that either all data in the dma-buf is -+ * coherent for all subsequent read access or that coherency is -+ * correctly handled by the underlying kernel-side dma-buf -+ * implementation. -+ * -+ * - Don't make any more attachments after sending the buffer to the -+ * compositor. Making more attachments later increases the risk of -+ * the compositor not being able to use (re-import) an existing -+ * dmabuf-based wl_buffer. -+ * -+ * The underlying graphics stack must ensure the following: -+ * -+ * - The dmabuf file descriptors relayed to the server will stay valid -+ * for the whole lifetime of the wl_buffer. This means the server may -+ * at any time use those fds to import the dmabuf into any kernel -+ * sub-system that might accept it. -+ * -+ * To create a wl_buffer from one or more dmabufs, a client creates a -+ * zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params -+ * request. All planes required by the intended format are added with -+ * the 'add' request. Finally, a 'create' or 'create_immed' request is -+ * issued, which has the following outcome depending on the import success. -+ * -+ * The 'create' request, -+ * - on success, triggers a 'created' event which provides the final -+ * wl_buffer to the client. -+ * - on failure, triggers a 'failed' event to convey that the server -+ * cannot use the dmabufs received from the client. -+ * -+ * For the 'create_immed' request, -+ * - on success, the server immediately imports the added dmabufs to -+ * create a wl_buffer. No event is sent from the server in this case. -+ * - on failure, the server can choose to either: -+ * - terminate the client by raising a fatal error. -+ * - mark the wl_buffer as failed, and send a 'failed' event to the -+ * client. If the client uses a failed wl_buffer as an argument to any -+ * request, the behaviour is compositor implementation-defined. -+ * -+ * Warning! The protocol described in this file is experimental and -+ * backward incompatible changes may be made. Backward compatible changes -+ * may be added together with the corresponding interface version bump. -+ * Backward incompatible changes are done by bumping the version number in -+ * the protocol and interface names and resetting the interface version. -+ * Once the protocol is to be declared stable, the 'z' prefix and the -+ * version number in the protocol and interface names are removed and the -+ * interface version number is reset. -+ * @section page_iface_zwp_linux_dmabuf_v1_api API -+ * See @ref iface_zwp_linux_dmabuf_v1. -+ */ -+/** -+ * @defgroup iface_zwp_linux_dmabuf_v1 The zwp_linux_dmabuf_v1 interface -+ * -+ * Following the interfaces from: -+ * https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt -+ * and the Linux DRM sub-system's AddFb2 ioctl. -+ * -+ * This interface offers ways to create generic dmabuf-based -+ * wl_buffers. Immediately after a client binds to this interface, -+ * the set of supported formats and format modifiers is sent with -+ * 'format' and 'modifier' events. -+ * -+ * The following are required from clients: -+ * -+ * - Clients must ensure that either all data in the dma-buf is -+ * coherent for all subsequent read access or that coherency is -+ * correctly handled by the underlying kernel-side dma-buf -+ * implementation. -+ * -+ * - Don't make any more attachments after sending the buffer to the -+ * compositor. Making more attachments later increases the risk of -+ * the compositor not being able to use (re-import) an existing -+ * dmabuf-based wl_buffer. -+ * -+ * The underlying graphics stack must ensure the following: -+ * -+ * - The dmabuf file descriptors relayed to the server will stay valid -+ * for the whole lifetime of the wl_buffer. This means the server may -+ * at any time use those fds to import the dmabuf into any kernel -+ * sub-system that might accept it. -+ * -+ * To create a wl_buffer from one or more dmabufs, a client creates a -+ * zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params -+ * request. All planes required by the intended format are added with -+ * the 'add' request. Finally, a 'create' or 'create_immed' request is -+ * issued, which has the following outcome depending on the import success. -+ * -+ * The 'create' request, -+ * - on success, triggers a 'created' event which provides the final -+ * wl_buffer to the client. -+ * - on failure, triggers a 'failed' event to convey that the server -+ * cannot use the dmabufs received from the client. -+ * -+ * For the 'create_immed' request, -+ * - on success, the server immediately imports the added dmabufs to -+ * create a wl_buffer. No event is sent from the server in this case. -+ * - on failure, the server can choose to either: -+ * - terminate the client by raising a fatal error. -+ * - mark the wl_buffer as failed, and send a 'failed' event to the -+ * client. If the client uses a failed wl_buffer as an argument to any -+ * request, the behaviour is compositor implementation-defined. -+ * -+ * Warning! The protocol described in this file is experimental and -+ * backward incompatible changes may be made. Backward compatible changes -+ * may be added together with the corresponding interface version bump. -+ * Backward incompatible changes are done by bumping the version number in -+ * the protocol and interface names and resetting the interface version. -+ * Once the protocol is to be declared stable, the 'z' prefix and the -+ * version number in the protocol and interface names are removed and the -+ * interface version number is reset. -+ */ -+extern const struct wl_interface zwp_linux_dmabuf_v1_interface; -+/** -+ * @page page_iface_zwp_linux_buffer_params_v1 zwp_linux_buffer_params_v1 -+ * @section page_iface_zwp_linux_buffer_params_v1_desc Description -+ * -+ * This temporary object is a collection of dmabufs and other -+ * parameters that together form a single logical buffer. The temporary -+ * object may eventually create one wl_buffer unless cancelled by -+ * destroying it before requesting 'create'. -+ * -+ * Single-planar formats only require one dmabuf, however -+ * multi-planar formats may require more than one dmabuf. For all -+ * formats, an 'add' request must be called once per plane (even if the -+ * underlying dmabuf fd is identical). -+ * -+ * You must use consecutive plane indices ('plane_idx' argument for 'add') -+ * from zero to the number of planes used by the drm_fourcc format code. -+ * All planes required by the format must be given exactly once, but can -+ * be given in any order. Each plane index can be set only once. -+ * @section page_iface_zwp_linux_buffer_params_v1_api API -+ * See @ref iface_zwp_linux_buffer_params_v1. -+ */ -+/** -+ * @defgroup iface_zwp_linux_buffer_params_v1 The zwp_linux_buffer_params_v1 -+ * interface -+ * -+ * This temporary object is a collection of dmabufs and other -+ * parameters that together form a single logical buffer. The temporary -+ * object may eventually create one wl_buffer unless cancelled by -+ * destroying it before requesting 'create'. -+ * -+ * Single-planar formats only require one dmabuf, however -+ * multi-planar formats may require more than one dmabuf. For all -+ * formats, an 'add' request must be called once per plane (even if the -+ * underlying dmabuf fd is identical). -+ * -+ * You must use consecutive plane indices ('plane_idx' argument for 'add') -+ * from zero to the number of planes used by the drm_fourcc format code. -+ * All planes required by the format must be given exactly once, but can -+ * be given in any order. Each plane index can be set only once. -+ */ -+extern const struct wl_interface zwp_linux_buffer_params_v1_interface; -+ -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ * @struct zwp_linux_dmabuf_v1_listener -+ */ -+struct zwp_linux_dmabuf_v1_listener { -+ /** -+ * supported buffer format -+ * -+ * This event advertises one buffer format that the server -+ * supports. All the supported formats are advertised once when the -+ * client binds to this interface. A roundtrip after binding -+ * guarantees that the client has received all supported formats. -+ * -+ * For the definition of the format codes, see the -+ * zwp_linux_buffer_params_v1::create request. -+ * -+ * Warning: the 'format' event is likely to be deprecated and -+ * replaced with the 'modifier' event introduced in -+ * zwp_linux_dmabuf_v1 version 3, described below. Please refrain -+ * from using the information received from this event. -+ * @param format DRM_FORMAT code -+ */ -+ void (*format)(void* data, struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, -+ uint32_t format); -+ /** -+ * supported buffer format modifier -+ * -+ * This event advertises the formats that the server supports, -+ * along with the modifiers supported for each format. All the -+ * supported modifiers for all the supported formats are advertised -+ * once when the client binds to this interface. A roundtrip after -+ * binding guarantees that the client has received all supported -+ * format-modifier pairs. -+ * -+ * For the definition of the format and modifier codes, see the -+ * zwp_linux_buffer_params_v1::create request. -+ * @param format DRM_FORMAT code -+ * @param modifier_hi high 32 bits of layout modifier -+ * @param modifier_lo low 32 bits of layout modifier -+ * @since 3 -+ */ -+ void (*modifier)(void* data, struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, -+ uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo); -+}; -+ -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ */ -+static inline int zwp_linux_dmabuf_v1_add_listener( -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, -+ const struct zwp_linux_dmabuf_v1_listener* listener, void* data) { -+ return wl_proxy_add_listener((struct wl_proxy*)zwp_linux_dmabuf_v1, -+ (void (**)(void))listener, data); -+} -+ -+#define ZWP_LINUX_DMABUF_V1_DESTROY 0 -+#define ZWP_LINUX_DMABUF_V1_CREATE_PARAMS 1 -+ -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ */ -+#define ZWP_LINUX_DMABUF_V1_FORMAT_SINCE_VERSION 1 -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ */ -+#define ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION 3 -+ -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ */ -+#define ZWP_LINUX_DMABUF_V1_DESTROY_SINCE_VERSION 1 -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ */ -+#define ZWP_LINUX_DMABUF_V1_CREATE_PARAMS_SINCE_VERSION 1 -+ -+/** @ingroup iface_zwp_linux_dmabuf_v1 */ -+static inline void zwp_linux_dmabuf_v1_set_user_data( -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1, void* user_data) { -+ wl_proxy_set_user_data((struct wl_proxy*)zwp_linux_dmabuf_v1, user_data); -+} -+ -+/** @ingroup iface_zwp_linux_dmabuf_v1 */ -+static inline void* zwp_linux_dmabuf_v1_get_user_data( -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { -+ return wl_proxy_get_user_data((struct wl_proxy*)zwp_linux_dmabuf_v1); -+} -+ -+static inline uint32_t zwp_linux_dmabuf_v1_get_version( -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { -+ return wl_proxy_get_version((struct wl_proxy*)zwp_linux_dmabuf_v1); -+} -+ -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ * -+ * Objects created through this interface, especially wl_buffers, will -+ * remain valid. -+ */ -+static inline void zwp_linux_dmabuf_v1_destroy( -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { -+ wl_proxy_marshal((struct wl_proxy*)zwp_linux_dmabuf_v1, -+ ZWP_LINUX_DMABUF_V1_DESTROY); -+ -+ wl_proxy_destroy((struct wl_proxy*)zwp_linux_dmabuf_v1); -+} -+ -+/** -+ * @ingroup iface_zwp_linux_dmabuf_v1 -+ * -+ * This temporary object is used to collect multiple dmabuf handles into -+ * a single batch to create a wl_buffer. It can only be used once and -+ * should be destroyed after a 'created' or 'failed' event has been -+ * received. -+ */ -+static inline struct zwp_linux_buffer_params_v1* -+zwp_linux_dmabuf_v1_create_params( -+ struct zwp_linux_dmabuf_v1* zwp_linux_dmabuf_v1) { -+ struct wl_proxy* params_id; -+ -+ params_id = wl_proxy_marshal_constructor( -+ (struct wl_proxy*)zwp_linux_dmabuf_v1, ZWP_LINUX_DMABUF_V1_CREATE_PARAMS, -+ &zwp_linux_buffer_params_v1_interface, NULL); -+ -+ return (struct zwp_linux_buffer_params_v1*)params_id; -+} -+ -+#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM -+# define ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM -+enum zwp_linux_buffer_params_v1_error { -+ /** -+ * the dmabuf_batch object has already been used to create a wl_buffer -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ALREADY_USED = 0, -+ /** -+ * plane index out of bounds -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_IDX = 1, -+ /** -+ * the plane index was already set -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_SET = 2, -+ /** -+ * missing or too many planes to create a buffer -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE = 3, -+ /** -+ * format not supported -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT = 4, -+ /** -+ * invalid width or height -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_DIMENSIONS = 5, -+ /** -+ * offset + stride * height goes out of dmabuf bounds -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_OUT_OF_BOUNDS = 6, -+ /** -+ * invalid wl_buffer resulted from importing dmabufs via the -+ * create_immed request on given buffer_params -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_WL_BUFFER = 7, -+}; -+#endif /* ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM */ -+ -+#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM -+# define ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM -+enum zwp_linux_buffer_params_v1_flags { -+ /** -+ * contents are y-inverted -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT = 1, -+ /** -+ * content is interlaced -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED = 2, -+ /** -+ * bottom field first -+ */ -+ ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST = 4, -+}; -+#endif /* ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM */ -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ * @struct zwp_linux_buffer_params_v1_listener -+ */ -+struct zwp_linux_buffer_params_v1_listener { -+ /** -+ * buffer creation succeeded -+ * -+ * This event indicates that the attempted buffer creation was -+ * successful. It provides the new wl_buffer referencing the -+ * dmabuf(s). -+ * -+ * Upon receiving this event, the client should destroy the -+ * zlinux_dmabuf_params object. -+ * @param buffer the newly created wl_buffer -+ */ -+ void (*created)(void* data, -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, -+ struct wl_buffer* buffer); -+ /** -+ * buffer creation failed -+ * -+ * This event indicates that the attempted buffer creation has -+ * failed. It usually means that one of the dmabuf constraints has -+ * not been fulfilled. -+ * -+ * Upon receiving this event, the client should destroy the -+ * zlinux_buffer_params object. -+ */ -+ void (*failed)(void* data, -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1); -+}; -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+static inline int zwp_linux_buffer_params_v1_add_listener( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, -+ const struct zwp_linux_buffer_params_v1_listener* listener, void* data) { -+ return wl_proxy_add_listener((struct wl_proxy*)zwp_linux_buffer_params_v1, -+ (void (**)(void))listener, data); -+} -+ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY 0 -+#define ZWP_LINUX_BUFFER_PARAMS_V1_ADD 1 -+#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE 2 -+#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED 3 -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATED_SINCE_VERSION 1 -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_FAILED_SINCE_VERSION 1 -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY_SINCE_VERSION 1 -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_ADD_SINCE_VERSION 1 -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_SINCE_VERSION 1 -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ */ -+#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED_SINCE_VERSION 2 -+ -+/** @ingroup iface_zwp_linux_buffer_params_v1 */ -+static inline void zwp_linux_buffer_params_v1_set_user_data( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, -+ void* user_data) { -+ wl_proxy_set_user_data((struct wl_proxy*)zwp_linux_buffer_params_v1, -+ user_data); -+} -+ -+/** @ingroup iface_zwp_linux_buffer_params_v1 */ -+static inline void* zwp_linux_buffer_params_v1_get_user_data( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1) { -+ return wl_proxy_get_user_data((struct wl_proxy*)zwp_linux_buffer_params_v1); -+} -+ -+static inline uint32_t zwp_linux_buffer_params_v1_get_version( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1) { -+ return wl_proxy_get_version((struct wl_proxy*)zwp_linux_buffer_params_v1); -+} -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ * -+ * Cleans up the temporary data sent to the server for dmabuf-based -+ * wl_buffer creation. -+ */ -+static inline void zwp_linux_buffer_params_v1_destroy( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1) { -+ wl_proxy_marshal((struct wl_proxy*)zwp_linux_buffer_params_v1, -+ ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY); -+ -+ wl_proxy_destroy((struct wl_proxy*)zwp_linux_buffer_params_v1); -+} -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ * -+ * This request adds one dmabuf to the set in this -+ * zwp_linux_buffer_params_v1. -+ * -+ * The 64-bit unsigned value combined from modifier_hi and modifier_lo -+ * is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the -+ * fb modifier, which is defined in drm_mode.h of Linux UAPI. -+ * This is an opaque token. Drivers use this token to express tiling, -+ * compression, etc. driver-specific modifications to the base format -+ * defined by the DRM fourcc code. -+ * -+ * This request raises the PLANE_IDX error if plane_idx is too large. -+ * The error PLANE_SET is raised if attempting to set a plane that -+ * was already set. -+ */ -+static inline void zwp_linux_buffer_params_v1_add( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, int32_t fd, -+ uint32_t plane_idx, uint32_t offset, uint32_t stride, uint32_t modifier_hi, -+ uint32_t modifier_lo) { -+ wl_proxy_marshal((struct wl_proxy*)zwp_linux_buffer_params_v1, -+ ZWP_LINUX_BUFFER_PARAMS_V1_ADD, fd, plane_idx, offset, -+ stride, modifier_hi, modifier_lo); -+} -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ * -+ * This asks for creation of a wl_buffer from the added dmabuf -+ * buffers. The wl_buffer is not created immediately but returned via -+ * the 'created' event if the dmabuf sharing succeeds. The sharing -+ * may fail at runtime for reasons a client cannot predict, in -+ * which case the 'failed' event is triggered. -+ * -+ * The 'format' argument is a DRM_FORMAT code, as defined by the -+ * libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the -+ * authoritative source on how the format codes should work. -+ * -+ * The 'flags' is a bitfield of the flags defined in enum "flags". -+ * 'y_invert' means the that the image needs to be y-flipped. -+ * -+ * Flag 'interlaced' means that the frame in the buffer is not -+ * progressive as usual, but interlaced. An interlaced buffer as -+ * supported here must always contain both top and bottom fields. -+ * The top field always begins on the first pixel row. The temporal -+ * ordering between the two fields is top field first, unless -+ * 'bottom_first' is specified. It is undefined whether 'bottom_first' -+ * is ignored if 'interlaced' is not set. -+ * -+ * This protocol does not convey any information about field rate, -+ * duration, or timing, other than the relative ordering between the -+ * two fields in one buffer. A compositor may have to estimate the -+ * intended field rate from the incoming buffer rate. It is undefined -+ * whether the time of receiving wl_surface.commit with a new buffer -+ * attached, applying the wl_surface state, wl_surface.frame callback -+ * trigger, presentation, or any other point in the compositor cycle -+ * is used to measure the frame or field times. There is no support -+ * for detecting missed or late frames/fields/buffers either, and -+ * there is no support whatsoever for cooperating with interlaced -+ * compositor output. -+ * -+ * The composited image quality resulting from the use of interlaced -+ * buffers is explicitly undefined. A compositor may use elaborate -+ * hardware features or software to deinterlace and create progressive -+ * output frames from a sequence of interlaced input buffers, or it -+ * may produce substandard image quality. However, compositors that -+ * cannot guarantee reasonable image quality in all cases are recommended -+ * to just reject all interlaced buffers. -+ * -+ * Any argument errors, including non-positive width or height, -+ * mismatch between the number of planes and the format, bad -+ * format, bad offset or stride, may be indicated by fatal protocol -+ * errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, -+ * OUT_OF_BOUNDS. -+ * -+ * Dmabuf import errors in the server that are not obvious client -+ * bugs are returned via the 'failed' event as non-fatal. This -+ * allows attempting dmabuf sharing and falling back in the client -+ * if it fails. -+ * -+ * This request can be sent only once in the object's lifetime, after -+ * which the only legal request is destroy. This object should be -+ * destroyed after issuing a 'create' request. Attempting to use this -+ * object after issuing 'create' raises ALREADY_USED protocol error. -+ * -+ * It is not mandatory to issue 'create'. If a client wants to -+ * cancel the buffer creation, it can just destroy this object. -+ */ -+static inline void zwp_linux_buffer_params_v1_create( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, -+ int32_t width, int32_t height, uint32_t format, uint32_t flags) { -+ wl_proxy_marshal((struct wl_proxy*)zwp_linux_buffer_params_v1, -+ ZWP_LINUX_BUFFER_PARAMS_V1_CREATE, width, height, format, -+ flags); -+} -+ -+/** -+ * @ingroup iface_zwp_linux_buffer_params_v1 -+ * -+ * This asks for immediate creation of a wl_buffer by importing the -+ * added dmabufs. -+ * -+ * In case of import success, no event is sent from the server, and the -+ * wl_buffer is ready to be used by the client. -+ * -+ * Upon import failure, either of the following may happen, as seen fit -+ * by the implementation: -+ * - the client is terminated with one of the following fatal protocol -+ * errors: -+ * - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, -+ * in case of argument errors such as mismatch between the number -+ * of planes and the format, bad format, non-positive width or -+ * height, or bad offset or stride. -+ * - INVALID_WL_BUFFER, in case the cause for failure is unknown or -+ * plaform specific. -+ * - the server creates an invalid wl_buffer, marks it as failed and -+ * sends a 'failed' event to the client. The result of using this -+ * invalid wl_buffer as an argument in any request by the client is -+ * defined by the compositor implementation. -+ * -+ * This takes the same arguments as a 'create' request, and obeys the -+ * same restrictions. -+ */ -+static inline struct wl_buffer* zwp_linux_buffer_params_v1_create_immed( -+ struct zwp_linux_buffer_params_v1* zwp_linux_buffer_params_v1, -+ int32_t width, int32_t height, uint32_t format, uint32_t flags) { -+ struct wl_proxy* buffer_id; -+ -+ buffer_id = wl_proxy_marshal_constructor( -+ (struct wl_proxy*)zwp_linux_buffer_params_v1, -+ ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED, &wl_buffer_interface, NULL, -+ width, height, format, flags); -+ -+ return (struct wl_buffer*)buffer_id; -+} -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif -diff --git a/widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c b/widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c -new file mode 100644 ---- /dev/null -+++ b/widget/gtk/wayland/linux-dmabuf-unstable-v1-protocol.c -@@ -0,0 +1,81 @@ -+/* Generated by wayland-scanner 1.17.0 */ -+ -+/* -+ * Copyright © 2014, 2015 Collabora, Ltd. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -+ * DEALINGS IN THE SOFTWARE. -+ */ -+ -+#include -+#include -+#include "wayland-util.h" -+ -+#pragma GCC visibility push(default) -+extern const struct wl_interface wl_buffer_interface; -+extern const struct wl_interface zwp_linux_buffer_params_v1_interface; -+#pragma GCC visibility pop -+ -+static const struct wl_interface* types[] = { -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ &zwp_linux_buffer_params_v1_interface, -+ &wl_buffer_interface, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ &wl_buffer_interface, -+}; -+ -+static const struct wl_message zwp_linux_dmabuf_v1_requests[] = { -+ {"destroy", "", types + 0}, -+ {"create_params", "n", types + 6}, -+}; -+ -+static const struct wl_message zwp_linux_dmabuf_v1_events[] = { -+ {"format", "u", types + 0}, -+ {"modifier", "3uuu", types + 0}, -+}; -+ -+const struct wl_interface zwp_linux_dmabuf_v1_interface = { -+ "zwp_linux_dmabuf_v1", 3, 2, -+ zwp_linux_dmabuf_v1_requests, 2, zwp_linux_dmabuf_v1_events, -+}; -+ -+static const struct wl_message zwp_linux_buffer_params_v1_requests[] = { -+ {"destroy", "", types + 0}, -+ {"add", "huuuuu", types + 0}, -+ {"create", "iiuu", types + 0}, -+ {"create_immed", "2niiuu", types + 7}, -+}; -+ -+static const struct wl_message zwp_linux_buffer_params_v1_events[] = { -+ {"created", "n", types + 12}, -+ {"failed", "", types + 0}, -+}; -+ -+const struct wl_interface zwp_linux_buffer_params_v1_interface = { -+ "zwp_linux_buffer_params_v1", 3, 4, -+ zwp_linux_buffer_params_v1_requests, 2, zwp_linux_buffer_params_v1_events, -+}; -diff --git a/widget/gtk/wayland/moz.build b/widget/gtk/wayland/moz.build ---- a/widget/gtk/wayland/moz.build -+++ b/widget/gtk/wayland/moz.build -@@ -4,16 +4,22 @@ - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - - with Files("**"): - BUG_COMPONENT = ("Core", "Widget: Gtk") - - SOURCES += [ - 'gtk-primary-selection-protocol.c', -+ 'linux-dmabuf-unstable-v1-protocol.c' -+] -+ -+EXPORTS.mozilla.widget += [ -+ 'gtk-primary-selection-client-protocol.h', -+ 'linux-dmabuf-unstable-v1-client-protocol.h', - ] - - include('/ipc/chromium/chromium-config.mozbuild') - - FINAL_LIBRARY = 'xul' - - CFLAGS += CONFIG['TK_CFLAGS'] - CXXFLAGS += CONFIG['TK_CFLAGS'] - diff --git a/sources b/sources index 274916a..4be600b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-67.0.4.source.tar.xz) = 42abc837b5808a55e68273db6aa45fa73f8fe1df3c9072c94d8d049b6803ce8758745cc0a68af64c4ce9f86e5dd3b3619824ba67fabddce428204605894d9ee7 -SHA512 (firefox-langpacks-67.0.4-20190620.tar.xz) = 99a0528d7be28a26352dc43ef0090b38a83959af2b68d9b08015c83f523bbc9f364199a9016d13b5a039a2d8aaa164f8b4b0a210d0c62d209d5261dbfa9ada1f +SHA512 (firefox-68.0.source.tar.xz) = 3822d9e72edffd278b4a8e86998252e7e7134a1751d64c9913e5492971f41606187b67b3639dcfca6c97ae958547d6bc0426a5cb2c321e32fb96f33ed8760feb +SHA512 (firefox-langpacks-68.0-20190702.tar.xz) = 6b146f7ef5fd57c38d3074b5f7ee19ac90d11d3e742bedb843f47ed528c27df8aa3f38698e31dd0357cdfa13e37a08845c29e5b5ac0efe8c8291b2272acae1d7 From 062a42c5554ad70436726c2c983abdb037f60aef Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Mon, 8 Jul 2019 16:49:04 +0200 Subject: [PATCH 0013/1136] Updated pipewire patch --- firefox-pipewire.patch | 2440 +--------------------------------------- firefox.spec | 9 +- 2 files changed, 25 insertions(+), 2424 deletions(-) diff --git a/firefox-pipewire.patch b/firefox-pipewire.patch index 816010e..7233a73 100644 --- a/firefox-pipewire.patch +++ b/firefox-pipewire.patch @@ -1,6 +1,6 @@ -diff -up firefox-66.0/config/system-headers.mozbuild.firefox-pipewire firefox-66.0/config/system-headers.mozbuild ---- firefox-66.0/config/system-headers.mozbuild.firefox-pipewire 2019-03-12 01:22:15.000000000 +0100 -+++ firefox-66.0/config/system-headers.mozbuild 2019-03-12 15:27:37.675285710 +0100 +diff -up firefox-68.0/config/system-headers.mozbuild.firefox-pipewire firefox-68.0/config/system-headers.mozbuild +--- firefox-68.0/config/system-headers.mozbuild.firefox-pipewire 2019-07-01 22:30:26.000000000 +0200 ++++ firefox-68.0/config/system-headers.mozbuild 2019-07-08 15:26:15.397161627 +0200 @@ -314,6 +314,7 @@ system_headers = [ 'Gestalt.h', 'getopt.h', @@ -17,1349 +17,11 @@ diff -up firefox-66.0/config/system-headers.mozbuild.firefox-pipewire firefox-66 'pixman.h', 'pk11func.h', 'pk11pqg.h', -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc 2019-03-12 15:27:37.675285710 +0100 -@@ -7,9 +7,6 @@ - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ --#include "modules/desktop_capture/app_capturer.h" --#include "modules/desktop_capture/shared_desktop_frame.h" --#include "modules/desktop_capture/x11/shared_x_util.h" - - #include - #include -@@ -21,79 +18,18 @@ - - #include - -+#include "modules/desktop_capture/app_capturer_x11.h" - #include "modules/desktop_capture/desktop_capture_options.h" - #include "modules/desktop_capture/desktop_frame.h" - #include "modules/desktop_capture/x11/shared_x_display.h" -+#include "modules/desktop_capture/x11/shared_x_util.h" - #include "modules/desktop_capture/x11/x_error_trap.h" - #include "modules/desktop_capture/x11/x_server_pixel_buffer.h" - #include "rtc_base/logging.h" - - namespace webrtc { - --namespace { -- --class ScreenCapturerProxy : DesktopCapturer::Callback { --public: -- ScreenCapturerProxy() -- : screen_capturer_(DesktopCapturer::CreateScreenCapturer(DesktopCaptureOptions::CreateDefault())) { -- screen_capturer_->SelectSource(kFullDesktopScreenId); -- screen_capturer_->Start(this); -- } -- void CaptureFrame() { screen_capturer_->CaptureFrame(); } -- std::unique_ptr GetFrame() { return std::move(frame_); } -- -- // Callback interface -- virtual void OnCaptureResult(DesktopCapturer::Result result, -- std::unique_ptr frame) { -- frame_ = std::move(frame); -- } -- --protected: -- std::unique_ptr screen_capturer_; -- std::unique_ptr frame_; --}; -- --class AppCapturerLinux : public AppCapturer { --public: -- AppCapturerLinux(const DesktopCaptureOptions& options); -- virtual ~AppCapturerLinux(); -- -- // AppCapturer interface. -- virtual bool GetAppList(AppList* apps) override; -- virtual bool SelectApp(ProcessId processId) override; -- virtual bool BringAppToFront() override; -- -- // DesktopCapturer interface. -- virtual void Start(Callback* callback) override; -- virtual void CaptureFrame() override; -- virtual bool SelectSource(SourceId id) override -- { -- return SelectApp(static_cast(id)); -- } -- --protected: -- Display* GetDisplay() { return x_display_->display(); } -- bool UpdateRegions(); -- -- void FillDesktopFrameRegionWithColor(DesktopFrame* pDesktopFrame,Region rgn, uint32_t color); --private: -- Callback* callback_; -- ProcessId selected_process_; -- -- // Sample Mode -- ScreenCapturerProxy screen_capturer_proxy_; -- // Mask of foreground (non-app windows in front of selected) -- Region rgn_mask_; -- // Region of selected windows -- Region rgn_visual_; -- // Mask of background (desktop, non-app windows behind selected) -- Region rgn_background_; -- -- rtc::scoped_refptr x_display_; -- RTC_DISALLOW_COPY_AND_ASSIGN(AppCapturerLinux); --}; -- --AppCapturerLinux::AppCapturerLinux(const DesktopCaptureOptions& options) -+AppCapturerX11::AppCapturerX11(const DesktopCaptureOptions& options) - : callback_(NULL), - selected_process_(0), - x_display_(options.x_display()) { -@@ -102,7 +38,7 @@ AppCapturerLinux::AppCapturerLinux(const - rgn_background_ = XCreateRegion(); - } - --AppCapturerLinux::~AppCapturerLinux() { -+AppCapturerX11::~AppCapturerX11() { - if (rgn_mask_) { - XDestroyRegion(rgn_mask_); - } -@@ -115,28 +51,28 @@ AppCapturerLinux::~AppCapturerLinux() { - } - - // AppCapturer interface. --bool AppCapturerLinux::GetAppList(AppList* apps) { -+bool AppCapturerX11::GetAppList(AppList* apps) { - // Implemented in DesktopDeviceInfo - return true; - } --bool AppCapturerLinux::SelectApp(ProcessId processId) { -+bool AppCapturerX11::SelectApp(ProcessId processId) { - selected_process_ = processId; - return true; - } --bool AppCapturerLinux::BringAppToFront() { -+bool AppCapturerX11::BringAppToFront() { - // Not implemented yet: See Bug 1036653 - return true; - } - - // DesktopCapturer interface. --void AppCapturerLinux::Start(Callback* callback) { -+void AppCapturerX11::Start(Callback* callback) { - assert(!callback_); - assert(callback); - - callback_ = callback; - } - --void AppCapturerLinux::CaptureFrame() { -+void AppCapturerX11::CaptureFrame() { - XErrorTrap error_trap(GetDisplay()); - - //Capture screen >> set root window as capture window -@@ -164,7 +100,7 @@ void AppCapturerLinux::CaptureFrame() { - } - } - --void AppCapturerLinux::FillDesktopFrameRegionWithColor(DesktopFrame* pDesktopFrame, Region rgn, uint32_t color) { -+void AppCapturerX11::FillDesktopFrameRegionWithColor(DesktopFrame* pDesktopFrame, Region rgn, uint32_t color) { - XErrorTrap error_trap(GetDisplay()); - - if (!pDesktopFrame) { -@@ -187,7 +123,7 @@ void AppCapturerLinux::FillDesktopFrameR - } - } - --bool AppCapturerLinux::UpdateRegions() { -+bool AppCapturerX11::UpdateRegions() { - XErrorTrap error_trap(GetDisplay()); - - XSubtractRegion(rgn_visual_, rgn_visual_, rgn_visual_); -@@ -264,21 +200,19 @@ bool AppCapturerLinux::UpdateRegions() { - return true; - } - --} // namespace -- - // static --AppCapturer* AppCapturer::Create(const DesktopCaptureOptions& options) { -- return new AppCapturerLinux(options); -+AppCapturer* AppCapturerX11::Create(const DesktopCaptureOptions& options) { -+ return new AppCapturerX11(options); - } - - // static --std::unique_ptr DesktopCapturer::CreateRawAppCapturer( -+std::unique_ptr AppCapturerX11::CreateRawAppCapturer( - const DesktopCaptureOptions& options) { - - if (!options.x_display()) - return nullptr; - -- std::unique_ptr capturer(new AppCapturerLinux(options)); -+ std::unique_ptr capturer(new AppCapturerX11(options)); - - return std::unique_ptr(std::move(capturer)); - } -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h.firefox-pipewire 2019-03-12 15:27:37.676285720 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h 2019-03-12 16:08:04.440031789 +0100 -@@ -0,0 +1,97 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_APP_CAPTURER_X11_H_ -+#define MODULES_DESKTOP_CAPTURE_APP_CAPTURER_X11_H_ -+ -+#include -+#include -+#include -+#include -+ -+#include "modules/desktop_capture/app_capturer.h" -+#include "modules/desktop_capture/shared_desktop_frame.h" -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+#include "modules/desktop_capture/desktop_geometry.h" -+#include "modules/desktop_capture/x11/shared_x_display.h" -+#include "modules/desktop_capture/x11/x_server_pixel_buffer.h" -+#include "rtc_base/constructormagic.h" -+#include "rtc_base/scoped_ref_ptr.h" -+ -+namespace webrtc { -+ -+class ScreenCapturerProxy : DesktopCapturer::Callback { -+public: -+ ScreenCapturerProxy() -+ : screen_capturer_(DesktopCapturer::CreateScreenCapturer(DesktopCaptureOptions::CreateDefault())) { -+ screen_capturer_->SelectSource(kFullDesktopScreenId); -+ screen_capturer_->Start(this); -+ } -+ void CaptureFrame() { screen_capturer_->CaptureFrame(); } -+ std::unique_ptr GetFrame() { return std::move(frame_); } -+ -+ // Callback interface -+ virtual void OnCaptureResult(DesktopCapturer::Result result, -+ std::unique_ptr frame) { -+ frame_ = std::move(frame); -+ } -+ -+protected: -+ std::unique_ptr screen_capturer_; -+ std::unique_ptr frame_; -+}; -+ -+class AppCapturerX11 : public AppCapturer { -+public: -+ AppCapturerX11(const DesktopCaptureOptions& options); -+ virtual ~AppCapturerX11(); -+ -+ static AppCapturer* Create(const DesktopCaptureOptions& options); -+ static std::unique_ptr CreateRawAppCapturer(const DesktopCaptureOptions& options); -+ -+ // AppCapturer interface. -+ virtual bool GetAppList(AppList* apps) override; -+ virtual bool SelectApp(ProcessId processId) override; -+ virtual bool BringAppToFront() override; -+ -+ // DesktopCapturer interface. -+ virtual void Start(Callback* callback) override; -+ virtual void CaptureFrame() override; -+ virtual bool SelectSource(SourceId id) override -+ { -+ return SelectApp(static_cast(id)); -+ } -+ -+protected: -+ Display* GetDisplay() { return x_display_->display(); } -+ bool UpdateRegions(); -+ -+ void FillDesktopFrameRegionWithColor(DesktopFrame* pDesktopFrame,Region rgn, uint32_t color); -+private: -+ Callback* callback_; -+ ProcessId selected_process_; -+ -+ // Sample Mode -+ ScreenCapturerProxy screen_capturer_proxy_; -+ // Mask of foreground (non-app windows in front of selected) -+ Region rgn_mask_; -+ // Region of selected windows -+ Region rgn_visual_; -+ // Mask of background (desktop, non-app windows behind selected) -+ Region rgn_background_; -+ -+ rtc::scoped_refptr x_display_; -+ RTC_DISALLOW_COPY_AND_ASSIGN(AppCapturerX11); -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_APP_CAPTURER_X11_H_ -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc.firefox-pipewire 2019-03-12 15:27:37.676285720 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc 2019-03-12 15:27:37.676285720 +0100 -@@ -0,0 +1,849 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "modules/desktop_capture/base_capturer_pipewire.h" -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+#include "rtc_base/checks.h" -+#include "rtc_base/logging.h" -+ -+namespace webrtc { -+ -+const char kDesktopBusName[] = "org.freedesktop.portal.Desktop"; -+const char kDesktopObjectPath[] = "/org/freedesktop/portal/desktop"; -+const char kDesktopRequestObjectPath[] = -+ "/org/freedesktop/portal/desktop/request"; -+const char kSessionInterfaceName[] = "org.freedesktop.portal.Session"; -+const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; -+const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; -+ -+const int kBytesPerPixelPw = 4; -+ -+// static -+void BaseCapturerPipeWire::OnStateChanged(void* data, -+ pw_remote_state old_state, -+ pw_remote_state state, -+ const char* error_message) { -+ BaseCapturerPipeWire* that = static_cast(data); -+ RTC_DCHECK(that); -+ -+ switch (state) { -+ case PW_REMOTE_STATE_ERROR: -+ RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message; -+ break; -+ case PW_REMOTE_STATE_CONNECTED: -+ RTC_LOG(LS_INFO) << "PipeWire remote state: connected."; -+ that->CreateReceivingStream(); -+ break; -+ case PW_REMOTE_STATE_CONNECTING: -+ RTC_LOG(LS_INFO) << "PipeWire remote state: connecting."; -+ break; -+ case PW_REMOTE_STATE_UNCONNECTED: -+ RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected."; -+ break; -+ } -+} -+ -+// static -+void BaseCapturerPipeWire::OnStreamStateChanged(void* data, -+ pw_stream_state old_state, -+ pw_stream_state state, -+ const char* error_message) { -+ BaseCapturerPipeWire* that = static_cast(data); -+ RTC_DCHECK(that); -+ -+ switch (state) { -+ case PW_STREAM_STATE_ERROR: -+ RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message; -+ break; -+ case PW_STREAM_STATE_CONFIGURE: -+ pw_stream_set_active(that->pw_stream_, true); -+ break; -+ case PW_STREAM_STATE_UNCONNECTED: -+ case PW_STREAM_STATE_CONNECTING: -+ case PW_STREAM_STATE_READY: -+ case PW_STREAM_STATE_PAUSED: -+ case PW_STREAM_STATE_STREAMING: -+ break; -+ } -+} -+ -+// static -+void BaseCapturerPipeWire::OnStreamFormatChanged( -+ void* data, -+ const struct spa_pod* format) { -+ BaseCapturerPipeWire* that = static_cast(data); -+ RTC_DCHECK(that); -+ -+ RTC_LOG(LS_INFO) << "PipeWire stream format changed."; -+ -+ if (!format) { -+ pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr, -+ /*n_params=*/0); -+ return; -+ } -+ -+ that->spa_video_format_ = new spa_video_info_raw(); -+ spa_format_video_raw_parse(format, that->spa_video_format_, -+ &that->pw_type_->format_video); -+ -+ auto width = that->spa_video_format_->size.width; -+ auto height = that->spa_video_format_->size.height; -+ auto stride = SPA_ROUND_UP_N(width * kBytesPerPixelPw, 4); -+ auto size = height * stride; -+ -+ uint8_t buffer[1024] = {}; -+ auto builder = spa_pod_builder{buffer, sizeof(buffer)}; -+ -+ // Setup buffers and meta header for new format. -+ const struct spa_pod* params[2]; -+ params[0] = reinterpret_cast(spa_pod_builder_object( -+ &builder, -+ // id to enumerate buffer requirements -+ that->pw_core_type_->param.idBuffers, -+ that->pw_core_type_->param_buffers.Buffers, -+ // Size: specified as integer (i) and set to specified size -+ ":", that->pw_core_type_->param_buffers.size, "i", size, -+ // Stride: specified as integer (i) and set to specified stride -+ ":", that->pw_core_type_->param_buffers.stride, "i", stride, -+ // Buffers: specifies how many buffers we want to deal with, set as -+ // integer (i) where preferred number is 8, then allowed number is defined -+ // as range (r) from min and max values and it is undecided (u) to allow -+ // negotiation -+ ":", that->pw_core_type_->param_buffers.buffers, "iru", 8, -+ SPA_POD_PROP_MIN_MAX(1, 32), -+ // Align: memory alignment of the buffer, set as integer (i) to specified -+ // value -+ ":", that->pw_core_type_->param_buffers.align, "i", 16)); -+ params[1] = reinterpret_cast(spa_pod_builder_object( -+ &builder, -+ // id to enumerate supported metadata -+ that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta, -+ // Type: specified as id or enum (I) -+ ":", that->pw_core_type_->param_meta.type, "I", -+ that->pw_core_type_->meta.Header, -+ // Size: size of the metadata, specified as integer (i) -+ ":", that->pw_core_type_->param_meta.size, "i", -+ sizeof(struct spa_meta_header))); -+ -+ pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2); -+} -+ -+// static -+void BaseCapturerPipeWire::OnStreamProcess(void* data) { -+ BaseCapturerPipeWire* that = static_cast(data); -+ RTC_DCHECK(that); -+ -+ pw_buffer* buf = nullptr; -+ -+ if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { -+ return; -+ } -+ -+ that->HandleBuffer(buf); -+ -+ pw_stream_queue_buffer(that->pw_stream_, buf); -+} -+ -+BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) -+ : capture_source_type_(source_type) {} -+ -+BaseCapturerPipeWire::~BaseCapturerPipeWire() { -+ if (pw_main_loop_) { -+ pw_thread_loop_stop(pw_main_loop_); -+ } -+ -+ if (pw_type_) { -+ delete pw_type_; -+ } -+ -+ if (spa_video_format_) { -+ delete spa_video_format_; -+ } -+ -+ if (pw_stream_) { -+ pw_stream_destroy(pw_stream_); -+ } -+ -+ if (pw_remote_) { -+ pw_remote_destroy(pw_remote_); -+ } -+ -+ if (pw_core_) { -+ pw_core_destroy(pw_core_); -+ } -+ -+ if (pw_main_loop_) { -+ pw_thread_loop_destroy(pw_main_loop_); -+ } -+ -+ if (pw_loop_) { -+ pw_loop_destroy(pw_loop_); -+ } -+ -+ if (current_frame_) { -+ free(current_frame_); -+ } -+ -+ if (start_request_signal_id_) { -+ g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); -+ } -+ if (sources_request_signal_id_) { -+ g_dbus_connection_signal_unsubscribe(connection_, -+ sources_request_signal_id_); -+ } -+ if (session_request_signal_id_) { -+ g_dbus_connection_signal_unsubscribe(connection_, -+ session_request_signal_id_); -+ } -+ -+ if (session_handle_) { -+ GDBusMessage* message = g_dbus_message_new_method_call( -+ kDesktopBusName, session_handle_, kSessionInterfaceName, "Close"); -+ if (message) { -+ GError* error = nullptr; -+ g_dbus_connection_send_message(connection_, message, -+ G_DBUS_SEND_MESSAGE_FLAGS_NONE, -+ /*out_serial=*/nullptr, &error); -+ if (error) { -+ RTC_LOG(LS_ERROR) << "Failed to close the session: " << error->message; -+ g_error_free(error); -+ } -+ g_object_unref(message); -+ } -+ } -+ -+ g_free(start_handle_); -+ g_free(sources_handle_); -+ g_free(session_handle_); -+ g_free(portal_handle_); -+ -+ if (proxy_) { -+ g_clear_object(&proxy_); -+ } -+} -+ -+void BaseCapturerPipeWire::InitPortals() { -+ g_dbus_proxy_new_for_bus( -+ G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, /*info=*/nullptr, -+ kDesktopBusName, kDesktopObjectPath, kScreenCastInterfaceName, -+ /*cancellable=*/nullptr, -+ reinterpret_cast(OnProxyRequested), this); -+} -+ -+void BaseCapturerPipeWire::InitPipeWire() { -+ pw_init(/*argc=*/nullptr, /*argc=*/nullptr); -+ -+ pw_loop_ = pw_loop_new(/*properties=*/nullptr); -+ pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop"); -+ -+ pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr); -+ pw_core_type_ = pw_core_get_type(pw_core_); -+ pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0); -+ -+ InitPipeWireTypes(); -+ -+ // Initialize event handlers, remote end and stream-related. -+ pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS; -+ pw_remote_events_.state_changed = &OnStateChanged; -+ -+ pw_stream_events_.version = PW_VERSION_STREAM_EVENTS; -+ pw_stream_events_.state_changed = &OnStreamStateChanged; -+ pw_stream_events_.format_changed = &OnStreamFormatChanged; -+ pw_stream_events_.process = &OnStreamProcess; -+ -+ pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_, -+ this); -+ pw_remote_connect_fd(pw_remote_, pw_fd_); -+ -+ if (pw_thread_loop_start(pw_main_loop_) < 0) { -+ RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop"; -+ portal_init_failed_ = true; -+ } -+} -+ -+void BaseCapturerPipeWire::InitPipeWireTypes() { -+ spa_type_map* map = pw_core_type_->map; -+ pw_type_ = new PipeWireType(); -+ -+ spa_type_media_type_map(map, &pw_type_->media_type); -+ spa_type_media_subtype_map(map, &pw_type_->media_subtype); -+ spa_type_format_video_map(map, &pw_type_->format_video); -+ spa_type_video_format_map(map, &pw_type_->video_format); -+} -+ -+void BaseCapturerPipeWire::CreateReceivingStream() { -+ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; -+ spa_rectangle pwScreenBounds = -+ spa_rectangle{static_cast(desktop_size_.width()), -+ static_cast(desktop_size_.height())}; -+ -+ spa_fraction pwFrameRateMin = spa_fraction{0, 1}; -+ spa_fraction pwFrameRateMax = spa_fraction{60, 1}; -+ -+ pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1", -+ /*end of varargs*/ nullptr); -+ pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps); -+ -+ uint8_t buffer[1024] = {}; -+ const spa_pod* params[1]; -+ spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; -+ params[0] = reinterpret_cast(spa_pod_builder_object( -+ &builder, -+ // id to enumerate formats -+ pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I", -+ pw_type_->media_type.video, "I", pw_type_->media_subtype.raw, -+ // Video format: specified as id or enum (I), preferred format is BGRx, -+ // then allowed formats are enumerated (e) and the format is undecided (u) -+ // to allow negotiation -+ ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx, -+ SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx, -+ pw_type_->video_format.BGRx), -+ // Video size: specified as rectangle (R), preferred size is specified as -+ // first parameter, then allowed size is defined as range (r) from min and -+ // max values and the format is undecided (u) to allow negotiation -+ ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2, -+ &pwMinScreenBounds, &pwScreenBounds, -+ // Frame rate: specified as fraction (F) and set to minimum frame rate -+ // value -+ ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin, -+ // Max frame rate: specified as fraction (F), preferred frame rate is set -+ // to maximum value, then allowed frame rate is defined as range (r) from -+ // min and max values and it is undecided (u) to allow negotiation -+ ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, -+ &pwFrameRateMin, &pwFrameRateMax)); -+ -+ pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, -+ this); -+ pw_stream_flags flags = static_cast( -+ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | -+ PW_STREAM_FLAG_MAP_BUFFERS); -+ if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, -+ flags, params, -+ /*n_params=*/1) != 0) { -+ RTC_LOG(LS_ERROR) << "Could not connect receiving stream."; -+ portal_init_failed_ = true; -+ return; -+ } -+} -+ -+void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { -+ spa_buffer* spaBuffer = buffer->buffer; -+ void* src = nullptr; -+ -+ if (!(src = spaBuffer->datas[0].data)) { -+ return; -+ } -+ -+ uint32_t maxSize = spaBuffer->datas[0].maxsize; -+ int32_t srcStride = spaBuffer->datas[0].chunk->stride; -+ if (srcStride != (desktop_size_.width() * kBytesPerPixelPw)) { -+ RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " -+ << srcStride -+ << " != " << (desktop_size_.width() * kBytesPerPixelPw); -+ portal_init_failed_ = true; -+ return; -+ } -+ -+ if (!current_frame_) { -+ current_frame_ = static_cast(malloc(maxSize)); -+ } -+ RTC_DCHECK(current_frame_ != nullptr); -+ -+ // If both sides decided to go with the RGBx format we need to convert it to -+ // BGRx to match color format expected by WebRTC. -+ if (spa_video_format_->format == pw_type_->video_format.RGBx) { -+ uint8_t* tempFrame = static_cast(malloc(maxSize)); -+ std::memcpy(tempFrame, src, maxSize); -+ ConvertRGBxToBGRx(tempFrame, maxSize); -+ std::memcpy(current_frame_, tempFrame, maxSize); -+ free(tempFrame); -+ } else { -+ std::memcpy(current_frame_, src, maxSize); -+ } -+} -+ -+void BaseCapturerPipeWire::ConvertRGBxToBGRx(uint8_t* frame, uint32_t size) { -+ // Change color format for KDE KWin which uses RGBx and not BGRx -+ for (uint32_t i = 0; i < size; i += 4) { -+ uint8_t tempR = frame[i]; -+ uint8_t tempB = frame[i + 2]; -+ frame[i] = tempB; -+ frame[i + 2] = tempR; -+ } -+} -+ -+guint BaseCapturerPipeWire::SetupRequestResponseSignal( -+ const gchar* object_path, -+ GDBusSignalCallback callback) { -+ return g_dbus_connection_signal_subscribe( -+ connection_, kDesktopBusName, kRequestInterfaceName, "Response", -+ object_path, /*arg0=*/nullptr, G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE, -+ callback, this, /*user_data_free_func=*/nullptr); -+} -+ -+// static -+void BaseCapturerPipeWire::OnProxyRequested(GObject* /*object*/, -+ GAsyncResult* result, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ GError* error = nullptr; -+ that->proxy_ = g_dbus_proxy_new_finish(result, &error); -+ if (!that->proxy_) { -+ RTC_LOG(LS_ERROR) << "Failed to create a proxy for the screen cast portal: " -+ << error->message; -+ g_error_free(error); -+ that->portal_init_failed_ = true; -+ return; -+ } -+ that->connection_ = g_dbus_proxy_get_connection(that->proxy_); -+ -+ RTC_LOG(LS_INFO) << "Created proxy for the screen cast portal."; -+ that->SessionRequest(); -+} -+ -+// static -+gchar* BaseCapturerPipeWire::PrepareSignalHandle(GDBusConnection* connection, -+ const gchar* token) { -+ gchar* sender = g_strdup(g_dbus_connection_get_unique_name(connection) + 1); -+ for (int i = 0; sender[i]; i++) { -+ if (sender[i] == '.') { -+ sender[i] = '_'; -+ } -+ } -+ -+ gchar* handle = g_strconcat(kDesktopRequestObjectPath, "/", sender, "/", -+ token, /*end of varargs*/ nullptr); -+ g_free(sender); -+ -+ return handle; -+} -+ -+void BaseCapturerPipeWire::SessionRequest() { -+ GVariantBuilder builder; -+ gchar* variant_string; -+ -+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); -+ variant_string = -+ g_strdup_printf("webrtc_session%d", g_random_int_range(0, G_MAXINT)); -+ g_variant_builder_add(&builder, "{sv}", "session_handle_token", -+ g_variant_new_string(variant_string)); -+ g_free(variant_string); -+ variant_string = g_strdup_printf("webrtc%d", g_random_int_range(0, G_MAXINT)); -+ g_variant_builder_add(&builder, "{sv}", "handle_token", -+ g_variant_new_string(variant_string)); -+ -+ portal_handle_ = PrepareSignalHandle(connection_, variant_string); -+ session_request_signal_id_ = SetupRequestResponseSignal( -+ portal_handle_, OnSessionRequestResponseSignal); -+ g_free(variant_string); -+ -+ RTC_LOG(LS_INFO) << "Screen cast session requested."; -+ g_dbus_proxy_call( -+ proxy_, "CreateSession", g_variant_new("(a{sv})", &builder), -+ G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*cancellable=*/nullptr, -+ reinterpret_cast(OnSessionRequested), this); -+} -+ -+// static -+void BaseCapturerPipeWire::OnSessionRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ GError* error = nullptr; -+ GVariant* variant = g_dbus_proxy_call_finish(that->proxy_, result, &error); -+ if (!variant) { -+ RTC_LOG(LS_ERROR) << "Failed to create a screen cast session: " -+ << error->message; -+ g_error_free(error); -+ that->portal_init_failed_ = true; -+ return; -+ } -+ RTC_LOG(LS_INFO) << "Initializing the screen cast session."; -+ -+ gchar* handle = nullptr; -+ g_variant_get_child(variant, 0, "o", &handle); -+ g_variant_unref(variant); -+ if (!handle) { -+ RTC_LOG(LS_ERROR) << "Failed to initialize the screen cast session."; -+ if (that->session_request_signal_id_) { -+ g_dbus_connection_signal_unsubscribe(connection, -+ that->session_request_signal_id_); -+ that->session_request_signal_id_ = 0; -+ } -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ g_free(handle); -+ -+ RTC_LOG(LS_INFO) << "Subscribing to the screen cast session."; -+} -+ -+// static -+void BaseCapturerPipeWire::OnSessionRequestResponseSignal( -+ GDBusConnection* connection, -+ const gchar* sender_name, -+ const gchar* object_path, -+ const gchar* interface_name, -+ const gchar* signal_name, -+ GVariant* parameters, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ -+ RTC_LOG(LS_INFO) -+ << "Received response for the screen cast session subscription."; -+ -+ guint32 portal_response; -+ GVariant* response_data; -+ g_variant_get(parameters, "(u@a{sv})", &portal_response, &response_data); -+ g_variant_lookup(response_data, "session_handle", "s", -+ &that->session_handle_); -+ g_variant_unref(response_data); -+ -+ if (!that->session_handle_ || portal_response) { -+ RTC_LOG(LS_ERROR) -+ << "Failed to request the screen cast session subscription."; -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ that->SourcesRequest(); -+} -+ -+void BaseCapturerPipeWire::SourcesRequest() { -+ GVariantBuilder builder; -+ gchar* variant_string; -+ -+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); -+ // We want to record monitor content. -+ g_variant_builder_add(&builder, "{sv}", "types", -+ g_variant_new_uint32(capture_source_type_)); -+ // We don't want to allow selection of multiple sources. -+ g_variant_builder_add(&builder, "{sv}", "multiple", -+ g_variant_new_boolean(false)); -+ variant_string = g_strdup_printf("webrtc%d", g_random_int_range(0, G_MAXINT)); -+ g_variant_builder_add(&builder, "{sv}", "handle_token", -+ g_variant_new_string(variant_string)); -+ -+ sources_handle_ = PrepareSignalHandle(connection_, variant_string); -+ sources_request_signal_id_ = SetupRequestResponseSignal( -+ sources_handle_, OnSourcesRequestResponseSignal); -+ g_free(variant_string); -+ -+ RTC_LOG(LS_INFO) << "Requesting sources from the screen cast session."; -+ g_dbus_proxy_call( -+ proxy_, "SelectSources", -+ g_variant_new("(oa{sv})", session_handle_, &builder), -+ G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*cancellable=*/nullptr, -+ reinterpret_cast(OnSourcesRequested), this); -+} -+ -+// static -+void BaseCapturerPipeWire::OnSourcesRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ GError* error = nullptr; -+ GVariant* variant = g_dbus_proxy_call_finish(that->proxy_, result, &error); -+ if (!variant) { -+ RTC_LOG(LS_ERROR) << "Failed to request the sources: " << error->message; -+ g_error_free(error); -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ RTC_LOG(LS_INFO) << "Sources requested from the screen cast session."; -+ -+ gchar* handle = nullptr; -+ g_variant_get_child(variant, 0, "o", &handle); -+ g_variant_unref(variant); -+ if (!handle) { -+ RTC_LOG(LS_ERROR) << "Failed to initialize the screen cast session."; -+ if (that->sources_request_signal_id_) { -+ g_dbus_connection_signal_unsubscribe(connection, -+ that->sources_request_signal_id_); -+ that->sources_request_signal_id_ = 0; -+ } -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ g_free(handle); -+ -+ RTC_LOG(LS_INFO) << "Subscribed to sources signal."; -+} -+ -+// static -+void BaseCapturerPipeWire::OnSourcesRequestResponseSignal( -+ GDBusConnection* connection, -+ const gchar* sender_name, -+ const gchar* object_path, -+ const gchar* interface_name, -+ const gchar* signal_name, -+ GVariant* parameters, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ guint32 portal_response; -+ g_variant_get(parameters, "(u@a{sv})", &portal_response, nullptr); -+ if (portal_response) { -+ RTC_LOG(LS_ERROR) -+ << "Failed to select sources for the screen cast session."; -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ RTC_LOG(LS_INFO) << "Received sources signal from session."; -+ that->StartRequest(); -+} -+ -+void BaseCapturerPipeWire::StartRequest() { -+ GVariantBuilder builder; -+ gchar* variant_string; -+ -+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); -+ variant_string = g_strdup_printf("webrtc%d", g_random_int_range(0, G_MAXINT)); -+ g_variant_builder_add(&builder, "{sv}", "handle_token", -+ g_variant_new_string(variant_string)); -+ -+ start_handle_ = PrepareSignalHandle(connection_, variant_string); -+ start_request_signal_id_ = -+ SetupRequestResponseSignal(start_handle_, OnStartRequestResponseSignal); -+ g_free(variant_string); -+ -+ // "Identifier for the application window", this is Wayland, so not "x11:...". -+ const gchar parent_window[] = ""; -+ -+ RTC_LOG(LS_INFO) << "Starting the screen cast session."; -+ g_dbus_proxy_call( -+ proxy_, "Start", -+ g_variant_new("(osa{sv})", session_handle_, parent_window, &builder), -+ G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*cancellable=*/nullptr, -+ reinterpret_cast(OnStartRequested), this); -+} -+ -+// static -+void BaseCapturerPipeWire::OnStartRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ GError* error = nullptr; -+ GVariant* variant = g_dbus_proxy_call_finish(that->proxy_, result, &error); -+ if (!variant) { -+ RTC_LOG(LS_ERROR) << "Failed to start the screen cast session: " -+ << error->message; -+ g_error_free(error); -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ RTC_LOG(LS_INFO) << "Initializing the start of the screen cast session."; -+ -+ gchar* handle = nullptr; -+ g_variant_get_child(variant, 0, "o", &handle); -+ g_variant_unref(variant); -+ if (!handle) { -+ RTC_LOG(LS_ERROR) -+ << "Failed to initialize the start of the screen cast session."; -+ if (that->start_request_signal_id_) { -+ g_dbus_connection_signal_unsubscribe(connection, -+ that->start_request_signal_id_); -+ that->start_request_signal_id_ = 0; -+ } -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ g_free(handle); -+ -+ RTC_LOG(LS_INFO) << "Subscribed to the start signal."; -+} -+ -+// static -+void BaseCapturerPipeWire::OnStartRequestResponseSignal( -+ GDBusConnection* connection, -+ const gchar* sender_name, -+ const gchar* object_path, -+ const gchar* interface_name, -+ const gchar* signal_name, -+ GVariant* parameters, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ RTC_LOG(LS_INFO) << "Start signal received."; -+ guint32 portal_response; -+ GVariant* response_data; -+ GVariantIter* iter = nullptr; -+ g_variant_get(parameters, "(u@a{sv})", &portal_response, &response_data); -+ if (portal_response || !response_data) { -+ RTC_LOG(LS_ERROR) << "Failed to start the screen cast session."; -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ // Array of PipeWire streams. See -+ // https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.ScreenCast.xml -+ // documentation for . -+ if (g_variant_lookup(response_data, "streams", "a(ua{sv})", &iter)) { -+ GVariant* variant; -+ -+ while (g_variant_iter_next(iter, "@(ua{sv})", &variant)) { -+ guint32 stream_id; -+ gint32 width; -+ gint32 height; -+ GVariant* options; -+ -+ g_variant_get(variant, "(u@a{sv})", &stream_id, &options); -+ RTC_DCHECK(options != nullptr); -+ -+ g_variant_lookup(options, "size", "(ii)", &width, &height); -+ -+ that->desktop_size_.set(width, height); -+ -+ g_variant_unref(options); -+ g_variant_unref(variant); -+ } -+ } -+ g_variant_iter_free(iter); -+ g_variant_unref(response_data); -+ -+ that->OpenPipeWireRemote(); -+} -+ -+void BaseCapturerPipeWire::OpenPipeWireRemote() { -+ GVariantBuilder builder; -+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT); -+ -+ RTC_LOG(LS_INFO) << "Opening the PipeWire remote."; -+ -+ g_dbus_proxy_call_with_unix_fd_list( -+ proxy_, "OpenPipeWireRemote", -+ g_variant_new("(oa{sv})", session_handle_, &builder), -+ G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*fd_list=*/nullptr, -+ /*cancellable=*/nullptr, -+ reinterpret_cast(OnOpenPipeWireRemoteRequested), -+ this); -+} -+ -+// static -+void BaseCapturerPipeWire::OnOpenPipeWireRemoteRequested( -+ GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data) { -+ BaseCapturerPipeWire* that = -+ static_cast(user_data); -+ RTC_DCHECK(that); -+ -+ GError* error = nullptr; -+ GUnixFDList* outlist = nullptr; -+ GVariant* variant = g_dbus_proxy_call_with_unix_fd_list_finish( -+ that->proxy_, &outlist, result, &error); -+ if (!variant) { -+ RTC_LOG(LS_ERROR) << "Failed to open the PipeWire remote: " -+ << error->message; -+ g_error_free(error); -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ gint32 index; -+ g_variant_get(variant, "(h)", &index); -+ -+ if ((that->pw_fd_ = g_unix_fd_list_get(outlist, index, &error)) == -1) { -+ RTC_LOG(LS_ERROR) << "Failed to get file descriptor from the list: " -+ << error->message; -+ g_error_free(error); -+ g_variant_unref(variant); -+ that->portal_init_failed_ = true; -+ return; -+ } -+ -+ g_variant_unref(variant); -+ g_object_unref(outlist); -+ -+ that->InitPipeWire(); -+ RTC_LOG(LS_INFO) << "PipeWire remote opened."; -+} -+ -+void BaseCapturerPipeWire::Start(Callback* callback) { -+ RTC_DCHECK(!callback_); -+ RTC_DCHECK(callback); -+ -+ InitPortals(); -+ -+ callback_ = callback; -+} -+ -+void BaseCapturerPipeWire::CaptureFrame() { -+ if (portal_init_failed_) { -+ callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); -+ return; -+ } -+ -+ if (!current_frame_) { -+ callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); -+ return; -+ } -+ -+ std::unique_ptr result(new BasicDesktopFrame(desktop_size_)); -+ result->CopyPixelsFrom( -+ current_frame_, (desktop_size_.width() * kBytesPerPixelPw), -+ DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height())); -+ if (!result) { -+ callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); -+ return; -+ } -+ callback_->OnCaptureResult(Result::SUCCESS, std::move(result)); -+} -+ -+bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) { -+ RTC_DCHECK(sources->size() == 0); -+ // List of available screens is already presented by the xdg-desktop-portal. -+ // But we have to add an empty source as the code expects it. -+ sources->push_back({0}); -+ return true; -+} -+ -+bool BaseCapturerPipeWire::SelectSource(SourceId id) { -+ // Screen selection is handled by the xdg-desktop-portal. -+ return true; -+} -+ -+} // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h.firefox-pipewire 2019-03-12 15:27:37.676285720 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h 2019-03-12 16:08:26.294298896 +0100 -@@ -0,0 +1,166 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_BASE_CAPTURER_PIPEWIRE_H_ -+#define MODULES_DESKTOP_CAPTURE_BASE_CAPTURER_PIPEWIRE_H_ -+ -+#include -+#define typeof __typeof__ -+#include -+#include -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+ -+namespace webrtc { -+ -+class PipeWireType { -+ public: -+ spa_type_media_type media_type; -+ spa_type_media_subtype media_subtype; -+ spa_type_format_video format_video; -+ spa_type_video_format video_format; -+}; -+ -+class BaseCapturerPipeWire : public DesktopCapturer { -+ public: -+ enum CaptureSourceType { Screen = 1, Window }; -+ -+ explicit BaseCapturerPipeWire(CaptureSourceType source_type); -+ ~BaseCapturerPipeWire() override; -+ -+ // DesktopCapturer interface. -+ void Start(Callback* delegate) override; -+ void CaptureFrame() override; -+ bool GetSourceList(SourceList* sources) override; -+ bool SelectSource(SourceId id) override; -+ -+ private: -+ // PipeWire types --> -+ pw_core* pw_core_ = nullptr; -+ pw_type* pw_core_type_ = nullptr; -+ pw_stream* pw_stream_ = nullptr; -+ pw_remote* pw_remote_ = nullptr; -+ pw_loop* pw_loop_ = nullptr; -+ pw_thread_loop* pw_main_loop_ = nullptr; -+ PipeWireType* pw_type_ = nullptr; -+ -+ spa_hook spa_stream_listener_ = {}; -+ spa_hook spa_remote_listener_ = {}; -+ -+ pw_stream_events pw_stream_events_ = {}; -+ pw_remote_events pw_remote_events_ = {}; -+ -+ spa_video_info_raw* spa_video_format_ = nullptr; -+ -+ gint32 pw_fd_ = -1; -+ -+ CaptureSourceType capture_source_type_ = -+ BaseCapturerPipeWire::CaptureSourceType::Screen; -+ -+ // <-- end of PipeWire types -+ -+ GDBusConnection* connection_ = nullptr; -+ GDBusProxy* proxy_ = nullptr; -+ gchar* portal_handle_ = nullptr; -+ gchar* session_handle_ = nullptr; -+ gchar* sources_handle_ = nullptr; -+ gchar* start_handle_ = nullptr; -+ guint session_request_signal_id_ = 0; -+ guint sources_request_signal_id_ = 0; -+ guint start_request_signal_id_ = 0; -+ -+ DesktopSize desktop_size_ = {}; -+ DesktopCaptureOptions options_ = {}; -+ -+ uint8_t* current_frame_ = nullptr; -+ Callback* callback_ = nullptr; -+ -+ bool portal_init_failed_ = false; -+ -+ void InitPortals(); -+ void InitPipeWire(); -+ void InitPipeWireTypes(); -+ -+ void CreateReceivingStream(); -+ void HandleBuffer(pw_buffer* buffer); -+ -+ void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size); -+ -+ static void OnStateChanged(void* data, -+ pw_remote_state old_state, -+ pw_remote_state state, -+ const char* error); -+ static void OnStreamStateChanged(void* data, -+ pw_stream_state old_state, -+ pw_stream_state state, -+ const char* error_message); -+ -+ static void OnStreamFormatChanged(void* data, const struct spa_pod* format); -+ static void OnStreamProcess(void* data); -+ static void OnNewBuffer(void* data, uint32_t id); -+ -+ guint SetupRequestResponseSignal(const gchar* object_path, -+ GDBusSignalCallback callback); -+ -+ static void OnProxyRequested(GObject* object, -+ GAsyncResult* result, -+ gpointer user_data); -+ -+ static gchar* PrepareSignalHandle(GDBusConnection* connection, -+ const gchar* token); -+ -+ void SessionRequest(); -+ static void OnSessionRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data); -+ static void OnSessionRequestResponseSignal(GDBusConnection* connection, -+ const gchar* sender_name, -+ const gchar* object_path, -+ const gchar* interface_name, -+ const gchar* signal_name, -+ GVariant* parameters, -+ gpointer user_data); -+ -+ void SourcesRequest(); -+ static void OnSourcesRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data); -+ static void OnSourcesRequestResponseSignal(GDBusConnection* connection, -+ const gchar* sender_name, -+ const gchar* object_path, -+ const gchar* interface_name, -+ const gchar* signal_name, -+ GVariant* parameters, -+ gpointer user_data); -+ -+ void StartRequest(); -+ static void OnStartRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data); -+ static void OnStartRequestResponseSignal(GDBusConnection* connection, -+ const gchar* sender_name, -+ const gchar* object_path, -+ const gchar* interface_name, -+ const gchar* signal_name, -+ GVariant* parameters, -+ gpointer user_data); -+ -+ void OpenPipeWireRemote(); -+ static void OnOpenPipeWireRemoteRequested(GDBusConnection* connection, -+ GAsyncResult* result, -+ gpointer user_data); -+ -+ RTC_DISALLOW_COPY_AND_ASSIGN(BaseCapturerPipeWire); -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_BASE_CAPTURER_PIPEWIRE_H_ -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2019-03-12 15:27:37.676285720 +0100 -@@ -152,10 +152,10 @@ if CONFIG["OS_TARGET"] == "FreeBSD": - "/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc" - ] - -+# Common Linux stuff between X11 and PipeWire - if CONFIG["OS_TARGET"] == "Linux": - - DEFINES["USE_NSS_CERTS"] = "1" -- DEFINES["USE_X11"] = "1" - DEFINES["WEBRTC_LINUX"] = True - DEFINES["WEBRTC_POSIX"] = True - DEFINES["_FILE_OFFSET_BITS"] = "64" -@@ -175,6 +175,18 @@ if CONFIG["OS_TARGET"] == "Linux": - ] - - UNIFIED_SOURCES += [ -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc", -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc", -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc", -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc", -+ ] -+ -+# X11 specific files -+if CONFIG["OS_TARGET"] == "Linux": -+ -+ DEFINES["USE_X11"] = "1" -+ -+ UNIFIED_SOURCES += [ - "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc", - "/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc", - "/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc", -@@ -189,6 +201,27 @@ if CONFIG["OS_TARGET"] == "Linux": - "/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc" +diff -up firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +--- firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire 2019-07-01 22:30:33.000000000 +0200 ++++ firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2019-07-08 15:26:15.397161627 +0200 +@@ -194,6 +194,28 @@ if CONFIG["OS_TARGET"] == "Linux": + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc" ] +# PipeWire specific files @@ -1378,1088 +40,24 @@ diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_ + CXXFLAGS += CONFIG['TK_CFLAGS'] + + UNIFIED_SOURCES += [ -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc", -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc", -+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc" ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc" + ] ++ + if CONFIG["OS_TARGET"] == "NetBSD": DEFINES["USE_X11"] = "1" -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2019-03-12 15:27:37.677285729 +0100 -@@ -113,6 +113,11 @@ class DesktopCaptureOptions { - } - #endif - -+#if defined(WEBRTC_USE_PIPEWIRE) -+ bool allow_pipewire() const { return allow_pipewire_; } -+ void set_allow_pipewire(bool allow) { allow_pipewire_ = allow; } -+#endif -+ - private: - #if defined(USE_X11) - rtc::scoped_refptr x_display_; -@@ -135,6 +140,9 @@ class DesktopCaptureOptions { - #endif +diff -up firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h +--- firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire 2019-07-08 16:42:13.936254926 +0200 ++++ firefox-68.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2019-07-08 16:42:17.509264974 +0200 +@@ -141,7 +141,7 @@ class DesktopCaptureOptions { bool disable_effects_ = true; bool detect_updated_region_ = false; -+#if defined(WEBRTC_USE_PIPEWIRE) + #if defined(WEBRTC_USE_PIPEWIRE) +- bool allow_pipewire_ = false; + bool allow_pipewire_ = true; -+#endif + #endif }; - } // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc 2019-03-12 15:27:37.677285729 +0100 -@@ -70,4 +70,17 @@ std::unique_ptr Desktop - return capturer; - } - -+#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11) -+bool DesktopCapturer::IsRunningUnderWayland() { -+ const char* xdg_session_type = getenv("XDG_SESSION_TYPE"); -+ if (!xdg_session_type || strncmp(xdg_session_type, "wayland", 7) != 0) -+ return false; -+ -+ if (!(getenv("WAYLAND_DISPLAY"))) -+ return false; -+ -+ return true; -+} -+#endif -+ - } // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h 2019-03-12 15:27:37.677285729 +0100 -@@ -139,6 +139,10 @@ class DesktopCapturer { - static std::unique_ptr CreateAppCapturer( - const DesktopCaptureOptions& options); - -+#if defined(WEBRTC_USE_PIPEWIRE) || defined(USE_X11) -+ static bool IsRunningUnderWayland(); -+#endif -+ - protected: - // CroppingWindowCapturer needs to create raw capturers without wrappers, so - // the following two functions are protected. -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc.firefox-pipewire 2019-03-12 15:27:37.677285729 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc 2019-03-12 15:27:37.677285729 +0100 -@@ -0,0 +1,40 @@ -+/* -+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include "modules/desktop_capture/mouse_cursor_monitor.h" -+ -+#if defined(USE_X11) -+#include "modules/desktop_capture/mouse_cursor_monitor_x11.h" -+#endif // defined(USE_X11) -+ -+namespace webrtc { -+ -+// static -+MouseCursorMonitor* MouseCursorMonitor::CreateForWindow( -+ const DesktopCaptureOptions& options, WindowId window) { -+#if defined(USE_X11) -+ return MouseCursorMonitorX11::CreateForWindow(options, window); -+#else -+ return nullptr; -+#endif // defined(USE_X11) -+} -+ -+// static -+MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( -+ const DesktopCaptureOptions& options, -+ ScreenId screen) { -+#if defined(USE_X11) -+ return MouseCursorMonitorX11::CreateForScreen(options, screen); -+#else -+ return nullptr; -+#endif // defined(USE_X11) -+} -+ -+} // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc 2019-03-12 15:27:37.678285739 +0100 -@@ -16,6 +16,8 @@ - #include - #include - -+#include "modules/desktop_capture/mouse_cursor_monitor_x11.h" -+ - #include "modules/desktop_capture/desktop_capture_options.h" - #include "modules/desktop_capture/desktop_capture_types.h" - #include "modules/desktop_capture/desktop_frame.h" -@@ -60,37 +62,6 @@ Window GetTopLevelWindow(Display* displa - - namespace webrtc { - --class MouseCursorMonitorX11 : public MouseCursorMonitor, -- public SharedXDisplay::XEventHandler { -- public: -- MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window, Window inner_window); -- ~MouseCursorMonitorX11() override; -- -- void Init(Callback* callback, Mode mode) override; -- void Capture() override; -- -- private: -- // SharedXDisplay::XEventHandler interface. -- bool HandleXEvent(const XEvent& event) override; -- -- Display* display() { return x_display_->display(); } -- -- // Captures current cursor shape and stores it in |cursor_shape_|. -- void CaptureCursor(); -- -- rtc::scoped_refptr x_display_; -- Callback* callback_; -- Mode mode_; -- Window window_; -- Window inner_window_; -- -- bool have_xfixes_; -- int xfixes_event_base_; -- int xfixes_error_base_; -- -- std::unique_ptr cursor_shape_; --}; -- - MouseCursorMonitorX11::MouseCursorMonitorX11( - const DesktopCaptureOptions& options, - Window window, Window inner_window) -@@ -257,7 +228,7 @@ void MouseCursorMonitorX11::CaptureCurso - } - - // static --MouseCursorMonitor* MouseCursorMonitor::CreateForWindow( -+MouseCursorMonitor* MouseCursorMonitorX11::CreateForWindow( - const DesktopCaptureOptions& options, WindowId window) { - if (!options.x_display()) - return NULL; -@@ -267,7 +238,7 @@ MouseCursorMonitor* MouseCursorMonitor:: - return new MouseCursorMonitorX11(options, outer_window, window); - } - --MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( -+MouseCursorMonitor* MouseCursorMonitorX11::CreateForScreen( - const DesktopCaptureOptions& options, - ScreenId screen) { - if (!options.x_display()) -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h.firefox-pipewire 2019-03-12 15:27:37.678285739 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h 2019-03-13 08:06:28.525517995 +0100 -@@ -0,0 +1,62 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_X11_H_ -+#define MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_X11_H_ -+ -+#include -+#include -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capture_types.h" -+#include "modules/desktop_capture/x11/shared_x_display.h" -+#include "modules/desktop_capture/mouse_cursor.h" -+#include "modules/desktop_capture/mouse_cursor_monitor.h" -+#include "rtc_base/scoped_ref_ptr.h" -+ -+namespace webrtc { -+ -+class MouseCursorMonitorX11 : public MouseCursorMonitor, -+ public SharedXDisplay::XEventHandler { -+ public: -+ MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window, Window inner_window); -+ ~MouseCursorMonitorX11() override; -+ -+ void Init(Callback* callback, Mode mode) override; -+ void Capture() override; -+ -+ static MouseCursorMonitor* CreateForWindow(const DesktopCaptureOptions& options, WindowId window); -+ static MouseCursorMonitor* CreateForScreen(const DesktopCaptureOptions& options, ScreenId screen); -+ -+ private: -+ // SharedXDisplay::XEventHandler interface. -+ bool HandleXEvent(const XEvent& event) override; -+ -+ Display* display() { return x_display_->display(); } -+ -+ // Captures current cursor shape and stores it in |cursor_shape_|. -+ void CaptureCursor(); -+ -+ rtc::scoped_refptr x_display_; -+ Callback* callback_; -+ Mode mode_; -+ Window window_; -+ Window inner_window_; -+ -+ bool have_xfixes_; -+ int xfixes_event_base_; -+ int xfixes_error_base_; -+ -+ std::unique_ptr cursor_shape_; -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_X11_H_ -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire 2019-03-12 15:27:37.678285739 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2019-03-12 15:27:37.678285739 +0100 -@@ -0,0 +1,40 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+ -+#if defined(WEBRTC_USE_PIPEWIRE) -+#include "modules/desktop_capture/screen_capturer_pipewire.h" -+#endif // defined(WEBRTC_USE_PIPEWIRE) -+ -+#if defined(USE_X11) -+#include "modules/desktop_capture/screen_capturer_x11.h" -+#endif // defined(USE_X11) -+ -+namespace webrtc { -+ -+// static -+std::unique_ptr DesktopCapturer::CreateRawScreenCapturer( -+ const DesktopCaptureOptions& options) { -+#if defined(WEBRTC_USE_PIPEWIRE) -+ if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { -+ return ScreenCapturerPipeWire::CreateRawScreenCapturer(options); -+ } -+#endif // defined(WEBRTC_USE_PIPEWIRE) -+ -+#if defined(USE_X11) -+ return ScreenCapturerX11::CreateRawScreenCapturer(options); -+#endif // defined(USE_X11) -+ -+ return nullptr; -+} -+ -+} // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc.firefox-pipewire 2019-03-12 15:27:37.678285739 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc 2019-03-12 15:27:37.678285739 +0100 -@@ -0,0 +1,31 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include "modules/desktop_capture/screen_capturer_pipewire.h" -+ -+#include -+ -+namespace webrtc { -+ -+ScreenCapturerPipeWire::ScreenCapturerPipeWire() -+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {} -+ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} -+ -+// static -+std::unique_ptr -+ScreenCapturerPipeWire::CreateRawScreenCapturer( -+ const DesktopCaptureOptions& options) { -+ std::unique_ptr capturer( -+ new ScreenCapturerPipeWire()); -+ -+ return std::move(capturer); -+} -+ -+} // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h.firefox-pipewire 2019-03-12 15:27:37.679285748 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h 2019-03-12 15:27:37.679285748 +0100 -@@ -0,0 +1,33 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_PIPEWIRE_H_ -+#define MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_PIPEWIRE_H_ -+ -+#include -+ -+#include "modules/desktop_capture/base_capturer_pipewire.h" -+ -+namespace webrtc { -+ -+class ScreenCapturerPipeWire : public BaseCapturerPipeWire { -+ public: -+ ScreenCapturerPipeWire(); -+ ~ScreenCapturerPipeWire() override; -+ -+ static std::unique_ptr CreateRawScreenCapturer( -+ const DesktopCaptureOptions& options); -+ -+ RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerPipeWire); -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_PIPEWIRE_H_ -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc 2019-03-12 15:27:37.679285748 +0100 -@@ -19,6 +19,8 @@ - #include - #include - -+#include "modules/desktop_capture/screen_capturer_x11.h" -+ - #include "modules/desktop_capture/desktop_capture_options.h" - #include "modules/desktop_capture/desktop_capturer.h" - #include "modules/desktop_capture/desktop_frame.h" -@@ -32,99 +34,12 @@ - #include "rtc_base/timeutils.h" - - namespace webrtc { --namespace { -- --// A class to perform video frame capturing for Linux. --// --// If XDamage is used, this class sets DesktopFrame::updated_region() according --// to the areas reported by XDamage. Otherwise this class does not detect --// DesktopFrame::updated_region(), the field is always set to the entire frame --// rectangle. ScreenCapturerDifferWrapper should be used if that functionality --// is necessary. --class ScreenCapturerLinux : public DesktopCapturer, -- public SharedXDisplay::XEventHandler { -- public: -- ScreenCapturerLinux(); -- ~ScreenCapturerLinux() override; -- -- // TODO(ajwong): Do we really want this to be synchronous? -- bool Init(const DesktopCaptureOptions& options); -- -- // DesktopCapturer interface. -- void Start(Callback* delegate) override; -- void CaptureFrame() override; -- bool GetSourceList(SourceList* sources) override; -- bool SelectSource(SourceId id) override; -- -- private: -- Display* display() { return options_.x_display()->display(); } -- -- // SharedXDisplay::XEventHandler interface. -- bool HandleXEvent(const XEvent& event) override; -- -- void InitXDamage(); -- -- // Capture screen pixels to the current buffer in the queue. In the DAMAGE -- // case, the ScreenCapturerHelper already holds the list of invalid rectangles -- // from HandleXEvent(). In the non-DAMAGE case, this captures the -- // whole screen, then calculates some invalid rectangles that include any -- // differences between this and the previous capture. -- std::unique_ptr CaptureScreen(); -- -- // Called when the screen configuration is changed. -- void ScreenConfigurationChanged(); -- -- // Synchronize the current buffer with |last_buffer_|, by copying pixels from -- // the area of |last_invalid_rects|. -- // Note this only works on the assumption that kNumBuffers == 2, as -- // |last_invalid_rects| holds the differences from the previous buffer and -- // the one prior to that (which will then be the current buffer). -- void SynchronizeFrame(); -- -- void DeinitXlib(); -- -- DesktopCaptureOptions options_; -- -- Callback* callback_ = nullptr; -- -- // X11 graphics context. -- GC gc_ = nullptr; -- Window root_window_ = BadValue; -- -- // XFixes. -- bool has_xfixes_ = false; -- int xfixes_event_base_ = -1; -- int xfixes_error_base_ = -1; -- -- // XDamage information. -- bool use_damage_ = false; -- Damage damage_handle_ = 0; -- int damage_event_base_ = -1; -- int damage_error_base_ = -1; -- XserverRegion damage_region_ = 0; -- -- // Access to the X Server's pixel buffer. -- XServerPixelBuffer x_server_pixel_buffer_; -- -- // A thread-safe list of invalid rectangles, and the size of the most -- // recently captured screen. -- ScreenCapturerHelper helper_; -- -- // Queue of the frames buffers. -- ScreenCaptureFrameQueue queue_; -- -- // Invalid region from the previous capture. This is used to synchronize the -- // current with the last buffer used. -- DesktopRegion last_invalid_region_; - -- RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerLinux); --}; -- --ScreenCapturerLinux::ScreenCapturerLinux() { -+ScreenCapturerX11::ScreenCapturerX11() { - helper_.SetLogGridSize(4); - } - --ScreenCapturerLinux::~ScreenCapturerLinux() { -+ScreenCapturerX11::~ScreenCapturerX11() { - options_.x_display()->RemoveEventHandler(ConfigureNotify, this); - if (use_damage_) { - options_.x_display()->RemoveEventHandler( -@@ -133,7 +48,7 @@ ScreenCapturerLinux::~ScreenCapturerLinu - DeinitXlib(); - } - --bool ScreenCapturerLinux::Init(const DesktopCaptureOptions& options) { -+bool ScreenCapturerX11::Init(const DesktopCaptureOptions& options) { - options_ = options; - - root_window_ = RootWindow(display(), DefaultScreen(display())); -@@ -176,7 +91,7 @@ bool ScreenCapturerLinux::Init(const Des - return true; - } - --void ScreenCapturerLinux::InitXDamage() { -+void ScreenCapturerX11::InitXDamage() { - // Our use of XDamage requires XFixes. - if (!has_xfixes_) { - return; -@@ -217,14 +132,14 @@ void ScreenCapturerLinux::InitXDamage() - RTC_LOG(LS_INFO) << "Using XDamage extension."; - } - --void ScreenCapturerLinux::Start(Callback* callback) { -+void ScreenCapturerX11::Start(Callback* callback) { - RTC_DCHECK(!callback_); - RTC_DCHECK(callback); - - callback_ = callback; - } - --void ScreenCapturerLinux::CaptureFrame() { -+void ScreenCapturerX11::CaptureFrame() { - int64_t capture_start_time_nanos = rtc::TimeNanos(); - - queue_.MoveToNextFrame(); -@@ -238,6 +153,7 @@ void ScreenCapturerLinux::CaptureFrame() - // in a good shape. - if (!x_server_pixel_buffer_.is_initialized()) { - // We failed to initialize pixel buffer. -+ RTC_LOG(LS_ERROR) << "Pixel buffer is not initialized."; - callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); - return; - } -@@ -253,6 +169,7 @@ void ScreenCapturerLinux::CaptureFrame() - - std::unique_ptr result = CaptureScreen(); - if (!result) { -+ RTC_LOG(LS_WARNING) << "Temporarily failed to capture screen."; - callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); - return; - } -@@ -263,19 +180,19 @@ void ScreenCapturerLinux::CaptureFrame() - callback_->OnCaptureResult(Result::SUCCESS, std::move(result)); - } - --bool ScreenCapturerLinux::GetSourceList(SourceList* sources) { -+bool ScreenCapturerX11::GetSourceList(SourceList* sources) { - RTC_DCHECK(sources->size() == 0); - // TODO(jiayl): implement screen enumeration. - sources->push_back({0}); - return true; - } - --bool ScreenCapturerLinux::SelectSource(SourceId id) { -+bool ScreenCapturerX11::SelectSource(SourceId id) { - // TODO(jiayl): implement screen selection. - return true; - } - --bool ScreenCapturerLinux::HandleXEvent(const XEvent& event) { -+bool ScreenCapturerX11::HandleXEvent(const XEvent& event) { - if (use_damage_ && (event.type == damage_event_base_ + XDamageNotify)) { - const XDamageNotifyEvent* damage_event = - reinterpret_cast(&event); -@@ -290,7 +207,7 @@ bool ScreenCapturerLinux::HandleXEvent(c - return false; - } - --std::unique_ptr ScreenCapturerLinux::CaptureScreen() { -+std::unique_ptr ScreenCapturerX11::CaptureScreen() { - std::unique_ptr frame = queue_.current_frame()->Share(); - RTC_DCHECK(x_server_pixel_buffer_.window_size().equals(frame->size())); - -@@ -348,7 +265,7 @@ std::unique_ptr ScreenCapt - return std::move(frame); - } - --void ScreenCapturerLinux::ScreenConfigurationChanged() { -+void ScreenCapturerX11::ScreenConfigurationChanged() { - // Make sure the frame buffers will be reallocated. - queue_.Reset(); - -@@ -359,7 +276,7 @@ void ScreenCapturerLinux::ScreenConfigur - } - } - --void ScreenCapturerLinux::SynchronizeFrame() { -+void ScreenCapturerX11::SynchronizeFrame() { - // Synchronize the current buffer with the previous one since we do not - // capture the entire desktop. Note that encoder may be reading from the - // previous buffer at this time so thread access complaints are false -@@ -379,7 +296,7 @@ void ScreenCapturerLinux::SynchronizeFra - } - } - --void ScreenCapturerLinux::DeinitXlib() { -+void ScreenCapturerX11::DeinitXlib() { - if (gc_) { - XFreeGC(display(), gc_); - gc_ = nullptr; -@@ -400,15 +317,13 @@ void ScreenCapturerLinux::DeinitXlib() { - } - } - --} // namespace -- - // static --std::unique_ptr DesktopCapturer::CreateRawScreenCapturer( -+std::unique_ptr ScreenCapturerX11::CreateRawScreenCapturer( - const DesktopCaptureOptions& options) { - if (!options.x_display()) - return nullptr; - -- std::unique_ptr capturer(new ScreenCapturerLinux()); -+ std::unique_ptr capturer(new ScreenCapturerX11()); - if (!capturer.get()->Init(options)) { - return nullptr; - } -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h.firefox-pipewire 2019-03-12 15:27:37.679285748 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h 2019-03-13 08:06:40.412607602 +0100 -@@ -0,0 +1,123 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_X11_H_ -+#define MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_X11_H_ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+#include "modules/desktop_capture/desktop_frame.h" -+#include "modules/desktop_capture/desktop_region.h" -+#include "modules/desktop_capture/x11/shared_x_display.h" -+#include "modules/desktop_capture/x11/x_server_pixel_buffer.h" -+#include "modules/desktop_capture/screen_capture_frame_queue.h" -+#include "modules/desktop_capture/screen_capturer_helper.h" -+#include "modules/desktop_capture/shared_desktop_frame.h" -+#include "rtc_base/constructormagic.h" -+ -+namespace webrtc { -+ -+// A class to perform video frame capturing for Linux on X11. -+// -+// If XDamage is used, this class sets DesktopFrame::updated_region() according -+// to the areas reported by XDamage. Otherwise this class does not detect -+// DesktopFrame::updated_region(), the field is always set to the entire frame -+// rectangle. ScreenCapturerDifferWrapper should be used if that functionality -+// is necessary. -+class ScreenCapturerX11 : public DesktopCapturer, -+ public SharedXDisplay::XEventHandler { -+ public: -+ ScreenCapturerX11(); -+ ~ScreenCapturerX11() override; -+ -+ static std::unique_ptr CreateRawScreenCapturer(const DesktopCaptureOptions& options); -+ -+ // TODO(ajwong): Do we really want this to be synchronous? -+ bool Init(const DesktopCaptureOptions& options); -+ -+ // DesktopCapturer interface. -+ void Start(Callback* delegate) override; -+ void CaptureFrame() override; -+ bool GetSourceList(SourceList* sources) override; -+ bool SelectSource(SourceId id) override; -+ -+ private: -+ Display* display() { return options_.x_display()->display(); } -+ -+ // SharedXDisplay::XEventHandler interface. -+ bool HandleXEvent(const XEvent& event) override; -+ -+ void InitXDamage(); -+ -+ // Capture screen pixels to the current buffer in the queue. In the DAMAGE -+ // case, the ScreenCapturerHelper already holds the list of invalid rectangles -+ // from HandleXEvent(). In the non-DAMAGE case, this captures the -+ // whole screen, then calculates some invalid rectangles that include any -+ // differences between this and the previous capture. -+ std::unique_ptr CaptureScreen(); -+ -+ // Called when the screen configuration is changed. -+ void ScreenConfigurationChanged(); -+ -+ // Synchronize the current buffer with |last_buffer_|, by copying pixels from -+ // the area of |last_invalid_rects|. -+ // Note this only works on the assumption that kNumBuffers == 2, as -+ // |last_invalid_rects| holds the differences from the previous buffer and -+ // the one prior to that (which will then be the current buffer). -+ void SynchronizeFrame(); -+ -+ void DeinitXlib(); -+ -+ DesktopCaptureOptions options_; -+ -+ Callback* callback_ = nullptr; -+ -+ // X11 graphics context. -+ GC gc_ = nullptr; -+ Window root_window_ = BadValue; -+ -+ // XFixes. -+ bool has_xfixes_ = false; -+ int xfixes_event_base_ = -1; -+ int xfixes_error_base_ = -1; -+ -+ // XDamage information. -+ bool use_damage_ = false; -+ Damage damage_handle_ = 0; -+ int damage_event_base_ = -1; -+ int damage_error_base_ = -1; -+ XserverRegion damage_region_ = 0; -+ -+ // Access to the X Server's pixel buffer. -+ XServerPixelBuffer x_server_pixel_buffer_; -+ -+ // A thread-safe list of invalid rectangles, and the size of the most -+ // recently captured screen. -+ ScreenCapturerHelper helper_; -+ -+ // Queue of the frames buffers. -+ ScreenCaptureFrameQueue queue_; -+ -+ // Invalid region from the previous capture. This is used to synchronize the -+ // current with the last buffer used. -+ DesktopRegion last_invalid_region_; -+ -+ RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerX11); -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_X11_H_ -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire 2019-03-12 15:27:37.679285748 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2019-03-12 15:27:37.679285748 +0100 -@@ -0,0 +1,40 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+ -+#if defined(WEBRTC_USE_PIPEWIRE) -+#include "modules/desktop_capture/window_capturer_pipewire.h" -+#endif // defined(WEBRTC_USE_PIPEWIRE) -+ -+#if defined(USE_X11) -+#include "modules/desktop_capture/window_capturer_x11.h" -+#endif // defined(USE_X11) -+ -+namespace webrtc { -+ -+// static -+std::unique_ptr DesktopCapturer::CreateRawWindowCapturer( -+ const DesktopCaptureOptions& options) { -+#if defined(WEBRTC_USE_PIPEWIRE) -+ if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { -+ return WindowCapturerPipeWire::CreateRawWindowCapturer(options); -+ } -+#endif // defined(WEBRTC_USE_PIPEWIRE) -+ -+#if defined(USE_X11) -+ return WindowCapturerX11::CreateRawWindowCapturer(options); -+#endif // defined(USE_X11) -+ -+ return nullptr; -+} -+ -+} // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc.firefox-pipewire 2019-03-12 15:27:37.680285758 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc 2019-03-12 15:27:37.680285758 +0100 -@@ -0,0 +1,28 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#include "modules/desktop_capture/window_capturer_pipewire.h" -+ -+namespace webrtc { -+ -+WindowCapturerPipeWire::WindowCapturerPipeWire() -+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {} -+WindowCapturerPipeWire::~WindowCapturerPipeWire() {} -+ -+// static -+std::unique_ptr -+WindowCapturerPipeWire::CreateRawWindowCapturer( -+ const DesktopCaptureOptions& options) { -+ std::unique_ptr capturer( -+ new WindowCapturerPipeWire()); -+ -+ return std::move(capturer); -+} -+} // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h.firefox-pipewire 2019-03-12 15:27:37.680285758 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h 2019-03-12 15:27:37.680285758 +0100 -@@ -0,0 +1,33 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_PIPEWIRE_H_ -+#define MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_PIPEWIRE_H_ -+ -+#include -+ -+#include "modules/desktop_capture/base_capturer_pipewire.h" -+ -+namespace webrtc { -+ -+class WindowCapturerPipeWire : public BaseCapturerPipeWire { -+ public: -+ WindowCapturerPipeWire(); -+ ~WindowCapturerPipeWire() override; -+ -+ static std::unique_ptr CreateRawWindowCapturer( -+ const DesktopCaptureOptions& options); -+ -+ RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerPipeWire); -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_PIPEWIRE_H_ -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc 2019-03-12 15:27:37.680285758 +0100 -@@ -16,6 +16,8 @@ - - #include - -+#include "modules/desktop_capture/window_capturer_x11.h" -+ - #include "modules/desktop_capture/desktop_capture_options.h" - #include "modules/desktop_capture/desktop_capturer.h" - #include "modules/desktop_capture/desktop_frame.h" -@@ -32,49 +34,7 @@ - - namespace webrtc { - --namespace { -- --class WindowCapturerLinux : public DesktopCapturer, -- public SharedXDisplay::XEventHandler { -- public: -- WindowCapturerLinux(const DesktopCaptureOptions& options); -- ~WindowCapturerLinux() override; -- -- // DesktopCapturer interface. -- void Start(Callback* callback) override; -- void CaptureFrame() override; -- bool GetSourceList(SourceList* sources) override; -- bool SelectSource(SourceId id) override; -- bool FocusOnSelectedSource() override; -- bool IsOccluded(const DesktopVector& pos) override; -- -- // SharedXDisplay::XEventHandler interface. -- bool HandleXEvent(const XEvent& event) override; -- -- private: -- Display* display() { return x_display_->display(); } -- -- // Returns window title for the specified X |window|. -- bool GetWindowTitle(::Window window, std::string* title); -- -- // Returns the id of the owning process. -- int GetWindowProcessID(::Window window); -- -- Callback* callback_ = nullptr; -- -- rtc::scoped_refptr x_display_; -- -- bool has_composite_extension_ = false; -- -- ::Window selected_window_ = 0; -- XServerPixelBuffer x_server_pixel_buffer_; -- XAtomCache atom_cache_; -- WindowFinderX11 window_finder_; -- -- RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerLinux); --}; -- --WindowCapturerLinux::WindowCapturerLinux(const DesktopCaptureOptions& options) -+WindowCapturerX11::WindowCapturerX11(const DesktopCaptureOptions& options) - : x_display_(options.x_display()), - atom_cache_(display()), - window_finder_(&atom_cache_) { -@@ -91,11 +51,11 @@ WindowCapturerLinux::WindowCapturerLinux - x_display_->AddEventHandler(ConfigureNotify, this); - } - --WindowCapturerLinux::~WindowCapturerLinux() { -+WindowCapturerX11::~WindowCapturerX11() { - x_display_->RemoveEventHandler(ConfigureNotify, this); - } - --bool WindowCapturerLinux::GetSourceList(SourceList* sources) { -+bool WindowCapturerX11::GetSourceList(SourceList* sources) { - return GetWindowList(&atom_cache_, - [this, sources](::Window window) { - Source w; -@@ -108,7 +68,7 @@ bool WindowCapturerLinux::GetSourceList( - }); - } - --bool WindowCapturerLinux::SelectSource(SourceId id) { -+bool WindowCapturerX11::SelectSource(SourceId id) { - if (!x_server_pixel_buffer_.Init(display(), id)) - return false; - -@@ -129,7 +89,7 @@ bool WindowCapturerLinux::SelectSource(S - return true; - } - --bool WindowCapturerLinux::FocusOnSelectedSource() { -+bool WindowCapturerX11::FocusOnSelectedSource() { - if (!selected_window_) - return false; - -@@ -178,14 +138,14 @@ bool WindowCapturerLinux::FocusOnSelecte - return true; - } - --void WindowCapturerLinux::Start(Callback* callback) { -+void WindowCapturerX11::Start(Callback* callback) { - RTC_DCHECK(!callback_); - RTC_DCHECK(callback); - - callback_ = callback; - } - --void WindowCapturerLinux::CaptureFrame() { -+void WindowCapturerX11::CaptureFrame() { - x_display_->ProcessPendingXEvents(); - - if (!x_server_pixel_buffer_.IsWindowValid()) { -@@ -228,12 +188,12 @@ void WindowCapturerLinux::CaptureFrame() - callback_->OnCaptureResult(Result::SUCCESS, std::move(frame)); - } - --bool WindowCapturerLinux::IsOccluded(const DesktopVector& pos) { -+bool WindowCapturerX11::IsOccluded(const DesktopVector& pos) { - return window_finder_.GetWindowUnderPoint(pos) != - static_cast(selected_window_); - } - --bool WindowCapturerLinux::HandleXEvent(const XEvent& event) { -+bool WindowCapturerX11::HandleXEvent(const XEvent& event) { - if (event.type == ConfigureNotify) { - XConfigureEvent xce = event.xconfigure; - if (xce.window == selected_window_) { -@@ -251,7 +211,7 @@ bool WindowCapturerLinux::HandleXEvent(c - return false; - } - --bool WindowCapturerLinux::GetWindowTitle(::Window window, std::string* title) { -+bool WindowCapturerX11::GetWindowTitle(::Window window, std::string* title) { - int status; - bool result = false; - XTextProperty window_name; -@@ -280,9 +240,7 @@ bool WindowCapturerLinux::GetWindowTitle - return result; - } - --} // namespace -- --int WindowCapturerLinux::GetWindowProcessID(::Window window) { -+int WindowCapturerX11::GetWindowProcessID(::Window window) { - // Get _NET_WM_PID property of the window. - Atom process_atom = XInternAtom(display(), "_NET_WM_PID", True); - XWindowProperty process_id(display(), window, process_atom); -@@ -291,11 +249,11 @@ int WindowCapturerLinux::GetWindowProces - } - - // static --std::unique_ptr DesktopCapturer::CreateRawWindowCapturer( -+std::unique_ptr WindowCapturerX11::CreateRawWindowCapturer( - const DesktopCaptureOptions& options) { - if (!options.x_display()) - return nullptr; -- return std::unique_ptr(new WindowCapturerLinux(options)); -+ return std::unique_ptr(new WindowCapturerX11(options)); - } - - } // namespace webrtc -diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h ---- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h.firefox-pipewire 2019-03-12 15:27:37.680285758 +0100 -+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h 2019-03-13 08:06:55.974724907 +0100 -@@ -0,0 +1,76 @@ -+/* -+ * Copyright 2018 The WebRTC project authors. All Rights Reserved. -+ * -+ * Use of this source code is governed by a BSD-style license -+ * that can be found in the LICENSE file in the root of the source -+ * tree. An additional intellectual property rights grant can be found -+ * in the file PATENTS. All contributing project authors may -+ * be found in the AUTHORS file in the root of the source tree. -+ */ -+ -+#ifndef MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_X11_H_ -+#define MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_X11_H_ -+ -+#include -+#include -+#include -+#include -+ -+#include "modules/desktop_capture/desktop_capture_options.h" -+#include "modules/desktop_capture/desktop_capturer.h" -+#include "modules/desktop_capture/desktop_geometry.h" -+#include "modules/desktop_capture/window_finder_x11.h" -+#include "modules/desktop_capture/x11/x_atom_cache.h" -+#include "modules/desktop_capture/x11/shared_x_display.h" -+#include "modules/desktop_capture/x11/x_server_pixel_buffer.h" -+#include "rtc_base/constructormagic.h" -+#include "rtc_base/scoped_ref_ptr.h" -+ -+namespace webrtc { -+ -+class WindowCapturerX11 : public DesktopCapturer, -+ public SharedXDisplay::XEventHandler { -+ public: -+ explicit WindowCapturerX11(const DesktopCaptureOptions& options); -+ ~WindowCapturerX11() override; -+ -+ static std::unique_ptr CreateRawWindowCapturer( -+ const DesktopCaptureOptions& options); -+ -+ // DesktopCapturer interface. -+ void Start(Callback* callback) override; -+ void CaptureFrame() override; -+ bool GetSourceList(SourceList* sources) override; -+ bool SelectSource(SourceId id) override; -+ bool FocusOnSelectedSource() override; -+ bool IsOccluded(const DesktopVector& pos) override; -+ -+ // SharedXDisplay::XEventHandler interface. -+ bool HandleXEvent(const XEvent& event) override; -+ -+ private: -+ Display* display() { return x_display_->display(); } -+ -+ // Returns window title for the specified X |window|. -+ bool GetWindowTitle(::Window window, std::string* title); -+ -+ // Returns the id of the owning process. -+ int GetWindowProcessID(::Window window); -+ -+ Callback* callback_ = nullptr; -+ -+ rtc::scoped_refptr x_display_; -+ -+ bool has_composite_extension_ = false; -+ -+ ::Window selected_window_ = 0; -+ XServerPixelBuffer x_server_pixel_buffer_; -+ XAtomCache atom_cache_; -+ WindowFinderX11 window_finder_; -+ -+ RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerX11); -+}; -+ -+} // namespace webrtc -+ -+#endif // MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_X11_H_ diff --git a/firefox.spec b/firefox.spec index 57d88ba..885832b 100644 --- a/firefox.spec +++ b/firefox.spec @@ -86,7 +86,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -140,7 +140,7 @@ Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch Patch417: bug1375074-save-restore-x28.patch # Wayland specific upstream patches -#Patch574: firefox-pipewire.patch +Patch574: firefox-pipewire.patch # PGO/LTO patches Patch600: pgo.patch @@ -341,7 +341,7 @@ This package contains results of tests executed during build. %endif # Wayland specific upstream patches -#%patch574 -p1 -b .firefox-pipewire +%patch574 -p1 -b .firefox-pipewire # PGO patches %patch600 -p1 -b .pgo @@ -911,6 +911,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Jul 8 2019 Jan Horak - 68.0-2 +- Update pipewire patch + * Tue Jul 2 2019 Martin Stransky - 68.0-1 - Updated to 68.0 From 0eea5d2d94e2d1499f0567107dd96cb5cf231386 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 8 Jul 2019 21:48:22 +0200 Subject: [PATCH 0014/1136] build fix --- firefox.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 57d88ba..10fc423 100644 --- a/firefox.spec +++ b/firefox.spec @@ -742,7 +742,7 @@ echo "%%lang($language_short) %{langpackdir}/langpack-$language_short@firefox.mo # Table of fallbacks for each language # please file a bug at bugzilla.redhat.com if the assignment is incorrect -create_default_langpack "bn-IN" "bn" +#create_default_langpack "bn-IN" "bn" create_default_langpack "es-AR" "es" create_default_langpack "fy-NL" "fy" create_default_langpack "ga-IE" "ga" From 3012f109018259381f1a3d9f5e7711169fa124c0 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 8 Jul 2019 22:46:12 +0200 Subject: [PATCH 0015/1136] Fixed second arch patches --- ...fix-mozillaSignalTrampoline-to-work-.patch | 22 ++++++++----------- rhbz-1354671.patch | 6 ++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch b/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch index 70e45ff..d7e53e7 100644 --- a/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch +++ b/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch @@ -1,19 +1,15 @@ -diff -up firefox-60.0/mfbt/LinuxSignal.h.mozilla-1238661 firefox-60.0/mfbt/LinuxSignal.h ---- firefox-60.0/mfbt/LinuxSignal.h.mozilla-1238661 2018-04-27 08:55:38.848241768 +0200 -+++ firefox-60.0/mfbt/LinuxSignal.h 2018-04-27 09:06:47.946769859 +0200 -@@ -25,10 +25,13 @@ SignalTrampoline(int aSignal, siginfo_t* - "nop; nop; nop; nop" - : : : "memory"); +diff -up firefox-68.0/mfbt/LinuxSignal.h.1238661 firefox-68.0/mfbt/LinuxSignal.h +--- firefox-68.0/mfbt/LinuxSignal.h.1238661 2019-07-08 22:27:29.620749569 +0200 ++++ firefox-68.0/mfbt/LinuxSignal.h 2019-07-08 22:44:17.794112428 +0200 +@@ -22,7 +22,10 @@ __attribute__((naked)) void SignalTrampo + void* aContext) { + asm volatile("nop; nop; nop; nop" : : : "memory"); +- asm volatile("b %0" : : "X"(H) : "memory"); + // Because the assembler may generate additional insturctions below, we + // need to ensure NOPs are inserted first by separating them out above. + - asm volatile ( -- "b %0" -+ "bx %0" - : -- : "X"(H) -+ : "r"(H), "l"(aSignal), "l"(aInfo), "l"(aContext) - : "memory"); ++ asm volatile("bx %0" : : "r"(H), "l"(aSignal), "l"(aInfo), "l"(aContext) : "memory"); } + # define MOZ_SIGNAL_TRAMPOLINE(h) (mozilla::SignalTrampoline) diff --git a/rhbz-1354671.patch b/rhbz-1354671.patch index 0e22dab..1f867eb 100644 --- a/rhbz-1354671.patch +++ b/rhbz-1354671.patch @@ -1,6 +1,6 @@ -diff -up firefox-65.0/layout/base/nsIPresShell.h.1354671 firefox-65.0/layout/base/nsIPresShell.h ---- firefox-65.0/layout/base/nsIPresShell.h.1354671 2019-01-29 11:50:08.516649643 +0100 -+++ firefox-65.0/layout/base/nsIPresShell.h 2019-01-29 11:51:48.930258629 +0100 +diff -up firefox-65.0/layout/base/PresShell.h.1354671 firefox-65.0/layout/base/PresShell.h +--- firefox-65.0/layout/base/PresShell.h.1354671 2019-01-29 11:50:08.516649643 +0100 ++++ firefox-65.0/layout/base/PresShell.h 2019-01-29 11:51:48.930258629 +0100 @@ -205,7 +205,7 @@ class nsIPresShell : public nsStubDocume * to the same aSize value. AllocateFrame is infallible and will abort * on out-of-memory. From 406faa89cbb9b667fc629105a24602e7cfbc49e1 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 8 Jul 2019 22:58:02 +0200 Subject: [PATCH 0016/1136] Updated to build 3 --- .gitignore | 1 + firefox.spec | 2 +- sources | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f3093a9..ab6e92a 100644 --- a/.gitignore +++ b/.gitignore @@ -353,3 +353,4 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-67.0.4-20190620.tar.xz /firefox-68.0.source.tar.xz /firefox-langpacks-68.0-20190702.tar.xz +/firefox-langpacks-68.0-20190708.tar.xz diff --git a/firefox.spec b/firefox.spec index e998a71..5305448 100644 --- a/firefox.spec +++ b/firefox.spec @@ -91,7 +91,7 @@ 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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190702.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190708.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig diff --git a/sources b/sources index 4be600b..9dc9dfb 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-68.0.source.tar.xz) = 3822d9e72edffd278b4a8e86998252e7e7134a1751d64c9913e5492971f41606187b67b3639dcfca6c97ae958547d6bc0426a5cb2c321e32fb96f33ed8760feb -SHA512 (firefox-langpacks-68.0-20190702.tar.xz) = 6b146f7ef5fd57c38d3074b5f7ee19ac90d11d3e742bedb843f47ed528c27df8aa3f38698e31dd0357cdfa13e37a08845c29e5b5ac0efe8c8291b2272acae1d7 +SHA512 (firefox-68.0.source.tar.xz) = fcb6f6dd8069ca43b0b75cba4566f81c94535e66ddeb80fbdd4f47eaac2efc82d6e6bd36bf7cbebdc260a74886ba3f007a321d88fdf30731d3b669a38273f42e +SHA512 (firefox-langpacks-68.0-20190708.tar.xz) = d6a8b3e9e1b8b7d86da58ea33490a56134051f99feec5b1183c11b351644854527e4b681a53445a98b772378cbe60e9b0f7597feba63fbd126f44574d2c48840 From 12ce2e0048b0845bdc8f6898d35b0b7d0798182f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 9 Jul 2019 13:27:42 +0200 Subject: [PATCH 0017/1136] - Fix crash on ppc64le (mozilla#1512162) --- firefox.spec | 7 ++++++- mozilla-1512162.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 mozilla-1512162.patch diff --git a/firefox.spec b/firefox.spec index 5305448..91f505e 100644 --- a/firefox.spec +++ b/firefox.spec @@ -86,7 +86,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0 -Release: 2%{?pre_tag}%{?dist} +Release: 3%{?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 @@ -138,6 +138,7 @@ Patch412: mozilla-1337988.patch #Patch413: mozilla-1353817.patch Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch Patch417: bug1375074-save-restore-x28.patch +Patch418: mozilla-1512162.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -335,6 +336,7 @@ This package contains results of tests executed during build. %ifarch %{arm} %patch415 -p1 -b .1238661 %endif +%patch418 -p1 -b .1512162 # Patch for big endian platforms only %if 0%{?big_endian} %patch26 -p1 -b .icu @@ -911,6 +913,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Jul 9 2019 Dan Horák - 68.0-3 +- Fix crash on ppc64le (mozilla#1512162) + * Mon Jul 8 2019 Jan Horak - 68.0-2 - Update pipewire patch diff --git a/mozilla-1512162.patch b/mozilla-1512162.patch new file mode 100644 index 0000000..a246a3e --- /dev/null +++ b/mozilla-1512162.patch @@ -0,0 +1,26 @@ +diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp +--- a/js/xpconnect/src/XPCWrappedNative.cpp ++++ b/js/xpconnect/src/XPCWrappedNative.cpp +@@ -1157,6 +1157,10 @@ + return helper.get().Call(); + } + ++#if (__GNUC__ && __linux__ && __PPC64__ && _LITTLE_ENDIAN) ++// Work around a compiler bug on ppc64le (bug 1512162). ++__attribute__ ((noinline,noclone)) ++#endif + bool CallMethodHelper::Call() { + mCallContext.SetRetVal(JS::UndefinedValue()); + +@@ -1315,6 +1319,10 @@ + return true; + } + ++#if (__GNUC__ && __linux__ && __PPC64__ && _LITTLE_ENDIAN) ++// Work around a compiler bug on ppc64le (bug 1512162). ++__attribute__ ((noinline,noclone)) ++#endif + bool CallMethodHelper::GatherAndConvertResults() { + // now we iterate through the native params to gather and convert results + uint8_t paramCount = mMethodInfo->GetParamCount(); + From 1d9c07d0f5f859efad87ea64391b459cb8c33b4b Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 9 Jul 2019 14:22:23 +0200 Subject: [PATCH 0018/1136] aarch64 build fixes --- build-aarch64-skia.patch | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build-aarch64-skia.patch b/build-aarch64-skia.patch index 1ecad24..108316c 100644 --- a/build-aarch64-skia.patch +++ b/build-aarch64-skia.patch @@ -10,3 +10,24 @@ diff -up firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia return vcvt_f16_f32(f); #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512) +diff -up firefox-68.0/gfx/skia/skia/include/private/SkHalf.h.old firefox-68.0/gfx/skia/skia/include/private/SkHalf.h +--- firefox-68.0/gfx/skia/skia/include/private/SkHalf.h.old 2019-07-09 14:20:12.527441789 +0200 ++++ firefox-68.0/gfx/skia/skia/include/private/SkHalf.h 2019-07-09 14:20:31.744366018 +0200 +@@ -40,7 +40,7 @@ static inline Sk4h SkFloatToHalf_finite_ + + static inline Sk4f SkHalfToFloat_finite_ftz(uint64_t rgba) { + Sk4h hs = Sk4h::Load(&rgba); +-#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 // !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) + float32x4_t fs; + asm ("fcvtl %[fs].4s, %[hs].4h \n" // vcvt_f32_f16(...) + : [fs] "=w" (fs) // =w: write-only NEON register +@@ -62,7 +62,7 @@ static inline Sk4f SkHalfToFloat_finite_ + } + + static inline Sk4h SkFloatToHalf_finite_ftz(const Sk4f& fs) { +-#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 //!defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) + float32x4_t vec = fs.fVec; + asm ("fcvtn %[vec].4h, %[vec].4s \n" // vcvt_f16_f32(vec) + : [vec] "+w" (vec)); // +w: read-write NEON register From 1cb3681420b28a84c37a6f3b34e9412efbf29dff Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 10 Jul 2019 17:06:38 +0200 Subject: [PATCH 0019/1136] Added fixes for aarch64 builds. --- firefox.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 91f505e..1d4f717 100644 --- a/firefox.spec +++ b/firefox.spec @@ -86,7 +86,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0 -Release: 3%{?pre_tag}%{?dist} +Release: 4%{?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 @@ -913,6 +913,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Jul 10 2019 Martin Stransky - 68.0-4 +- Added fixes for aarch64 builds. + * Tue Jul 9 2019 Dan Horák - 68.0-3 - Fix crash on ppc64le (mozilla#1512162) From 856a33510e156db188a06ea5a38ec3ab9a5a33ba Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 10 Jul 2019 17:11:22 +0200 Subject: [PATCH 0020/1136] Temporary disable aarch64/ppc64le --- firefox.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/firefox.spec b/firefox.spec index 1d4f717..090f2e0 100644 --- a/firefox.spec +++ b/firefox.spec @@ -6,6 +6,10 @@ ExcludeArch: armv7hl # Disabled due to https://pagure.io/fedora-infrastructure/issue/7581 ExcludeArch: s390x +# Temporary disabled +ExcludeArch: aarch64 +ExcludeArch: ppc64le + %global system_nss 1 %global system_ffi 1 # libvpx is too new for Firefox 65 From bdad7ba3db39eafb3e0eecd2131d53752e1131cb Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 10 Jul 2019 20:16:33 +0200 Subject: [PATCH 0021/1136] added firefox-SIOCGSTAMP.patch --- firefox-SIOCGSTAMP.patch | 16 ++++++++++++++++ firefox.spec | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 firefox-SIOCGSTAMP.patch diff --git a/firefox-SIOCGSTAMP.patch b/firefox-SIOCGSTAMP.patch new file mode 100644 index 0000000..673cb07 --- /dev/null +++ b/firefox-SIOCGSTAMP.patch @@ -0,0 +1,16 @@ +diff -up firefox-68.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-68.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium +diff -up firefox-68.0/media/webrtc/trunk/Makefile.old firefox-68.0/media/webrtc/trunk/Makefile +diff -up firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc.old firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc +--- firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc.old 2019-07-10 20:10:04.420328534 +0200 ++++ firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc 2019-07-10 20:13:48.766658793 +0200 +@@ -62,6 +62,10 @@ typedef void* SockOptArg; + + #if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) && !defined(__native_client__) + ++#ifndef SIOCGSTAMP ++#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ ++#endif ++ + int64_t GetSocketRecvTimestamp(int socket) { + struct timeval tv_ioctl; + int ret = ioctl(socket, SIOCGSTAMP, &tv_ioctl); diff --git a/firefox.spec b/firefox.spec index 090f2e0..32cd2f0 100644 --- a/firefox.spec +++ b/firefox.spec @@ -135,6 +135,7 @@ Patch224: mozilla-1170092.patch #ARM run-time patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch +Patch228: firefox-SIOCGSTAMP.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -334,6 +335,7 @@ This package contains results of tests executed during build. %patch226 -p1 -b .1354671 %endif %patch227 -p1 -b .locale-debug +%patch228 -p1 -b .SIOCGSTAMP %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 From 691cff84365c6f581a05d7c1018494ce5563ab05 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 11 Jul 2019 08:25:58 +0200 Subject: [PATCH 0022/1136] Enabled aarch64 and ppc64le --- firefox.spec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/firefox.spec b/firefox.spec index 32cd2f0..fdeaced 100644 --- a/firefox.spec +++ b/firefox.spec @@ -6,10 +6,6 @@ ExcludeArch: armv7hl # Disabled due to https://pagure.io/fedora-infrastructure/issue/7581 ExcludeArch: s390x -# Temporary disabled -ExcludeArch: aarch64 -ExcludeArch: ppc64le - %global system_nss 1 %global system_ffi 1 # libvpx is too new for Firefox 65 @@ -90,7 +86,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0 -Release: 4%{?pre_tag}%{?dist} +Release: 5%{?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 @@ -919,6 +915,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Jul 11 2019 Martin Stransky - 68.0-5 +- Enabled aarch64 and ppc64le + * Wed Jul 10 2019 Martin Stransky - 68.0-4 - Added fixes for aarch64 builds. From 2c91415020f089008233d6152ae649684d9c5fa3 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 11 Jul 2019 12:42:24 +0200 Subject: [PATCH 0023/1136] Fixed aarch64 patch --- build-aarch64-skia.patch | 43 ++++++++++++++++++++++++++-------------- firefox.spec | 3 +-- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/build-aarch64-skia.patch b/build-aarch64-skia.patch index 108316c..a00ee70 100644 --- a/build-aarch64-skia.patch +++ b/build-aarch64-skia.patch @@ -1,18 +1,6 @@ -diff -up firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp ---- firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia 2018-06-20 09:19:11.411939714 +0200 -+++ firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp 2018-06-20 09:23:36.831919894 +0200 -@@ -686,7 +686,7 @@ SI F from_half(U16 h) { - } - - SI U16 to_half(F f) { --#if defined(JUMPER_IS_NEON) && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. -+#if 0 && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. - return vcvt_f16_f32(f); - - #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512) diff -up firefox-68.0/gfx/skia/skia/include/private/SkHalf.h.old firefox-68.0/gfx/skia/skia/include/private/SkHalf.h ---- firefox-68.0/gfx/skia/skia/include/private/SkHalf.h.old 2019-07-09 14:20:12.527441789 +0200 -+++ firefox-68.0/gfx/skia/skia/include/private/SkHalf.h 2019-07-09 14:20:31.744366018 +0200 +--- firefox-68.0/gfx/skia/skia/include/private/SkHalf.h.old 2019-07-11 12:33:40.471936951 +0200 ++++ firefox-68.0/gfx/skia/skia/include/private/SkHalf.h 2019-07-11 12:33:50.527913736 +0200 @@ -40,7 +40,7 @@ static inline Sk4h SkFloatToHalf_finite_ static inline Sk4f SkHalfToFloat_finite_ftz(uint64_t rgba) { @@ -27,7 +15,32 @@ diff -up firefox-68.0/gfx/skia/skia/include/private/SkHalf.h.old firefox-68.0/gf static inline Sk4h SkFloatToHalf_finite_ftz(const Sk4f& fs) { -#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) -+#if 0 //!defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 // !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) float32x4_t vec = fs.fVec; asm ("fcvtn %[vec].4h, %[vec].4s \n" // vcvt_f16_f32(vec) : [vec] "+w" (vec)); // +w: read-write NEON register + +diff -up firefox-68.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.old firefox-68.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h +--- firefox-68.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.old 2019-07-11 12:39:08.694166900 +0200 ++++ firefox-68.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h 2019-07-11 12:39:21.572136328 +0200 +@@ -830,7 +830,7 @@ SI F from_half(U16 h) { + } + + SI U16 to_half(F f) { +-#if defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. ++#if 0 // defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. + return vcvt_f16_f32(f); + + #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512) +diff -up firefox-68.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h.old firefox-68.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h +--- firefox-68.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h.old 2019-07-11 12:38:45.285222428 +0200 ++++ firefox-68.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h 2019-07-11 12:38:57.414193679 +0200 +@@ -163,7 +163,7 @@ SI F F_from_Half(U16 half) { + __attribute__((no_sanitize("unsigned-integer-overflow"))) + #endif + SI U16 Half_from_F(F f) { +-#if defined(USING_NEON_F16C) ++#if 0 // defined(USING_NEON_F16C) + return (U16)vcvt_f16_f32(f); + #elif defined(__AVX512F__) + return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION ); diff --git a/firefox.spec b/firefox.spec index fdeaced..e7c0639 100644 --- a/firefox.spec +++ b/firefox.spec @@ -313,8 +313,7 @@ This package contains results of tests executed during build. %patch25 -p1 -b .rhbz-1219542-s390 %endif #%patch37 -p1 -b .jit-atomic-lucky -# TODO Fix later -#%patch40 -p1 -b .aarch64-skia +%patch40 -p1 -b .aarch64-skia %if 0%{?disable_elfhack} %patch41 -p1 -b .disable-elfhack %endif From e99574982f7cb26c1af310c8badc70010ec6085e Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 22 Jul 2019 14:13:01 +0200 Subject: [PATCH 0024/1136] Updated to 68.0.1 --- .gitignore | 2 ++ firefox.spec | 9 ++++++--- sources | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ab6e92a..11d934a 100644 --- a/.gitignore +++ b/.gitignore @@ -354,3 +354,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-68.0.source.tar.xz /firefox-langpacks-68.0-20190702.tar.xz /firefox-langpacks-68.0-20190708.tar.xz +/firefox-68.0.1.source.tar.xz +/firefox-langpacks-68.0.1-20190722.tar.xz diff --git a/firefox.spec b/firefox.spec index e7c0639..e3d1552 100644 --- a/firefox.spec +++ b/firefox.spec @@ -85,13 +85,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 68.0 -Release: 5%{?pre_tag}%{?dist} +Version: 68.0.1 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190708.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190722.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -914,6 +914,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Jul 22 2019 Martin Stransky - 68.0.1-1 +- Updated to 68.0.1 + * Thu Jul 11 2019 Martin Stransky - 68.0-5 - Enabled aarch64 and ppc64le diff --git a/sources b/sources index 9dc9dfb..63864be 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-68.0.source.tar.xz) = fcb6f6dd8069ca43b0b75cba4566f81c94535e66ddeb80fbdd4f47eaac2efc82d6e6bd36bf7cbebdc260a74886ba3f007a321d88fdf30731d3b669a38273f42e -SHA512 (firefox-langpacks-68.0-20190708.tar.xz) = d6a8b3e9e1b8b7d86da58ea33490a56134051f99feec5b1183c11b351644854527e4b681a53445a98b772378cbe60e9b0f7597feba63fbd126f44574d2c48840 +SHA512 (firefox-68.0.1.source.tar.xz) = 96b45135cf0b2368013afccb8c375de54d591a4e11016e8b65fc83904cedc362096dd15814cd02be23f6e52e392c605817b86a59ee2300d3e7a754d345399c81 +SHA512 (firefox-langpacks-68.0.1-20190722.tar.xz) = cb4f356bdc770f0d3ca41bed6015c3c53c8675c99ac2340c011e319384b3178d895a85a8a1852e65370c7f97ea603eb93eee85db546db206fa9362bf8cff7b72 From c5559a47a2aff16540848879d5a2556a9218ae60 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 23 Jul 2019 08:03:03 +0200 Subject: [PATCH 0025/1136] Enabled WebRTC on ppc64le - rhbz#1732069 --- firefox.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index e3d1552..4d88262 100644 --- a/firefox.spec +++ b/firefox.spec @@ -20,7 +20,9 @@ ExcludeArch: s390x %global disable_elfhack 1 %global build_with_clang 0 %global use_bundled_cbindgen 1 -%ifnarch %{ix86} ppc64 s390 ppc64le +# Build PGO+LTO on x86_64 and aarch64 only due to build issues +# on other arches. +%ifarch x86_64 aarch64 %if %{release_build} %global build_with_pgo 1 %else @@ -403,7 +405,7 @@ echo "ac_add_options --disable-debug" >> .mozconfig echo "ac_add_options --disable-jemalloc" >> .mozconfig %endif -%ifnarch %{ix86} x86_64 +%ifnarch %{ix86} x86_64 ppc64le echo "ac_add_options --disable-webrtc" >> .mozconfig %endif From 2a43e54c7701379e600eed3e1bba3ee135d80777 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 23 Jul 2019 08:07:47 +0200 Subject: [PATCH 0026/1136] Fixed changelog --- firefox.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/firefox.spec b/firefox.spec index 4d88262..75688d0 100644 --- a/firefox.spec +++ b/firefox.spec @@ -918,6 +918,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 +- Enabled WebRTC on ppc64le (rhbz#1732069) * Thu Jul 11 2019 Martin Stransky - 68.0-5 - Enabled aarch64 and ppc64le From 3854104b7147ca409e0845fae2f757030484affc Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 23 Jul 2019 15:22:37 +0200 Subject: [PATCH 0027/1136] Disabled webrtc for ppc64le due to build issues --- firefox.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 75688d0..6a5afd9 100644 --- a/firefox.spec +++ b/firefox.spec @@ -405,7 +405,7 @@ echo "ac_add_options --disable-debug" >> .mozconfig echo "ac_add_options --disable-jemalloc" >> .mozconfig %endif -%ifnarch %{ix86} x86_64 ppc64le +%ifnarch %{ix86} x86_64 echo "ac_add_options --disable-webrtc" >> .mozconfig %endif @@ -918,7 +918,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 -- Enabled WebRTC on ppc64le (rhbz#1732069) * Thu Jul 11 2019 Martin Stransky - 68.0-5 - Enabled aarch64 and ppc64le From d34068c6f91406f5fd1e2a00c1ddd74a5e6bd622 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 24 Jul 2019 16:01:58 +0200 Subject: [PATCH 0028/1136] Revert "Disabled webrtc for ppc64le due to build issues" This reverts commit 3854104b7147ca409e0845fae2f757030484affc. --- firefox.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 6a5afd9..75688d0 100644 --- a/firefox.spec +++ b/firefox.spec @@ -405,7 +405,7 @@ echo "ac_add_options --disable-debug" >> .mozconfig echo "ac_add_options --disable-jemalloc" >> .mozconfig %endif -%ifnarch %{ix86} x86_64 +%ifnarch %{ix86} x86_64 ppc64le echo "ac_add_options --disable-webrtc" >> .mozconfig %endif @@ -918,6 +918,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 +- Enabled WebRTC on ppc64le (rhbz#1732069) * Thu Jul 11 2019 Martin Stransky - 68.0-5 - Enabled aarch64 and ppc64le From 70d0d4ac6d08e8d5ca91ef5e42f3833b1439136b Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 24 Jul 2019 16:02:45 +0200 Subject: [PATCH 0029/1136] Revert "Disabled webrtc for ppc64le due to build issues" This reverts commit 3854104b7147ca409e0845fae2f757030484affc. --- firefox.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 6a5afd9..75688d0 100644 --- a/firefox.spec +++ b/firefox.spec @@ -405,7 +405,7 @@ echo "ac_add_options --disable-debug" >> .mozconfig echo "ac_add_options --disable-jemalloc" >> .mozconfig %endif -%ifnarch %{ix86} x86_64 +%ifnarch %{ix86} x86_64 ppc64le echo "ac_add_options --disable-webrtc" >> .mozconfig %endif @@ -918,6 +918,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 +- Enabled WebRTC on ppc64le (rhbz#1732069) * Thu Jul 11 2019 Martin Stransky - 68.0-5 - Enabled aarch64 and ppc64le From 30b47b75ce413ad6a2edf6b732af87dd302c844d Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 24 Jul 2019 16:28:23 +0200 Subject: [PATCH 0030/1136] Temporary set -j2 on all arches to test koji builds --- firefox.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 75688d0..d078dd4 100644 --- a/firefox.spec +++ b/firefox.spec @@ -554,8 +554,9 @@ MOZ_SMP_FLAGS=-j1 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" [ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 -[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 -[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +# Temporary disabled to test koji build failures +#[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +#[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" From 77e9ffc8d39bba62a06187035335d2f8efe2c657 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 24 Jul 2019 18:31:18 +0200 Subject: [PATCH 0031/1136] Added fix for rhbz#1709840 --- firefox.spec | 10 +++--- mozilla-1568569.patch | 73 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 mozilla-1568569.patch diff --git a/firefox.spec b/firefox.spec index d078dd4..7d72bd6 100644 --- a/firefox.spec +++ b/firefox.spec @@ -142,6 +142,7 @@ Patch412: mozilla-1337988.patch Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch Patch417: bug1375074-save-restore-x28.patch Patch418: mozilla-1512162.patch +Patch419: mozilla-1568569.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -321,6 +322,10 @@ This package contains results of tests executed during build. %endif %patch3 -p1 -b .arm %patch44 -p1 -b .build-arm-libopus +# Patch for big endian platforms only +%if 0%{?big_endian} +%patch26 -p1 -b .icu +%endif # Fedora patches %patch215 -p1 -b .addons @@ -340,10 +345,7 @@ This package contains results of tests executed during build. %patch415 -p1 -b .1238661 %endif %patch418 -p1 -b .1512162 -# Patch for big endian platforms only -%if 0%{?big_endian} -%patch26 -p1 -b .icu -%endif +%patch419 -p1 -b .1568569 # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire diff --git a/mozilla-1568569.patch b/mozilla-1568569.patch new file mode 100644 index 0000000..ab6225a --- /dev/null +++ b/mozilla-1568569.patch @@ -0,0 +1,73 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -3238,16 +3238,18 @@ void nsWindow::OnWindowStateEvent(GtkWid + // We don't care about anything but changes in the maximized/icon/fullscreen + // states + if ((aEvent->changed_mask & + (GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_MAXIMIZED | + GDK_WINDOW_STATE_FULLSCREEN)) == 0) { + return; + } + ++ nsSizeMode lastSizeState = mSizeState; ++ + if (aEvent->new_window_state & GDK_WINDOW_STATE_ICONIFIED) { + LOG(("\tIconified\n")); + mSizeState = nsSizeMode_Minimized; + #ifdef ACCESSIBILITY + DispatchMinimizeEventAccessible(); + #endif // ACCESSIBILITY + } else if (aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) { + LOG(("\tFullscreen\n")); +@@ -3261,16 +3263,28 @@ void nsWindow::OnWindowStateEvent(GtkWid + } else { + LOG(("\tNormal\n")); + mSizeState = nsSizeMode_Normal; + #ifdef ACCESSIBILITY + DispatchRestoreEventAccessible(); + #endif // ACCESSIBILITY + } + ++ // Fullscreen video playback may generate bogus alpha values which blends ++ // with desktop background in fullscreen video playback (Bug 1568569). ++ // As a workaround enable to draw mShell background in fullscreen mode ++ // if we draw to mContainer. ++ if (gtk_widget_get_has_window(GTK_WIDGET(mContainer))) { ++ if (mSizeState == nsSizeMode_Fullscreen) { ++ gtk_widget_set_app_paintable(mShell, FALSE); ++ } else if (lastSizeState == nsSizeMode_Fullscreen) { ++ gtk_widget_set_app_paintable(mShell, TRUE); ++ } ++ } ++ + if (mWidgetListener) { + mWidgetListener->SizeModeChanged(mSizeState); + if (aEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { + mWidgetListener->FullscreenChanged(aEvent->new_window_state & + GDK_WINDOW_STATE_FULLSCREEN); + } + } + +@@ -3787,16 +3801,21 @@ nsresult nsWindow::Create(nsIWidget* aPa + eventWidget = (drawToContainer) ? container : mShell; + + // Prevent GtkWindow from painting a background to avoid flickering. + gtk_widget_set_app_paintable(eventWidget, TRUE); + + gtk_widget_add_events(eventWidget, kEvents); + if (drawToContainer) { + gtk_widget_add_events(mShell, GDK_PROPERTY_CHANGE_MASK); ++ // Don't paint mShell background when we draw to mContainer. ++ // Otherwise we see mShell backround to shine through ++ // mContainer (Bug 1507608). ++ // But it may also lead to various bugs where mContainer has unintended ++ // transparent parts which blend with underlying desktop (Bug 1516224). + gtk_widget_set_app_paintable(mShell, TRUE); + } + if (mTransparencyBitmapForTitlebar) { + moz_container_force_default_visual(mContainer); + } + + // If we draw to mContainer window then configure it now because + // gtk_container_add() realizes the child widget. From a91404f6b224a4d02f9418c9c36237f09cf3ec06 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 24 Jul 2019 18:33:02 +0200 Subject: [PATCH 0032/1136] release up + changelog fix --- firefox.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 7d72bd6..c2986f2 100644 --- a/firefox.spec +++ b/firefox.spec @@ -88,7 +88,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0.1 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -919,6 +919,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Jul 24 2019 Martin Stransky - 68.0.1-2 +- Added fix for rhbz#1709840 + * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 - Enabled WebRTC on ppc64le (rhbz#1732069) From 30eb43b2b62cc29c01c30e282c075daeaf587b3f Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 25 Jul 2019 08:04:59 +0200 Subject: [PATCH 0033/1136] Added node js wrapper to fix koji freezes --- firefox.spec | 8 ++++++++ node-stdout-nonblocking-wrapper | 2 ++ 2 files changed, 10 insertions(+) create mode 100755 node-stdout-nonblocking-wrapper diff --git a/firefox.spec b/firefox.spec index c2986f2..3ef4fbd 100644 --- a/firefox.spec +++ b/firefox.spec @@ -109,6 +109,7 @@ Source28: firefox-wayland.sh.in Source29: firefox-wayland.desktop Source30: firefox-x11.sh.in Source31: firefox-x11.desktop +Source32: node-stdout-nonblocking-wrapper # Build patches Patch3: mozilla-build-arm.patch @@ -435,6 +436,8 @@ echo "ac_add_options --without-system-libvpx" >> .mozconfig echo "ac_add_options --disable-ion" >> .mozconfig %endif +echo 'export NODEJS="%{_buildrootdir}/bin/node-stdout-nonblocking-wrapper"' >> .mozconfig + # Remove executable bit to make brp-mangle-shebangs happy. chmod -x third_party/rust/itertools/src/lib.rs @@ -467,6 +470,9 @@ echo "Generate big endian version of config/external/icu/data/icud58l.dat" rm -f config/external/icu/data/icudt*l.dat %endif +mkdir %{_buildrootdir}/bin || : +cp %{SOURCE32} %{_buildrootdir}/bin || : + # Update the various config.guess to upstream release for aarch64 support find ./ -name config.guess -exec cp /usr/lib/rpm/config.guess {} ';' @@ -921,6 +927,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog * Wed Jul 24 2019 Martin Stransky - 68.0.1-2 - Added fix for rhbz#1709840 +- Added node js wrapper to fix koji freezes + (https://pagure.io/fedora-infrastructure/issue/8026) * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 diff --git a/node-stdout-nonblocking-wrapper b/node-stdout-nonblocking-wrapper new file mode 100755 index 0000000..b2814b8 --- /dev/null +++ b/node-stdout-nonblocking-wrapper @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/node "$@" 2>&1 | cat - From 81d75249322c34fcc55eafa39f9286a876f79f58 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 25 Jul 2019 08:11:28 +0200 Subject: [PATCH 0034/1136] Updated mozbz#1512162 for ppc64le --- firefox.spec | 3 +++ mozilla-1512162.patch | 29 +++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/firefox.spec b/firefox.spec index 3ef4fbd..4ab6025 100644 --- a/firefox.spec +++ b/firefox.spec @@ -345,7 +345,9 @@ This package contains results of tests executed during build. %ifarch %{arm} %patch415 -p1 -b .1238661 %endif +%ifarch ppc64 ppc64le %patch418 -p1 -b .1512162 +%endif %patch419 -p1 -b .1568569 # Wayland specific upstream patches @@ -929,6 +931,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : - Added fix for rhbz#1709840 - Added node js wrapper to fix koji freezes (https://pagure.io/fedora-infrastructure/issue/8026) +- Updated mozbz#1512162 for ppc64le * Mon Jul 22 2019 Martin Stransky - 68.0.1-1 - Updated to 68.0.1 diff --git a/mozilla-1512162.patch b/mozilla-1512162.patch index a246a3e..99a0b14 100644 --- a/mozilla-1512162.patch +++ b/mozilla-1512162.patch @@ -1,7 +1,25 @@ -diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp ---- a/js/xpconnect/src/XPCWrappedNative.cpp -+++ b/js/xpconnect/src/XPCWrappedNative.cpp -@@ -1157,6 +1157,10 @@ +diff -up firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp.1512162 firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp +--- firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp.1512162 2019-07-17 22:51:30.000000000 +0200 ++++ firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp 2019-07-25 08:08:18.512528313 +0200 +@@ -1092,7 +1092,7 @@ class MOZ_STACK_CLASS CallMethodHelper f + MOZ_ALWAYS_INLINE bool GetOutParamSource(uint8_t paramIndex, + MutableHandleValue srcp) const; + +- MOZ_ALWAYS_INLINE bool GatherAndConvertResults(); ++ bool GatherAndConvertResults(); + + MOZ_ALWAYS_INLINE bool QueryInterfaceFastPath(); + +@@ -1139,7 +1139,7 @@ class MOZ_STACK_CLASS CallMethodHelper f + + ~CallMethodHelper(); + +- MOZ_ALWAYS_INLINE bool Call(); ++ bool Call(); + + // Trace implementation so we can put our CallMethodHelper in a Rooted. + void trace(JSTracer* aTrc); +@@ -1157,6 +1157,10 @@ bool XPCWrappedNative::CallMethod(XPCCal return helper.get().Call(); } @@ -12,7 +30,7 @@ diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrapped bool CallMethodHelper::Call() { mCallContext.SetRetVal(JS::UndefinedValue()); -@@ -1315,6 +1319,10 @@ +@@ -1315,6 +1319,10 @@ bool CallMethodHelper::GetOutParamSource return true; } @@ -23,4 +41,3 @@ diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrapped bool CallMethodHelper::GatherAndConvertResults() { // now we iterate through the native params to gather and convert results uint8_t paramCount = mMethodInfo->GetParamCount(); - From 6470af93456fcd5051c2cee8da9f2bac90b78e94 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 25 Jul 2019 10:48:34 +0200 Subject: [PATCH 0035/1136] Enable more paralel builds again (-j4/-j8) --- firefox.spec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firefox.spec b/firefox.spec index 4ab6025..7ac7218 100644 --- a/firefox.spec +++ b/firefox.spec @@ -564,9 +564,8 @@ MOZ_SMP_FLAGS=-j1 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" [ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 -# Temporary disabled to test koji build failures -#[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 -#[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" From f732261c5efb96c279280582f599d31dd1584fc2 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 5 Aug 2019 09:28:57 +0200 Subject: [PATCH 0036/1136] Add stdout wrapper --- firefox.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 7ac7218..6c85e77 100644 --- a/firefox.spec +++ b/firefox.spec @@ -572,9 +572,9 @@ export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" export MOZ_SERVICES_SYNC="1" export STRIP=/bin/true %if 0%{?build_with_pgo} -GDK_BACKEND=x11 xvfb-run ./mach build +GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - %else -./mach build +./mach build 2>&1 | cat - %endif # create debuginfo for crash-stats.mozilla.com From 05040f1acd78af761679d32a8e1e535cecb3993a Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Mon, 5 Aug 2019 13:49:49 +0200 Subject: [PATCH 0037/1136] Added webrtc indicator fix --- firefox.spec | 7 ++++++- mozilla-1566876-webrtc-ind.patch | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 mozilla-1566876-webrtc-ind.patch diff --git a/firefox.spec b/firefox.spec index 6c85e77..10abab7 100644 --- a/firefox.spec +++ b/firefox.spec @@ -88,7 +88,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0.1 -Release: 2%{?pre_tag}%{?dist} +Release: 3%{?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 @@ -144,6 +144,7 @@ Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch Patch417: bug1375074-save-restore-x28.patch Patch418: mozilla-1512162.patch Patch419: mozilla-1568569.patch +Patch420: mozilla-1566876-webrtc-ind.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -349,6 +350,7 @@ This package contains results of tests executed during build. %patch418 -p1 -b .1512162 %endif %patch419 -p1 -b .1568569 +%patch420 -p1 -b .1566876-webrtc-ind # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire @@ -926,6 +928,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Aug 5 2019 Jan Horak - 68.0.1-3 +- Added workaround fix for webrtc indicator + * Wed Jul 24 2019 Martin Stransky - 68.0.1-2 - Added fix for rhbz#1709840 - Added node js wrapper to fix koji freezes diff --git a/mozilla-1566876-webrtc-ind.patch b/mozilla-1566876-webrtc-ind.patch new file mode 100644 index 0000000..598f58f --- /dev/null +++ b/mozilla-1566876-webrtc-ind.patch @@ -0,0 +1,36 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -3504,12 +3504,6 @@ + mBounds = aRect; + ConstrainSize(&mBounds.width, &mBounds.height); + +- // eWindowType_child is not supported on Wayland. Just switch to toplevel +- // as a workaround. +- if (!mIsX11Display && mWindowType == eWindowType_child) { +- mWindowType = eWindowType_toplevel; +- } +- + // figure out our parent window + GtkWidget* parentMozContainer = nullptr; + GtkContainer* parentGtkContainer = nullptr; +@@ -3543,6 +3537,18 @@ + topLevelParent = GTK_WINDOW(gtk_widget_get_toplevel(parentMozContainer)); + } + ++ if (!mIsX11Display) { ++ if (mWindowType == eWindowType_child) { ++ // eWindowType_child is not supported on Wayland. Just switch to toplevel ++ // as a workaround. ++ mWindowType = eWindowType_toplevel; ++ } else if (mWindowType == eWindowType_popup && !topLevelParent) { ++ // Workaround for Wayland where the popup windows always need to have ++ // parent window. For example webrtc ui is a popup window without parent. ++ mWindowType = eWindowType_toplevel; ++ } ++ } ++ + // ok, create our windows + switch (mWindowType) { + case eWindowType_dialog: + From a94add60e53e44e28359b32d3ff9d6d0e337eb06 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Tue, 6 Aug 2019 11:06:08 +0200 Subject: [PATCH 0038/1136] Debug build for failing koji builds --- firefox.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 10abab7..49eeff9 100644 --- a/firefox.spec +++ b/firefox.spec @@ -24,7 +24,7 @@ ExcludeArch: s390x # on other arches. %ifarch x86_64 aarch64 %if %{release_build} -%global build_with_pgo 1 +%global build_with_pgo 0 %else %global build_with_pgo 0 %endif @@ -576,7 +576,7 @@ export STRIP=/bin/true %if 0%{?build_with_pgo} GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - %else -./mach build 2>&1 | cat - +env RUST_LOG=debug strace -y -f ./mach build 2>&1 | cat - %endif # create debuginfo for crash-stats.mozilla.com From afc58560fcf92cd001f40e3eac152dd2e050279e Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Tue, 6 Aug 2019 11:47:01 +0200 Subject: [PATCH 0039/1136] Added strace as temporary BuildRequire --- firefox.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/firefox.spec b/firefox.spec index 49eeff9..ebad0b3 100644 --- a/firefox.spec +++ b/firefox.spec @@ -199,6 +199,7 @@ BuildRequires: cbindgen %endif BuildRequires: nodejs BuildRequires: nasm >= 1.13 +BuildRequires: strace Requires: mozilla-filesystem Requires: p11-kit-trust From 552b94bac781332262301392dcf065cc61abc462 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 7 Aug 2019 10:18:17 +0200 Subject: [PATCH 0040/1136] Use make -j1 for debugging purposes --- firefox.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/firefox.spec b/firefox.spec index ebad0b3..05724f9 100644 --- a/firefox.spec +++ b/firefox.spec @@ -561,23 +561,23 @@ MOZ_SMP_FLAGS=-j1 %ifarch %{ix86} [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 %endif %ifarch x86_64 ppc ppc64 ppc64le aarch64 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 -[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 -[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +#[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +#[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" export MOZ_SERVICES_SYNC="1" export STRIP=/bin/true %if 0%{?build_with_pgo} -GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - +GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - %else -env RUST_LOG=debug strace -y -f ./mach build 2>&1 | cat - +env RUST_LOG=debug strace -y -f ./mach build -v 2>&1 | cat - %endif # create debuginfo for crash-stats.mozilla.com From 5b4070831b473471806ea40d1b7bd203d151d78a Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 8 Aug 2019 11:43:11 +0200 Subject: [PATCH 0041/1136] Added rust build workaround to disable multiple jobs because of deadlock --- build-disable-multijobs-rust.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 build-disable-multijobs-rust.patch diff --git a/build-disable-multijobs-rust.patch b/build-disable-multijobs-rust.patch new file mode 100644 index 0000000..82da56b --- /dev/null +++ b/build-disable-multijobs-rust.patch @@ -0,0 +1,14 @@ +diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -10,6 +10,10 @@ + # commands can be executed directly by make, without doing a round-trip + # through a shell. + ++MOZ_MAKE_FLAGS := $(filter-out -j%,$(MAKEFLAGS)) ++MAKEFLAGS += -j1 ++ ++ + cargo_host_flag := --target=$(RUST_HOST_TARGET) + cargo_target_flag := --target=$(RUST_TARGET) + From 75daa97c60f006067b091d5568b0c9093a1aa11f Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 8 Aug 2019 11:44:26 +0200 Subject: [PATCH 0042/1136] Added rust build workaround to disable multiple jobs because of deadlock --- firefox.spec | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/firefox.spec b/firefox.spec index 05724f9..1447053 100644 --- a/firefox.spec +++ b/firefox.spec @@ -88,7 +88,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 68.0.1 -Release: 3%{?pre_tag}%{?dist} +Release: 4%{?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 @@ -125,6 +125,7 @@ Patch38: build-cacheFlush-missing.patch Patch40: build-aarch64-skia.patch Patch41: build-disable-elfhack.patch Patch44: build-arm-libopus.patch +Patch45: build-disable-multijobs-rust.patch # Fedora specific patches Patch215: firefox-enable-addons.patch @@ -199,7 +200,6 @@ BuildRequires: cbindgen %endif BuildRequires: nodejs BuildRequires: nasm >= 1.13 -BuildRequires: strace Requires: mozilla-filesystem Requires: p11-kit-trust @@ -325,6 +325,7 @@ This package contains results of tests executed during build. %endif %patch3 -p1 -b .arm %patch44 -p1 -b .build-arm-libopus +%patch45 -p1 -b .build-disable-multijobs-rust # Patch for big endian platforms only %if 0%{?big_endian} %patch26 -p1 -b .icu @@ -561,14 +562,14 @@ MOZ_SMP_FLAGS=-j1 %ifarch %{ix86} [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 %endif %ifarch x86_64 ppc ppc64 ppc64le aarch64 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 -#[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 -#[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" @@ -577,7 +578,7 @@ export STRIP=/bin/true %if 0%{?build_with_pgo} GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - %else -env RUST_LOG=debug strace -y -f ./mach build -v 2>&1 | cat - +./mach build -v 2>&1 | cat - %endif # create debuginfo for crash-stats.mozilla.com @@ -929,8 +930,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Mon Aug 5 2019 Jan Horak - 68.0.1-3 +* Mon Aug 5 2019 Jan Horak - 68.0.1-4 - Added workaround fix for webrtc indicator +- Added rust build workaround * Wed Jul 24 2019 Martin Stransky - 68.0.1-2 - Added fix for rhbz#1709840 From 31bcafc8cb522d81f1d51dd2bb7ebf47eb1c7ef0 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 14 Aug 2019 16:04:42 +0200 Subject: [PATCH 0043/1136] Update to 60.8.1 --- .gitignore | 2 ++ firefox-SIOCGSTAMP.patch | 16 ---------------- firefox.spec | 25 +++++++++++++++---------- sources | 4 ++-- 4 files changed, 19 insertions(+), 28 deletions(-) delete mode 100644 firefox-SIOCGSTAMP.patch diff --git a/.gitignore b/.gitignore index 11d934a..1f87135 100644 --- a/.gitignore +++ b/.gitignore @@ -356,3 +356,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-68.0-20190708.tar.xz /firefox-68.0.1.source.tar.xz /firefox-langpacks-68.0.1-20190722.tar.xz +/firefox-68.0.2.source.tar.xz +/firefox-langpacks-68.0.2-20190814.tar.xz diff --git a/firefox-SIOCGSTAMP.patch b/firefox-SIOCGSTAMP.patch deleted file mode 100644 index 673cb07..0000000 --- a/firefox-SIOCGSTAMP.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -up firefox-68.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-68.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium -diff -up firefox-68.0/media/webrtc/trunk/Makefile.old firefox-68.0/media/webrtc/trunk/Makefile -diff -up firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc.old firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc ---- firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc.old 2019-07-10 20:10:04.420328534 +0200 -+++ firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc 2019-07-10 20:13:48.766658793 +0200 -@@ -62,6 +62,10 @@ typedef void* SockOptArg; - - #if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) && !defined(__native_client__) - -+#ifndef SIOCGSTAMP -+#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ -+#endif -+ - int64_t GetSocketRecvTimestamp(int socket) { - struct timeval tv_ioctl; - int ret = ioctl(socket, SIOCGSTAMP, &tv_ioctl); diff --git a/firefox.spec b/firefox.spec index 05724f9..76a654c 100644 --- a/firefox.spec +++ b/firefox.spec @@ -23,6 +23,8 @@ ExcludeArch: s390x # Build PGO+LTO on x86_64 and aarch64 only due to build issues # on other arches. %ifarch x86_64 aarch64 +# FIXME disable PGO because of -j1 build would take ages +%global disable_multiprocess_compilation 1 %if %{release_build} %global build_with_pgo 0 %else @@ -87,13 +89,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 68.0.1 -Release: 3%{?pre_tag}%{?dist} +Version: 68.0.2 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190722.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190814.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -134,7 +136,6 @@ Patch224: mozilla-1170092.patch #ARM run-time patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch -Patch228: firefox-SIOCGSTAMP.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -340,7 +341,6 @@ This package contains results of tests executed during build. %patch226 -p1 -b .1354671 %endif %patch227 -p1 -b .locale-debug -%patch228 -p1 -b .SIOCGSTAMP %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 @@ -558,17 +558,19 @@ echo "ac_add_options --enable-lto" >> .mozconfig MOZ_SMP_FLAGS=-j1 # On x86_64 architectures, Mozilla can build up to 4 jobs at once in parallel, # however builds tend to fail on other arches when building in parallel. +%if !%{?disable_multiprocess_compilation} %ifarch %{ix86} [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 %endif %ifarch x86_64 ppc ppc64 ppc64le aarch64 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 -#[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 -#[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +%endif %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" @@ -577,7 +579,7 @@ export STRIP=/bin/true %if 0%{?build_with_pgo} GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - %else -env RUST_LOG=debug strace -y -f ./mach build -v 2>&1 | cat - +./mach build -v 2>&1 | cat - %endif # create debuginfo for crash-stats.mozilla.com @@ -929,6 +931,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Aug 14 2019 Jan Horak - 68.0.2-1 +- Update to 68.0.2 + * Mon Aug 5 2019 Jan Horak - 68.0.1-3 - Added workaround fix for webrtc indicator diff --git a/sources b/sources index 63864be..cc7352b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ +SHA512 (firefox-68.0.2.source.tar.xz) = 5c289825fd0de062b9943eabcc16e09c1821c04717e689aa8df03162e722b72ea698195f3ea93e1e746c481dacd77d125301dba951468d134b986e35eb4ef5bb +SHA512 (firefox-langpacks-68.0.2-20190814.tar.xz) = f0031f7cb6277e5216c63956aeb4e88b2ce76ba0c65f293822970740882f95803ef083525e7c3a23e92252f2322a7fb0e43ac2359416f40c98480b9587f698be SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-68.0.1.source.tar.xz) = 96b45135cf0b2368013afccb8c375de54d591a4e11016e8b65fc83904cedc362096dd15814cd02be23f6e52e392c605817b86a59ee2300d3e7a754d345399c81 -SHA512 (firefox-langpacks-68.0.1-20190722.tar.xz) = cb4f356bdc770f0d3ca41bed6015c3c53c8675c99ac2340c011e319384b3178d895a85a8a1852e65370c7f97ea603eb93eee85db546db206fa9362bf8cff7b72 From 4321d587c560890c52300facd9564446fcd8472e Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 14 Aug 2019 16:04:42 +0200 Subject: [PATCH 0044/1136] Update to 68.0.2 --- .gitignore | 2 ++ firefox-SIOCGSTAMP.patch | 16 ---------------- firefox.spec | 25 +++++++++++++++---------- sources | 4 ++-- 4 files changed, 19 insertions(+), 28 deletions(-) delete mode 100644 firefox-SIOCGSTAMP.patch diff --git a/.gitignore b/.gitignore index 11d934a..1f87135 100644 --- a/.gitignore +++ b/.gitignore @@ -356,3 +356,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-68.0-20190708.tar.xz /firefox-68.0.1.source.tar.xz /firefox-langpacks-68.0.1-20190722.tar.xz +/firefox-68.0.2.source.tar.xz +/firefox-langpacks-68.0.2-20190814.tar.xz diff --git a/firefox-SIOCGSTAMP.patch b/firefox-SIOCGSTAMP.patch deleted file mode 100644 index 673cb07..0000000 --- a/firefox-SIOCGSTAMP.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -up firefox-68.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-68.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium -diff -up firefox-68.0/media/webrtc/trunk/Makefile.old firefox-68.0/media/webrtc/trunk/Makefile -diff -up firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc.old firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc ---- firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc.old 2019-07-10 20:10:04.420328534 +0200 -+++ firefox-68.0/media/webrtc/trunk/webrtc/rtc_base/physicalsocketserver.cc 2019-07-10 20:13:48.766658793 +0200 -@@ -62,6 +62,10 @@ typedef void* SockOptArg; - - #if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) && !defined(__native_client__) - -+#ifndef SIOCGSTAMP -+#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ -+#endif -+ - int64_t GetSocketRecvTimestamp(int socket) { - struct timeval tv_ioctl; - int ret = ioctl(socket, SIOCGSTAMP, &tv_ioctl); diff --git a/firefox.spec b/firefox.spec index 05724f9..76a654c 100644 --- a/firefox.spec +++ b/firefox.spec @@ -23,6 +23,8 @@ ExcludeArch: s390x # Build PGO+LTO on x86_64 and aarch64 only due to build issues # on other arches. %ifarch x86_64 aarch64 +# FIXME disable PGO because of -j1 build would take ages +%global disable_multiprocess_compilation 1 %if %{release_build} %global build_with_pgo 0 %else @@ -87,13 +89,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 68.0.1 -Release: 3%{?pre_tag}%{?dist} +Version: 68.0.2 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190722.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190814.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -134,7 +136,6 @@ Patch224: mozilla-1170092.patch #ARM run-time patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch -Patch228: firefox-SIOCGSTAMP.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -340,7 +341,6 @@ This package contains results of tests executed during build. %patch226 -p1 -b .1354671 %endif %patch227 -p1 -b .locale-debug -%patch228 -p1 -b .SIOCGSTAMP %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 @@ -558,17 +558,19 @@ echo "ac_add_options --enable-lto" >> .mozconfig MOZ_SMP_FLAGS=-j1 # On x86_64 architectures, Mozilla can build up to 4 jobs at once in parallel, # however builds tend to fail on other arches when building in parallel. +%if !%{?disable_multiprocess_compilation} %ifarch %{ix86} [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 %endif %ifarch x86_64 ppc ppc64 ppc64le aarch64 [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -#[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 -#[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 -#[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +%endif %endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" @@ -577,7 +579,7 @@ export STRIP=/bin/true %if 0%{?build_with_pgo} GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - %else -env RUST_LOG=debug strace -y -f ./mach build -v 2>&1 | cat - +./mach build -v 2>&1 | cat - %endif # create debuginfo for crash-stats.mozilla.com @@ -929,6 +931,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Aug 14 2019 Jan Horak - 68.0.2-1 +- Update to 68.0.2 + * Mon Aug 5 2019 Jan Horak - 68.0.1-3 - Added workaround fix for webrtc indicator diff --git a/sources b/sources index 63864be..cc7352b 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ +SHA512 (firefox-68.0.2.source.tar.xz) = 5c289825fd0de062b9943eabcc16e09c1821c04717e689aa8df03162e722b72ea698195f3ea93e1e746c481dacd77d125301dba951468d134b986e35eb4ef5bb +SHA512 (firefox-langpacks-68.0.2-20190814.tar.xz) = f0031f7cb6277e5216c63956aeb4e88b2ce76ba0c65f293822970740882f95803ef083525e7c3a23e92252f2322a7fb0e43ac2359416f40c98480b9587f698be SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 -SHA512 (firefox-68.0.1.source.tar.xz) = 96b45135cf0b2368013afccb8c375de54d591a4e11016e8b65fc83904cedc362096dd15814cd02be23f6e52e392c605817b86a59ee2300d3e7a754d345399c81 -SHA512 (firefox-langpacks-68.0.1-20190722.tar.xz) = cb4f356bdc770f0d3ca41bed6015c3c53c8675c99ac2340c011e319384b3178d895a85a8a1852e65370c7f97ea603eb93eee85db546db206fa9362bf8cff7b72 From a711b2a7120edbef2b6d59da1b358632269de87c Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 14 Aug 2019 20:14:59 +0200 Subject: [PATCH 0045/1136] Fixed wrong if statement if spec --- firefox.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firefox.spec b/firefox.spec index 76a654c..e9cfd7a 100644 --- a/firefox.spec +++ b/firefox.spec @@ -20,11 +20,11 @@ ExcludeArch: s390x %global disable_elfhack 1 %global build_with_clang 0 %global use_bundled_cbindgen 1 +# FIXME disable PGO because of -j1 build would take ages +%global disable_multiprocess_compilation 1 # Build PGO+LTO on x86_64 and aarch64 only due to build issues # on other arches. %ifarch x86_64 aarch64 -# FIXME disable PGO because of -j1 build would take ages -%global disable_multiprocess_compilation 1 %if %{release_build} %global build_with_pgo 0 %else @@ -558,7 +558,7 @@ echo "ac_add_options --enable-lto" >> .mozconfig MOZ_SMP_FLAGS=-j1 # On x86_64 architectures, Mozilla can build up to 4 jobs at once in parallel, # however builds tend to fail on other arches when building in parallel. -%if !%{?disable_multiprocess_compilation} +%if !0%{?disable_multiprocess_compilation} %ifarch %{ix86} [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" From 7f5cbc47266f42ed37dc5d94cee85c0175971c56 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 14 Aug 2019 20:21:12 +0200 Subject: [PATCH 0046/1136] Fixed wrong spec file --- firefox.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/firefox.spec b/firefox.spec index 295800f..145d763 100644 --- a/firefox.spec +++ b/firefox.spec @@ -89,13 +89,8 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -<<<<<<< HEAD -Version: 68.0.1 -Release: 4%{?pre_tag}%{?dist} -======= Version: 68.0.2 Release: 1%{?pre_tag}%{?dist} ->>>>>>> master 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 From dfb6ca77fd5c777157c2af923f2f2c58c5b41cdb Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 29 Aug 2019 10:44:36 +0200 Subject: [PATCH 0047/1136] Update to 69 --- .gitignore | 2 ++ firefox.spec | 7 +++++-- mozilla-1516081.patch | 24 ++++++++++++------------ mozilla-1568569.patch | 42 ++++++------------------------------------ sources | 4 ++-- 5 files changed, 27 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 1f87135..d09688d 100644 --- a/.gitignore +++ b/.gitignore @@ -358,3 +358,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-68.0.1-20190722.tar.xz /firefox-68.0.2.source.tar.xz /firefox-langpacks-68.0.2-20190814.tar.xz +/firefox-69.0.source.tar.xz +/firefox-langpacks-69.0-20190829.tar.xz diff --git a/firefox.spec b/firefox.spec index e9cfd7a..07901ec 100644 --- a/firefox.spec +++ b/firefox.spec @@ -89,13 +89,13 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox -Version: 68.0.2 +Version: 69.0 Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190814.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190829.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -931,6 +931,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Aug 29 2019 Jan Horak - 69.0-1 +- Update to 69.0 + * Wed Aug 14 2019 Jan Horak - 68.0.2-1 - Update to 68.0.2 diff --git a/mozilla-1516081.patch b/mozilla-1516081.patch index 8eec605..1ecff39 100644 --- a/mozilla-1516081.patch +++ b/mozilla-1516081.patch @@ -1,7 +1,7 @@ -diff -up firefox-65.0/build/moz.configure/toolchain.configure.1516081 firefox-65.0/build/moz.configure/toolchain.configure ---- firefox-65.0/build/moz.configure/toolchain.configure.1516081 2019-01-24 19:48:38.000000000 +0100 -+++ firefox-65.0/build/moz.configure/toolchain.configure 2019-01-28 14:09:00.813320242 +0100 -@@ -1364,7 +1364,7 @@ def pgo_flags(compiler, build_env, targe +diff -up firefox-69.0/build/moz.configure/toolchain.configure.1516081 firefox-69.0/build/moz.configure/toolchain.configure +--- firefox-69.0/build/moz.configure/toolchain.configure.1516081 2019-08-27 03:31:51.000000000 +0200 ++++ firefox-69.0/build/moz.configure/toolchain.configure 2019-08-29 10:42:45.872919255 +0200 +@@ -1411,7 +1411,7 @@ def pgo_flags(compiler, build_env, targe if compiler.type == 'gcc': return namespace( @@ -10,19 +10,19 @@ diff -up firefox-65.0/build/moz.configure/toolchain.configure.1516081 firefox-65 gen_ldflags=['-fprofile-generate'], use_cflags=['-fprofile-use', '-fprofile-correction', '-Wcoverage-mismatch'], -@@ -1385,7 +1385,8 @@ def pgo_flags(compiler, build_env, targe +@@ -1434,7 +1434,8 @@ def pgo_flags(compiler, build_env, targe if gen_ldflags: return namespace( -- gen_cflags=['-fprofile-instr-generate'], -+ gen_cflags=['-fprofile-instr-generate', +- gen_cflags=[prefix + '-fprofile-generate'], ++ gen_cflags=[prefix + '-fprofile-generate', + '-DMOZ_PROFILE_INSTRUMENTATION'], gen_ldflags=gen_ldflags, - use_cflags=['-fprofile-instr-use=%s' % profdata, - '-Wno-error=profile-instr-out-of-date', -diff -up firefox-65.0/toolkit/components/terminator/nsTerminator.cpp.1516081 firefox-65.0/toolkit/components/terminator/nsTerminator.cpp ---- firefox-65.0/toolkit/components/terminator/nsTerminator.cpp.1516081 2019-01-28 14:09:00.813320242 +0100 -+++ firefox-65.0/toolkit/components/terminator/nsTerminator.cpp 2019-01-28 14:11:56.745577302 +0100 + use_cflags=[prefix + '-fprofile-use=%s' % profdata, + # Some error messages about mismatched profile data +diff -up firefox-69.0/toolkit/components/terminator/nsTerminator.cpp.1516081 firefox-69.0/toolkit/components/terminator/nsTerminator.cpp +--- firefox-69.0/toolkit/components/terminator/nsTerminator.cpp.1516081 2019-08-27 03:32:05.000000000 +0200 ++++ firefox-69.0/toolkit/components/terminator/nsTerminator.cpp 2019-08-29 09:51:08.513440687 +0200 @@ -419,6 +419,12 @@ void nsTerminator::StartWatchdog() { } } diff --git a/mozilla-1568569.patch b/mozilla-1568569.patch index ab6225a..bb33c59 100644 --- a/mozilla-1568569.patch +++ b/mozilla-1568569.patch @@ -1,12 +1,7 @@ -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -3238,16 +3238,18 @@ void nsWindow::OnWindowStateEvent(GtkWid - // We don't care about anything but changes in the maximized/icon/fullscreen - // states - if ((aEvent->changed_mask & - (GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_MAXIMIZED | - GDK_WINDOW_STATE_FULLSCREEN)) == 0) { +diff -up firefox-69.0/widget/gtk/nsWindow.cpp.1568569 firefox-69.0/widget/gtk/nsWindow.cpp +--- firefox-69.0/widget/gtk/nsWindow.cpp.1568569 2019-08-29 09:42:10.484631750 +0200 ++++ firefox-69.0/widget/gtk/nsWindow.cpp 2019-08-29 09:49:35.371121273 +0200 +@@ -3252,6 +3252,8 @@ void nsWindow::OnWindowStateEvent(GtkWid return; } @@ -15,17 +10,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp if (aEvent->new_window_state & GDK_WINDOW_STATE_ICONIFIED) { LOG(("\tIconified\n")); mSizeState = nsSizeMode_Minimized; - #ifdef ACCESSIBILITY - DispatchMinimizeEventAccessible(); - #endif // ACCESSIBILITY - } else if (aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) { - LOG(("\tFullscreen\n")); -@@ -3261,16 +3263,28 @@ void nsWindow::OnWindowStateEvent(GtkWid - } else { - LOG(("\tNormal\n")); - mSizeState = nsSizeMode_Normal; - #ifdef ACCESSIBILITY - DispatchRestoreEventAccessible(); +@@ -3275,6 +3277,18 @@ void nsWindow::OnWindowStateEvent(GtkWid #endif // ACCESSIBILITY } @@ -44,17 +29,7 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp if (mWidgetListener) { mWidgetListener->SizeModeChanged(mSizeState); if (aEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { - mWidgetListener->FullscreenChanged(aEvent->new_window_state & - GDK_WINDOW_STATE_FULLSCREEN); - } - } - -@@ -3787,16 +3801,21 @@ nsresult nsWindow::Create(nsIWidget* aPa - eventWidget = (drawToContainer) ? container : mShell; - - // Prevent GtkWindow from painting a background to avoid flickering. - gtk_widget_set_app_paintable(eventWidget, TRUE); - +@@ -3800,6 +3814,11 @@ nsresult nsWindow::Create(nsIWidget* aPa gtk_widget_add_events(eventWidget, kEvents); if (drawToContainer) { gtk_widget_add_events(mShell, GDK_PROPERTY_CHANGE_MASK); @@ -66,8 +41,3 @@ diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp gtk_widget_set_app_paintable(mShell, TRUE); } if (mTransparencyBitmapForTitlebar) { - moz_container_force_default_visual(mContainer); - } - - // If we draw to mContainer window then configure it now because - // gtk_container_add() realizes the child widget. diff --git a/sources b/sources index cc7352b..29de78f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (firefox-68.0.2.source.tar.xz) = 5c289825fd0de062b9943eabcc16e09c1821c04717e689aa8df03162e722b72ea698195f3ea93e1e746c481dacd77d125301dba951468d134b986e35eb4ef5bb -SHA512 (firefox-langpacks-68.0.2-20190814.tar.xz) = f0031f7cb6277e5216c63956aeb4e88b2ce76ba0c65f293822970740882f95803ef083525e7c3a23e92252f2322a7fb0e43ac2359416f40c98480b9587f698be +SHA512 (firefox-69.0.source.tar.xz) = 83b4b9a3466d2686ae5b72f9495172dcb37037f3301c68f7940604180e28a40720256f66b34b090dffbdd7b377fbb815df1bb80c3df842bc9ae59551c7cf07b0 +SHA512 (firefox-langpacks-69.0-20190829.tar.xz) = e45cec7cf4e0832407ce4fbe2c8e881ce6cf3d91ea7309ab9aec14adf808ecd7cdb5117e453eed9d145e3ac63b4c14c61272d00be25853b3a729c0b1e4fe6d19 SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 From 861049e391411efdc34466c117e2101b01672656 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 29 Aug 2019 11:06:21 +0200 Subject: [PATCH 0048/1136] Updated bundled cbindgen --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 29de78f..8f3638f 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (firefox-69.0.source.tar.xz) = 83b4b9a3466d2686ae5b72f9495172dcb37037f3301c68f7940604180e28a40720256f66b34b090dffbdd7b377fbb815df1bb80c3df842bc9ae59551c7cf07b0 SHA512 (firefox-langpacks-69.0-20190829.tar.xz) = e45cec7cf4e0832407ce4fbe2c8e881ce6cf3d91ea7309ab9aec14adf808ecd7cdb5117e453eed9d145e3ac63b4c14c61272d00be25853b3a729c0b1e4fe6d19 -SHA512 (cbindgen-vendor.tar.xz) = bdd1535c9923a082cdca263ff2c1765814b00b6a1c74be95bac4dbf7d0b7b29c1c27f0fed6feae99c88521c96e2865f0ea3cf784bd9a32a44cec6ee4df850662 +SHA512 (cbindgen-vendor.tar.xz) = c62ab13b0ddceebe79cb17fc14fd5cc87f3533babf125e69c29603752203fde8a64de034978dd3d48c70d72559a1705b006880b399a4b1bdb8af96066cc4b433 From 46085f5df814706b6c674ab1e8c521a9e52d8e4a Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 29 Aug 2019 11:21:23 +0200 Subject: [PATCH 0049/1136] Really updated bundled cbindgen --- firefox.spec | 2 +- gen_cbindgen-vendor.sh | 2 +- sources | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/firefox.spec b/firefox.spec index 07901ec..c4a4b8b 100644 --- a/firefox.spec +++ b/firefox.spec @@ -348,7 +348,7 @@ This package contains results of tests executed during build. %patch415 -p1 -b .1238661 %endif %ifarch ppc64 ppc64le -%patch418 -p1 -b .1512162 +#%patch418 -p1 -b .1512162 FIXME no longer needed? %endif %patch419 -p1 -b .1568569 %patch420 -p1 -b .1566876-webrtc-ind diff --git a/gen_cbindgen-vendor.sh b/gen_cbindgen-vendor.sh index afe171c..01ecc5d 100755 --- a/gen_cbindgen-vendor.sh +++ b/gen_cbindgen-vendor.sh @@ -12,7 +12,7 @@ to be used with 'cargo vendor' commmand. """ [dependencies] -cbindgen = "0.8.2" +cbindgen = "0.9.0" [[bin]] name = "dummy" diff --git a/sources b/sources index 8f3638f..3ac2847 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (firefox-69.0.source.tar.xz) = 83b4b9a3466d2686ae5b72f9495172dcb37037f3301c68f7940604180e28a40720256f66b34b090dffbdd7b377fbb815df1bb80c3df842bc9ae59551c7cf07b0 SHA512 (firefox-langpacks-69.0-20190829.tar.xz) = e45cec7cf4e0832407ce4fbe2c8e881ce6cf3d91ea7309ab9aec14adf808ecd7cdb5117e453eed9d145e3ac63b4c14c61272d00be25853b3a729c0b1e4fe6d19 -SHA512 (cbindgen-vendor.tar.xz) = c62ab13b0ddceebe79cb17fc14fd5cc87f3533babf125e69c29603752203fde8a64de034978dd3d48c70d72559a1705b006880b399a4b1bdb8af96066cc4b433 +SHA512 (cbindgen-vendor.tar.xz) = 88afa0bc6af525cbb46bc75578b90419b28b95b396d5002fbf299a78a173681b840096ff83ef6e48553d1a5e0aa04e79383ab4d09bf431f3b864fcbacc7de46d From 20c032f2ed576eac3d30b4ac8851d13921e6cf77 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 2 Sep 2019 17:03:30 +0200 Subject: [PATCH 0050/1136] Added upstream Wayland patches (mozilla-1548475, mozilla-1562827, mozilla-1567434, mozilla-1573813, mozilla-1574036, mozilla-1576268). - Enable multiprocess compilation. --- firefox.spec | 28 ++- mozilla-1548475.patch | 34 ++++ mozilla-1562827.patch | 141 +++++++++++++ mozilla-1567434-1.patch | 226 +++++++++++++++++++++ mozilla-1567434-2.patch | 35 ++++ mozilla-1573813.patch | 29 +++ mozilla-1574036.patch | 425 ++++++++++++++++++++++++++++++++++++++++ mozilla-1576268.patch | 17 ++ 8 files changed, 931 insertions(+), 4 deletions(-) create mode 100644 mozilla-1548475.patch create mode 100644 mozilla-1562827.patch create mode 100644 mozilla-1567434-1.patch create mode 100644 mozilla-1567434-2.patch create mode 100644 mozilla-1573813.patch create mode 100644 mozilla-1574036.patch create mode 100644 mozilla-1576268.patch diff --git a/firefox.spec b/firefox.spec index 59ed950..eb6b7a6 100644 --- a/firefox.spec +++ b/firefox.spec @@ -21,7 +21,7 @@ ExcludeArch: s390x %global build_with_clang 0 %global use_bundled_cbindgen 1 # FIXME disable PGO because of -j1 build would take ages -%global disable_multiprocess_compilation 1 +%global disable_multiprocess_compilation 0 # Build PGO+LTO on x86_64 and aarch64 only due to build issues # on other arches. %ifarch x86_64 aarch64 @@ -90,7 +90,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -127,7 +127,7 @@ Patch38: build-cacheFlush-missing.patch Patch40: build-aarch64-skia.patch Patch41: build-disable-elfhack.patch Patch44: build-arm-libopus.patch -Patch45: build-disable-multijobs-rust.patch +#Patch45: build-disable-multijobs-rust.patch # Fedora specific patches Patch215: firefox-enable-addons.patch @@ -150,6 +150,13 @@ Patch420: mozilla-1566876-webrtc-ind.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch +Patch575: mozilla-1548475.patch +Patch576: mozilla-1562827.patch +Patch578: mozilla-1567434-1.patch +Patch579: mozilla-1567434-2.patch +Patch580: mozilla-1573813.patch +Patch581: mozilla-1574036.patch +Patch582: mozilla-1576268.patch # PGO/LTO patches Patch600: pgo.patch @@ -326,7 +333,7 @@ This package contains results of tests executed during build. %endif %patch3 -p1 -b .arm %patch44 -p1 -b .build-arm-libopus -%patch45 -p1 -b .build-disable-multijobs-rust +#%patch45 -p1 -b .build-disable-multijobs-rust # Patch for big endian platforms only %if 0%{?big_endian} %patch26 -p1 -b .icu @@ -356,6 +363,13 @@ This package contains results of tests executed during build. # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire +%patch575 -p1 -b .mozilla-1548475 +%patch576 -p1 -b .mozilla-1562827 +%patch578 -p1 -b .mozilla-1567434-1 +%patch579 -p1 -b .mozilla-1567434-2 +%patch580 -p1 -b .mozilla-1573813 +%patch581 -p1 -b .mozilla-1574036 +%patch582 -p1 -b .mozilla-1576268 # PGO patches %patch600 -p1 -b .pgo @@ -932,6 +946,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Sep 2 2019 Martin Stransky - 69.0-1 +- Added upstream Wayland patches (mozilla-1548475, mozilla-1562827, + mozilla-1567434, mozilla-1573813, mozilla-1574036, + mozilla-1576268). +- Enable multiprocess compilation. + * Thu Aug 29 2019 Jan Horak - 69.0-1 - Update to 69.0 diff --git a/mozilla-1548475.patch b/mozilla-1548475.patch new file mode 100644 index 0000000..b325683 --- /dev/null +++ b/mozilla-1548475.patch @@ -0,0 +1,34 @@ +diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp +--- a/dom/plugins/base/nsPluginHost.cpp ++++ b/dom/plugins/base/nsPluginHost.cpp +@@ -105,6 +105,10 @@ + # include "windows.h" + # include "winbase.h" + #endif ++#if (MOZ_WIDGET_GTK) ++# include ++# include ++#endif + + #include "npapi.h" + +@@ -358,9 +362,15 @@ + mOverrideInternalTypes = + Preferences::GetBool("plugin.override_internal_types", false); + +- mPluginsDisabled = Preferences::GetBool("plugin.disable", false); +- +- Preferences::AddStrongObserver(this, "plugin.disable"); ++ bool waylandBackend = false; ++#if MOZ_WIDGET_GTK ++ waylandBackend = !GDK_IS_X11_DISPLAY(gdk_display_get_default()); ++#endif ++ mPluginsDisabled = ++ Preferences::GetBool("plugin.disable", false) || waylandBackend; ++ if (!waylandBackend) { ++ Preferences::AddStrongObserver(this, "plugin.disable"); ++ } + + nsCOMPtr obsService = + mozilla::services::GetObserverService(); + diff --git a/mozilla-1562827.patch b/mozilla-1562827.patch new file mode 100644 index 0000000..497133c --- /dev/null +++ b/mozilla-1562827.patch @@ -0,0 +1,141 @@ +diff -up firefox-69.0/widget/gtk/nsWindow.cpp.mozilla-1562827 firefox-69.0/widget/gtk/nsWindow.cpp +--- firefox-69.0/widget/gtk/nsWindow.cpp.mozilla-1562827 2019-09-02 15:16:15.031528276 +0200 ++++ firefox-69.0/widget/gtk/nsWindow.cpp 2019-09-02 15:16:15.037528254 +0200 +@@ -818,7 +818,6 @@ void nsWindow::SetParent(nsIWidget* aNew + if (mParent) { + mParent->RemoveChild(this); + } +- + mParent = aNewParent; + + GtkWidget* oldContainer = GetMozContainerWidget(); +@@ -830,88 +829,73 @@ void nsWindow::SetParent(nsIWidget* aNew + return; + } + ++ nsWindow* newParent = static_cast(aNewParent); ++ GdkWindow* newParentWindow = nullptr; ++ GtkWidget* newContainer = nullptr; + if (aNewParent) { + aNewParent->AddChild(this); +- ReparentNativeWidget(aNewParent); ++ newParentWindow = newParent->mGdkWindow; ++ newContainer = newParent->GetMozContainerWidget(); + } else { + // aNewParent is nullptr, but reparent to a hidden window to avoid + // destroying the GdkWindow and its descendants. + // An invisible container widget is needed to hold descendant + // GtkWidgets. +- GtkWidget* newContainer = EnsureInvisibleContainer(); +- GdkWindow* newParentWindow = gtk_widget_get_window(newContainer); +- ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow, +- oldContainer); +- } +-} +- +-bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); } +- +-void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) { +- MOZ_ASSERT(aNewParent, "null widget"); +- NS_ASSERTION(!mIsDestroyed, ""); +- NS_ASSERTION(!static_cast(aNewParent)->mIsDestroyed, ""); +- +- GtkWidget* oldContainer = GetMozContainerWidget(); +- if (!oldContainer) { +- // The GdkWindows have been destroyed so there is nothing else to +- // reparent. +- MOZ_ASSERT(gdk_window_is_destroyed(mGdkWindow), +- "live GdkWindow with no widget"); +- return; ++ newContainer = EnsureInvisibleContainer(); ++ newParentWindow = gtk_widget_get_window(newContainer); + } +- MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow), +- "destroyed GdkWindow with widget"); + +- auto* newParent = static_cast(aNewParent); +- GdkWindow* newParentWindow = newParent->mGdkWindow; +- GtkWidget* newContainer = newParent->GetMozContainerWidget(); +- GtkWindow* shell = GTK_WINDOW(mShell); +- +- if (shell && gtk_window_get_transient_for(shell)) { +- GtkWindow* topLevelParent = +- GTK_WINDOW(gtk_widget_get_toplevel(newContainer)); +- gtk_window_set_transient_for(shell, topLevelParent); +- } +- +- ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow, +- oldContainer); +-} +- +-void nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent, +- GtkWidget* aNewContainer, +- GdkWindow* aNewParentWindow, +- GtkWidget* aOldContainer) { +- if (!aNewContainer) { ++ if (!newContainer) { + // The new parent GdkWindow has been destroyed. +- MOZ_ASSERT(!aNewParentWindow || gdk_window_is_destroyed(aNewParentWindow), ++ MOZ_ASSERT(!newParentWindow || gdk_window_is_destroyed(newParentWindow), + "live GdkWindow with no widget"); + Destroy(); + } else { +- if (aNewContainer != aOldContainer) { +- MOZ_ASSERT(!gdk_window_is_destroyed(aNewParentWindow), ++ if (newContainer != oldContainer) { ++ MOZ_ASSERT(!gdk_window_is_destroyed(newParentWindow), + "destroyed GdkWindow with widget"); +- SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer); ++ SetWidgetForHierarchy(mGdkWindow, oldContainer, newContainer); + +- if (aOldContainer == gInvisibleContainer) { ++ if (oldContainer == gInvisibleContainer) { + CheckDestroyInvisibleContainer(); + } + } + +- if (!mIsTopLevel) { +- gdk_window_reparent(mGdkWindow, aNewParentWindow, +- DevicePixelsToGdkCoordRoundDown(mBounds.x), +- DevicePixelsToGdkCoordRoundDown(mBounds.y)); +- } ++ gdk_window_reparent(mGdkWindow, newParentWindow, ++ DevicePixelsToGdkCoordRoundDown(mBounds.x), ++ DevicePixelsToGdkCoordRoundDown(mBounds.y)); ++ mToplevelParentWindow = GTK_WINDOW(gtk_widget_get_toplevel(newContainer)); + } + +- auto* newParent = static_cast(aNewParent); + bool parentHasMappedToplevel = newParent && newParent->mHasMappedToplevel; + if (mHasMappedToplevel != parentHasMappedToplevel) { + SetHasMappedToplevel(parentHasMappedToplevel); + } + } + ++bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); } ++ ++void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) { ++ MOZ_ASSERT(aNewParent, "null widget"); ++ MOZ_ASSERT(!mIsDestroyed, ""); ++ MOZ_ASSERT(!static_cast(aNewParent)->mIsDestroyed, ""); ++ MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow), ++ "destroyed GdkWindow with widget"); ++ ++ MOZ_ASSERT( ++ !mParent, ++ "nsWindow::ReparentNativeWidget() works on toplevel windows only."); ++ ++ auto* newParent = static_cast(aNewParent); ++ GtkWindow* newParentWidget = GTK_WINDOW(newParent->GetGtkWidget()); ++ GtkWindow* shell = GTK_WINDOW(mShell); ++ ++ if (shell && gtk_window_get_transient_for(shell)) { ++ gtk_window_set_transient_for(shell, newParentWidget); ++ mToplevelParentWindow = newParentWidget; ++ } ++} ++ + void nsWindow::SetModal(bool aModal) { + LOG(("nsWindow::SetModal [%p] %d\n", (void*)this, aModal)); + if (mIsDestroyed) return; +diff -up firefox-69.0/widget/gtk/nsWindow.h.mozilla-1562827 firefox-69.0/widget/gtk/nsWindow.h diff --git a/mozilla-1567434-1.patch b/mozilla-1567434-1.patch new file mode 100644 index 0000000..446cd6b --- /dev/null +++ b/mozilla-1567434-1.patch @@ -0,0 +1,226 @@ +diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp +--- a/widget/gtk/WindowSurfaceWayland.cpp ++++ b/widget/gtk/WindowSurfaceWayland.cpp +@@ -616,8 +616,6 @@ + } + + if (!aFullScreenUpdate) { +- NS_WARNING( +- "We can't create a new Wayland buffer for non-fullscreen updates!"); + return nullptr; + } + +@@ -674,8 +672,6 @@ + (void*)buffer)); + + if (!buffer) { +- NS_WARNING( +- "WindowSurfaceWayland::LockWaylandBuffer(): No buffer available"); + return nullptr; + } + +diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h +--- a/widget/gtk/nsWindow.h ++++ b/widget/gtk/nsWindow.h +@@ -487,6 +487,7 @@ + GtkWidget* mShell; + MozContainer* mContainer; + GdkWindow* mGdkWindow; ++ GtkWindow* mToplevelParentWindow; + bool mWindowShouldStartDragging = false; + PlatformCompositorWidgetDelegate* mCompositorWidgetDelegate; + +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -401,6 +401,7 @@ + mContainer = nullptr; + mGdkWindow = nullptr; + mShell = nullptr; ++ mToplevelParentWindow = nullptr; + mCompositorWidgetDelegate = nullptr; + mHasMappedToplevel = false; + mIsFullyObscured = false; +@@ -1144,6 +1145,8 @@ + nsWindow* window = + static_cast(gVisibleWaylandPopupWindows->data); + if (window->mPopupType != ePopupTypeTooltip) break; ++ LOG(("nsWindow::HideWaylandTooltips [%p] hidding tooltip [%p].\n", ++ (void*)this, window)); + window->HideWaylandWindow(); + gVisibleWaylandPopupWindows = g_list_delete_link( + gVisibleWaylandPopupWindows, gVisibleWaylandPopupWindows); +@@ -1172,9 +1175,12 @@ + // before we open another one on that level. It means that every open + // popup needs to have an unique parent. + GtkWidget* nsWindow::ConfigureWaylandPopupWindows() { ++ LOG(("nsWindow::ConfigureWaylandPopupWindows [%p]\n", (void*)this)); ++ + // Check if we're already configured. + if (gVisibleWaylandPopupWindows && + g_list_find(gVisibleWaylandPopupWindows, this)) { ++ LOG(("...[%p] is already configured.\n", (void*)this)); + return GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); + } + +@@ -1182,9 +1188,15 @@ + // as it's short lived temporary window. + HideWaylandTooltips(); + +- GtkWindow* parentWidget = nullptr; ++ GtkWindow* parentWidget = mToplevelParentWindow; + if (gVisibleWaylandPopupWindows) { ++ LOG(("... there's visible active popup [%p]\n", ++ gVisibleWaylandPopupWindows->data)); ++ + if (mPopupType == ePopupTypeTooltip) { ++ LOG(("...[%p] is tooltip, parent [%p]\n", (void*)this, ++ gVisibleWaylandPopupWindows->data)); ++ + // Attach tooltip window to the latest popup window + // to have both visible. + nsWindow* window = +@@ -1200,12 +1212,19 @@ + // nsWindow::Create()) or we're toplevel popup without parent. + // In both cases just use parent which was passed to nsWindow::Create(). + if (!menuPopupFrame) { +- return GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); ++ LOG(("...[%p] menuPopupFrame = null, using given parent widget [%p]\n", ++ (void*)this, parentWidget)); ++ return GTK_WIDGET(parentWidget); + } + + nsWindow* parentWindow = + static_cast(menuPopupFrame->GetParentMenuWidget()); ++ LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow)); ++ + if (!parentWindow) { ++ LOG(("...[%p] using active/visible popups as a parent [%p]\n", ++ (void*)this, gVisibleWaylandPopupWindows->data)); ++ + // We're toplevel popup menu attached to another menu. Just use our + // latest popup as a parent. + parentWindow = +@@ -1234,10 +1253,10 @@ + } + } + ++ MOZ_ASSERT(parentWidget, "Missing parent widget for wayland popup!"); + if (parentWidget) { ++ LOG(("...[%p] set parent widget [%p]\n", (void*)this, parentWidget)); + gtk_window_set_transient_for(GTK_WINDOW(mShell), parentWidget); +- } else { +- parentWidget = gtk_window_get_transient_for(GTK_WINDOW(mShell)); + } + gVisibleWaylandPopupWindows = + g_list_prepend(gVisibleWaylandPopupWindows, this); +@@ -1248,9 +1267,11 @@ + static void NativeMoveResizeWaylandPopupCallback( + GdkWindow* window, const GdkRectangle* flipped_rect, + const GdkRectangle* final_rect, gboolean flipped_x, gboolean flipped_y, +- void* unused) { +- LOG(("%s flipped %d %d\n", __FUNCTION__, flipped_rect->x, flipped_rect->y)); +- LOG(("%s final %d %d\n", __FUNCTION__, final_rect->x, final_rect->y)); ++ void* aWindow) { ++ LOG(("%s [%p] flipped %d %d\n", __FUNCTION__, aWindow, flipped_rect->x, ++ flipped_rect->y)); ++ LOG(("%s [%p] final %d %d\n", __FUNCTION__, aWindow, final_rect->x, ++ final_rect->y)); + } + #endif + +@@ -1264,6 +1285,8 @@ + // Compositor may be confused by windows with width/height = 0 + // and positioning such windows leads to Bug 1555866. + if (!AreBoundsSane()) { ++ LOG(("nsWindow::NativeMoveResizeWaylandPopup [%p] Bounds are not sane\n", ++ (void*)this)); + return; + } + +@@ -1277,6 +1300,8 @@ + // - gdk_window_move_to_rect() is not available + // - the widget doesn't have a valid GdkWindow + if (!sGdkWindowMoveToRect || !gdkWindow) { ++ LOG(("nsWindow::NativeMoveResizeWaylandPopup [%p] use gtk_window_move()\n", ++ (void*)this)); + gtk_window_move(GTK_WINDOW(mShell), aPosition->x, aPosition->y); + return; + } +@@ -1302,8 +1327,12 @@ + } + LOG((" request result %d %d\n", rect.x, rect.y)); + #ifdef DEBUG +- g_signal_connect(gdkWindow, "moved-to-rect", +- G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this); ++ if (!g_signal_handler_find( ++ gdkWindow, G_SIGNAL_MATCH_FUNC, 0, 0, nullptr, ++ FuncToGpointer(NativeMoveResizeWaylandPopupCallback), this)) { ++ g_signal_connect(gdkWindow, "moved-to-rect", ++ G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this); ++ } + #endif + + GdkGravity rectAnchor = GDK_GRAVITY_NORTH_WEST; +@@ -3508,7 +3537,6 @@ + GtkWidget* parentMozContainer = nullptr; + GtkContainer* parentGtkContainer = nullptr; + GdkWindow* parentGdkWindow = nullptr; +- GtkWindow* topLevelParent = nullptr; + nsWindow* parentnsWindow = nullptr; + GtkWidget* eventWidget = nullptr; + bool drawToContainer = false; +@@ -3534,7 +3562,8 @@ + + // get the toplevel window just in case someone needs to use it + // for setting transients or whatever. +- topLevelParent = GTK_WINDOW(gtk_widget_get_toplevel(parentMozContainer)); ++ mToplevelParentWindow = ++ GTK_WINDOW(gtk_widget_get_toplevel(parentMozContainer)); + } + + if (!mIsX11Display) { +@@ -3542,7 +3571,7 @@ + // eWindowType_child is not supported on Wayland. Just switch to toplevel + // as a workaround. + mWindowType = eWindowType_toplevel; +- } else if (mWindowType == eWindowType_popup && !topLevelParent) { ++ } else if (mWindowType == eWindowType_popup && !mToplevelParentWindow) { + // Workaround for Wayland where the popup windows always need to have + // parent window. For example webrtc ui is a popup window without parent. + mWindowType = eWindowType_toplevel; +@@ -3677,7 +3706,7 @@ + gdk_get_program_class()); + gtk_window_set_type_hint(GTK_WINDOW(mShell), + GDK_WINDOW_TYPE_HINT_DIALOG); +- gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); ++ gtk_window_set_transient_for(GTK_WINDOW(mShell), mToplevelParentWindow); + } else if (mWindowType == eWindowType_popup) { + gtk_window_set_wmclass(GTK_WINDOW(mShell), "Popup", + gdk_get_program_class()); +@@ -3730,10 +3759,11 @@ + } + gtk_window_set_type_hint(GTK_WINDOW(mShell), gtkTypeHint); + +- if (topLevelParent) { ++ if (mToplevelParentWindow) { + LOG(("nsWindow::Create [%p] Set popup parent %p\n", (void*)this, +- topLevelParent)); +- gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); ++ mToplevelParentWindow)); ++ gtk_window_set_transient_for(GTK_WINDOW(mShell), ++ mToplevelParentWindow); + } + + // We need realized mShell at NativeMove(). +@@ -4011,7 +4041,8 @@ + #endif + } + +- LOG(("nsWindow [%p]\n", (void*)this)); ++ LOG(("nsWindow [%p] %s\n", (void*)this, ++ mWindowType == eWindowType_toplevel ? "Toplevel" : "Popup")); + if (mShell) { + LOG(("\tmShell %p mContainer %p mGdkWindow %p 0x%lx\n", mShell, mContainer, + mGdkWindow, mIsX11Display ? gdk_x11_window_get_xid(mGdkWindow) : 0)); + diff --git a/mozilla-1567434-2.patch b/mozilla-1567434-2.patch new file mode 100644 index 0000000..966118a --- /dev/null +++ b/mozilla-1567434-2.patch @@ -0,0 +1,35 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1208,6 +1208,7 @@ + if (frame) { + menuPopupFrame = do_QueryFrame(frame); + } ++ + // The popup is not fully created yet (we're called from + // nsWindow::Create()) or we're toplevel popup without parent. + // In both cases just use parent which was passed to nsWindow::Create(). +@@ -1217,10 +1218,22 @@ + return GTK_WIDGET(parentWidget); + } + ++ LOG(("...[%p] is %s\n", (void*)this, ++ menuPopupFrame->IsContextMenu() ? "context menu" : "popup")); ++ + nsWindow* parentWindow = + static_cast(menuPopupFrame->GetParentMenuWidget()); + LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow)); + ++ // If the popup is a regular menu but GetParentMenuWidget() returns ++ // nullptr which means it's connected non-menu parent ++ // (bookmark toolbar for instance). ++ // In this case use a parent given at nsWindow::Create(). ++ if (!parentWindow && !menuPopupFrame->IsContextMenu()) { ++ parentWindow = ++ get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow)); ++ } ++ + if (!parentWindow) { + LOG(("...[%p] using active/visible popups as a parent [%p]\n", + (void*)this, gVisibleWaylandPopupWindows->data)); + diff --git a/mozilla-1573813.patch b/mozilla-1573813.patch new file mode 100644 index 0000000..e9fca07 --- /dev/null +++ b/mozilla-1573813.patch @@ -0,0 +1,29 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -6577,11 +6577,22 @@ + } + + gint nsWindow::GdkScaleFactor() { ++ // For popup windows with parent window we need to get scale factor of the ++ // parent window. Otherwise the scale factor of the popup is not updated ++ // during it's hidden. ++ GdkWindow* scaledGdkWindow = mGdkWindow; ++ if (mToplevelParentWindow) { ++ scaledGdkWindow = gtk_widget_get_window(GTK_WIDGET(mToplevelParentWindow)); ++ // Fallback for windows which parent has been unrealized. ++ if (!scaledGdkWindow) { ++ scaledGdkWindow = mGdkWindow; ++ } ++ } + // Available as of GTK 3.10+ + static auto sGdkWindowGetScaleFactorPtr = + (gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor"); +- if (sGdkWindowGetScaleFactorPtr && mGdkWindow) +- return (*sGdkWindowGetScaleFactorPtr)(mGdkWindow); ++ if (sGdkWindowGetScaleFactorPtr && scaledGdkWindow) ++ return (*sGdkWindowGetScaleFactorPtr)(scaledGdkWindow); + return ScreenHelperGTK::GetGTKMonitorScaleFactor(); + } + + diff --git a/mozilla-1574036.patch b/mozilla-1574036.patch new file mode 100644 index 0000000..c3ecdc7 --- /dev/null +++ b/mozilla-1574036.patch @@ -0,0 +1,425 @@ +diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h +--- a/widget/gtk/WindowSurfaceWayland.h ++++ b/widget/gtk/WindowSurfaceWayland.h +@@ -177,12 +177,9 @@ + + private: + WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); +- WindowBackBuffer* GetWaylandBufferToDraw(int aWidth, int aHeight, +- bool aFullScreenUpdate); ++ WindowBackBuffer* GetWaylandBufferToDraw(bool aCanSwitchBuffer); + +- already_AddRefed LockWaylandBuffer(int aWidth, int aHeight, +- bool aClearBuffer, +- bool aFullScreenUpdate); ++ already_AddRefed LockWaylandBuffer(bool aCanSwitchBuffer); + void UnlockWaylandBuffer(); + + already_AddRefed LockImageSurface( +@@ -198,7 +195,10 @@ + + // TODO: Do we need to hold a reference to nsWindow object? + nsWindow* mWindow; +- LayoutDeviceIntRect mLastScreenRect; ++ // Buffer screen rects helps us understand if we operate on ++ // the same window size as we're called on WindowSurfaceWayland::Lock(). ++ // mBufferScreenRect is window size when our wayland buffer was allocated. ++ LayoutDeviceIntRect mBufferScreenRect; + nsWaylandDisplay* mWaylandDisplay; + WindowBackBuffer* mWaylandBuffer; + LayoutDeviceIntRegion mWaylandBufferDamage; +@@ -211,7 +211,8 @@ + AutoTArray mDelayedImageCommits; + bool mDrawToWaylandBufferDirectly; + bool mPendingCommit; +- bool mWaylandBufferFullScreenDamage; ++ bool mWholeWindowBufferDamage; ++ bool mBufferNeedsClear; + bool mIsMainThread; + bool mNeedScaleFactorUpdate; + +diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp +--- a/widget/gtk/WindowSurfaceWayland.cpp ++++ b/widget/gtk/WindowSurfaceWayland.cpp +@@ -499,7 +499,8 @@ + mDelayedCommitHandle(nullptr), + mDrawToWaylandBufferDirectly(true), + mPendingCommit(false), +- mWaylandBufferFullScreenDamage(false), ++ mWholeWindowBufferDamage(false), ++ mBufferNeedsClear(false), + mIsMainThread(NS_IsMainThread()), + mNeedScaleFactorUpdate(true) { + for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; +@@ -565,18 +566,20 @@ + } + + WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( +- int aWidth, int aHeight, bool aFullScreenUpdate) { ++ bool aCanSwitchBuffer) { + LOGWAYLAND(("%s [%p] Requested buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, aWidth, aHeight)); ++ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); + + // There's no buffer created yet, create a new one. + if (!mWaylandBuffer) { +- MOZ_ASSERT(aFullScreenUpdate, "Created new buffer for partial drawing!"); ++ MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage, ++ "Created new buffer for partial drawing!"); + LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, aWidth, aHeight)); ++ (void*)this, mBufferScreenRect.width, ++ mBufferScreenRect.height)); + +- mWaylandBuffer = CreateWaylandBuffer(aWidth, aHeight); +- mWaylandBufferFullScreenDamage = true; ++ mWaylandBuffer = ++ CreateWaylandBuffer(mBufferScreenRect.width, mBufferScreenRect.height); + mNeedScaleFactorUpdate = true; + return mWaylandBuffer; + } +@@ -593,29 +596,31 @@ + LOGWAYLAND( + ("%s [%p] Use recent buffer.\n", __PRETTY_FUNCTION__, (void*)this)); + +- if (mWaylandBuffer->IsMatchingSize(aWidth, aHeight)) { ++ if (mWaylandBuffer->IsMatchingSize(mBufferScreenRect.width, ++ mBufferScreenRect.height)) { + LOGWAYLAND(("%s [%p] Size is ok, use the buffer [%d x %d]\n", +- __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); ++ __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, ++ mBufferScreenRect.height)); + return mWaylandBuffer; + } + +- if (!aFullScreenUpdate) { ++ if (!aCanSwitchBuffer) { + NS_WARNING("We can't resize Wayland buffer for non-fullscreen updates!"); + return nullptr; + } + + LOGWAYLAND(("%s [%p] Reuse buffer with resize [%d x %d]\n", +- __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); ++ __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, ++ mBufferScreenRect.height)); + +- mWaylandBuffer->Resize(aWidth, aHeight); ++ mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); + // There's a chance that scale factor has been changed + // when buffer size changed +- mWaylandBufferFullScreenDamage = true; + mNeedScaleFactorUpdate = true; + return mWaylandBuffer; + } + +- if (!aFullScreenUpdate) { ++ if (!aCanSwitchBuffer) { + return nullptr; + } + +@@ -625,8 +630,10 @@ + availableBuffer++) { + if (!mBackupBuffer[availableBuffer]) { + LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, aWidth, aHeight)); +- mBackupBuffer[availableBuffer] = CreateWaylandBuffer(aWidth, aHeight); ++ (void*)this, mBufferScreenRect.width, ++ mBufferScreenRect.height)); ++ mBackupBuffer[availableBuffer] = CreateWaylandBuffer( ++ mBufferScreenRect.width, mBufferScreenRect.height); + break; + } + +@@ -650,23 +657,23 @@ + __PRETTY_FUNCTION__, (void*)this, (void*)lastWaylandBuffer, + (void*)mWaylandBuffer)); + +- mWaylandBufferFullScreenDamage = true; + mNeedScaleFactorUpdate = true; + +- bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize(aWidth, aHeight); ++ bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize( ++ mBufferScreenRect.width, mBufferScreenRect.height); + if (bufferNeedsResize) { + LOGWAYLAND(("%s [%p] Resize buffer to [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, aWidth, aHeight)); +- mWaylandBuffer->Resize(aWidth, aHeight); ++ (void*)this, mBufferScreenRect.width, ++ mBufferScreenRect.height)); ++ mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); + } + + return mWaylandBuffer; + } + + already_AddRefed WindowSurfaceWayland::LockWaylandBuffer( +- int aWidth, int aHeight, bool aClearBuffer, bool aFullScreenUpdate) { +- WindowBackBuffer* buffer = +- GetWaylandBufferToDraw(aWidth, aHeight, aFullScreenUpdate); ++ bool aCanSwitchBuffer) { ++ WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer); + + LOGWAYLAND(("%s [%p] Got buffer %p\n", __PRETTY_FUNCTION__, (void*)this, + (void*)buffer)); +@@ -675,8 +682,9 @@ + return nullptr; + } + +- if (aClearBuffer) { ++ if (mBufferNeedsClear && mWholeWindowBufferDamage) { + buffer->Clear(); ++ mBufferNeedsClear = false; + } + + return buffer->Lock(); +@@ -744,7 +752,7 @@ + const LayoutDeviceIntRegion& aRegion) { + MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); + +- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); ++ LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); + gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); + gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); + +@@ -753,54 +761,77 @@ + mWindow->IsWaylandPopup() && + (eTransparencyTransparent == mWindow->GetTransparencyMode()); + +- mDrawToWaylandBufferDirectly = +- isTransparentPopup ? IsPopupFullScreenUpdate(screenRect, aRegion) +- : IsWindowFullScreenUpdate(screenRect, aRegion); ++ // We have request to lock whole buffer/window. ++ mWholeWindowBufferDamage = ++ isTransparentPopup ? IsPopupFullScreenUpdate(lockedScreenRect, aRegion) ++ : IsWindowFullScreenUpdate(lockedScreenRect, aRegion); + +- bool needsClear = mWindow->WaylandSurfaceNeedsClear() || +- (isTransparentPopup && mDrawToWaylandBufferDirectly); ++ // Clear buffer when we (re)draw new transparent popup window, ++ // otherwise leave it as-is, mBufferNeedsClear can be set from previous ++ // (already pending) commits which are cached now. ++ if (mWholeWindowBufferDamage) { ++ mBufferNeedsClear = ++ mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup; ++ } + + LOGWAYLAND(("%s [%p] lockSize [%d x %d] windowSize [%d x %d]\n", + __PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height, +- screenRect.width, screenRect.height)); ++ lockedScreenRect.width, lockedScreenRect.height)); + LOGWAYLAND((" nsWindow = %p\n", mWindow)); + LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup())); + LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup)); + LOGWAYLAND((" IsPopupFullScreenUpdate = %d\n", +- IsPopupFullScreenUpdate(screenRect, aRegion))); ++ IsPopupFullScreenUpdate(lockedScreenRect, aRegion))); + LOGWAYLAND((" IsWindowFullScreenUpdate = %d\n", +- IsWindowFullScreenUpdate(screenRect, aRegion))); +- LOGWAYLAND((" needsClear = %d\n", needsClear)); +- LOGWAYLAND( +- (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); ++ IsWindowFullScreenUpdate(lockedScreenRect, aRegion))); ++ LOGWAYLAND((" mBufferNeedsClear = %d\n", mBufferNeedsClear)); ++ LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); ++ ++#if DEBUG ++ if (!(mBufferScreenRect == lockedScreenRect)) { ++ LOGWAYLAND((" screen size changed\n")); ++ } ++#endif + +- // Allow full screen allocation and clear +- // when window size changed. +- bool bufferRedraw = !(screenRect == mLastScreenRect); +- if (bufferRedraw) { +- mDrawToWaylandBufferDirectly = true; +- needsClear = true; ++ if (!(mBufferScreenRect == lockedScreenRect)) { ++ // Screen (window) size changed and we still have some painting pending ++ // for the last window size. That can happen when window is resized. ++ // We can't commit them any more as they're for former window size, so ++ // scratch them. ++ mDelayedImageCommits.Clear(); ++ ++ if (!mWholeWindowBufferDamage) { ++ NS_WARNING("Partial screen update when window is resized!"); ++ // This should not happen. Screen size changed but we got only ++ // partal screen update instead of whole screen. Discard this painting ++ // as it produces artifacts. ++ return nullptr; ++ } ++ mBufferScreenRect = lockedScreenRect; + } + +- if (mDrawToWaylandBufferDirectly) { ++ if (mWholeWindowBufferDamage) { ++ // We can lock/commit entire buffer direcly. ++ mDrawToWaylandBufferDirectly = true; ++ + // If there's any pending image commit scratch them as we're going + // to redraw the whole sceen anyway. + mDelayedImageCommits.Clear(); + +- RefPtr dt = +- LockWaylandBuffer(screenRect.width, screenRect.height, needsClear, +- /* aFullScreenUpdate */ true); ++ RefPtr dt = LockWaylandBuffer( ++ /* aCanSwitchBuffer */ mWholeWindowBufferDamage); + if (dt) { +- if (bufferRedraw) { +- mLastScreenRect = screenRect; +- } + return dt.forget(); + } ++ } + +- // We don't have any front buffer available. Try indirect drawing +- // to mImageSurface which is mirrored to front buffer at commit. +- mDrawToWaylandBufferDirectly = false; +- } ++ // We do indirect drawing due to: ++ // ++ // 1) We don't have any front buffer available. Try indirect drawing ++ // to mImageSurface which is mirrored to front buffer at commit. ++ // 2) Only part of the screen is locked. We can't lock entire screen for ++ // such drawing as it produces visible artifacts. ++ mDrawToWaylandBufferDirectly = false; + + LOGWAYLAND((" Indirect drawing.\n")); + return LockImageSurface(lockSize); +@@ -851,16 +882,14 @@ + LayoutDeviceIntRegion& aWaylandBufferDamage) { + MOZ_ASSERT(!mDrawToWaylandBufferDirectly); + +- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); ++#ifdef DEBUG + gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); +- + gfx::Rect rect(bounds); +- if (rect.IsEmpty()) { +- return false; +- } ++ MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?"); ++#endif + + LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, screenRect.width, screenRect.height)); ++ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); + + RefPtr surf = + gfx::Factory::CreateSourceSurfaceForCairoSurface( +@@ -871,13 +900,8 @@ + return false; + } + +- // Allow full screen allocation and clear +- // when window size changed. +- bool bufferRedraw = !(screenRect == mLastScreenRect); +- RefPtr dt = +- LockWaylandBuffer(screenRect.width, screenRect.height, +- /* needs clear*/ bufferRedraw, +- /* aFullScreenUpdate */ bufferRedraw); ++ RefPtr dt = LockWaylandBuffer( ++ /* aCanSwitchBuffer */ mWholeWindowBufferDamage); + if (dt) { + LOGWAYLAND( + (" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", +@@ -885,14 +909,11 @@ + + // Draw any delayed image commits first + DrawDelayedImageCommits(dt, aWaylandBufferDamage); ++ // Draw image from recent WindowSurfaceWayland::Lock(). + WindowImageSurface::Draw(surf, dt, aRegion); + // Submit all drawing to final Wayland buffer upload + aWaylandBufferDamage.OrWith(aRegion); + UnlockWaylandBuffer(); +- +- if (bufferRedraw) { +- mLastScreenRect = screenRect; +- } + } else { + mDelayedImageCommits.AppendElement(WindowImageSurface(surf, aRegion)); + LOGWAYLAND((" Added WindowImageSurfaces, cached surfaces %ld\n", +@@ -930,29 +951,25 @@ + LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); + LOGWAYLAND( + (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); +- LOGWAYLAND((" mWaylandBufferFullScreenDamage = %d\n", +- mWaylandBufferFullScreenDamage)); ++ LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); + LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); + LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); + LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); + + if (!mDrawToWaylandBufferDirectly) { ++ MOZ_ASSERT(mDelayedImageCommits.Length(), ++ "Indirect drawing without any image?"); ++ + // There's some cached drawings - try to flush them now. +- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); +- bool bufferRedraw = !(screenRect == mLastScreenRect); +- RefPtr dt = +- LockWaylandBuffer(screenRect.width, screenRect.height, +- /* needsClear */ bufferRedraw, +- /* full screen update */ bufferRedraw); ++ RefPtr dt = LockWaylandBuffer( ++ /* aCanSwitchBuffer */ mWholeWindowBufferDamage); ++ + if (dt) { + LOGWAYLAND(("%s [%p] flushed indirect drawing\n", __PRETTY_FUNCTION__, + (void*)this)); + DrawDelayedImageCommits(dt, mWaylandBufferDamage); + UnlockWaylandBuffer(); + mDrawToWaylandBufferDirectly = true; +- if (bufferRedraw) { +- mLastScreenRect = screenRect; +- } + } + } + +@@ -1000,10 +1017,10 @@ + mLastCommittedSurface = nullptr; + } + +- if (mWaylandBufferFullScreenDamage) { +- LayoutDeviceIntRect rect = mWindow->GetBounds(); +- wl_surface_damage(waylandSurface, 0, 0, rect.width, rect.height); +- mWaylandBufferFullScreenDamage = false; ++ if (mWholeWindowBufferDamage) { ++ wl_surface_damage(waylandSurface, 0, 0, mBufferScreenRect.width, ++ mBufferScreenRect.height); ++ mWholeWindowBufferDamage = false; + mNeedScaleFactorUpdate = true; + } else { + gint scaleFactor = mWindow->GdkScaleFactor(); +@@ -1043,24 +1060,24 @@ + + #ifdef DEBUG + { +- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); + gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); + gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); + + LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", + __PRETTY_FUNCTION__, (void*)this, lockSize.width, +- lockSize.height, screenRect.width, screenRect.height)); ++ lockSize.height, mBufferScreenRect.width, ++ mBufferScreenRect.height)); + LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", + mDrawToWaylandBufferDirectly)); +- LOGWAYLAND((" mWaylandBufferFullScreenDamage = %d\n", +- mWaylandBufferFullScreenDamage)); ++ LOGWAYLAND( ++ (" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); + } + #endif + + if (mDrawToWaylandBufferDirectly) { + MOZ_ASSERT(mWaylandBuffer->IsLocked()); + // If we're not at fullscreen damage add drawing area from aInvalidRegion +- if (!mWaylandBufferFullScreenDamage) { ++ if (!mWholeWindowBufferDamage) { + mWaylandBufferDamage.OrWith(aInvalidRegion); + } + UnlockWaylandBuffer(); + diff --git a/mozilla-1576268.patch b/mozilla-1576268.patch new file mode 100644 index 0000000..85fd1a8 --- /dev/null +++ b/mozilla-1576268.patch @@ -0,0 +1,17 @@ +diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp +--- a/widget/gtk/nsClipboardWayland.cpp ++++ b/widget/gtk/nsClipboardWayland.cpp +@@ -195,6 +195,12 @@ + uint32_t all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY | + WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE; + ++ /* Default to move D&D action (Bug 1576268). ++ */ ++ if (dnd_actions == 0) { ++ all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE; ++ } ++ + wl_data_offer_set_actions(mWaylandDataOffer, all_actions, dnd_actions); + + /* Workaround Wayland D&D architecture here. To get the data_device_drop() + From 0a26542698561e0145493f4fcc14c1bb979fdccd Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 2 Sep 2019 17:06:27 +0200 Subject: [PATCH 0051/1136] Release up --- firefox.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index ce496b5..cc7e212 100644 --- a/firefox.spec +++ b/firefox.spec @@ -946,7 +946,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Mon Sep 2 2019 Martin Stransky - 69.0-1 +* Mon Sep 2 2019 Martin Stransky - 69.0-2 - Added upstream Wayland patches (mozilla-1548475, mozilla-1562827, mozilla-1567434, mozilla-1573813, mozilla-1574036, mozilla-1576268). From 234c40b2b9e2611f0b0f6d9b9bfba5a851298c02 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 4 Sep 2019 14:16:56 +0200 Subject: [PATCH 0052/1136] nss version up --- firefox.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firefox.spec b/firefox.spec index cc7e212..ba7fb0e 100644 --- a/firefox.spec +++ b/firefox.spec @@ -26,7 +26,7 @@ ExcludeArch: s390x # on other arches. %ifarch x86_64 aarch64 %if %{release_build} -%global build_with_pgo 0 +%global build_with_pgo 1 %else %global build_with_pgo 0 %endif @@ -65,9 +65,9 @@ ExcludeArch: s390x %endif %if %{?system_nss} -%global nspr_version 4.19 +%global nspr_version 4.21 %global nspr_build_version %{nspr_version} -%global nss_version 3.40.1 +%global nss_version 3.45 %global nss_build_version %{nss_version} %endif From b2802deb3dc56b6e8818a5b565414004377e6cdd Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 4 Sep 2019 14:52:50 +0200 Subject: [PATCH 0053/1136] Enable profile downgrade --- firefox.sh.in | 3 +++ firefox.spec | 1 + 2 files changed, 4 insertions(+) diff --git a/firefox.sh.in b/firefox.sh.in index 29bd738..4fe71e4 100644 --- a/firefox.sh.in +++ b/firefox.sh.in @@ -251,6 +251,9 @@ done # Flatpak specific environment variables %FLATPAK_ENV_VARS% +# Don't throw "old profile" dialog box. +export MOZ_ALLOW_DOWNGRADE=1 + # Run the browser debugging=0 if [ $debugging = 1 ] diff --git a/firefox.spec b/firefox.spec index ba7fb0e..fa27e12 100644 --- a/firefox.spec +++ b/firefox.spec @@ -951,6 +951,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : mozilla-1567434, mozilla-1573813, mozilla-1574036, mozilla-1576268). - Enable multiprocess compilation. +- Enable profile downgrade. * Thu Aug 29 2019 Jan Horak - 69.0-1 - Update to 69.0 From 57b02aeb2f0eeb1359773b1dabe6cc03c8b72cd2 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Fri, 6 Sep 2019 12:28:45 +0200 Subject: [PATCH 0054/1136] Disabled ppc64le on Fedora 29 (rhbz#1749729) --- firefox.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firefox.spec b/firefox.spec index fa27e12..efe33ab 100644 --- a/firefox.spec +++ b/firefox.spec @@ -5,6 +5,10 @@ ExcludeArch: armv7hl # Disabled due to https://pagure.io/fedora-infrastructure/issue/7581 ExcludeArch: s390x +# Disabled due to build error rhbz#1749729 +%if 0%{?fedora} < 30 +ExcludeArch: ppc64le +%endif %global system_nss 1 %global system_ffi 1 @@ -952,6 +956,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : mozilla-1576268). - Enable multiprocess compilation. - Enable profile downgrade. +- Disabled ppc64le on Fedora 29 (rhbz#1749729) * Thu Aug 29 2019 Jan Horak - 69.0-1 - Update to 69.0 From 8eab606fb29c158f4d544b844ebc41603893919c Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 10 Sep 2019 10:42:29 +0200 Subject: [PATCH 0055/1136] Added fix for mozbz#1579023 --- firefox.spec | 7 ++++++- mozilla-1579023.patch | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 mozilla-1579023.patch diff --git a/firefox.spec b/firefox.spec index efe33ab..99767c0 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 2%{?pre_tag}%{?dist} +Release: 3%{?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 @@ -151,6 +151,7 @@ Patch417: bug1375074-save-restore-x28.patch Patch418: mozilla-1512162.patch Patch419: mozilla-1568569.patch Patch420: mozilla-1566876-webrtc-ind.patch +Patch421: mozilla-1579023.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -364,6 +365,7 @@ This package contains results of tests executed during build. %endif %patch419 -p1 -b .1568569 %patch420 -p1 -b .1566876-webrtc-ind +%patch421 -p1 -b .1579023 # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire @@ -950,6 +952,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Sep 9 2019 Martin Stransky - 69.0-3 +- Added fix for mozbz#1579023 + * Mon Sep 2 2019 Martin Stransky - 69.0-2 - Added upstream Wayland patches (mozilla-1548475, mozilla-1562827, mozilla-1567434, mozilla-1573813, mozilla-1574036, diff --git a/mozilla-1579023.patch b/mozilla-1579023.patch new file mode 100644 index 0000000..32881b9 --- /dev/null +++ b/mozilla-1579023.patch @@ -0,0 +1,23 @@ +diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp +--- a/security/manager/ssl/nsNSSComponent.cpp ++++ b/security/manager/ssl/nsNSSComponent.cpp +@@ -683,10 +683,17 @@ + AutoSECMODListReadLock secmodLock; + SECMODModuleList* list = SECMOD_GetDefaultModuleList(); + while (list) { +- if (SECMOD_HasRemovableSlots(list->module)) { ++ SECMODModule* module = list->module; ++ if (SECMOD_HasRemovableSlots(module)) { + *result = true; + return NS_OK; + } ++ for (int i = 0; i < module->slotCount; i++) { ++ if (!PK11_IsFriendly(module->slots[i])) { ++ *result = true; ++ return NS_OK; ++ } ++ } + list = list->next; + } + #endif + From 36345da5139b4ffba1e6529abf1240fc80b42c1d Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 11 Sep 2019 08:35:24 +0200 Subject: [PATCH 0056/1136] Added fix for mozbz#1579794 - Flickering on video playback on 4k/HiDPI displays --- firefox.spec | 10 ++- mozilla-1579794-1.patch | 134 ++++++++++++++++++++++++++++++++ mozilla-1579794-2.patch | 166 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 mozilla-1579794-1.patch create mode 100644 mozilla-1579794-2.patch diff --git a/firefox.spec b/firefox.spec index 99767c0..e23bf3b 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 3%{?pre_tag}%{?dist} +Release: 4%{?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 @@ -162,6 +162,8 @@ Patch579: mozilla-1567434-2.patch Patch580: mozilla-1573813.patch Patch581: mozilla-1574036.patch Patch582: mozilla-1576268.patch +Patch583: mozilla-1579794-1.patch +Patch584: mozilla-1579794-2.patch # PGO/LTO patches Patch600: pgo.patch @@ -376,6 +378,8 @@ This package contains results of tests executed during build. %patch580 -p1 -b .mozilla-1573813 %patch581 -p1 -b .mozilla-1574036 %patch582 -p1 -b .mozilla-1576268 +%patch583 -p1 -b .mozilla-1579794-1 +%patch584 -p1 -b .mozilla-1579794-2 # PGO patches %patch600 -p1 -b .pgo @@ -952,6 +956,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Sep 11 2019 Martin Stransky - 69.0-4 +- Added fix for mozbz#1579794 - Flickering on video playback on + 4k/HiDPI displays. + * Mon Sep 9 2019 Martin Stransky - 69.0-3 - Added fix for mozbz#1579023 diff --git a/mozilla-1579794-1.patch b/mozilla-1579794-1.patch new file mode 100644 index 0000000..60c8cab --- /dev/null +++ b/mozilla-1579794-1.patch @@ -0,0 +1,134 @@ +diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h +--- a/widget/gtk/WindowSurfaceWayland.h ++++ b/widget/gtk/WindowSurfaceWayland.h +@@ -154,11 +154,12 @@ + void Draw(gfx::DrawTarget* aDest, + LayoutDeviceIntRegion& aWaylandBufferDamage); + +- WindowImageSurface(gfx::SourceSurface* aSurface, ++ WindowImageSurface(gfxImageSurface* aImageSurface, + const LayoutDeviceIntRegion& aUpdateRegion); + + private: + RefPtr mSurface; ++ RefPtr mImageSurface; + const LayoutDeviceIntRegion mUpdateRegion; + }; + +diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp +--- a/widget/gtk/WindowSurfaceWayland.cpp ++++ b/widget/gtk/WindowSurfaceWayland.cpp +@@ -890,8 +890,12 @@ + } + + WindowImageSurface::WindowImageSurface( +- gfx::SourceSurface* aSurface, const LayoutDeviceIntRegion& aUpdateRegion) +- : mSurface(aSurface), mUpdateRegion(aUpdateRegion){}; ++ gfxImageSurface* aImageSurface, const LayoutDeviceIntRegion& aUpdateRegion) ++ : mImageSurface(aImageSurface), mUpdateRegion(aUpdateRegion) { ++ mSurface = gfx::Factory::CreateSourceSurfaceForCairoSurface( ++ mImageSurface->CairoSurface(), mImageSurface->GetSize(), ++ mImageSurface->Format()); ++} + + void WindowSurfaceWayland::DrawDelayedImageCommits( + gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { +@@ -915,36 +919,24 @@ + LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__, + (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); + +- RefPtr surf = +- gfx::Factory::CreateSourceSurfaceForCairoSurface( +- mImageSurface->CairoSurface(), mImageSurface->GetSize(), +- mImageSurface->Format()); +- if (!surf) { +- NS_WARNING("Failed to create source cairo surface!"); +- return false; +- } ++ mDelayedImageCommits.AppendElement( ++ WindowImageSurface(mImageSurface, aRegion)); ++ // mImageSurface is owned by mDelayedImageCommits ++ mImageSurface = nullptr; + + RefPtr dt = LockWaylandBuffer( + /* aCanSwitchBuffer */ mWholeWindowBufferDamage); +- if (dt) { +- LOGWAYLAND( +- (" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", +- long(mDelayedImageCommits.Length() + 1))); +- +- // Draw any delayed image commits first +- DrawDelayedImageCommits(dt, aWaylandBufferDamage); +- // Draw image from recent WindowSurfaceWayland::Lock(). +- WindowImageSurface::Draw(surf, dt, aRegion); +- // Submit all drawing to final Wayland buffer upload +- aWaylandBufferDamage.OrWith(aRegion); +- UnlockWaylandBuffer(); +- } else { +- mDelayedImageCommits.AppendElement(WindowImageSurface(surf, aRegion)); +- LOGWAYLAND((" Added WindowImageSurfaces, cached surfaces %ld\n", +- long(mDelayedImageCommits.Length()))); ++ if (!dt) { + return false; + } + ++ LOGWAYLAND((" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", ++ long(mDelayedImageCommits.Length() + 1))); ++ ++ // Draw any delayed image commits first ++ DrawDelayedImageCommits(dt, aWaylandBufferDamage); ++ UnlockWaylandBuffer(); ++ + return true; + } + +@@ -980,23 +972,6 @@ + LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); + LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); + +- if (!mDrawToWaylandBufferDirectly) { +- MOZ_ASSERT(mDelayedImageCommits.Length(), +- "Indirect drawing without any image?"); +- +- // There's some cached drawings - try to flush them now. +- RefPtr dt = LockWaylandBuffer( +- /* aCanSwitchBuffer */ mWholeWindowBufferDamage); +- +- if (dt) { +- LOGWAYLAND(("%s [%p] flushed indirect drawing\n", __PRETTY_FUNCTION__, +- (void*)this)); +- DrawDelayedImageCommits(dt, mWaylandBufferDamage); +- UnlockWaylandBuffer(); +- mDrawToWaylandBufferDirectly = true; +- } +- } +- + wl_surface* waylandSurface = mWindow->GetWaylandSurface(); + if (!waylandSurface) { + LOGWAYLAND(("%s [%p] mWindow->GetWaylandSurface() failed, delay commit.\n", +@@ -1105,6 +1080,7 @@ + mWaylandBufferDamage.OrWith(aInvalidRegion); + } + UnlockWaylandBuffer(); ++ mPendingCommit = true; + } else { + MOZ_ASSERT(!mWaylandBuffer->IsLocked(), + "Drawing to already locked buffer?"); +@@ -1112,12 +1088,13 @@ + mWaylandBufferDamage)) { + // Our cached drawing is flushed, we can draw fullscreen again. + mDrawToWaylandBufferDirectly = true; ++ mPendingCommit = true; + } + } + +- // We're ready to commit. +- mPendingCommit = true; +- CommitWaylandBuffer(); ++ if (mPendingCommit) { ++ CommitWaylandBuffer(); ++ } + } + + void WindowSurfaceWayland::FrameCallbackHandler() { + diff --git a/mozilla-1579794-2.patch b/mozilla-1579794-2.patch new file mode 100644 index 0000000..a8c249b --- /dev/null +++ b/mozilla-1579794-2.patch @@ -0,0 +1,166 @@ +diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h +--- a/widget/gtk/WindowSurfaceWayland.h ++++ b/widget/gtk/WindowSurfaceWayland.h +@@ -204,7 +204,6 @@ + const LayoutDeviceIntRegion& aRegion, + LayoutDeviceIntRegion& aWaylandBufferDamage); + void CommitWaylandBuffer(); +- void CalcRectScale(LayoutDeviceIntRect& aRect, int scale); + + void DrawDelayedImageCommits(gfx::DrawTarget* aDrawTarget, + LayoutDeviceIntRegion& aWaylandBufferDamage); +diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp +--- a/widget/gtk/WindowSurfaceWayland.cpp ++++ b/widget/gtk/WindowSurfaceWayland.cpp +@@ -951,16 +951,6 @@ + } + } + +-void WindowSurfaceWayland::CalcRectScale(LayoutDeviceIntRect& aRect, +- int aScale) { +- aRect.x = aRect.x / aScale; +- aRect.y = aRect.y / aScale; +- +- // We don't need exact damage size - just safely cover the round errors. +- aRect.width = (aRect.width / aScale) + 2; +- aRect.height = (aRect.height / aScale) + 2; +-} +- + void WindowSurfaceWayland::CommitWaylandBuffer() { + MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); + +@@ -1022,16 +1012,10 @@ + mWholeWindowBufferDamage = false; + mNeedScaleFactorUpdate = true; + } else { +- gint scaleFactor = mWindow->GdkScaleFactor(); + for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); + iter.Next()) { + mozilla::LayoutDeviceIntRect r = iter.Get(); +- // We need to remove the scale factor because the wl_surface_damage +- // also multiplies by current scale factor. +- if (scaleFactor > 1) { +- CalcRectScale(r, scaleFactor); +- } +- wl_surface_damage(waylandSurface, r.x, r.y, r.width, r.height); ++ wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); + } + } + +diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp +--- a/widget/gtk/mozcontainer.cpp ++++ b/widget/gtk/mozcontainer.cpp +@@ -578,16 +578,12 @@ + return nullptr; + } + GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(container)); ++ nsWaylandDisplay* waylandDisplay = WaylandDisplayGet(display); + + // Available as of GTK 3.8+ +- static auto sGdkWaylandDisplayGetWlCompositor = +- (wl_compositor * (*)(GdkDisplay*)) +- dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_compositor"); +- struct wl_compositor* compositor = +- sGdkWaylandDisplayGetWlCompositor(display); ++ struct wl_compositor* compositor = waylandDisplay->GetCompositor(); + container->surface = wl_compositor_create_surface(compositor); + +- nsWaylandDisplay* waylandDisplay = WaylandDisplayGet(display); + container->subsurface = wl_subcompositor_get_subsurface( + waylandDisplay->GetSubcompositor(), container->surface, + moz_container_get_gtk_container_surface(container)); +diff --git a/widget/gtk/mozwayland/mozwayland.h b/widget/gtk/mozwayland/mozwayland.h +--- a/widget/gtk/mozwayland/mozwayland.h ++++ b/widget/gtk/mozwayland/mozwayland.h +@@ -108,6 +108,17 @@ + } + #endif + ++#ifndef WL_SURFACE_DAMAGE_BUFFER ++# define WL_SURFACE_DAMAGE_BUFFER 9 ++ ++static inline void wl_surface_damage_buffer(struct wl_surface* wl_surface, ++ int32_t x, int32_t y, int32_t width, ++ int32_t height) { ++ wl_proxy_marshal((struct wl_proxy*)wl_surface, WL_SURFACE_DAMAGE_BUFFER, x, y, ++ width, height); ++} ++#endif ++ + #ifdef __cplusplus + } + #endif +diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c +--- a/widget/gtk/mozwayland/mozwayland.c ++++ b/widget/gtk/mozwayland/mozwayland.c +@@ -30,6 +30,7 @@ + const struct wl_interface wl_seat_interface; + const struct wl_interface wl_surface_interface; + const struct wl_interface wl_subsurface_interface; ++const struct wl_interface wl_compositor_interface; + const struct wl_interface wl_subcompositor_interface; + #pragma GCC visibility pop + +diff --git a/widget/gtk/nsWaylandDisplay.h b/widget/gtk/nsWaylandDisplay.h +--- a/widget/gtk/nsWaylandDisplay.h ++++ b/widget/gtk/nsWaylandDisplay.h +@@ -45,6 +45,7 @@ + MessageLoop* GetDispatcherThreadLoop() { return mDispatcherThreadLoop; } + wl_display* GetDisplay() { return mDisplay; }; + wl_event_queue* GetEventQueue() { return mEventQueue; }; ++ wl_compositor* GetCompositor(void) { return mCompositor; }; + wl_subcompositor* GetSubcompositor(void) { return mSubcompositor; }; + wl_data_device_manager* GetDataDeviceManager(void) { + return mDataDeviceManager; +@@ -56,6 +57,7 @@ + }; + + void SetShm(wl_shm* aShm); ++ void SetCompositor(wl_compositor* aCompositor); + void SetSubcompositor(wl_subcompositor* aSubcompositor); + void SetDataDeviceManager(wl_data_device_manager* aDataDeviceManager); + void SetSeat(wl_seat* aSeat); +@@ -88,6 +90,7 @@ + wl_display* mDisplay; + wl_event_queue* mEventQueue; + wl_data_device_manager* mDataDeviceManager; ++ wl_compositor* mCompositor; + wl_subcompositor* mSubcompositor; + wl_seat* mSeat; + wl_shm* mShm; +diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp +--- a/widget/gtk/nsWaylandDisplay.cpp ++++ b/widget/gtk/nsWaylandDisplay.cpp +@@ -116,6 +116,10 @@ + + void nsWaylandDisplay::SetShm(wl_shm* aShm) { mShm = aShm; } + ++void nsWaylandDisplay::SetCompositor(wl_compositor* aCompositor) { ++ mCompositor = aCompositor; ++} ++ + void nsWaylandDisplay::SetSubcompositor(wl_subcompositor* aSubcompositor) { + mSubcompositor = aSubcompositor; + } +@@ -223,6 +227,12 @@ + wl_proxy_set_queue((struct wl_proxy*)primary_selection_device_manager, + display->GetEventQueue()); + display->SetPrimarySelectionDeviceManager(primary_selection_device_manager); ++ } else if (strcmp(interface, "wl_compositor") == 0) { ++ // Requested wl_compositor version 4 as we need wl_surface_damage_buffer(). ++ auto compositor = static_cast( ++ wl_registry_bind(registry, id, &wl_compositor_interface, 4)); ++ wl_proxy_set_queue((struct wl_proxy*)compositor, display->GetEventQueue()); ++ display->SetCompositor(compositor); + } else if (strcmp(interface, "wl_subcompositor") == 0) { + auto subcompositor = static_cast( + wl_registry_bind(registry, id, &wl_subcompositor_interface, 1)); +@@ -306,6 +316,7 @@ + mDisplay(aDisplay), + mEventQueue(nullptr), + mDataDeviceManager(nullptr), ++ mCompositor(nullptr), + mSubcompositor(nullptr), + mSeat(nullptr), + mShm(nullptr), + From 25a13aa0dcdd8b60f5e49d8a783840fd17cdea8b Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 11 Sep 2019 14:47:20 +0200 Subject: [PATCH 0057/1136] Added fix for mozbz#1579849 - partial screen update when page switches --- firefox.spec | 8 +++++++- mozilla-1579849.patch | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 mozilla-1579849.patch diff --git a/firefox.spec b/firefox.spec index e23bf3b..9e929a5 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 4%{?pre_tag}%{?dist} +Release: 5%{?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 @@ -164,6 +164,7 @@ Patch581: mozilla-1574036.patch Patch582: mozilla-1576268.patch Patch583: mozilla-1579794-1.patch Patch584: mozilla-1579794-2.patch +Patch585: mozilla-1579849.patch # PGO/LTO patches Patch600: pgo.patch @@ -380,6 +381,7 @@ This package contains results of tests executed during build. %patch582 -p1 -b .mozilla-1576268 %patch583 -p1 -b .mozilla-1579794-1 %patch584 -p1 -b .mozilla-1579794-2 +%patch585 -p1 -b .mozilla-1579849 # PGO patches %patch600 -p1 -b .pgo @@ -956,6 +958,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Sep 11 2019 Martin Stransky - 69.0-5 +- Added fix for mozbz#1579849 - partial screen update when + page switches. + * Wed Sep 11 2019 Martin Stransky - 69.0-4 - Added fix for mozbz#1579794 - Flickering on video playback on 4k/HiDPI displays. diff --git a/mozilla-1579849.patch b/mozilla-1579849.patch new file mode 100644 index 0000000..fb3e8c2 --- /dev/null +++ b/mozilla-1579849.patch @@ -0,0 +1,14 @@ +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.old firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.old 2019-09-11 14:34:36.687382704 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-11 14:39:02.000391578 +0200 +@@ -751,6 +751,10 @@ static bool IsPopupFullScreenUpdate(Layo + already_AddRefed WindowSurfaceWayland::Lock( + const LayoutDeviceIntRegion& aRegion) { + MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); ++ ++ // Disable all commits from frame callback handler and delayed comit handler ++ // as we're updated by gecko compositor. ++ mPendingCommit = false; + + LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); + gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); From b686f27745b168b3c60ca8a5cbc5a7da1c687ac1 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 12 Sep 2019 15:24:58 +0200 Subject: [PATCH 0058/1136] Fix for disappearing webrtc popups --- firefox.spec | 2 ++ mozilla-1580174-webrtc-popup.patch | 51 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 mozilla-1580174-webrtc-popup.patch diff --git a/firefox.spec b/firefox.spec index 9e929a5..1719e43 100644 --- a/firefox.spec +++ b/firefox.spec @@ -152,6 +152,7 @@ Patch418: mozilla-1512162.patch Patch419: mozilla-1568569.patch Patch420: mozilla-1566876-webrtc-ind.patch Patch421: mozilla-1579023.patch +Patch422: mozilla-1580174-webrtc-popup.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -382,6 +383,7 @@ This package contains results of tests executed during build. %patch583 -p1 -b .mozilla-1579794-1 %patch584 -p1 -b .mozilla-1579794-2 %patch585 -p1 -b .mozilla-1579849 +%patch422 -p1 -b .1580174-webrtc-popup # PGO patches %patch600 -p1 -b .pgo diff --git a/mozilla-1580174-webrtc-popup.patch b/mozilla-1580174-webrtc-popup.patch new file mode 100644 index 0000000..2d154eb --- /dev/null +++ b/mozilla-1580174-webrtc-popup.patch @@ -0,0 +1,51 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1155,6 +1155,28 @@ + } + } + ++bool IsPopupWithoutToplevelParent(nsMenuPopupFrame* aMenuPopupFrame) { ++ // Check if the popup is autocomplete (like tags autocomplete ++ // in the bookmark edit popup). ++ nsAtom* popupId = aMenuPopupFrame->GetContent()->GetID(); ++ if (popupId && popupId->Equals(NS_LITERAL_STRING("PopupAutoComplete"))) { ++ return true; ++ } ++ ++ // Check if the popup is in popupnotificationcontent (like choosing capture ++ // device when starting webrtc session). ++ nsIFrame* parentFrame = aMenuPopupFrame->GetParent(); ++ if (!parentFrame) { ++ return false; ++ } ++ parentFrame = parentFrame->GetParent(); ++ if (parentFrame && parentFrame->GetContent()->NodeName().EqualsLiteral( ++ "popupnotificationcontent")) { ++ return true; ++ } ++ return false; ++} ++ + // Wayland keeps strong popup window hierarchy. We need to track active + // (visible) popup windows and make sure we hide popup on the same level + // before we open another one on that level. It means that every open +@@ -1211,10 +1233,14 @@ + LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow)); + + // If the popup is a regular menu but GetParentMenuWidget() returns +- // nullptr which means it's connected non-menu parent +- // (bookmark toolbar for instance). ++ // nullptr which means is not a submenu of any other menu. + // In this case use a parent given at nsWindow::Create(). +- if (!parentWindow && !menuPopupFrame->IsContextMenu()) { ++ // But we have to avoid using mToplevelParentWindow in case the popup ++ // is in 'popupnotificationcontent' element or autocomplete popup, ++ // otherwise the popupnotification would disappear when for ++ // example opening a popup with microphone selection. ++ if (!parentWindow && !menuPopupFrame->IsContextMenu() && ++ !IsPopupWithoutToplevelParent(menuPopupFrame)) { + parentWindow = + get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow)); + } + From 9b804de1e9df481a535e369083ae9e255cbceae6 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 16 Sep 2019 11:13:16 +0200 Subject: [PATCH 0059/1136] Added fixes for mozbz#1579823, mozbz#1580152 --- firefox.spec | 9 +- mozilla-1579823.patch | 306 +++++++++++++++++++++ mozilla-1580152.patch | 617 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 931 insertions(+), 1 deletion(-) create mode 100644 mozilla-1579823.patch create mode 100644 mozilla-1580152.patch diff --git a/firefox.spec b/firefox.spec index 1719e43..88f5fc6 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.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 @@ -166,6 +166,8 @@ Patch582: mozilla-1576268.patch Patch583: mozilla-1579794-1.patch Patch584: mozilla-1579794-2.patch Patch585: mozilla-1579849.patch +Patch586: mozilla-1579823.patch +Patch587: mozilla-1580152.patch # PGO/LTO patches Patch600: pgo.patch @@ -384,6 +386,8 @@ This package contains results of tests executed during build. %patch584 -p1 -b .mozilla-1579794-2 %patch585 -p1 -b .mozilla-1579849 %patch422 -p1 -b .1580174-webrtc-popup +%patch586 -p1 -b .mozilla-1579823 +%patch587 -p1 -b .mozilla-1580152 # PGO patches %patch600 -p1 -b .pgo @@ -960,6 +964,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Sep 16 2019 Martin Stransky - 69.0-6 +- Added fixes for mozbz#1579823, mozbz#1580152 + * Wed Sep 11 2019 Martin Stransky - 69.0-5 - Added fix for mozbz#1579849 - partial screen update when page switches. diff --git a/mozilla-1579823.patch b/mozilla-1579823.patch new file mode 100644 index 0000000..9e00d4f --- /dev/null +++ b/mozilla-1579823.patch @@ -0,0 +1,306 @@ +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1579823 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1579823 2019-09-12 07:53:06.119602913 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-12 07:54:47.410105270 +0200 +@@ -326,13 +326,13 @@ void WindowBackBufferShm::Create(int aWi + mHeight = aHeight; + + LOGWAYLAND(( +- "%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, ++ "WindowBackBufferShm::Create [%p] wl_buffer %p ID %d\n", (void*)this, + (void*)mWaylandBuffer, + mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); + } + + void WindowBackBufferShm::Release() { +- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND(("WindowBackBufferShm::Release [%p]\n", (void*)this)); + + wl_buffer_destroy(mWaylandBuffer); + mWidth = mHeight = 0; +@@ -358,8 +358,8 @@ WindowBackBufferShm::~WindowBackBufferSh + bool WindowBackBufferShm::Resize(int aWidth, int aHeight) { + if (aWidth == mWidth && aHeight == mHeight) return true; + +- LOGWAYLAND( +- ("%s [%p] %d %d\n", __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); ++ LOGWAYLAND(("WindowBackBufferShm::Resize [%p] %d %d\n", (void*)this, aWidth, ++ aHeight)); + + Release(); + Create(aWidth, aHeight); +@@ -369,7 +369,7 @@ bool WindowBackBufferShm::Resize(int aWi + + void WindowBackBuffer::Attach(wl_surface* aSurface) { + LOGWAYLAND( +- ("%s [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, ++ ("WindowBackBuffer::Attach [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", + (void*)this, (void*)aSurface, + aSurface ? wl_proxy_get_id((struct wl_proxy*)aSurface) : -1, + (void*)GetWlBuffer(), +@@ -382,8 +382,8 @@ void WindowBackBuffer::Attach(wl_surface + } + + void WindowBackBufferShm::Detach(wl_buffer* aBuffer) { +- LOGWAYLAND(("%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, +- (void*)aBuffer, ++ LOGWAYLAND(("WindowBackBufferShm::Detach [%p] wl_buffer %p ID %d\n", ++ (void*)this, (void*)aBuffer, + aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1)); + + mAttached = false; +@@ -404,7 +404,7 @@ bool WindowBackBufferShm::SetImageDataFr + + already_AddRefed WindowBackBufferShm::Lock() { + LOGWAYLAND(( +- "%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, ++ "WindowBackBufferShm::Lock [%p] [%d x %d] wl_buffer %p ID %d\n", + (void*)this, mWidth, mHeight, (void*)mWaylandBuffer, + mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); + +@@ -419,16 +419,17 @@ WindowBackBufferDMABuf::WindowBackBuffer + nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight) + : WindowBackBuffer(aWaylandDisplay) { + mDMAbufSurface.Create(aWidth, aHeight); +- +- LOGWAYLAND(("%s [%p] Created DMABuf buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, aWidth, aHeight)); ++ LOGWAYLAND( ++ ("WindowBackBufferDMABuf::WindowBackBufferDMABuf [%p] Created DMABuf " ++ "buffer [%d x %d]\n", ++ (void*)this, aWidth, aHeight)); + } + + WindowBackBufferDMABuf::~WindowBackBufferDMABuf() { mDMAbufSurface.Release(); } + + already_AddRefed WindowBackBufferDMABuf::Lock() { + LOGWAYLAND( +- ("%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, ++ ("WindowBackBufferDMABuf::Lock [%p] [%d x %d] wl_buffer %p ID %d\n", + (void*)this, GetWidth(), GetHeight(), (void*)GetWlBuffer(), + GetWlBuffer() ? wl_proxy_get_id((struct wl_proxy*)GetWlBuffer()) : -1)); + +@@ -534,7 +535,8 @@ WindowSurfaceWayland::~WindowSurfaceWayl + bool WindowSurfaceWayland::UseDMABufBackend() { + if (!mUseDMABufInitialized) { + mUseDMABuf = nsWaylandDisplay::IsDMABufEnabled(); +- LOGWAYLAND(("%s DMABuf state %d\n", __PRETTY_FUNCTION__, mUseDMABuf)); ++ LOGWAYLAND(("WindowSurfaceWayland::UseDMABufBackend DMABuf state %d\n", ++ mUseDMABuf)); + mUseDMABufInitialized = true; + } + return mUseDMABuf; +@@ -567,15 +569,16 @@ WindowBackBuffer* WindowSurfaceWayland:: + + WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( + bool aCanSwitchBuffer) { +- LOGWAYLAND(("%s [%p] Requested buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::GetWaylandBufferToDraw [%p] Requested buffer [%d " ++ "x %d]\n", ++ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); + + // There's no buffer created yet, create a new one. + if (!mWaylandBuffer) { + MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage, + "Created new buffer for partial drawing!"); +- LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, mBufferScreenRect.width, ++ LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width, + mBufferScreenRect.height)); + + mWaylandBuffer = +@@ -586,21 +589,19 @@ WindowBackBuffer* WindowSurfaceWayland:: + + #ifdef DEBUG + if (mWaylandBuffer->IsAttached()) { +- LOGWAYLAND(("%s [%p] Buffer %p is attached, need to find a new one.\n", +- __PRETTY_FUNCTION__, (void*)this, mWaylandBuffer)); ++ LOGWAYLAND((" Buffer %p is attached, need to find a new one.\n", ++ mWaylandBuffer)); + } + #endif + + // Reuse existing buffer + if (!mWaylandBuffer->IsAttached()) { +- LOGWAYLAND( +- ("%s [%p] Use recent buffer.\n", __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND((" Use recent buffer.\n")); + + if (mWaylandBuffer->IsMatchingSize(mBufferScreenRect.width, + mBufferScreenRect.height)) { +- LOGWAYLAND(("%s [%p] Size is ok, use the buffer [%d x %d]\n", +- __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, +- mBufferScreenRect.height)); ++ LOGWAYLAND((" Size is ok, use the buffer [%d x %d]\n", ++ mBufferScreenRect.width, mBufferScreenRect.height)); + return mWaylandBuffer; + } + +@@ -609,9 +610,8 @@ WindowBackBuffer* WindowSurfaceWayland:: + return nullptr; + } + +- LOGWAYLAND(("%s [%p] Reuse buffer with resize [%d x %d]\n", +- __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, +- mBufferScreenRect.height)); ++ LOGWAYLAND((" Reuse buffer with resize [%d x %d]\n", ++ mBufferScreenRect.width, mBufferScreenRect.height)); + + mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); + // There's a chance that scale factor has been changed +@@ -629,8 +629,7 @@ WindowBackBuffer* WindowSurfaceWayland:: + for (availableBuffer = 0; availableBuffer < BACK_BUFFER_NUM; + availableBuffer++) { + if (!mBackupBuffer[availableBuffer]) { +- LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, mBufferScreenRect.width, ++ LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width, + mBufferScreenRect.height)); + mBackupBuffer[availableBuffer] = CreateWaylandBuffer( + mBufferScreenRect.width, mBufferScreenRect.height); +@@ -643,8 +642,7 @@ WindowBackBuffer* WindowSurfaceWayland:: + } + + if (MOZ_UNLIKELY(availableBuffer == BACK_BUFFER_NUM)) { +- LOGWAYLAND(("%s [%p] No drawing buffer available!\n", __PRETTY_FUNCTION__, +- (void*)this)); ++ LOGWAYLAND((" No drawing buffer available!\n")); + NS_WARNING("No drawing buffer available"); + return nullptr; + } +@@ -653,17 +651,15 @@ WindowBackBuffer* WindowSurfaceWayland:: + mWaylandBuffer = mBackupBuffer[availableBuffer]; + mBackupBuffer[availableBuffer] = lastWaylandBuffer; + +- LOGWAYLAND(("%s [%p] Buffer flip new back %p new front %p \n", +- __PRETTY_FUNCTION__, (void*)this, (void*)lastWaylandBuffer, +- (void*)mWaylandBuffer)); ++ LOGWAYLAND((" Buffer flip new back %p new front %p \n", ++ (void*)lastWaylandBuffer, (void*)mWaylandBuffer)); + + mNeedScaleFactorUpdate = true; + + bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize( + mBufferScreenRect.width, mBufferScreenRect.height); + if (bufferNeedsResize) { +- LOGWAYLAND(("%s [%p] Resize buffer to [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, mBufferScreenRect.width, ++ LOGWAYLAND((" Resize buffer to [%d x %d]\n", mBufferScreenRect.width, + mBufferScreenRect.height)); + mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); + } +@@ -675,8 +671,8 @@ already_AddRefed Window + bool aCanSwitchBuffer) { + WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer); + +- LOGWAYLAND(("%s [%p] Got buffer %p\n", __PRETTY_FUNCTION__, (void*)this, +- (void*)buffer)); ++ LOGWAYLAND(("WindowSurfaceWayland::LockWaylandBuffer [%p] Got buffer %p\n", ++ (void*)this, (void*)buffer)); + + if (!buffer) { + return nullptr; +@@ -691,7 +687,7 @@ already_AddRefed Window + } + + void WindowSurfaceWayland::UnlockWaylandBuffer() { +- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND(("WindowSurfaceWayland::UnlockWaylandBuffer [%p]\n", (void*)this)); + mWaylandBuffer->Unlock(); + } + +@@ -774,9 +770,11 @@ already_AddRefed Window + mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup; + } + +- LOGWAYLAND(("%s [%p] lockSize [%d x %d] windowSize [%d x %d]\n", +- __PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height, +- lockedScreenRect.width, lockedScreenRect.height)); ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::Lock [%p] lockSize [%d x %d] windowSize [%d x " ++ "%d]\n", ++ (void*)this, lockSize.width, lockSize.height, lockedScreenRect.width, ++ lockedScreenRect.height)); + LOGWAYLAND((" nsWindow = %p\n", mWindow)); + LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup())); + LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup)); +@@ -892,8 +890,10 @@ bool WindowSurfaceWayland::CommitImageSu + MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?"); + #endif + +- LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__, +- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer [%p] " ++ "screenSize [%d x %d]\n", ++ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); + + mDelayedImageCommits.AppendElement( + WindowImageSurface(mImageSurface, aRegion)); +@@ -930,7 +930,7 @@ static void WaylandBufferDelayCommitHand + void WindowSurfaceWayland::CommitWaylandBuffer() { + MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); + +- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); + LOGWAYLAND( + (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); + LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); +@@ -940,8 +940,8 @@ void WindowSurfaceWayland::CommitWayland + + wl_surface* waylandSurface = mWindow->GetWaylandSurface(); + if (!waylandSurface) { +- LOGWAYLAND(("%s [%p] mWindow->GetWaylandSurface() failed, delay commit.\n", +- __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND((" [%p] mWindow->GetWaylandSurface() failed, delay commit.\n", ++ (void*)this)); + + // Target window is not created yet - delay the commit. This can happen only + // when the window is newly created and there's no active +@@ -969,8 +969,7 @@ void WindowSurfaceWayland::CommitWayland + // We have an active frame callback request so handle it. + if (mFrameCallback) { + if (waylandSurface == mLastCommittedSurface) { +- LOGWAYLAND(("%s [%p] wait for frame callback.\n", __PRETTY_FUNCTION__, +- (void*)this)); ++ LOGWAYLAND((" [%p] wait for frame callback.\n", (void*)this)); + // We have an active frame callback pending from our recent surface. + // It means we should defer the commit to FrameCallbackHandler(). + return; +@@ -1022,10 +1021,11 @@ void WindowSurfaceWayland::Commit(const + gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); + gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); + +- LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", +- __PRETTY_FUNCTION__, (void*)this, lockSize.width, +- lockSize.height, mBufferScreenRect.width, +- mBufferScreenRect.height)); ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::Commit [%p] lockSize [%d x %d] screenSize [%d " ++ "x %d]\n", ++ (void*)this, lockSize.width, lockSize.height, mBufferScreenRect.width, ++ mBufferScreenRect.height)); + LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", + mDrawToWaylandBufferDirectly)); + LOGWAYLAND( +@@ -1064,7 +1064,8 @@ void WindowSurfaceWayland::FrameCallback + MOZ_ASSERT(mLastCommittedSurface != nullptr, + "FrameCallbackHandler() called without valid wl_surface!"); + +- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::FrameCallbackHandler [%p]\n", (void*)this)); + + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; +@@ -1077,7 +1078,8 @@ void WindowSurfaceWayland::FrameCallback + void WindowSurfaceWayland::DelayedCommitHandler() { + MOZ_ASSERT(mDelayedCommitHandle != nullptr, "Missing mDelayedCommitHandle!"); + +- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::DelayedCommitHandler [%p]\n", (void*)this)); + + *mDelayedCommitHandle = nullptr; + free(mDelayedCommitHandle); diff --git a/mozilla-1580152.patch b/mozilla-1580152.patch new file mode 100644 index 0000000..43a5264 --- /dev/null +++ b/mozilla-1580152.patch @@ -0,0 +1,617 @@ +diff -up firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 firefox-69.0/widget/gtk/mozwayland/mozwayland.h +--- firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 2019-09-16 10:43:50.214742949 +0200 ++++ firefox-69.0/widget/gtk/mozwayland/mozwayland.h 2019-09-16 10:43:50.222742921 +0200 +@@ -27,6 +27,9 @@ MOZ_EXPORT struct wl_proxy* wl_proxy_mar + struct wl_proxy* proxy, uint32_t opcode, + const struct wl_interface* interface, ...); + ++MOZ_EXPORT void* wl_proxy_create_wrapper(void* proxy); ++MOZ_EXPORT void wl_proxy_wrapper_destroy(void* proxy_wrapper); ++ + /* We need implement some missing functions from wayland-client-protocol.h + */ + #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM +diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 firefox-69.0/widget/gtk/nsWaylandDisplay.cpp +--- firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 2019-09-16 10:43:50.215742946 +0200 ++++ firefox-69.0/widget/gtk/nsWaylandDisplay.cpp 2019-09-16 10:50:58.647224684 +0200 +@@ -243,6 +243,61 @@ bool nsWaylandDisplay::DispatchEventQueu + return true; + } + ++void nsWaylandDisplay::SyncEnd() { ++ wl_callback_destroy(mSyncCallback); ++ mSyncCallback = NULL; ++} ++ ++static void wayland_sync_callback(void* data, struct wl_callback* callback, ++ uint32_t time) { ++ auto display = static_cast(data); ++ display->SyncEnd(); ++} ++ ++static const struct wl_callback_listener sync_callback_listener = { ++ .done = wayland_sync_callback}; ++ ++void nsWaylandDisplay::SyncBegin() { ++ WaitForSyncEnd(); ++ ++ // Use wl_display_sync() to synchronize wayland events. ++ // See dri2_wl_swap_buffers_with_damage() from MESA ++ // or wl_display_roundtrip_queue() from wayland-client. ++ struct wl_display* displayWrapper = ++ static_cast(wl_proxy_create_wrapper((void*)mDisplay)); ++ if (!displayWrapper) { ++ NS_WARNING("Failed to create wl_proxy wrapper!"); ++ return; ++ } ++ ++ wl_proxy_set_queue((struct wl_proxy*)displayWrapper, mEventQueue); ++ mSyncCallback = wl_display_sync(displayWrapper); ++ wl_proxy_wrapper_destroy((void*)displayWrapper); ++ ++ if (!mSyncCallback) { ++ NS_WARNING("Failed to create wl_display_sync callback!"); ++ return; ++ } ++ ++ wl_callback_add_listener(mSyncCallback, &sync_callback_listener, this); ++ wl_display_flush(mDisplay); ++} ++ ++void nsWaylandDisplay::WaitForSyncEnd() { ++ // We're done here ++ if (!mSyncCallback) { ++ return; ++ } ++ ++ while (mSyncCallback != NULL) { ++ if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1) { ++ NS_WARNING("wl_display_dispatch_queue failed!"); ++ SyncEnd(); ++ return; ++ } ++ } ++} ++ + bool nsWaylandDisplay::Matches(wl_display* aDisplay) { + return mThreadId == PR_GetCurrentThread() && aDisplay == mDisplay; + } +@@ -305,6 +360,7 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di + mSubcompositor(nullptr), + mSeat(nullptr), + mShm(nullptr), ++ mSyncCallback(nullptr), + mPrimarySelectionDeviceManager(nullptr), + mRegistry(nullptr), + mGbmDevice(nullptr), +diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 firefox-69.0/widget/gtk/nsWaylandDisplay.h +--- firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 2019-09-16 10:43:50.215742946 +0200 ++++ firefox-69.0/widget/gtk/nsWaylandDisplay.h 2019-09-16 10:43:50.222742921 +0200 +@@ -41,6 +41,11 @@ class nsWaylandDisplay { + virtual ~nsWaylandDisplay(); + + bool DispatchEventQueue(); ++ ++ void SyncBegin(); ++ void SyncEnd(); ++ void WaitForSyncEnd(); ++ + bool Matches(wl_display* aDisplay); + + MessageLoop* GetDispatcherThreadLoop() { return mDispatcherThreadLoop; } +@@ -90,6 +95,7 @@ class nsWaylandDisplay { + wl_subcompositor* mSubcompositor; + wl_seat* mSeat; + wl_shm* mShm; ++ wl_callback* mSyncCallback; + gtk_primary_selection_device_manager* mPrimarySelectionDeviceManager; + wl_registry* mRegistry; + zwp_linux_dmabuf_v1* mDmabuf; +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 2019-09-16 10:43:50.220742928 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-16 11:08:00.079998054 +0200 +@@ -32,6 +32,9 @@ extern mozilla::LazyLogModule gWidgetWay + # define LOGWAYLAND(args) + #endif /* MOZ_LOGGING */ + ++// Maximal compositin timeout it miliseconds ++#define COMPOSITING_TIMEOUT 200 ++ + namespace mozilla { + namespace widget { + +@@ -198,6 +201,10 @@ available and gfx.wayland_dmabuf_backend + #define BUFFER_BPP 4 + gfx::SurfaceFormat WindowBackBuffer::mFormat = gfx::SurfaceFormat::B8G8R8A8; + ++nsWaylandDisplay* WindowBackBuffer::GetWaylandDisplay() { ++ return mWindowSurfaceWayland->GetWaylandDisplay(); ++} ++ + int WaylandShmPool::CreateTemporaryFile(int aSize) { + const char* tmppath = getenv("XDG_RUNTIME_DIR"); + MOZ_RELEASE_ASSERT(tmppath, "Missing XDG_RUNTIME_DIR env variable."); +@@ -342,10 +349,11 @@ void WindowBackBufferShm::Clear() { + memset(mShmPool.GetImageData(), 0, mHeight * mWidth * BUFFER_BPP); + } + +-WindowBackBufferShm::WindowBackBufferShm(nsWaylandDisplay* aWaylandDisplay, +- int aWidth, int aHeight) +- : WindowBackBuffer(aWaylandDisplay), +- mShmPool(aWaylandDisplay, aWidth * aHeight * BUFFER_BPP), ++WindowBackBufferShm::WindowBackBufferShm( ++ WindowSurfaceWayland* aWindowSurfaceWayland, int aWidth, int aHeight) ++ : WindowBackBuffer(aWindowSurfaceWayland), ++ mShmPool(aWindowSurfaceWayland->GetWaylandDisplay(), ++ aWidth * aHeight * BUFFER_BPP), + mWaylandBuffer(nullptr), + mWidth(aWidth), + mHeight(aHeight), +@@ -387,6 +395,9 @@ void WindowBackBufferShm::Detach(wl_buff + aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1)); + + mAttached = false; ++ ++ // Commit any potential cached drawings from latest Lock()/Commit() cycle. ++ mWindowSurfaceWayland->CommitWaylandBuffer(); + } + + bool WindowBackBufferShm::SetImageDataFromBuffer( +@@ -416,8 +427,8 @@ already_AddRefed Window + } + + WindowBackBufferDMABuf::WindowBackBufferDMABuf( +- nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight) +- : WindowBackBuffer(aWaylandDisplay) { ++ WindowSurfaceWayland* aWindowSurfaceWayland, int aWidth, int aHeight) ++ : WindowBackBuffer(aWindowSurfaceWayland) { + mDMAbufSurface.Create(aWidth, aHeight); + LOGWAYLAND( + ("WindowBackBufferDMABuf::WindowBackBufferDMABuf [%p] Created DMABuf " +@@ -475,6 +486,9 @@ bool WindowBackBufferDMABuf::SetImageDat + + void WindowBackBufferDMABuf::Detach(wl_buffer* aBuffer) { + mDMAbufSurface.WLBufferDetach(); ++ ++ // Commit any potential cached drawings from latest Lock()/Commit() cycle. ++ mWindowSurfaceWayland->CommitWaylandBuffer(); + } + + void WindowBackBufferDMABuf::Clear() { mDMAbufSurface.Clear(); } +@@ -496,10 +510,11 @@ WindowSurfaceWayland::WindowSurfaceWayla + mWaylandBuffer(nullptr), + mFrameCallback(nullptr), + mLastCommittedSurface(nullptr), +- mDisplayThreadMessageLoop(MessageLoop::current()), + mDelayedCommitHandle(nullptr), ++ mLastCommitTime(0), + mDrawToWaylandBufferDirectly(true), +- mPendingCommit(false), ++ mBufferPendingCommit(false), ++ mBufferCommitAllowed(false), + mWholeWindowBufferDamage(false), + mBufferNeedsClear(false), + mIsMainThread(NS_IsMainThread()), +@@ -508,7 +523,7 @@ WindowSurfaceWayland::WindowSurfaceWayla + } + + WindowSurfaceWayland::~WindowSurfaceWayland() { +- if (mPendingCommit) { ++ if (mBufferPendingCommit) { + NS_WARNING("Deleted WindowSurfaceWayland with a pending commit!"); + } + +@@ -547,7 +562,7 @@ WindowBackBuffer* WindowSurfaceWayland:: + if (UseDMABufBackend()) { + static bool sDMABufBufferCreated = false; + WindowBackBuffer* buffer = +- new WindowBackBufferDMABuf(mWaylandDisplay, aWidth, aHeight); ++ new WindowBackBufferDMABuf(this, aWidth, aHeight); + if (buffer) { + sDMABufBufferCreated = true; + return buffer; +@@ -564,7 +579,7 @@ WindowBackBuffer* WindowSurfaceWayland:: + } + } + +- return new WindowBackBufferShm(mWaylandDisplay, aWidth, aHeight); ++ return new WindowBackBufferShm(this, aWidth, aHeight); + } + + WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( +@@ -675,6 +690,11 @@ already_AddRefed Window + (void*)this, (void*)buffer)); + + if (!buffer) { ++ if (mLastCommitTime && (g_get_monotonic_time() / 1000) - mLastCommitTime > ++ COMPOSITING_TIMEOUT) { ++ NS_WARNING( ++ "Slow response from Wayland compositor, visual glitches ahead."); ++ } + return nullptr; + } + +@@ -724,10 +744,9 @@ static bool IsPopupFullScreenUpdate(Layo + // box is equal to window borders. + if (aRegion.GetNumRects() > 2) return false; + +- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); +- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); +- +- return (screenRect.width == lockSize.width && ++ IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); ++ return (lockSize.x == 0 && lockSize.y == 0 && ++ screenRect.width == lockSize.width && + screenRect.height == lockSize.height); + } + +@@ -738,8 +757,7 @@ static bool IsPopupFullScreenUpdate(Layo + to clip/buffer the drawing and we can return wl_buffer directly + for drawing. + - mWaylandBuffer is available - that's an ideal situation. +- - mWaylandBuffer is locked by compositor - flip buffers and draw. +- - if we can't flip buffers - go B) ++ - mWaylandBuffer is locked by compositor - go B) + + B) Lock() is requested for part(s) of screen. We need to provide temporary + surface to draw into and copy result (clipped) to target wl_surface. +@@ -747,14 +765,17 @@ static bool IsPopupFullScreenUpdate(Layo + already_AddRefed WindowSurfaceWayland::Lock( + const LayoutDeviceIntRegion& aRegion) { + MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); +- +- // Disable all commits from frame callback handler and delayed comit handler +- // as we're updated by gecko compositor. +- mPendingCommit = false; ++ ++ // Wait until all pending events are processed. There may be queued ++ // wl_buffer release event which releases our wl_buffer for further rendering. ++ mWaylandDisplay->WaitForSyncEnd(); ++ ++ // Disable all commits (from potential frame callback/delayed handlers) ++ // until next WindowSurfaceWayland::Commit() call. ++ mBufferCommitAllowed = false; + + LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); +- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); +- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); ++ gfx::IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); + + // Are we asked for entire nsWindow to draw? + bool isTransparentPopup = +@@ -775,10 +796,10 @@ already_AddRefed Window + } + + LOGWAYLAND( +- ("WindowSurfaceWayland::Lock [%p] lockSize [%d x %d] windowSize [%d x " +- "%d]\n", +- (void*)this, lockSize.width, lockSize.height, lockedScreenRect.width, +- lockedScreenRect.height)); ++ ("WindowSurfaceWayland::Lock [%p] [%d,%d] -> [%d x %d] rects %d " ++ "windowSize [%d x %d]\n", ++ (void*)this, lockSize.x, lockSize.y, lockSize.width, lockSize.height, ++ aRegion.GetNumRects(), lockedScreenRect.width, lockedScreenRect.height)); + LOGWAYLAND((" nsWindow = %p\n", mWindow)); + LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup())); + LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup)); +@@ -789,7 +810,7 @@ already_AddRefed Window + LOGWAYLAND((" mBufferNeedsClear = %d\n", mBufferNeedsClear)); + LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); + +-#if DEBUG ++#if MOZ_LOGGING + if (!(mBufferScreenRect == lockedScreenRect)) { + LOGWAYLAND((" screen size changed\n")); + } +@@ -836,7 +857,7 @@ already_AddRefed Window + mDrawToWaylandBufferDirectly = false; + + LOGWAYLAND((" Indirect drawing.\n")); +- return LockImageSurface(lockSize); ++ return LockImageSurface(gfx::IntSize(lockSize.XMost(), lockSize.YMost())); + } + + void WindowImageSurface::Draw(gfx::SourceSurface* aSurface, +@@ -875,34 +896,42 @@ WindowImageSurface::WindowImageSurface( + mImageSurface->Format()); + } + ++void WindowSurfaceWayland::CacheImageSurface( ++ const LayoutDeviceIntRegion& aRegion) { ++#ifdef MOZ_LOGGING ++ gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); ++ LOGWAYLAND(("WindowSurfaceWayland::CacheImageSurface [%p]\n", (void*)this)); ++ LOGWAYLAND((" rects num %d\n", aRegion.GetNumRects())); ++ LOGWAYLAND((" bounds [ %d, %d] -> [%d x %d]\n", bounds.x, bounds.y, ++ bounds.width, bounds.height)); ++#endif ++ ++ mDelayedImageCommits.AppendElement( ++ WindowImageSurface(mImageSurface, aRegion)); ++ // mImageSurface is owned by mDelayedImageCommits ++ mImageSurface = nullptr; ++ ++ LOGWAYLAND( ++ (" There's %d cached images\n", int(mDelayedImageCommits.Length()))); ++} ++ + void WindowSurfaceWayland::DrawDelayedImageCommits( + gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::DrawDelayedImageCommits [%p]\n", (void*)this)); ++ + for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { + mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); + } + mDelayedImageCommits.Clear(); + } + +-bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer( +- const LayoutDeviceIntRegion& aRegion, +- LayoutDeviceIntRegion& aWaylandBufferDamage) { ++bool WindowSurfaceWayland::CommitImageCacheToWaylandBuffer() { + MOZ_ASSERT(!mDrawToWaylandBufferDirectly); + +-#ifdef DEBUG +- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); +- gfx::Rect rect(bounds); +- MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?"); +-#endif +- +- LOGWAYLAND( +- ("WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer [%p] " +- "screenSize [%d x %d]\n", +- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); +- +- mDelayedImageCommits.AppendElement( +- WindowImageSurface(mImageSurface, aRegion)); +- // mImageSurface is owned by mDelayedImageCommits +- mImageSurface = nullptr; ++ if (!mDelayedImageCommits.Length()) { ++ return false; ++ } + + RefPtr dt = LockWaylandBuffer( + /* aCanSwitchBuffer */ mWholeWindowBufferDamage); +@@ -911,10 +940,10 @@ bool WindowSurfaceWayland::CommitImageSu + } + + LOGWAYLAND((" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", +- long(mDelayedImageCommits.Length() + 1))); ++ long(mDelayedImageCommits.Length()))); + + // Draw any delayed image commits first +- DrawDelayedImageCommits(dt, aWaylandBufferDamage); ++ DrawDelayedImageCommits(dt, mWaylandBufferDamage); + UnlockWaylandBuffer(); + + return true; +@@ -932,7 +961,8 @@ static void WaylandBufferDelayCommitHand + } + + void WindowSurfaceWayland::CommitWaylandBuffer() { +- MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); ++ MOZ_ASSERT(!mWaylandBuffer->IsAttached(), ++ "We can't draw to attached wayland buffer!"); + + LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); + LOGWAYLAND( +@@ -941,6 +971,21 @@ void WindowSurfaceWayland::CommitWayland + LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); + LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); + LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); ++ LOGWAYLAND((" mBufferPendingCommit = %d\n", mBufferPendingCommit)); ++ LOGWAYLAND((" mBufferCommitAllowed = %d\n", mBufferCommitAllowed)); ++ ++ if (!mBufferCommitAllowed) { ++ return; ++ } ++ ++ if (CommitImageCacheToWaylandBuffer()) { ++ mBufferPendingCommit = true; ++ } ++ ++ // There's nothing to do here ++ if (!mBufferPendingCommit) { ++ return; ++ } + + wl_surface* waylandSurface = mWindow->GetWaylandSurface(); + if (!waylandSurface) { +@@ -986,6 +1031,7 @@ void WindowSurfaceWayland::CommitWayland + } + + if (mWholeWindowBufferDamage) { ++ LOGWAYLAND((" send whole screen damage\n")); + wl_surface_damage(waylandSurface, 0, 0, mBufferScreenRect.width, + mBufferScreenRect.height); + mWholeWindowBufferDamage = false; +@@ -994,6 +1040,8 @@ void WindowSurfaceWayland::CommitWayland + for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); + iter.Next()) { + mozilla::LayoutDeviceIntRect r = iter.Get(); ++ LOGWAYLAND((" wl_surface_damage_buffer [%d, %d] -> [%d, %d]\n", r.x, ++ r.y, r.width, r.height)); + wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); + } + } +@@ -1012,24 +1060,31 @@ void WindowSurfaceWayland::CommitWayland + + mWaylandBuffer->Attach(waylandSurface); + mLastCommittedSurface = waylandSurface; ++ mLastCommitTime = g_get_monotonic_time() / 1000; ++ ++ // Ask wl_display to start events synchronization. We're going wait ++ // until all events are processed before next WindowSurfaceWayland::Lock() ++ // as we need freed wl_buffer there. ++ mWaylandDisplay->SyncBegin(); + + // There's no pending commit, all changes are sent to compositor. +- mPendingCommit = false; ++ mBufferPendingCommit = false; + } + + void WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion) { + MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); + +-#ifdef DEBUG +- { +- gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); +- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); ++ // Flush all waiting events explicitly as we need ++ // mWaylandDisplay->FlushEventQueue(); + ++#ifdef MOZ_LOGGING ++ { ++ gfx::IntRect lockSize = aInvalidRegion.GetBounds().ToUnknownRect(); + LOGWAYLAND( +- ("WindowSurfaceWayland::Commit [%p] lockSize [%d x %d] screenSize [%d " +- "x %d]\n", +- (void*)this, lockSize.width, lockSize.height, mBufferScreenRect.width, +- mBufferScreenRect.height)); ++ ("WindowSurfaceWayland::Commit [%p] damage size [%d, %d] -> [%d x %d]" ++ "screenSize [%d x %d]\n", ++ (void*)this, lockSize.x, lockSize.y, lockSize.width, lockSize.height, ++ mBufferScreenRect.width, mBufferScreenRect.height)); + LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", + mDrawToWaylandBufferDirectly)); + LOGWAYLAND( +@@ -1044,21 +1099,15 @@ void WindowSurfaceWayland::Commit(const + mWaylandBufferDamage.OrWith(aInvalidRegion); + } + UnlockWaylandBuffer(); +- mPendingCommit = true; ++ mBufferPendingCommit = true; + } else { + MOZ_ASSERT(!mWaylandBuffer->IsLocked(), + "Drawing to already locked buffer?"); +- if (CommitImageSurfaceToWaylandBuffer(aInvalidRegion, +- mWaylandBufferDamage)) { +- // Our cached drawing is flushed, we can draw fullscreen again. +- mDrawToWaylandBufferDirectly = true; +- mPendingCommit = true; +- } ++ CacheImageSurface(aInvalidRegion); + } + +- if (mPendingCommit) { +- CommitWaylandBuffer(); +- } ++ mBufferCommitAllowed = true; ++ CommitWaylandBuffer(); + } + + void WindowSurfaceWayland::FrameCallbackHandler() { +@@ -1074,9 +1123,7 @@ void WindowSurfaceWayland::FrameCallback + wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + +- if (mPendingCommit) { +- CommitWaylandBuffer(); +- } ++ CommitWaylandBuffer(); + } + + void WindowSurfaceWayland::DelayedCommitHandler() { +@@ -1089,9 +1136,7 @@ void WindowSurfaceWayland::DelayedCommit + free(mDelayedCommitHandle); + mDelayedCommitHandle = nullptr; + +- if (mPendingCommit) { +- CommitWaylandBuffer(); +- } ++ CommitWaylandBuffer(); + } + + } // namespace widget +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 firefox-69.0/widget/gtk/WindowSurfaceWayland.h +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 2019-09-16 10:43:50.214742949 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.h 2019-09-16 11:09:05.651780592 +0200 +@@ -17,6 +17,8 @@ + namespace mozilla { + namespace widget { + ++class WindowSurfaceWayland; ++ + // Allocates and owns shared memory for Wayland drawing surface + class WaylandShmPool { + public: +@@ -69,20 +71,22 @@ class WindowBackBuffer { + + static gfx::SurfaceFormat GetSurfaceFormat() { return mFormat; } + +- nsWaylandDisplay* GetWaylandDisplay() { return mWaylandDisplay; }; ++ nsWaylandDisplay* GetWaylandDisplay(); + +- WindowBackBuffer(nsWaylandDisplay* aWaylandDisplay) +- : mWaylandDisplay(aWaylandDisplay){}; ++ WindowBackBuffer(WindowSurfaceWayland* aWindowSurfaceWayland) ++ : mWindowSurfaceWayland(aWindowSurfaceWayland){}; + virtual ~WindowBackBuffer(){}; + ++ protected: ++ WindowSurfaceWayland* mWindowSurfaceWayland; ++ + private: + static gfx::SurfaceFormat mFormat; +- nsWaylandDisplay* mWaylandDisplay; + }; + + class WindowBackBufferShm : public WindowBackBuffer { + public: +- WindowBackBufferShm(nsWaylandDisplay* aWaylandDisplay, int aWidth, ++ WindowBackBufferShm(WindowSurfaceWayland* aWindowSurfaceWayland, int aWidth, + int aHeight); + ~WindowBackBufferShm(); + +@@ -121,8 +125,8 @@ class WindowBackBufferShm : public Windo + + class WindowBackBufferDMABuf : public WindowBackBuffer { + public: +- WindowBackBufferDMABuf(nsWaylandDisplay* aWaylandDisplay, int aWidth, +- int aHeight); ++ WindowBackBufferDMABuf(WindowSurfaceWayland* aWindowSurfaceWayland, ++ int aWidth, int aHeight); + ~WindowBackBufferDMABuf(); + + bool IsAttached(); +@@ -175,6 +179,9 @@ class WindowSurfaceWayland : public Wind + void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final; + void FrameCallbackHandler(); + void DelayedCommitHandler(); ++ void CommitWaylandBuffer(); ++ ++ nsWaylandDisplay* GetWaylandDisplay() { return mWaylandDisplay; }; + + private: + WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); +@@ -185,10 +192,9 @@ class WindowSurfaceWayland : public Wind + + already_AddRefed LockImageSurface( + const gfx::IntSize& aLockSize); +- bool CommitImageSurfaceToWaylandBuffer( +- const LayoutDeviceIntRegion& aRegion, +- LayoutDeviceIntRegion& aWaylandBufferDamage); +- void CommitWaylandBuffer(); ++ ++ void CacheImageSurface(const LayoutDeviceIntRegion& aRegion); ++ bool CommitImageCacheToWaylandBuffer(); + + void DrawDelayedImageCommits(gfx::DrawTarget* aDrawTarget, + LayoutDeviceIntRegion& aWaylandBufferDamage); +@@ -205,12 +211,13 @@ class WindowSurfaceWayland : public Wind + WindowBackBuffer* mBackupBuffer[BACK_BUFFER_NUM]; + wl_callback* mFrameCallback; + wl_surface* mLastCommittedSurface; +- MessageLoop* mDisplayThreadMessageLoop; + WindowSurfaceWayland** mDelayedCommitHandle; + RefPtr mImageSurface; + AutoTArray mDelayedImageCommits; ++ int64_t mLastCommitTime; + bool mDrawToWaylandBufferDirectly; +- bool mPendingCommit; ++ bool mBufferPendingCommit; ++ bool mBufferCommitAllowed; + bool mWholeWindowBufferDamage; + bool mBufferNeedsClear; + bool mIsMainThread; From 5ccfc2ed4ce2a95d7e3e1cc45f13029c22a318a4 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 16 Sep 2019 11:59:36 +0200 Subject: [PATCH 0060/1136] Fixed mozilla-1580152.patch patch --- mozilla-1580152.patch | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/mozilla-1580152.patch b/mozilla-1580152.patch index 43a5264..6260d3c 100644 --- a/mozilla-1580152.patch +++ b/mozilla-1580152.patch @@ -1,6 +1,6 @@ diff -up firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 firefox-69.0/widget/gtk/mozwayland/mozwayland.h ---- firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 2019-09-16 10:43:50.214742949 +0200 -+++ firefox-69.0/widget/gtk/mozwayland/mozwayland.h 2019-09-16 10:43:50.222742921 +0200 +--- firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 2019-09-16 11:11:30.081299217 +0200 ++++ firefox-69.0/widget/gtk/mozwayland/mozwayland.h 2019-09-16 11:11:30.089299191 +0200 @@ -27,6 +27,9 @@ MOZ_EXPORT struct wl_proxy* wl_proxy_mar struct wl_proxy* proxy, uint32_t opcode, const struct wl_interface* interface, ...); @@ -12,8 +12,8 @@ diff -up firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 firefox */ #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 firefox-69.0/widget/gtk/nsWaylandDisplay.cpp ---- firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 2019-09-16 10:43:50.215742946 +0200 -+++ firefox-69.0/widget/gtk/nsWaylandDisplay.cpp 2019-09-16 10:50:58.647224684 +0200 +--- firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 2019-09-16 11:11:30.081299217 +0200 ++++ firefox-69.0/widget/gtk/nsWaylandDisplay.cpp 2019-09-16 11:11:30.089299191 +0200 @@ -243,6 +243,61 @@ bool nsWaylandDisplay::DispatchEventQueu return true; } @@ -85,8 +85,8 @@ diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 firefox-69 mRegistry(nullptr), mGbmDevice(nullptr), diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 firefox-69.0/widget/gtk/nsWaylandDisplay.h ---- firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 2019-09-16 10:43:50.215742946 +0200 -+++ firefox-69.0/widget/gtk/nsWaylandDisplay.h 2019-09-16 10:43:50.222742921 +0200 +--- firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 2019-09-16 11:11:30.081299217 +0200 ++++ firefox-69.0/widget/gtk/nsWaylandDisplay.h 2019-09-16 11:11:30.089299191 +0200 @@ -41,6 +41,11 @@ class nsWaylandDisplay { virtual ~nsWaylandDisplay(); @@ -108,8 +108,8 @@ diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 firefox-69.0 wl_registry* mRegistry; zwp_linux_dmabuf_v1* mDmabuf; diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 2019-09-16 10:43:50.220742928 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-16 11:08:00.079998054 +0200 +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 2019-09-16 11:11:30.086299200 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-16 11:57:35.462193492 +0200 @@ -32,6 +32,9 @@ extern mozilla::LazyLogModule gWidgetWay # define LOGWAYLAND(args) #endif /* MOZ_LOGGING */ @@ -349,9 +349,8 @@ diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 firefo -bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer( - const LayoutDeviceIntRegion& aRegion, - LayoutDeviceIntRegion& aWaylandBufferDamage) { -+bool WindowSurfaceWayland::CommitImageCacheToWaylandBuffer() { - MOZ_ASSERT(!mDrawToWaylandBufferDirectly); - +- MOZ_ASSERT(!mDrawToWaylandBufferDirectly); +- -#ifdef DEBUG - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); - gfx::Rect rect(bounds); @@ -362,14 +361,16 @@ diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 firefo - ("WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer [%p] " - "screenSize [%d x %d]\n", - (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); -- ++bool WindowSurfaceWayland::CommitImageCacheToWaylandBuffer() { ++ if (!mDelayedImageCommits.Length()) { ++ return false; ++ } + - mDelayedImageCommits.AppendElement( - WindowImageSurface(mImageSurface, aRegion)); - // mImageSurface is owned by mDelayedImageCommits - mImageSurface = nullptr; -+ if (!mDelayedImageCommits.Length()) { -+ return false; -+ } ++ MOZ_ASSERT(!mDrawToWaylandBufferDirectly); RefPtr dt = LockWaylandBuffer( /* aCanSwitchBuffer */ mWholeWindowBufferDamage); @@ -525,8 +526,8 @@ diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 firefo } // namespace widget diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 firefox-69.0/widget/gtk/WindowSurfaceWayland.h ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 2019-09-16 10:43:50.214742949 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.h 2019-09-16 11:09:05.651780592 +0200 +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 2019-09-16 11:11:30.080299221 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.h 2019-09-16 11:11:30.090299187 +0200 @@ -17,6 +17,8 @@ namespace mozilla { namespace widget { From 868f498959a589b6577b126d5cf7c5e3d8ea8f8b Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 17 Sep 2019 13:22:34 +0200 Subject: [PATCH 0061/1136] Added fixes for mozbz#1581748 --- firefox.spec | 7 +- mozilla-1581748.patch | 574 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 580 insertions(+), 1 deletion(-) create mode 100644 mozilla-1581748.patch diff --git a/firefox.spec b/firefox.spec index 88f5fc6..3e96df4 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 6%{?pre_tag}%{?dist} +Release: 7%{?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 @@ -168,6 +168,7 @@ Patch584: mozilla-1579794-2.patch Patch585: mozilla-1579849.patch Patch586: mozilla-1579823.patch Patch587: mozilla-1580152.patch +Patch588: mozilla-1581748.patch # PGO/LTO patches Patch600: pgo.patch @@ -388,6 +389,7 @@ This package contains results of tests executed during build. %patch422 -p1 -b .1580174-webrtc-popup %patch586 -p1 -b .mozilla-1579823 %patch587 -p1 -b .mozilla-1580152 +%patch588 -p1 -b .mozilla-1581748 # PGO patches %patch600 -p1 -b .pgo @@ -964,6 +966,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Sep 17 2019 Martin Stransky - 69.0-7 +- Added fixes for mozbz#1581748 + * Mon Sep 16 2019 Martin Stransky - 69.0-6 - Added fixes for mozbz#1579823, mozbz#1580152 diff --git a/mozilla-1581748.patch b/mozilla-1581748.patch new file mode 100644 index 0000000..4fbffa8 --- /dev/null +++ b/mozilla-1581748.patch @@ -0,0 +1,574 @@ +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1581748 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1581748 2019-09-17 13:19:47.190908284 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-17 13:19:47.196908262 +0200 +@@ -32,7 +32,7 @@ extern mozilla::LazyLogModule gWidgetWay + # define LOGWAYLAND(args) + #endif /* MOZ_LOGGING */ + +-// Maximal compositin timeout it miliseconds ++// Maximal compositing timeout it miliseconds + #define COMPOSITING_TIMEOUT 200 + + namespace mozilla { +@@ -513,13 +513,15 @@ WindowSurfaceWayland::WindowSurfaceWayla + mDelayedCommitHandle(nullptr), + mLastCommitTime(0), + mDrawToWaylandBufferDirectly(true), ++ mCanSwitchWaylandBuffer(true), + mBufferPendingCommit(false), + mBufferCommitAllowed(false), +- mWholeWindowBufferDamage(false), + mBufferNeedsClear(false), + mIsMainThread(NS_IsMainThread()), + mNeedScaleFactorUpdate(true) { + for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; ++ mRenderingCacheMode = 0; ++ + } + + WindowSurfaceWayland::~WindowSurfaceWayland() { +@@ -591,8 +593,6 @@ WindowBackBuffer* WindowSurfaceWayland:: + + // There's no buffer created yet, create a new one. + if (!mWaylandBuffer) { +- MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage, +- "Created new buffer for partial drawing!"); + LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width, + mBufferScreenRect.height)); + +@@ -682,9 +682,8 @@ WindowBackBuffer* WindowSurfaceWayland:: + return mWaylandBuffer; + } + +-already_AddRefed WindowSurfaceWayland::LockWaylandBuffer( +- bool aCanSwitchBuffer) { +- WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer); ++already_AddRefed WindowSurfaceWayland::LockWaylandBuffer() { ++ WindowBackBuffer* buffer = GetWaylandBufferToDraw(mCanSwitchWaylandBuffer); + + LOGWAYLAND(("WindowSurfaceWayland::LockWaylandBuffer [%p] Got buffer %p\n", + (void*)this, (void*)buffer)); +@@ -698,7 +697,9 @@ already_AddRefed Window + return nullptr; + } + +- if (mBufferNeedsClear && mWholeWindowBufferDamage) { ++ mCanSwitchWaylandBuffer = false; ++ ++ if (mBufferNeedsClear) { + buffer->Clear(); + mBufferNeedsClear = false; + } +@@ -728,40 +729,30 @@ already_AddRefed Window + WindowBackBuffer::GetSurfaceFormat()); + } + +-static bool IsWindowFullScreenUpdate(LayoutDeviceIntRect& screenRect, +- const LayoutDeviceIntRegion& aRegion) { +- if (aRegion.GetNumRects() > 1) return false; +- +- IntRect rect = aRegion.RectIter().Get().ToUnknownRect(); +- return (rect.x == 0 && rect.y == 0 && screenRect.width == rect.width && +- screenRect.height == rect.height); ++static bool IsWindowFullScreenUpdate( ++ LayoutDeviceIntRect& aScreenRect, ++ const LayoutDeviceIntRegion& aUpdatedRegion) { ++ if (aUpdatedRegion.GetNumRects() > 1) return false; ++ ++ IntRect rect = aUpdatedRegion.RectIter().Get().ToUnknownRect(); ++ return (rect.x == 0 && rect.y == 0 && aScreenRect.width == rect.width && ++ aScreenRect.height == rect.height); + } + +-static bool IsPopupFullScreenUpdate(LayoutDeviceIntRect& screenRect, +- const LayoutDeviceIntRegion& aRegion) { ++static bool IsPopupFullScreenUpdate( ++ LayoutDeviceIntRect& aScreenRect, ++ const LayoutDeviceIntRegion& aUpdatedRegion) { + // We know that popups can be drawn from two parts; a panel and an arrow. + // Assume we redraw whole popups when we have two rects and bounding + // box is equal to window borders. +- if (aRegion.GetNumRects() > 2) return false; ++ if (aUpdatedRegion.GetNumRects() > 2) return false; + +- IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); ++ gfx::IntRect lockSize = aUpdatedRegion.GetBounds().ToUnknownRect(); + return (lockSize.x == 0 && lockSize.y == 0 && +- screenRect.width == lockSize.width && +- screenRect.height == lockSize.height); ++ aScreenRect.width == lockSize.width && ++ aScreenRect.height == lockSize.height); + } + +-/* +- There are some situations which can happen here: +- +- A) Lock() is called to whole surface. In that case we don't need +- to clip/buffer the drawing and we can return wl_buffer directly +- for drawing. +- - mWaylandBuffer is available - that's an ideal situation. +- - mWaylandBuffer is locked by compositor - go B) +- +- B) Lock() is requested for part(s) of screen. We need to provide temporary +- surface to draw into and copy result (clipped) to target wl_surface. +- */ + already_AddRefed WindowSurfaceWayland::Lock( + const LayoutDeviceIntRegion& aRegion) { + MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); +@@ -777,22 +768,31 @@ already_AddRefed Window + LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); + gfx::IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); + +- // Are we asked for entire nsWindow to draw? + bool isTransparentPopup = + mWindow->IsWaylandPopup() && + (eTransparencyTransparent == mWindow->GetTransparencyMode()); + +- // We have request to lock whole buffer/window. +- mWholeWindowBufferDamage = +- isTransparentPopup ? IsPopupFullScreenUpdate(lockedScreenRect, aRegion) +- : IsWindowFullScreenUpdate(lockedScreenRect, aRegion); +- +- // Clear buffer when we (re)draw new transparent popup window, +- // otherwise leave it as-is, mBufferNeedsClear can be set from previous +- // (already pending) commits which are cached now. +- if (mWholeWindowBufferDamage) { ++ bool windowRedraw = isTransparentPopup ++ ? IsPopupFullScreenUpdate(lockedScreenRect, aRegion) ++ : IsWindowFullScreenUpdate(lockedScreenRect, aRegion); ++ if (windowRedraw) { ++ // Clear buffer when we (re)draw new transparent popup window, ++ // otherwise leave it as-is, mBufferNeedsClear can be set from previous ++ // (already pending) commits which are cached now. + mBufferNeedsClear = + mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup; ++ ++ // Store info that we can switch WaylandBuffer when we flush ++ // mImageSurface / mDelayedImageCommits. Don't clear it - it's cleared ++ // at LockWaylandBuffer() when we actualy switch the buffer. ++ mCanSwitchWaylandBuffer = windowRedraw; ++ ++ // We do full buffer repaint so clear our cached drawings. ++ mDelayedImageCommits.Clear(); ++ mWaylandBufferDamage.SetEmpty(); ++ ++ // Also do scale factor update for whole window updates just to be sure. ++ mNeedScaleFactorUpdate = true; + } + + LOGWAYLAND( +@@ -808,7 +808,7 @@ already_AddRefed Window + LOGWAYLAND((" IsWindowFullScreenUpdate = %d\n", + IsWindowFullScreenUpdate(lockedScreenRect, aRegion))); + LOGWAYLAND((" mBufferNeedsClear = %d\n", mBufferNeedsClear)); +- LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); ++ LOGWAYLAND((" windowRedraw = %d\n", windowRedraw)); + + #if MOZ_LOGGING + if (!(mBufferScreenRect == lockedScreenRect)) { +@@ -822,8 +822,9 @@ already_AddRefed Window + // We can't commit them any more as they're for former window size, so + // scratch them. + mDelayedImageCommits.Clear(); ++ mWaylandBufferDamage.SetEmpty(); + +- if (!mWholeWindowBufferDamage) { ++ if (!windowRedraw) { + NS_WARNING("Partial screen update when window is resized!"); + // This should not happen. Screen size changed but we got only + // partal screen update instead of whole screen. Discard this painting +@@ -833,52 +834,56 @@ already_AddRefed Window + mBufferScreenRect = lockedScreenRect; + } + +- if (mWholeWindowBufferDamage) { +- // We can lock/commit entire buffer direcly. +- mDrawToWaylandBufferDirectly = true; +- +- // If there's any pending image commit scratch them as we're going +- // to redraw the whole sceen anyway. +- mDelayedImageCommits.Clear(); ++ mDrawToWaylandBufferDirectly = ++ (windowRedraw || mRenderingCacheMode != CACHE_ALL); + +- RefPtr dt = LockWaylandBuffer( +- /* aCanSwitchBuffer */ mWholeWindowBufferDamage); ++ if (mDrawToWaylandBufferDirectly) { ++ LOGWAYLAND((" Direct drawing\n")); ++ RefPtr dt = LockWaylandBuffer(); + if (dt) { ++ if (!windowRedraw) { ++ DrawDelayedImageCommits(dt, mWaylandBufferDamage); ++ } + return dt.forget(); + } + } + +- // We do indirect drawing due to: +- // +- // 1) We don't have any front buffer available. Try indirect drawing +- // to mImageSurface which is mirrored to front buffer at commit. +- // 2) Only part of the screen is locked. We can't lock entire screen for +- // such drawing as it produces visible artifacts. ++ // Any caching is disabled and we don't have any back buffer available. ++ if (mRenderingCacheMode == CACHE_NONE) { ++ return nullptr; ++ } ++ ++ // We do indirect drawing because there isn't any front buffer available. ++ // Do indirect drawing to mImageSurface which is commited to wayland ++ // wl_buffer by DrawDelayedImageCommits() later. + mDrawToWaylandBufferDirectly = false; + + LOGWAYLAND((" Indirect drawing.\n")); + return LockImageSurface(gfx::IntSize(lockSize.XMost(), lockSize.YMost())); + } + ++bool WindowImageSurface::OverlapsSurface( ++ class WindowImageSurface& aBottomSurface) { ++ return mUpdateRegion.Contains(aBottomSurface.mUpdateRegion); ++} ++ + void WindowImageSurface::Draw(gfx::SourceSurface* aSurface, + gfx::DrawTarget* aDest, + const LayoutDeviceIntRegion& aRegion) { +- uint32_t numRects = aRegion.GetNumRects(); +- if (numRects != 1) { +- AutoTArray rects; +- rects.SetCapacity(numRects); +- for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { +- rects.AppendElement(iter.Get().ToUnknownRect()); +- } +- aDest->PushDeviceSpaceClipRects(rects.Elements(), rects.Length()); +- } +- ++#ifdef MOZ_LOGGING + gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); +- gfx::Rect rect(bounds); +- aDest->DrawSurface(aSurface, rect, rect); ++ LOGWAYLAND(("WindowImageSurface::Draw\n")); ++ LOGWAYLAND((" rects num %d\n", aRegion.GetNumRects())); ++ LOGWAYLAND((" bounds [ %d, %d] -> [%d x %d]\n", bounds.x, bounds.y, ++ bounds.width, bounds.height)); ++#endif + +- if (numRects != 1) { +- aDest->PopClip(); ++ for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { ++ mozilla::LayoutDeviceIntRect r = iter.Get(); ++ gfx::Rect rect(r.ToUnknownRect()); ++ LOGWAYLAND((" draw rect [%f,%f] -> [%f x %f]\n", rect.x, rect.y, ++ rect.width, rect.height)); ++ aDest->DrawSurface(aSurface, rect, rect); + } + } + +@@ -896,6 +901,18 @@ WindowImageSurface::WindowImageSurface( + mImageSurface->Format()); + } + ++void WindowSurfaceWayland::DrawDelayedImageCommits( ++ gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { ++ LOGWAYLAND( ++ ("WindowSurfaceWayland::DrawDelayedImageCommits [%p]\n", (void*)this)); ++ MOZ_ASSERT(mDelayedImageCommits.Length() > 0, "Nothing to draw?"); ++ ++ for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { ++ mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); ++ } ++ mDelayedImageCommits.Clear(); ++} ++ + void WindowSurfaceWayland::CacheImageSurface( + const LayoutDeviceIntRegion& aRegion) { + #ifdef MOZ_LOGGING +@@ -906,8 +923,26 @@ void WindowSurfaceWayland::CacheImageSur + bounds.width, bounds.height)); + #endif + +- mDelayedImageCommits.AppendElement( +- WindowImageSurface(mImageSurface, aRegion)); ++ WindowImageSurface surf = WindowImageSurface(mImageSurface, aRegion); ++ ++ if (mDelayedImageCommits.Length()) { ++ int lastSurf = mDelayedImageCommits.Length() - 1; ++ if (surf.OverlapsSurface(mDelayedImageCommits[lastSurf])) { ++#ifdef MOZ_LOGGING ++ { ++ gfx::IntRect size = mDelayedImageCommits[lastSurf] ++ .GetUpdateRegion() ++ ->GetBounds() ++ .ToUnknownRect(); ++ LOGWAYLAND((" removing [ %d, %d] -> [%d x %d]\n", size.x, size.y, ++ size.width, size.height)); ++ } ++#endif ++ mDelayedImageCommits.RemoveElementAt(lastSurf); ++ } ++ } ++ ++ mDelayedImageCommits.AppendElement(surf); + // mImageSurface is owned by mDelayedImageCommits + mImageSurface = nullptr; + +@@ -915,17 +950,6 @@ void WindowSurfaceWayland::CacheImageSur + (" There's %d cached images\n", int(mDelayedImageCommits.Length()))); + } + +-void WindowSurfaceWayland::DrawDelayedImageCommits( +- gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { +- LOGWAYLAND( +- ("WindowSurfaceWayland::DrawDelayedImageCommits [%p]\n", (void*)this)); +- +- for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { +- mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); +- } +- mDelayedImageCommits.Clear(); +-} +- + bool WindowSurfaceWayland::CommitImageCacheToWaylandBuffer() { + if (!mDelayedImageCommits.Length()) { + return false; +@@ -933,8 +957,7 @@ bool WindowSurfaceWayland::CommitImageCa + + MOZ_ASSERT(!mDrawToWaylandBufferDirectly); + +- RefPtr dt = LockWaylandBuffer( +- /* aCanSwitchBuffer */ mWholeWindowBufferDamage); ++ RefPtr dt = LockWaylandBuffer(); + if (!dt) { + return false; + } +@@ -942,7 +965,6 @@ bool WindowSurfaceWayland::CommitImageCa + LOGWAYLAND((" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", + long(mDelayedImageCommits.Length()))); + +- // Draw any delayed image commits first + DrawDelayedImageCommits(dt, mWaylandBufferDamage); + UnlockWaylandBuffer(); + +@@ -967,7 +989,7 @@ void WindowSurfaceWayland::CommitWayland + LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); + LOGWAYLAND( + (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); +- LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); ++ LOGWAYLAND((" mCanSwitchWaylandBuffer = %d\n", mCanSwitchWaylandBuffer)); + LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); + LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); + LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); +@@ -1030,20 +1052,11 @@ void WindowSurfaceWayland::CommitWayland + mLastCommittedSurface = nullptr; + } + +- if (mWholeWindowBufferDamage) { +- LOGWAYLAND((" send whole screen damage\n")); +- wl_surface_damage(waylandSurface, 0, 0, mBufferScreenRect.width, +- mBufferScreenRect.height); +- mWholeWindowBufferDamage = false; +- mNeedScaleFactorUpdate = true; +- } else { +- for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); +- iter.Next()) { +- mozilla::LayoutDeviceIntRect r = iter.Get(); +- LOGWAYLAND((" wl_surface_damage_buffer [%d, %d] -> [%d, %d]\n", r.x, +- r.y, r.width, r.height)); +- wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); +- } ++ for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); iter.Next()) { ++ mozilla::LayoutDeviceIntRect r = iter.Get(); ++ LOGWAYLAND((" wl_surface_damage_buffer [%d, %d] -> [%d, %d]\n", r.x, r.y, ++ r.width, r.height)); ++ wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); + } + + // Clear all back buffer damage as we're committing +@@ -1062,9 +1075,9 @@ void WindowSurfaceWayland::CommitWayland + mLastCommittedSurface = waylandSurface; + mLastCommitTime = g_get_monotonic_time() / 1000; + +- // Ask wl_display to start events synchronization. We're going wait ++ // Ask wl_display to start events synchronization. We're going to wait + // until all events are processed before next WindowSurfaceWayland::Lock() +- // as we need freed wl_buffer there. ++ // as we hope for free wl_buffer there. + mWaylandDisplay->SyncBegin(); + + // There's no pending commit, all changes are sent to compositor. +@@ -1074,9 +1087,6 @@ void WindowSurfaceWayland::CommitWayland + void WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion) { + MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); + +- // Flush all waiting events explicitly as we need +- // mWaylandDisplay->FlushEventQueue(); +- + #ifdef MOZ_LOGGING + { + gfx::IntRect lockSize = aInvalidRegion.GetBounds().ToUnknownRect(); +@@ -1087,17 +1097,12 @@ void WindowSurfaceWayland::Commit(const + mBufferScreenRect.width, mBufferScreenRect.height)); + LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", + mDrawToWaylandBufferDirectly)); +- LOGWAYLAND( +- (" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); + } + #endif + + if (mDrawToWaylandBufferDirectly) { + MOZ_ASSERT(mWaylandBuffer->IsLocked()); +- // If we're not at fullscreen damage add drawing area from aInvalidRegion +- if (!mWholeWindowBufferDamage) { +- mWaylandBufferDamage.OrWith(aInvalidRegion); +- } ++ mWaylandBufferDamage.OrWith(aInvalidRegion); + UnlockWaylandBuffer(); + mBufferPendingCommit = true; + } else { +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1581748 firefox-69.0/widget/gtk/WindowSurfaceWayland.h +--- firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1581748 2019-09-17 13:19:47.191908280 +0200 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.h 2019-09-17 13:19:47.197908258 +0200 +@@ -161,6 +161,10 @@ class WindowImageSurface { + WindowImageSurface(gfxImageSurface* aImageSurface, + const LayoutDeviceIntRegion& aUpdateRegion); + ++ bool OverlapsSurface(class WindowImageSurface& aBottomSurface); ++ ++ const LayoutDeviceIntRegion* GetUpdateRegion() { return &mUpdateRegion; }; ++ + private: + RefPtr mSurface; + RefPtr mImageSurface; +@@ -174,20 +178,59 @@ class WindowSurfaceWayland : public Wind + explicit WindowSurfaceWayland(nsWindow* aWindow); + ~WindowSurfaceWayland(); + ++ // Lock() / Commit() are called by gecko when Firefox ++ // wants to display something. Lock() returns a DrawTarget ++ // where gecko paints. When gecko is done it calls Commit() ++ // and we try to send the DrawTarget (backed by wl_buffer) ++ // to wayland compositor. ++ // ++ // If we fail (wayland compositor is busy, ++ // wl_surface is not created yet) we queue the painting ++ // and we send it to wayland compositor in FrameCallbackHandler()/ ++ // DelayedCommitHandler/CommitWaylandBuffer(). + already_AddRefed Lock( + const LayoutDeviceIntRegion& aRegion) override; + void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final; ++ ++ // It's called from wayland compositor when there's the right ++ // time to send wl_buffer to display. It's no-op if there's no ++ // queued commits. + void FrameCallbackHandler(); ++ ++ // When a new window is created we may not have a valid wl_surface ++ // for drawing (Gtk haven't created it yet). All commits are queued ++ // and DelayedCommitHandler() is called by timer when wl_surface is ready ++ // for drawing. + void DelayedCommitHandler(); ++ ++ // Try to commit all queued drawings to Wayland compositor. This is usually ++ // called from other routines but can be used to explicitly flush ++ // all drawings as we do when wl_buffer is released ++ // (see WindowBackBufferShm::Detach() for instance). + void CommitWaylandBuffer(); + + nsWaylandDisplay* 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. ++ // Suitable for fullscreen content only like fullscreen video playback and ++ // may work well with dmabuf backend. ++ CACHE_NONE = 2 ++ } RenderingCacheMode; ++ + private: + WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); + WindowBackBuffer* GetWaylandBufferToDraw(bool aCanSwitchBuffer); + +- already_AddRefed LockWaylandBuffer(bool aCanSwitchBuffer); ++ already_AddRefed LockWaylandBuffer(); + void UnlockWaylandBuffer(); + + already_AddRefed LockImageSurface( +@@ -206,23 +249,71 @@ class WindowSurfaceWayland : public Wind + // mBufferScreenRect is window size when our wayland buffer was allocated. + LayoutDeviceIntRect mBufferScreenRect; + nsWaylandDisplay* mWaylandDisplay; ++ ++ // Actual buffer (backed by wl_buffer) where all drawings go into. ++ // Drawn areas are stored at mWaylandBufferDamage and if there's ++ // any uncommited drawings which needs to be send to wayland compositor ++ // the mBufferPendingCommit is set. + WindowBackBuffer* mWaylandBuffer; +- LayoutDeviceIntRegion mWaylandBufferDamage; + WindowBackBuffer* mBackupBuffer[BACK_BUFFER_NUM]; ++ LayoutDeviceIntRegion mWaylandBufferDamage; ++ ++ // After every commit to wayland compositor a frame callback is requested. ++ // Any next commit to wayland compositor will happen when frame callback ++ // comes from wayland compositor back as it's the best time to do the commit. + wl_callback* mFrameCallback; + wl_surface* mLastCommittedSurface; ++ ++ // Registered reference to pending DelayedCommitHandler() call. + WindowSurfaceWayland** mDelayedCommitHandle; ++ ++ // Cached drawings. If we can't get WaylandBuffer (wl_buffer) at ++ // WindowSurfaceWayland::Lock() we direct gecko rendering to ++ // mImageSurface. ++ // If we can't get WaylandBuffer at WindowSurfaceWayland::Commit() ++ // time, mImageSurface is moved to mDelayedImageCommits which ++ // holds all cached drawings. ++ // mDelayedImageCommits can be drawn by FrameCallbackHandler(), ++ // DelayedCommitHandler() or when WaylandBuffer is detached. + RefPtr mImageSurface; + AutoTArray mDelayedImageCommits; ++ + int64_t mLastCommitTime; ++ ++ // Indicates that we don't have any cached drawings at mDelayedImageCommits ++ // and WindowSurfaceWayland::Lock() returned WaylandBuffer to gecko ++ // to draw into. + bool mDrawToWaylandBufferDirectly; ++ ++ // Set when our cached drawings (mDelayedImageCommits) contains ++ // full screen damage. That means we can safely switch WaylandBuffer ++ // at LockWaylandBuffer(). ++ bool mCanSwitchWaylandBuffer; ++ ++ // Set when actual WaylandBuffer contains drawings which are not send to ++ // wayland compositor yet. + bool mBufferPendingCommit; ++ ++ // We can't send WaylandBuffer (wl_buffer) to compositor when gecko ++ // is rendering into it (i.e. between WindowSurfaceWayland::Lock() / ++ // WindowSurfaceWayland::Commit()). ++ // Thus we use mBufferCommitAllowed to disable commit by callbacks ++ // (FrameCallbackHandler(), DelayedCommitHandler()) + bool mBufferCommitAllowed; +- bool mWholeWindowBufferDamage; ++ ++ // We need to clear WaylandBuffer when entire transparent window is repainted. ++ // This typically apply to popup windows. + bool mBufferNeedsClear; ++ + bool mIsMainThread; ++ ++ // When new WaylandBuffer (wl_buffer) is send to wayland compositor ++ // (buffer switch or resize) we also need to set its scale factor. + bool mNeedScaleFactorUpdate; + ++ // Image caching strategy, see RenderingCacheMode for details. ++ RenderingCacheMode mRenderingCacheMode; ++ + static bool UseDMABufBackend(); + static bool mUseDMABufInitialized; + static bool mUseDMABuf; From d57ce1392667f44a10a589311c0e750fee7f21c8 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 17 Sep 2019 14:10:11 +0200 Subject: [PATCH 0062/1136] Build fix --- mozilla-1581748.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mozilla-1581748.patch b/mozilla-1581748.patch index 4fbffa8..9177f5b 100644 --- a/mozilla-1581748.patch +++ b/mozilla-1581748.patch @@ -22,7 +22,7 @@ diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1581748 firefo mIsMainThread(NS_IsMainThread()), mNeedScaleFactorUpdate(true) { for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; -+ mRenderingCacheMode = 0; ++ mRenderingCacheMode = CACHE_ALL; + } From fb305223b001679d94bb6d12dc98d911ce8109e0 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 17 Sep 2019 21:16:42 +0200 Subject: [PATCH 0063/1136] 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); From 6072729df195a40d98c4b378d558c075538ab7a4 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 18 Sep 2019 08:35:58 +0200 Subject: [PATCH 0064/1136] Load widget cache mode --- mozilla-1577024.patch | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/mozilla-1577024.patch b/mozilla-1577024.patch index c7789f1..b81f103 100644 --- a/mozilla-1577024.patch +++ b/mozilla-1577024.patch @@ -62,7 +62,7 @@ diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1577024 firefox-69.0 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 ++++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-18 08:34:50.568111279 +0200 @@ -192,7 +192,7 @@ It owns wl_buffer object, owns WaylandDM (which provides the DMA Buffer) and ties them together. @@ -72,14 +72,19 @@ diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1577024 firefo */ -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 +@@ -519,9 +519,11 @@ WindowSurfaceWayland::WindowSurfaceWayla + mBufferNeedsClear(false), + mIsMainThread(NS_IsMainThread()), + mNeedScaleFactorUpdate(true) { +- for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; +- mRenderingCacheMode = CACHE_ALL; +- ++ for (int i = 0; i < BACK_BUFFER_NUM; i++) { ++ mBackupBuffer[i] = nullptr; ++ } ++ mRenderingCacheMode = static_cast( ++ mWaylandDisplay->GetRenderingCacheModePref()); + } - pref("widget.window-transforms.disabled", false); + WindowSurfaceWayland::~WindowSurfaceWayland() { +diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1577024 firefox-69.0/widget/gtk/WindowSurfaceWayland.h From 2465d17547c07981d97af11f114f4be8ae8062a8 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 18 Sep 2019 08:38:03 +0200 Subject: [PATCH 0065/1136] Release up - fixed mozbz#1577024 patch --- firefox.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 2ec91ba..d4dad86 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 8%{?pre_tag}%{?dist} +Release: 9%{?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 @@ -968,7 +968,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Tue Sep 17 2019 Martin Stransky - 69.0-8 +* Tue Sep 17 2019 Martin Stransky - 69.0-9 - Enable Wayland cache mode control (mozbz#1577024) * Tue Sep 17 2019 Martin Stransky - 69.0-7 From 6bc6c7c0264fc989963efb2b8e298535a7daf95f Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 18 Sep 2019 09:14:03 +0200 Subject: [PATCH 0066/1136] =?UTF-8?q?Disabled=20DoH=20by=20default=20(rhbz?= =?UTF-8?q?#1751410),=20patch=20by=20Eduardo=20M=C3=ADnguez=20P=C3=A9rez?= =?UTF-8?q?=20(eminguez).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firefox-redhat-default-prefs.js | 4 +++- firefox.spec | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/firefox-redhat-default-prefs.js b/firefox-redhat-default-prefs.js index 1513345..8faf36c 100644 --- a/firefox-redhat-default-prefs.js +++ b/firefox-redhat-default-prefs.js @@ -29,4 +29,6 @@ pref("browser.display.use_system_colors", false); pref("layers.use-image-offscreen-surfaces", false); /* Allow sending credetials to all https:// sites */ pref("network.negotiate-auth.trusted-uris", "https://"); -pref("spellchecker.dictionary_path","/usr/share/myspell"); \ No newline at end of file +pref("spellchecker.dictionary_path","/usr/share/myspell"); +/* Disable DoH by default */ +pref("network.trr.mode", 5); diff --git a/firefox.spec b/firefox.spec index d4dad86..04ace3b 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 9%{?pre_tag}%{?dist} +Release: 10%{?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 @@ -968,6 +968,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Sep 18 2019 Martin Stransky - 69.0-10 +- Disabled DoH by default (rhbz#1751410), + patch by Eduardo Mínguez Pérez (eminguez). + * Tue Sep 17 2019 Martin Stransky - 69.0-9 - Enable Wayland cache mode control (mozbz#1577024) From 5b43bf243c1658192aa68807eb4ce31109836b1f Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 18 Sep 2019 10:04:57 +0200 Subject: [PATCH 0067/1136] Do PGO builds with Wayland backend. --- firefox.spec | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 04ace3b..5c794d9 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0 -Release: 10%{?pre_tag}%{?dist} +Release: 11%{?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 @@ -264,6 +264,7 @@ BuildRequires: pkgconfig(libffi) %if 0%{?use_xvfb} BuildRequires: xorg-x11-server-Xvfb +BuildRequires: mutter %endif BuildRequires: rust BuildRequires: cargo @@ -614,7 +615,13 @@ export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" export MOZ_SERVICES_SYNC="1" export STRIP=/bin/true %if 0%{?build_with_pgo} -GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - +xvfb-run mutter --wayland --nested & +if [ -z "$WAYLAND_DISPLAY" ]; then + export WAYLAND_DISPLAY=wayland-0 +else + export WAYLAND_DISPLAY=wayland-1 +fi +GDK_BACKEND=wayland MOZ_ENABLE_WAYLAND=1 ./mach build 2>&1 | cat - %else ./mach build -v 2>&1 | cat - %endif @@ -968,6 +975,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Sep 18 2019 Martin Stransky - 69.0-11 +- Do PGO builds with Wayland backend. + * Wed Sep 18 2019 Martin Stransky - 69.0-10 - Disabled DoH by default (rhbz#1751410), patch by Eduardo Mínguez Pérez (eminguez). From cda86d984418a88d837457a5302156a8dbe25901 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 18 Sep 2019 12:35:04 +0200 Subject: [PATCH 0068/1136] Updated to 69.0.1 --- .gitignore | 2 ++ firefox.spec | 9 ++++++--- sources | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d09688d..117da22 100644 --- a/.gitignore +++ b/.gitignore @@ -360,3 +360,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-68.0.2-20190814.tar.xz /firefox-69.0.source.tar.xz /firefox-langpacks-69.0-20190829.tar.xz +/firefox-69.0.1.source.tar.xz +/firefox-langpacks-69.0.1-20190918.tar.xz diff --git a/firefox.spec b/firefox.spec index 5c794d9..8b78944 100644 --- a/firefox.spec +++ b/firefox.spec @@ -93,13 +93,13 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox -Version: 69.0 -Release: 11%{?pre_tag}%{?dist} +Version: 69.0.1 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190829.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20190918.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -975,6 +975,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Sep 18 2019 Martin Stransky - 69.0.1-1 +- Updated to 69.0.1 + * Wed Sep 18 2019 Martin Stransky - 69.0-11 - Do PGO builds with Wayland backend. diff --git a/sources b/sources index 3ac2847..215accd 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (firefox-69.0.source.tar.xz) = 83b4b9a3466d2686ae5b72f9495172dcb37037f3301c68f7940604180e28a40720256f66b34b090dffbdd7b377fbb815df1bb80c3df842bc9ae59551c7cf07b0 -SHA512 (firefox-langpacks-69.0-20190829.tar.xz) = e45cec7cf4e0832407ce4fbe2c8e881ce6cf3d91ea7309ab9aec14adf808ecd7cdb5117e453eed9d145e3ac63b4c14c61272d00be25853b3a729c0b1e4fe6d19 SHA512 (cbindgen-vendor.tar.xz) = 88afa0bc6af525cbb46bc75578b90419b28b95b396d5002fbf299a78a173681b840096ff83ef6e48553d1a5e0aa04e79383ab4d09bf431f3b864fcbacc7de46d +SHA512 (firefox-69.0.1.source.tar.xz) = 89e63eb882cd729f938fef3cb0565cf166b14fa8c4e34ff027f3f6ea0469e4a49706074259013c1cea66f7a3f6f46aead8e055049d542935ddca983ac172b93f +SHA512 (firefox-langpacks-69.0.1-20190918.tar.xz) = f0165009a69bbd8d5d863a53cb5a5e270e8c6ea1187cbe0cf773c25ec44fac8bd2ebc64e36b0f399431c67ec3f71d62d413955a9e376cd194d157bae41f0c0ea From 101ab24287be6f81cf15d7013cdf3376ef3c3680 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 19 Sep 2019 10:43:42 +0200 Subject: [PATCH 0069/1136] Do PGO builds with X11 backend. --- firefox.spec | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/firefox.spec b/firefox.spec index 8b78944..38fed32 100644 --- a/firefox.spec +++ b/firefox.spec @@ -24,8 +24,6 @@ ExcludeArch: ppc64le %global disable_elfhack 1 %global build_with_clang 0 %global use_bundled_cbindgen 1 -# FIXME disable PGO because of -j1 build would take ages -%global disable_multiprocess_compilation 0 # Build PGO+LTO on x86_64 and aarch64 only due to build issues # on other arches. %ifarch x86_64 aarch64 @@ -34,6 +32,8 @@ ExcludeArch: ppc64le %else %global build_with_pgo 0 %endif +# Build PGO builds on Wayland backend +%global pgo_wayland 0 %endif %if 0%{?fedora} > 30 %global wayland_backend_default 1 @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.1 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -264,6 +264,8 @@ BuildRequires: pkgconfig(libffi) %if 0%{?use_xvfb} BuildRequires: xorg-x11-server-Xvfb +%endif +%if 0%{?pgo_wayland} BuildRequires: mutter %endif BuildRequires: rust @@ -596,7 +598,6 @@ echo "ac_add_options --enable-lto" >> .mozconfig MOZ_SMP_FLAGS=-j1 # On x86_64 architectures, Mozilla can build up to 4 jobs at once in parallel, # however builds tend to fail on other arches when building in parallel. -%if !0%{?disable_multiprocess_compilation} %ifarch %{ix86} [ -z "$RPM_BUILD_NCPUS" ] && \ RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" @@ -609,19 +610,22 @@ MOZ_SMP_FLAGS=-j1 [ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 [ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 %endif -%endif export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" export MOZ_SERVICES_SYNC="1" export STRIP=/bin/true %if 0%{?build_with_pgo} +%if 0%{?pgo_wayland} xvfb-run mutter --wayland --nested & if [ -z "$WAYLAND_DISPLAY" ]; then export WAYLAND_DISPLAY=wayland-0 else export WAYLAND_DISPLAY=wayland-1 fi -GDK_BACKEND=wayland MOZ_ENABLE_WAYLAND=1 ./mach build 2>&1 | cat - +MOZ_ENABLE_WAYLAND=1 ./mach build 2>&1 | cat - +%else +GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - +%endif %else ./mach build -v 2>&1 | cat - %endif @@ -975,6 +979,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Sep 18 2019 Martin Stransky - 69.0.1-2 +- Do PGO builds with X11 backend. + * Wed Sep 18 2019 Martin Stransky - 69.0.1-1 - Updated to 69.0.1 From b697fe555bdf7ac7a777b0997353e5151ca995a7 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 19 Sep 2019 15:14:15 +0200 Subject: [PATCH 0070/1136] Updated cache-missing strategy for Wayland image cache. --- firefox-wayland-cache-missing.patch | 21 +++++++++++++++++++++ firefox.spec | 9 +++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 firefox-wayland-cache-missing.patch diff --git a/firefox-wayland-cache-missing.patch b/firefox-wayland-cache-missing.patch new file mode 100644 index 0000000..8d665b5 --- /dev/null +++ b/firefox-wayland-cache-missing.patch @@ -0,0 +1,21 @@ +diff -up firefox-69.0.1/widget/gtk/WindowSurfaceWayland.cpp.old firefox-69.0.1/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-69.0.1/widget/gtk/WindowSurfaceWayland.cpp.old 2019-09-19 15:05:13.586437024 +0200 ++++ firefox-69.0.1/widget/gtk/WindowSurfaceWayland.cpp 2019-09-19 15:09:39.649079248 +0200 +@@ -836,8 +836,15 @@ already_AddRefed Window + mBufferScreenRect = lockedScreenRect; + } + +- mDrawToWaylandBufferDirectly = +- (windowRedraw || mRenderingCacheMode != CACHE_ALL); ++ if (mRenderingCacheMode == CACHE_ALL) { ++ mDrawToWaylandBufferDirectly = windowRedraw; ++ } else if (mRenderingCacheMode == CACHE_MISSING) { ++ mDrawToWaylandBufferDirectly = windowRedraw || ++ ((lockSize.width*3 > lockedScreenRect.width && ++ lockSize.height*3 > lockedScreenRect.height)); ++ } else { ++ mDrawToWaylandBufferDirectly = true; ++ } + + if (mDrawToWaylandBufferDirectly) { + LOGWAYLAND((" Direct drawing\n")); diff --git a/firefox.spec b/firefox.spec index 38fed32..abf3618 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.1 -Release: 2%{?pre_tag}%{?dist} +Release: 3%{?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 @@ -170,6 +170,7 @@ Patch586: mozilla-1579823.patch Patch587: mozilla-1580152.patch Patch588: mozilla-1581748.patch Patch589: mozilla-1577024.patch +Patch590: firefox-wayland-cache-missing.patch # PGO/LTO patches Patch600: pgo.patch @@ -395,6 +396,7 @@ This package contains results of tests executed during build. %patch587 -p1 -b .mozilla-1580152 %patch588 -p1 -b .mozilla-1581748 %patch589 -p1 -b .mozilla-1577024 +%patch590 -p1 -b .cache-missing # PGO patches %patch600 -p1 -b .pgo @@ -979,7 +981,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Thu Sep 18 2019 Martin Stransky - 69.0.1-2 +* Thu Sep 19 2019 Martin Stransky - 69.0.1-3 +- Updated cache-missing strategy for Wayland image cache. + +* Thu Sep 19 2019 Martin Stransky - 69.0.1-2 - Do PGO builds with X11 backend. * Wed Sep 18 2019 Martin Stransky - 69.0.1-1 From 0adc4aecec45e195b0f6cbcdb1625839846482bc Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 24 Sep 2019 12:37:44 +0200 Subject: [PATCH 0071/1136] Added fix for rhbz#1754460 --- firefox.spec | 7 ++- rhbz-1754460.patch | 127 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 rhbz-1754460.patch diff --git a/firefox.spec b/firefox.spec index abf3618..b7d4337 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.1 -Release: 3%{?pre_tag}%{?dist} +Release: 4%{?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 @@ -141,6 +141,7 @@ Patch224: mozilla-1170092.patch #ARM run-time patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch +Patch228: rhbz-1754460.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -366,6 +367,7 @@ This package contains results of tests executed during build. %patch226 -p1 -b .1354671 %endif %patch227 -p1 -b .locale-debug +%patch228 -p1 -b .rhbz-1754460 %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 @@ -981,6 +983,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Sep 24 2019 Martin Stransky - 69.0.1-4 +- Added fix for rhbz#1754460 + * Thu Sep 19 2019 Martin Stransky - 69.0.1-3 - Updated cache-missing strategy for Wayland image cache. diff --git a/rhbz-1754460.patch b/rhbz-1754460.patch new file mode 100644 index 0000000..cdfc236 --- /dev/null +++ b/rhbz-1754460.patch @@ -0,0 +1,127 @@ +diff --git a/toolkit/components/enterprisepolicies/EnterprisePolicies.js b/toolkit/components/enterprisepolicies/EnterprisePolicies.js +--- a/toolkit/components/enterprisepolicies/EnterprisePolicies.js ++++ b/toolkit/components/enterprisepolicies/EnterprisePolicies.js +@@ -447,21 +447,28 @@ class JSONPoliciesProvider { + + get failed() { + return this._failed; + } + + _getConfigurationFile() { + let configFile = null; + try { +- configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile); ++ configFile = Services.dirsvc.get("XREAppDistUser", Ci.nsIFile); + configFile.append(POLICIES_FILENAME); +- } catch (ex) { +- // Getting the correct directory will fail in xpcshell tests. This should +- // be handled the same way as if the configFile simply does not exist. ++ } catch (ex) {} ++ ++ if (!configFile) { ++ try { ++ configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile); ++ configFile.append(POLICIES_FILENAME); ++ } catch (ex) { ++ // Getting the correct directory will fail in xpcshell tests. This should ++ // be handled the same way as if the configFile simply does not exist. ++ } + } + + let alternatePath = Services.prefs.getStringPref(PREF_ALTERNATE_PATH, ""); + + // Check if we are in automation *before* we use the synchronous + // nsIFile.exists() function or allow the config file to be overriden + // An alternate policy path can also be used in Nightly builds (for + // testing purposes), but the Background Update Agent will be unable to +diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp +--- a/toolkit/xre/nsXREDirProvider.cpp ++++ b/toolkit/xre/nsXREDirProvider.cpp +@@ -40,16 +40,17 @@ + #include "mozilla/dom/ScriptSettings.h" + + #include "mozilla/AutoRestore.h" + #include "mozilla/Components.h" + #include "mozilla/Services.h" + #include "mozilla/Omnijar.h" + #include "mozilla/Preferences.h" + #include "mozilla/Telemetry.h" ++#include "nsPrintfCString.h" + + #include + + #ifdef XP_WIN + # include + # include + # include "WinUtils.h" + #endif +@@ -98,17 +99,17 @@ static already_AddRefed CreateP + nsXREDirProvider* gDirServiceProvider = nullptr; + nsIFile* gDataDirHomeLocal = nullptr; + nsIFile* gDataDirHome = nullptr; + nsCOMPtr gDataDirProfileLocal = nullptr; + nsCOMPtr gDataDirProfile = nullptr; + + // These are required to allow nsXREDirProvider to be usable in xpcshell tests. + // where gAppData is null. +-#if defined(XP_MACOSX) || defined(XP_WIN) ++#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_UNIX) + static const char* GetAppName() { + if (gAppData) { + return gAppData->name; + } + return nullptr; + } + #endif + +@@ -456,16 +457,23 @@ nsXREDirProvider::GetFile(const char* aP + else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DIR)) { + #ifdef ENABLE_SYSTEM_EXTENSION_DIRS + return GetSysUserExtensionsDirectory(aFile); + #else + return NS_ERROR_FAILURE; + #endif + } else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DEV_DIR)) { + return GetSysUserExtensionsDevDirectory(aFile); ++ } else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_USER_DIR)) { ++# ifndef MOZ_WIDGET_GTK ++ return NS_ERROR_FAILURE; ++# endif ++ return NS_NewNativeLocalFile( ++ nsPrintfCString("/run/user/%d/%s/", getuid(), GetAppName()), ++ false, aFile); + } else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) { + bool persistent = false; + rv = GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(file)); + if (NS_SUCCEEDED(rv)) + rv = file->AppendNative(NS_LITERAL_CSTRING("distribution")); + } else if (!strcmp(aProperty, XRE_APP_FEATURES_DIR)) { + rv = GetAppDir()->Clone(getter_AddRefs(file)); + if (NS_SUCCEEDED(rv)) +diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h +--- a/xpcom/build/nsXULAppAPI.h ++++ b/xpcom/build/nsXULAppAPI.h +@@ -137,16 +137,23 @@ + + /** + * A directory service key which specifies the location for app dir add-ons. + * Should be a synonym for XCurProcD everywhere except in tests. + */ + #define XRE_ADDON_APP_DIR "XREAddonAppDir" + + /** ++ * A directory service key which specifies the distribution specific files for ++ * the application unique for each user. ++ * It's located at /run/user/$PID// ++ */ ++#define XRE_APP_DISTRIBUTION_USER_DIR "XREAppDistUser" ++ ++/** + * A directory service key which provides the update directory. Callers should + * fall back to appDir. + * Windows: If vendor name exists: + * ProgramData\\updates\ + * + * + * If vendor name doesn't exist, but product name exists: + * ProgramData\\updates\ From a07515e07547ba9b67d3018cea155753f8068338 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 30 Sep 2019 10:04:35 +0200 Subject: [PATCH 0072/1136] Updated rhbz#1754460/mzbz#1583466 - per user policy dir. --- firefox-redhat-default-prefs.js | 2 + firefox.spec | 9 ++- rhbz-1754460.patch => mozilla-1583466.patch | 77 ++++++++++++++------- 3 files changed, 61 insertions(+), 27 deletions(-) rename rhbz-1754460.patch => mozilla-1583466.patch (61%) diff --git a/firefox-redhat-default-prefs.js b/firefox-redhat-default-prefs.js index 8faf36c..5a93fde 100644 --- a/firefox-redhat-default-prefs.js +++ b/firefox-redhat-default-prefs.js @@ -32,3 +32,5 @@ pref("network.negotiate-auth.trusted-uris", "https://"); pref("spellchecker.dictionary_path","/usr/share/myspell"); /* Disable DoH by default */ pref("network.trr.mode", 5); +/* Enable per-user policy dir, see mozbz#1583466 */ +pref("browser.policies.perUserDir", true); \ No newline at end of file diff --git a/firefox.spec b/firefox.spec index b7d4337..0c7bb7f 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.1 -Release: 4%{?pre_tag}%{?dist} +Release: 5%{?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 @@ -141,7 +141,7 @@ Patch224: mozilla-1170092.patch #ARM run-time patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch -Patch228: rhbz-1754460.patch +Patch228: mozilla-1583466.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -367,7 +367,7 @@ This package contains results of tests executed during build. %patch226 -p1 -b .1354671 %endif %patch227 -p1 -b .locale-debug -%patch228 -p1 -b .rhbz-1754460 +%patch228 -p1 -b .mozilla-1583466 %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 @@ -983,6 +983,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Sep 30 2019 Martin Stransky - 69.0.1-5 +- Updated rhbz#1754460/mzbz#1583466 - per user policy dir. + * Tue Sep 24 2019 Martin Stransky - 69.0.1-4 - Added fix for rhbz#1754460 diff --git a/rhbz-1754460.patch b/mozilla-1583466.patch similarity index 61% rename from rhbz-1754460.patch rename to mozilla-1583466.patch index cdfc236..a4c05a9 100644 --- a/rhbz-1754460.patch +++ b/mozilla-1583466.patch @@ -1,7 +1,43 @@ +changeset: 496943:24592798daf4 +tag: tip +parent: 496931:ca257801d86f +user: Martin Stransky +date: Tue Sep 24 12:54:11 2019 +0200 +files: toolkit/components/enterprisepolicies/EnterprisePolicies.js toolkit/xre/nsXREDirProvider.cpp xpcom/build/nsXULAppAPI.h +description: +Bug 1583466 - [Linux] Allow to Load policies per user from system on Linux/Gtk, r=mkaply + +When browser.policies.perUserPath is set, load browser policy per user +from /run/user/$UID/appname/ directory instead of the default firefox/distribution +dir. + +Differential Revision: https://phabricator.services.mozilla.com/D46921 + + diff --git a/toolkit/components/enterprisepolicies/EnterprisePolicies.js b/toolkit/components/enterprisepolicies/EnterprisePolicies.js --- a/toolkit/components/enterprisepolicies/EnterprisePolicies.js +++ b/toolkit/components/enterprisepolicies/EnterprisePolicies.js -@@ -447,21 +447,28 @@ class JSONPoliciesProvider { +@@ -18,16 +18,19 @@ XPCOMUtils.defineLazyModuleGetters(this, + JsonSchemaValidator: + "resource://gre/modules/components-utils/JsonSchemaValidator.jsm", + }); + + // This is the file that will be searched for in the + // ${InstallDir}/distribution folder. + const POLICIES_FILENAME = "policies.json"; + ++// When true browser policy is loaded per-user from ++// /run/usr/$UID/appname ++const PREF_PER_USER_DIR = "browser.policies.perUserDir"; + // For easy testing, modify the helpers/sample.json file, + // and set PREF_ALTERNATE_PATH in firefox.js as: + // /your/repo/browser/components/enterprisepolicies/helpers/sample.json + const PREF_ALTERNATE_PATH = "browser.policies.alternatePath"; + // For testing, we may want to set PREF_ALTERNATE_PATH to point to a file + // relative to the test root directory. In order to enable this, the string + // below may be placed at the beginning of that preference value and it will + // be replaced with the path to the test root directory. +@@ -450,17 +453,22 @@ class JSONPoliciesProvider { get failed() { return this._failed; @@ -11,29 +47,20 @@ diff --git a/toolkit/components/enterprisepolicies/EnterprisePolicies.js b/toolk let configFile = null; try { - configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile); -+ configFile = Services.dirsvc.get("XREAppDistUser", Ci.nsIFile); - configFile.append(POLICIES_FILENAME); -- } catch (ex) { -- // Getting the correct directory will fail in xpcshell tests. This should -- // be handled the same way as if the configFile simply does not exist. -+ } catch (ex) {} -+ -+ if (!configFile) { -+ try { ++ let perUserPath = Services.prefs.getBoolPref(PREF_PER_USER_DIR, false); ++ if (perUserPath) { ++ configFile = Services.dirsvc.get("XREAppDistUser", Ci.nsIFile); ++ } else { + configFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile); -+ configFile.append(POLICIES_FILENAME); -+ } catch (ex) { -+ // Getting the correct directory will fail in xpcshell tests. This should -+ // be handled the same way as if the configFile simply does not exist. + } + configFile.append(POLICIES_FILENAME); + } catch (ex) { + // Getting the correct directory will fail in xpcshell tests. This should + // be handled the same way as if the configFile simply does not exist. } let alternatePath = Services.prefs.getStringPref(PREF_ALTERNATE_PATH, ""); - // Check if we are in automation *before* we use the synchronous - // nsIFile.exists() function or allow the config file to be overriden - // An alternate policy path can also be used in Nightly builds (for - // testing purposes), but the Background Update Agent will be unable to diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -74,7 +101,7 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp } #endif -@@ -456,16 +457,23 @@ nsXREDirProvider::GetFile(const char* aP +@@ -456,16 +457,24 @@ nsXREDirProvider::GetFile(const char* aP else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DIR)) { #ifdef ENABLE_SYSTEM_EXTENSION_DIRS return GetSysUserExtensionsDirectory(aFile); @@ -84,12 +111,13 @@ diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp } else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DEV_DIR)) { return GetSysUserExtensionsDevDirectory(aFile); + } else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_USER_DIR)) { -+# ifndef MOZ_WIDGET_GTK ++#ifdef MOZ_WIDGET_GTK ++ nsPrintfCString path("/run/user/%d/%s/", getuid(), GetAppName()); ++ ToLowerCase(path); ++ return NS_NewNativeLocalFile(path, false, aFile); ++#else + return NS_ERROR_FAILURE; -+# endif -+ return NS_NewNativeLocalFile( -+ nsPrintfCString("/run/user/%d/%s/", getuid(), GetAppName()), -+ false, aFile); ++#endif } else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) { bool persistent = false; rv = GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(file)); @@ -125,3 +153,4 @@ diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h * * If vendor name doesn't exist, but product name exists: * ProgramData\\updates\ + From cc911d3225cc500830ae115bc513b468b9d5471c Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 2 Oct 2019 17:13:40 +0200 Subject: [PATCH 0073/1136] Don't compare buildID in upgradepath because builds in newer distro can be build sooner than in previous one. --- firefox.spec | 8 +++++++- rh-old-version-check.patch | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 rh-old-version-check.patch diff --git a/firefox.spec b/firefox.spec index 0c7bb7f..e56e087 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.1 -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 @@ -142,6 +142,7 @@ Patch224: mozilla-1170092.patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch Patch228: mozilla-1583466.patch +Patch229: rh-old-version-check.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -368,6 +369,7 @@ This package contains results of tests executed during build. %endif %patch227 -p1 -b .locale-debug %patch228 -p1 -b .mozilla-1583466 +%patch229 -p1 -b .rh-old-version-check %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 @@ -983,6 +985,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Oct 2 2019 Jan Horak - 69.0.1-6 +- Do not compare buildID because the build time of package in + newer distro can be older. + * Mon Sep 30 2019 Martin Stransky - 69.0.1-5 - Updated rhbz#1754460/mzbz#1583466 - per user policy dir. diff --git a/rh-old-version-check.patch b/rh-old-version-check.patch new file mode 100644 index 0000000..b83f34b --- /dev/null +++ b/rh-old-version-check.patch @@ -0,0 +1,20 @@ +diff -up firefox-69.0/toolkit/xre/nsAppRunner.cpp.old-version-check firefox-69.0/toolkit/xre/nsAppRunner.cpp +--- firefox-69.0/toolkit/xre/nsAppRunner.cpp.old-version-check 2019-10-02 16:58:38.018077162 +0200 ++++ firefox-69.0/toolkit/xre/nsAppRunner.cpp 2019-10-02 16:59:57.955339034 +0200 +@@ -2453,13 +2453,9 @@ int32_t CompareCompatVersions(const nsAC + return result; + } + +- // Fall back to build ID comparison. +- result = CompareBuildIDs(oldAppBuildID, newAppBuildID); +- if (result != 0) { +- return result; +- } +- +- return CompareBuildIDs(oldPlatformBuildID, newPlatformBuildID); ++ // Don't compare build ids because the build time can be older on the ++ // newer distribution package. ++ return 0; + } + + /** From 8fec45cc113d6218493da9026737cc27937b52b7 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 3 Oct 2019 10:13:04 +0200 Subject: [PATCH 0074/1136] Revert "Don't compare buildID in upgradepath because builds in newer distro can be build sooner than in previous one." Because it's already implemented by MOZ_ALLOW_DOWNGRADE env variable. This reverts commit cc911d3225cc500830ae115bc513b468b9d5471c. --- firefox.spec | 8 +------- rh-old-version-check.patch | 20 -------------------- 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 rh-old-version-check.patch diff --git a/firefox.spec b/firefox.spec index e56e087..0c7bb7f 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.1 -Release: 6%{?pre_tag}%{?dist} +Release: 5%{?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 @@ -142,7 +142,6 @@ Patch224: mozilla-1170092.patch Patch226: rhbz-1354671.patch Patch227: firefox-locale-debug.patch Patch228: mozilla-1583466.patch -Patch229: rh-old-version-check.patch # Upstream patches Patch402: mozilla-1196777.patch @@ -369,7 +368,6 @@ This package contains results of tests executed during build. %endif %patch227 -p1 -b .locale-debug %patch228 -p1 -b .mozilla-1583466 -%patch229 -p1 -b .rh-old-version-check %patch402 -p1 -b .1196777 #%patch413 -p1 -b .1353817 @@ -985,10 +983,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Wed Oct 2 2019 Jan Horak - 69.0.1-6 -- Do not compare buildID because the build time of package in - newer distro can be older. - * Mon Sep 30 2019 Martin Stransky - 69.0.1-5 - Updated rhbz#1754460/mzbz#1583466 - per user policy dir. diff --git a/rh-old-version-check.patch b/rh-old-version-check.patch deleted file mode 100644 index b83f34b..0000000 --- a/rh-old-version-check.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -up firefox-69.0/toolkit/xre/nsAppRunner.cpp.old-version-check firefox-69.0/toolkit/xre/nsAppRunner.cpp ---- firefox-69.0/toolkit/xre/nsAppRunner.cpp.old-version-check 2019-10-02 16:58:38.018077162 +0200 -+++ firefox-69.0/toolkit/xre/nsAppRunner.cpp 2019-10-02 16:59:57.955339034 +0200 -@@ -2453,13 +2453,9 @@ int32_t CompareCompatVersions(const nsAC - return result; - } - -- // Fall back to build ID comparison. -- result = CompareBuildIDs(oldAppBuildID, newAppBuildID); -- if (result != 0) { -- return result; -- } -- -- return CompareBuildIDs(oldPlatformBuildID, newPlatformBuildID); -+ // Don't compare build ids because the build time can be older on the -+ // newer distribution package. -+ return 0; - } - - /** From b87d9dc7bf7e95f8004acaf4c1a5a27443807f64 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 3 Oct 2019 16:09:51 +0200 Subject: [PATCH 0075/1136] Updated to 69.0.2 --- .gitignore | 2 ++ firefox.spec | 9 ++++++--- sources | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 117da22..49a80cc 100644 --- a/.gitignore +++ b/.gitignore @@ -362,3 +362,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-69.0-20190829.tar.xz /firefox-69.0.1.source.tar.xz /firefox-langpacks-69.0.1-20190918.tar.xz +/firefox-langpacks-69.0.2-20191003.tar.xz +/firefox-69.0.2.source.tar.xz diff --git a/firefox.spec b/firefox.spec index 0c7bb7f..8d7c6bc 100644 --- a/firefox.spec +++ b/firefox.spec @@ -93,13 +93,13 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox -Version: 69.0.1 -Release: 5%{?pre_tag}%{?dist} +Version: 69.0.2 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20190918.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20191003.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -983,6 +983,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Oct 3 2019 Martin Stransky - 69.0.2-1 +- Updated to 69.0.2 + * Mon Sep 30 2019 Martin Stransky - 69.0.1-5 - Updated rhbz#1754460/mzbz#1583466 - per user policy dir. diff --git a/sources b/sources index 215accd..9f92f14 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = 88afa0bc6af525cbb46bc75578b90419b28b95b396d5002fbf299a78a173681b840096ff83ef6e48553d1a5e0aa04e79383ab4d09bf431f3b864fcbacc7de46d -SHA512 (firefox-69.0.1.source.tar.xz) = 89e63eb882cd729f938fef3cb0565cf166b14fa8c4e34ff027f3f6ea0469e4a49706074259013c1cea66f7a3f6f46aead8e055049d542935ddca983ac172b93f -SHA512 (firefox-langpacks-69.0.1-20190918.tar.xz) = f0165009a69bbd8d5d863a53cb5a5e270e8c6ea1187cbe0cf773c25ec44fac8bd2ebc64e36b0f399431c67ec3f71d62d413955a9e376cd194d157bae41f0c0ea +SHA512 (firefox-langpacks-69.0.2-20191003.tar.xz) = 1da548a109489379e39b697eede84c65d6cede849680dd7ade3b4fd3f39d6998f5f6c97741384afc665d9a1addfe9b45c4933100e7c86158f54684840eb51d93 +SHA512 (firefox-69.0.2.source.tar.xz) = 86f29ff3c699f83041a25294a2ec4f4d07f73aab05132c0d63f583c2094ca007adc30d6a3b8e961170b1579f5966a76b905b0ae1094309741fc826ddd9ebf094 From e15d59f286ac57cc00c192771886906ae9eec2a3 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 8 Oct 2019 14:25:09 +0200 Subject: [PATCH 0076/1136] Added fix for mozilla#1587008 - flickering during GL resize. --- firefox.spec | 7 +- mozilla-1587008.patch | 189 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 mozilla-1587008.patch diff --git a/firefox.spec b/firefox.spec index 8d7c6bc..96c9d2f 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.2 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -172,6 +172,7 @@ Patch587: mozilla-1580152.patch Patch588: mozilla-1581748.patch Patch589: mozilla-1577024.patch Patch590: firefox-wayland-cache-missing.patch +Patch591: mozilla-1587008.patch # PGO/LTO patches Patch600: pgo.patch @@ -399,6 +400,7 @@ This package contains results of tests executed during build. %patch588 -p1 -b .mozilla-1581748 %patch589 -p1 -b .mozilla-1577024 %patch590 -p1 -b .cache-missing +%patch591 -p1 -b .mozilla-1587008 # PGO patches %patch600 -p1 -b .pgo @@ -983,6 +985,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Oct 3 2019 Martin Stransky - 69.0.2-2 +- Added fix for mozilla#1587008 - flickering during GL resize. + * Thu Oct 3 2019 Martin Stransky - 69.0.2-1 - Updated to 69.0.2 diff --git a/mozilla-1587008.patch b/mozilla-1587008.patch new file mode 100644 index 0000000..8daf72e --- /dev/null +++ b/mozilla-1587008.patch @@ -0,0 +1,189 @@ +changeset: 498019:9961a0e4d424 +tag: tip +parent: 498006:3fa65bda1e50 +user: Martin Stransky +date: Tue Oct 08 13:32:37 2019 +0200 +files: widget/gtk/mozcontainer.cpp +description: +Bug 1587008 - [Wayland/GL] Fixed visual glitches with gl compositor during window resize, r=jhorak + +Recently we update egl_window size only in moz_container_size_allocate() which is leads +to visible visual glitches as moz_container_size_allocate() is not called during window resize but +after it. + +We need to update egl_window size faster which is done in configure-event callback. + +Differential Revision: https://phabricator.services.mozilla.com/D48526 + + +diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp +--- a/widget/gtk/mozcontainer.cpp ++++ b/widget/gtk/mozcontainer.cpp +@@ -136,16 +136,60 @@ void moz_container_put(MozContainer* con + container->children = g_list_append(container->children, child); + + /* we assume that the caller of this function will have already set + the parent GdkWindow because we can have many anonymous children. */ + gtk_widget_set_parent(child_widget, GTK_WIDGET(container)); + } + + /* static methods */ ++#if defined(MOZ_WAYLAND) ++static gint moz_container_get_scale(MozContainer* container) { ++ static auto sGdkWindowGetScaleFactorPtr = ++ (gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor"); ++ ++ if (sGdkWindowGetScaleFactorPtr) { ++ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container)); ++ return (*sGdkWindowGetScaleFactorPtr)(window); ++ } ++ ++ return 1; ++} ++ ++static void moz_container_resize(MozContainer* container, int width, ++ int height) { ++ // Set correct scaled/unscaled mozcontainer offset ++ // especially when wl_egl is used but we don't recreate it as Gtk+ does. ++ if (container->subsurface) { ++ gint x, y; ++ gdk_window_get_position(gtk_widget_get_window(GTK_WIDGET(container)), &x, ++ &y); ++ wl_subsurface_set_position(container->subsurface, x, y); ++ } ++ ++ // Try to only resize wl_egl_window on scale factor change. ++ // It's a bit risky as Gtk+ recreates it at that event. ++ if (container->eglwindow) { ++ gint scale = moz_container_get_scale(container); ++ if (container->surface) { ++ wl_surface_set_buffer_scale(container->surface, scale); ++ } ++ wl_egl_window_resize(container->eglwindow, width * scale, height * scale, 0, ++ 0); ++ } ++} ++ ++static gboolean moz_container_configure_event_cb(GtkWidget* widget, ++ GdkEventConfigure* event) { ++ LOG(("moz_container_egl_window_configure_event_cb [%p] %d %d %d %d\n", ++ (void*)widget, event->x, event->y, event->width, event->height)); ++ moz_container_resize(MOZ_CONTAINER(widget), event->width, event->height); ++ return FALSE; ++} ++#endif + + void moz_container_class_init(MozContainerClass* klass) { + /*GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); */ + GtkContainerClass* container_class = GTK_CONTAINER_CLASS(klass); + GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass); + + widget_class->map = moz_container_map; +@@ -173,16 +217,21 @@ void moz_container_init(MozContainer* co + container->subsurface = nullptr; + container->eglwindow = nullptr; + container->frame_callback_handler = nullptr; + container->frame_callback_handler_surface_id = -1; + // We can draw to x11 window any time. + container->ready_to_draw = GDK_IS_X11_DISPLAY(gdk_display_get_default()); + container->surface_needs_clear = true; + container->inital_draw_cb = nullptr; ++ ++ // We need faster resize response in mozcontainer to avoid visual glitches ++ // during window resize. ++ g_signal_connect(container, "configure_event", ++ G_CALLBACK(moz_container_configure_event_cb), nullptr); + #endif + + LOG(("%s [%p]\n", __FUNCTION__, (void*)container)); + } + + #if defined(MOZ_WAYLAND) + void moz_container_set_initial_draw_callback( + MozContainer* container, std::function inital_draw_cb) { +@@ -285,53 +334,26 @@ static void moz_container_unmap_wayland( + container->frame_callback_handler_surface_id = -1; + + container->surface_needs_clear = true; + container->ready_to_draw = false; + + LOGWAYLAND(("%s [%p]\n", __FUNCTION__, (void*)container)); + } + +-static gint moz_container_get_scale(MozContainer* container) { +- static auto sGdkWindowGetScaleFactorPtr = +- (gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor"); +- +- if (sGdkWindowGetScaleFactorPtr) { +- GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container)); +- return (*sGdkWindowGetScaleFactorPtr)(window); +- } +- +- return 1; +-} +- + void moz_container_scale_changed(MozContainer* container, + GtkAllocation* aAllocation) { + LOGWAYLAND(("%s [%p] surface %p eglwindow %p\n", __FUNCTION__, + (void*)container, (void*)container->surface, + (void*)container->eglwindow)); + + if (!container->surface) { + return; + } +- +- // Set correct scaled/unscaled mozcontainer offset +- // especially when wl_egl is used but we don't recreate it as Gtk+ does. +- gint x, y; +- gdk_window_get_position(gtk_widget_get_window(GTK_WIDGET(container)), &x, &y); +- wl_subsurface_set_position(container->subsurface, x, y); +- +- // Try to only resize wl_egl_window on scale factor change. +- // It's a bit risky as Gtk+ recreates it at that event. +- if (container->eglwindow) { +- gint scale = moz_container_get_scale(container); +- wl_surface_set_buffer_scale(container->surface, +- moz_container_get_scale(container)); +- wl_egl_window_resize(container->eglwindow, aAllocation->width * scale, +- aAllocation->height * scale, 0, 0); +- } ++ moz_container_resize(container, aAllocation->width, aAllocation->height); + } + #endif + + void moz_container_map(GtkWidget* widget) { + MozContainer* container; + GList* tmp_list; + GtkWidget* tmp_child; + +@@ -451,26 +473,18 @@ void moz_container_size_allocate(GtkWidg + allocation->y, allocation->width, + allocation->height); + } + + #if defined(MOZ_WAYLAND) + // We need to position our subsurface according to GdkWindow + // when offset changes (GdkWindow is maximized for instance). + // see gtk-clutter-embed.c for reference. +- if (container->subsurface) { +- gint x, y; +- gdk_window_get_position(gtk_widget_get_window(widget), &x, &y); +- wl_subsurface_set_position(container->subsurface, x, y); +- } +- if (container->eglwindow) { +- gint scale = moz_container_get_scale(container); +- wl_egl_window_resize(container->eglwindow, allocation->width * scale, +- allocation->height * scale, 0, 0); +- } ++ moz_container_resize(MOZ_CONTAINER(widget), allocation->width, ++ allocation->height); + #endif + } + + void moz_container_remove(GtkContainer* container, GtkWidget* child_widget) { + MozContainerChild* child; + MozContainer* moz_container; + GdkWindow* parent_window; + + From b9f162580998b709d2f3dede531354f798f1a28a Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Wed, 9 Oct 2019 14:38:35 +0200 Subject: [PATCH 0077/1136] Obsolete firefox-wayland when we're on wayland by default --- firefox.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 96c9d2f..e51e821 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.2 -Release: 2%{?pre_tag}%{?dist} +Release: 3%{?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 @@ -278,6 +278,10 @@ BuildRequires: clang-devel Obsoletes: mozilla <= 37:1.7.13 Provides: webclient +%if 0%{?wayland_backend_default} +Obsoletes: firefox-wayland +%endif + %description Mozilla Firefox is an open-source web browser, designed for standards compliance, performance and portability. @@ -321,7 +325,6 @@ to run Firefox natively on Wayland. %{_datadir}/applications/firefox-wayland.desktop %endif - %if %{run_tests} %global testsuite_pkg_name mozilla-%{name}-testresults %package -n %{testsuite_pkg_name} @@ -985,6 +988,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Oct 9 2019 Martin Stransky - 69.0.2-3 +- Obsolete firefox-wayland when we're on wayland by default. + * Thu Oct 3 2019 Martin Stransky - 69.0.2-2 - Added fix for mozilla#1587008 - flickering during GL resize. From 152ddea84d84e38b2e2ad7fee427ad5500e27181 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 10 Oct 2019 21:56:13 +0200 Subject: [PATCH 0078/1136] Updated to 69.0.3 --- .gitignore | 2 ++ firefox.spec | 9 ++++++--- sources | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 49a80cc..379c588 100644 --- a/.gitignore +++ b/.gitignore @@ -364,3 +364,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-69.0.1-20190918.tar.xz /firefox-langpacks-69.0.2-20191003.tar.xz /firefox-69.0.2.source.tar.xz +/firefox-69.0.3.source.tar.xz +/firefox-langpacks-69.0.3-20191010.tar.xz diff --git a/firefox.spec b/firefox.spec index e51e821..6621edc 100644 --- a/firefox.spec +++ b/firefox.spec @@ -93,13 +93,13 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox -Version: 69.0.2 -Release: 3%{?pre_tag}%{?dist} +Version: 69.0.3 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20191003.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20191010.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -988,6 +988,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Oct 10 2019 Martin Stransky - 69.0.3-1 +- Updated to 69.0.3 + * Wed Oct 9 2019 Martin Stransky - 69.0.2-3 - Obsolete firefox-wayland when we're on wayland by default. diff --git a/sources b/sources index 9f92f14..ec7b042 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = 88afa0bc6af525cbb46bc75578b90419b28b95b396d5002fbf299a78a173681b840096ff83ef6e48553d1a5e0aa04e79383ab4d09bf431f3b864fcbacc7de46d -SHA512 (firefox-langpacks-69.0.2-20191003.tar.xz) = 1da548a109489379e39b697eede84c65d6cede849680dd7ade3b4fd3f39d6998f5f6c97741384afc665d9a1addfe9b45c4933100e7c86158f54684840eb51d93 -SHA512 (firefox-69.0.2.source.tar.xz) = 86f29ff3c699f83041a25294a2ec4f4d07f73aab05132c0d63f583c2094ca007adc30d6a3b8e961170b1579f5966a76b905b0ae1094309741fc826ddd9ebf094 +SHA512 (firefox-69.0.3.source.tar.xz) = bc4020c5f1a1eac82944f6402aa374c830231a0f168c6cdab8924a1c7a1b296381b45bce0a0567811ad86c2688972a35fda3f6c15e562b03a47d48617fe7611a +SHA512 (firefox-langpacks-69.0.3-20191010.tar.xz) = e293903557dffa0231345a2ae4085705ae3b5b9c1935c1fc2890d042e63862d45134a03403bbebec1fbe068b9d590797946feb8153e2d4129e5f4e309065381a From 3a864e53cfbaf2aa28dca48c73ff2dae406e1303 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 14 Oct 2019 21:23:01 +0200 Subject: [PATCH 0079/1136] Build firefox-wayland again (rhbz#1761578) --- firefox.spec | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/firefox.spec b/firefox.spec index 6621edc..f8e1648 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 69.0.3 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -278,10 +278,6 @@ BuildRequires: clang-devel Obsoletes: mozilla <= 37:1.7.13 Provides: webclient -%if 0%{?wayland_backend_default} -Obsoletes: firefox-wayland -%endif - %description Mozilla Firefox is an open-source web browser, designed for standards compliance, performance and portability. @@ -309,21 +305,21 @@ Summary: Firefox X11 launcher. Requires: %{name} %description x11 The firefox-x11 package contains launcher and desktop file -to run Firefox natively on X11. +to run Firefox explicitly on X11. %files x11 %{_bindir}/firefox-x11 %{_datadir}/applications/firefox-x11.desktop -%else +%endif + %package wayland Summary: Firefox Wayland launcher. Requires: %{name} %description wayland The firefox-wayland package contains launcher and desktop file -to run Firefox natively on Wayland. +to run Firefox explicitly on Wayland. %files wayland %{_bindir}/firefox-wayland %{_datadir}/applications/firefox-wayland.desktop -%endif %if %{run_tests} %global testsuite_pkg_name mozilla-%{name}-testresults @@ -988,6 +984,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Oct 14 2019 Martin Stransky - 69.0.3-2 +- Build firefox-wayland again (rhbz#1761578). + * Thu Oct 10 2019 Martin Stransky - 69.0.3-1 - Updated to 69.0.3 From be00a1517c763794ca8af877ad00c7a7b0fe00e8 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 15 Oct 2019 11:07:21 +0200 Subject: [PATCH 0080/1136] Spec file update - firefox-wayland package --- firefox.spec | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/firefox.spec b/firefox.spec index f8e1648..872105b 100644 --- a/firefox.spec +++ b/firefox.spec @@ -691,9 +691,8 @@ DESTDIR=%{buildroot} make -C objdir install desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE20} %if 0%{?wayland_backend_default} desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE31} -%else -desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE29} %endif +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE29} # set up the firefox start script %if 0%{?wayland_backend_default} @@ -716,10 +715,9 @@ sed -i -e 's|%FLATPAK_ENV_VARS%||' %{buildroot}%{_bindir}/firefox %if 0%{?wayland_backend_default} %{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE30} > %{buildroot}%{_bindir}/firefox-x11 %{__chmod} 755 %{buildroot}%{_bindir}/firefox-x11 -%else +%endif %{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE28} > %{buildroot}%{_bindir}/firefox-wayland %{__chmod} 755 %{buildroot}%{_bindir}/firefox-wayland -%endif %{__install} -p -D -m 644 %{SOURCE23} %{buildroot}%{_mandir}/man1/firefox.1 From 302967b0a822136f55649d389e0345870cae57a9 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Fri, 18 Oct 2019 20:43:19 +0200 Subject: [PATCH 0081/1136] Updated to 70.0 Build 2 --- .gitignore | 2 + firefox.spec | 44 +-- mozilla-1353817.patch | 27 -- mozilla-1512162.patch | 43 --- mozilla-1516081.patch | 41 +- mozilla-1562827.patch | 141 ------- mozilla-1566876-webrtc-ind.patch | 36 -- mozilla-1567434-1.patch | 226 ----------- mozilla-1567434-2.patch | 35 -- mozilla-1573813.patch | 29 -- mozilla-1574036.patch | 425 --------------------- mozilla-1576268.patch | 17 - mozilla-1577024.patch | 90 ----- mozilla-1579794-1.patch | 134 ------- mozilla-1579794-2.patch | 166 --------- mozilla-1579823.patch | 306 --------------- mozilla-1579849.patch | 14 - mozilla-1580152.patch | 618 ------------------------------- mozilla-1581748.patch | 574 ---------------------------- pgo.patch | 21 +- sources | 4 +- 21 files changed, 33 insertions(+), 2960 deletions(-) delete mode 100644 mozilla-1353817.patch delete mode 100644 mozilla-1512162.patch delete mode 100644 mozilla-1562827.patch delete mode 100644 mozilla-1566876-webrtc-ind.patch delete mode 100644 mozilla-1567434-1.patch delete mode 100644 mozilla-1567434-2.patch delete mode 100644 mozilla-1573813.patch delete mode 100644 mozilla-1574036.patch delete mode 100644 mozilla-1576268.patch delete mode 100644 mozilla-1577024.patch delete mode 100644 mozilla-1579794-1.patch delete mode 100644 mozilla-1579794-2.patch delete mode 100644 mozilla-1579823.patch delete mode 100644 mozilla-1579849.patch delete mode 100644 mozilla-1580152.patch delete mode 100644 mozilla-1581748.patch diff --git a/.gitignore b/.gitignore index 379c588..7077731 100644 --- a/.gitignore +++ b/.gitignore @@ -366,3 +366,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-69.0.2.source.tar.xz /firefox-69.0.3.source.tar.xz /firefox-langpacks-69.0.3-20191010.tar.xz +/firefox-70.0.source.tar.xz +/firefox-langpacks-70.0-20191018.tar.xz diff --git a/firefox.spec b/firefox.spec index 872105b..7a3dffc 100644 --- a/firefox.spec +++ b/firefox.spec @@ -93,13 +93,13 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox -Version: 69.0.3 -Release: 2%{?pre_tag}%{?dist} +Version: 70.0 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20191010.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20191018.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -146,31 +146,15 @@ Patch228: mozilla-1583466.patch # Upstream patches Patch402: mozilla-1196777.patch Patch412: mozilla-1337988.patch -#Patch413: mozilla-1353817.patch Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch Patch417: bug1375074-save-restore-x28.patch -Patch418: mozilla-1512162.patch Patch419: mozilla-1568569.patch -Patch420: mozilla-1566876-webrtc-ind.patch Patch421: mozilla-1579023.patch Patch422: mozilla-1580174-webrtc-popup.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch Patch575: mozilla-1548475.patch -Patch576: mozilla-1562827.patch -Patch578: mozilla-1567434-1.patch -Patch579: mozilla-1567434-2.patch -Patch580: mozilla-1573813.patch -Patch581: mozilla-1574036.patch -Patch582: mozilla-1576268.patch -Patch583: mozilla-1579794-1.patch -Patch584: mozilla-1579794-2.patch -Patch585: mozilla-1579849.patch -Patch586: mozilla-1579823.patch -Patch587: mozilla-1580152.patch -Patch588: mozilla-1581748.patch -Patch589: mozilla-1577024.patch Patch590: firefox-wayland-cache-missing.patch Patch591: mozilla-1587008.patch @@ -370,34 +354,15 @@ This package contains results of tests executed during build. %patch228 -p1 -b .mozilla-1583466 %patch402 -p1 -b .1196777 -#%patch413 -p1 -b .1353817 %ifarch %{arm} %patch415 -p1 -b .1238661 %endif -%ifarch ppc64 ppc64le -#%patch418 -p1 -b .1512162 FIXME no longer needed? -%endif %patch419 -p1 -b .1568569 -%patch420 -p1 -b .1566876-webrtc-ind %patch421 -p1 -b .1579023 # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire %patch575 -p1 -b .mozilla-1548475 -%patch576 -p1 -b .mozilla-1562827 -%patch578 -p1 -b .mozilla-1567434-1 -%patch579 -p1 -b .mozilla-1567434-2 -%patch580 -p1 -b .mozilla-1573813 -%patch581 -p1 -b .mozilla-1574036 -%patch582 -p1 -b .mozilla-1576268 -%patch583 -p1 -b .mozilla-1579794-1 -%patch584 -p1 -b .mozilla-1579794-2 -%patch585 -p1 -b .mozilla-1579849 -%patch422 -p1 -b .1580174-webrtc-popup -%patch586 -p1 -b .mozilla-1579823 -%patch587 -p1 -b .mozilla-1580152 -%patch588 -p1 -b .mozilla-1581748 -%patch589 -p1 -b .mozilla-1577024 %patch590 -p1 -b .cache-missing %patch591 -p1 -b .mozilla-1587008 @@ -982,6 +947,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Oct 15 2019 Martin Stransky - 70.0-1 +- Updated to 70.0 + * Mon Oct 14 2019 Martin Stransky - 69.0.3-2 - Build firefox-wayland again (rhbz#1761578). diff --git a/mozilla-1353817.patch b/mozilla-1353817.patch deleted file mode 100644 index dc8d8f8..0000000 --- a/mozilla-1353817.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1cc652f5525f458b0b4ceb12af24bf5a4367db32 Mon Sep 17 00:00:00 2001 -From: Nicolas Dufresne -Date: Tue, 23 May 2017 13:09:48 -0400 -Subject: [PATCH] Bug 1353817: Include SkNx_neon.h for ARM64 too - -This fixes build errors as arm_neon.h was missing along with some -missing converters. ---- - gfx/skia/skia/src/core/SkNx.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gfx/skia/skia/src/core/SkNx.h b/gfx/skia/skia/src/core/SkNx.h -index 6bca856..b0427aa 100644 ---- a/gfx/skia/skia/src/core/SkNx.h -+++ b/gfx/skia/skia/src/core/SkNx.h -@@ -299,7 +299,7 @@ typedef SkNx<4, uint32_t> Sk4u; - // Include platform specific specializations if available. - #if !defined(SKNX_NO_SIMD) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 - #include "../opts/SkNx_sse.h" --#elif !defined(SKNX_NO_SIMD) && defined(SK_ARM_HAS_NEON) -+#elif !defined(SKNX_NO_SIMD) && (defined(SK_ARM_HAS_NEON) || defined(SK_CPU_ARM64)) - #include "../opts/SkNx_neon.h" - #else - --- -2.9.4 - diff --git a/mozilla-1512162.patch b/mozilla-1512162.patch deleted file mode 100644 index 99a0b14..0000000 --- a/mozilla-1512162.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff -up firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp.1512162 firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp ---- firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp.1512162 2019-07-17 22:51:30.000000000 +0200 -+++ firefox-68.0.1/js/xpconnect/src/XPCWrappedNative.cpp 2019-07-25 08:08:18.512528313 +0200 -@@ -1092,7 +1092,7 @@ class MOZ_STACK_CLASS CallMethodHelper f - MOZ_ALWAYS_INLINE bool GetOutParamSource(uint8_t paramIndex, - MutableHandleValue srcp) const; - -- MOZ_ALWAYS_INLINE bool GatherAndConvertResults(); -+ bool GatherAndConvertResults(); - - MOZ_ALWAYS_INLINE bool QueryInterfaceFastPath(); - -@@ -1139,7 +1139,7 @@ class MOZ_STACK_CLASS CallMethodHelper f - - ~CallMethodHelper(); - -- MOZ_ALWAYS_INLINE bool Call(); -+ bool Call(); - - // Trace implementation so we can put our CallMethodHelper in a Rooted. - void trace(JSTracer* aTrc); -@@ -1157,6 +1157,10 @@ bool XPCWrappedNative::CallMethod(XPCCal - return helper.get().Call(); - } - -+#if (__GNUC__ && __linux__ && __PPC64__ && _LITTLE_ENDIAN) -+// Work around a compiler bug on ppc64le (bug 1512162). -+__attribute__ ((noinline,noclone)) -+#endif - bool CallMethodHelper::Call() { - mCallContext.SetRetVal(JS::UndefinedValue()); - -@@ -1315,6 +1319,10 @@ bool CallMethodHelper::GetOutParamSource - return true; - } - -+#if (__GNUC__ && __linux__ && __PPC64__ && _LITTLE_ENDIAN) -+// Work around a compiler bug on ppc64le (bug 1512162). -+__attribute__ ((noinline,noclone)) -+#endif - bool CallMethodHelper::GatherAndConvertResults() { - // now we iterate through the native params to gather and convert results - uint8_t paramCount = mMethodInfo->GetParamCount(); diff --git a/mozilla-1516081.patch b/mozilla-1516081.patch index 1ecff39..cc332a6 100644 --- a/mozilla-1516081.patch +++ b/mozilla-1516081.patch @@ -1,7 +1,7 @@ -diff -up firefox-69.0/build/moz.configure/toolchain.configure.1516081 firefox-69.0/build/moz.configure/toolchain.configure ---- firefox-69.0/build/moz.configure/toolchain.configure.1516081 2019-08-27 03:31:51.000000000 +0200 -+++ firefox-69.0/build/moz.configure/toolchain.configure 2019-08-29 10:42:45.872919255 +0200 -@@ -1411,7 +1411,7 @@ def pgo_flags(compiler, build_env, targe +diff -up firefox-70.0/build/moz.configure/lto-pgo.configure.old firefox-70.0/build/moz.configure/lto-pgo.configure +--- firefox-70.0/build/moz.configure/lto-pgo.configure.old 2019-10-18 20:33:54.240107068 +0200 ++++ firefox-70.0/build/moz.configure/lto-pgo.configure 2019-10-18 20:34:44.202009678 +0200 +@@ -16,7 +16,7 @@ def pgo_flags(compiler, build_env, targe if compiler.type == 'gcc': return namespace( @@ -10,29 +10,12 @@ diff -up firefox-69.0/build/moz.configure/toolchain.configure.1516081 firefox-69 gen_ldflags=['-fprofile-generate'], use_cflags=['-fprofile-use', '-fprofile-correction', '-Wcoverage-mismatch'], -@@ -1434,7 +1434,8 @@ def pgo_flags(compiler, build_env, targe +@@ -38,7 +38,7 @@ def pgo_flags(compiler, build_env, targe + gen_ldflags = ['-fprofile-generate'] - if gen_ldflags: - return namespace( -- gen_cflags=[prefix + '-fprofile-generate'], -+ gen_cflags=[prefix + '-fprofile-generate', -+ '-DMOZ_PROFILE_INSTRUMENTATION'], - gen_ldflags=gen_ldflags, - use_cflags=[prefix + '-fprofile-use=%s' % profdata, - # Some error messages about mismatched profile data -diff -up firefox-69.0/toolkit/components/terminator/nsTerminator.cpp.1516081 firefox-69.0/toolkit/components/terminator/nsTerminator.cpp ---- firefox-69.0/toolkit/components/terminator/nsTerminator.cpp.1516081 2019-08-27 03:32:05.000000000 +0200 -+++ firefox-69.0/toolkit/components/terminator/nsTerminator.cpp 2019-08-29 09:51:08.513440687 +0200 -@@ -419,6 +419,12 @@ void nsTerminator::StartWatchdog() { - } - } - #endif -+ // Disable watchdog for PGO train builds - writting profile information at -+ // exit may take time and it is better to make build hang rather than -+ // silently produce poorly performing binary. -+#ifdef MOZ_PROFILE_INSTRUMENTATION -+ crashAfterMS = INT32_MAX; -+#endif - - UniquePtr options(new Options()); - const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000); + return namespace( +- gen_cflags=[prefix + '-fprofile-generate'], ++ gen_cflags=[prefix + '-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'], + gen_ldflags=gen_ldflags, + use_cflags=[prefix + '-fprofile-use=%s' % profdata, + # Some error messages about mismatched profile data diff --git a/mozilla-1562827.patch b/mozilla-1562827.patch deleted file mode 100644 index 497133c..0000000 --- a/mozilla-1562827.patch +++ /dev/null @@ -1,141 +0,0 @@ -diff -up firefox-69.0/widget/gtk/nsWindow.cpp.mozilla-1562827 firefox-69.0/widget/gtk/nsWindow.cpp ---- firefox-69.0/widget/gtk/nsWindow.cpp.mozilla-1562827 2019-09-02 15:16:15.031528276 +0200 -+++ firefox-69.0/widget/gtk/nsWindow.cpp 2019-09-02 15:16:15.037528254 +0200 -@@ -818,7 +818,6 @@ void nsWindow::SetParent(nsIWidget* aNew - if (mParent) { - mParent->RemoveChild(this); - } -- - mParent = aNewParent; - - GtkWidget* oldContainer = GetMozContainerWidget(); -@@ -830,88 +829,73 @@ void nsWindow::SetParent(nsIWidget* aNew - return; - } - -+ nsWindow* newParent = static_cast(aNewParent); -+ GdkWindow* newParentWindow = nullptr; -+ GtkWidget* newContainer = nullptr; - if (aNewParent) { - aNewParent->AddChild(this); -- ReparentNativeWidget(aNewParent); -+ newParentWindow = newParent->mGdkWindow; -+ newContainer = newParent->GetMozContainerWidget(); - } else { - // aNewParent is nullptr, but reparent to a hidden window to avoid - // destroying the GdkWindow and its descendants. - // An invisible container widget is needed to hold descendant - // GtkWidgets. -- GtkWidget* newContainer = EnsureInvisibleContainer(); -- GdkWindow* newParentWindow = gtk_widget_get_window(newContainer); -- ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow, -- oldContainer); -- } --} -- --bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); } -- --void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) { -- MOZ_ASSERT(aNewParent, "null widget"); -- NS_ASSERTION(!mIsDestroyed, ""); -- NS_ASSERTION(!static_cast(aNewParent)->mIsDestroyed, ""); -- -- GtkWidget* oldContainer = GetMozContainerWidget(); -- if (!oldContainer) { -- // The GdkWindows have been destroyed so there is nothing else to -- // reparent. -- MOZ_ASSERT(gdk_window_is_destroyed(mGdkWindow), -- "live GdkWindow with no widget"); -- return; -+ newContainer = EnsureInvisibleContainer(); -+ newParentWindow = gtk_widget_get_window(newContainer); - } -- MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow), -- "destroyed GdkWindow with widget"); - -- auto* newParent = static_cast(aNewParent); -- GdkWindow* newParentWindow = newParent->mGdkWindow; -- GtkWidget* newContainer = newParent->GetMozContainerWidget(); -- GtkWindow* shell = GTK_WINDOW(mShell); -- -- if (shell && gtk_window_get_transient_for(shell)) { -- GtkWindow* topLevelParent = -- GTK_WINDOW(gtk_widget_get_toplevel(newContainer)); -- gtk_window_set_transient_for(shell, topLevelParent); -- } -- -- ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow, -- oldContainer); --} -- --void nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent, -- GtkWidget* aNewContainer, -- GdkWindow* aNewParentWindow, -- GtkWidget* aOldContainer) { -- if (!aNewContainer) { -+ if (!newContainer) { - // The new parent GdkWindow has been destroyed. -- MOZ_ASSERT(!aNewParentWindow || gdk_window_is_destroyed(aNewParentWindow), -+ MOZ_ASSERT(!newParentWindow || gdk_window_is_destroyed(newParentWindow), - "live GdkWindow with no widget"); - Destroy(); - } else { -- if (aNewContainer != aOldContainer) { -- MOZ_ASSERT(!gdk_window_is_destroyed(aNewParentWindow), -+ if (newContainer != oldContainer) { -+ MOZ_ASSERT(!gdk_window_is_destroyed(newParentWindow), - "destroyed GdkWindow with widget"); -- SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer); -+ SetWidgetForHierarchy(mGdkWindow, oldContainer, newContainer); - -- if (aOldContainer == gInvisibleContainer) { -+ if (oldContainer == gInvisibleContainer) { - CheckDestroyInvisibleContainer(); - } - } - -- if (!mIsTopLevel) { -- gdk_window_reparent(mGdkWindow, aNewParentWindow, -- DevicePixelsToGdkCoordRoundDown(mBounds.x), -- DevicePixelsToGdkCoordRoundDown(mBounds.y)); -- } -+ gdk_window_reparent(mGdkWindow, newParentWindow, -+ DevicePixelsToGdkCoordRoundDown(mBounds.x), -+ DevicePixelsToGdkCoordRoundDown(mBounds.y)); -+ mToplevelParentWindow = GTK_WINDOW(gtk_widget_get_toplevel(newContainer)); - } - -- auto* newParent = static_cast(aNewParent); - bool parentHasMappedToplevel = newParent && newParent->mHasMappedToplevel; - if (mHasMappedToplevel != parentHasMappedToplevel) { - SetHasMappedToplevel(parentHasMappedToplevel); - } - } - -+bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); } -+ -+void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) { -+ MOZ_ASSERT(aNewParent, "null widget"); -+ MOZ_ASSERT(!mIsDestroyed, ""); -+ MOZ_ASSERT(!static_cast(aNewParent)->mIsDestroyed, ""); -+ MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow), -+ "destroyed GdkWindow with widget"); -+ -+ MOZ_ASSERT( -+ !mParent, -+ "nsWindow::ReparentNativeWidget() works on toplevel windows only."); -+ -+ auto* newParent = static_cast(aNewParent); -+ GtkWindow* newParentWidget = GTK_WINDOW(newParent->GetGtkWidget()); -+ GtkWindow* shell = GTK_WINDOW(mShell); -+ -+ if (shell && gtk_window_get_transient_for(shell)) { -+ gtk_window_set_transient_for(shell, newParentWidget); -+ mToplevelParentWindow = newParentWidget; -+ } -+} -+ - void nsWindow::SetModal(bool aModal) { - LOG(("nsWindow::SetModal [%p] %d\n", (void*)this, aModal)); - if (mIsDestroyed) return; -diff -up firefox-69.0/widget/gtk/nsWindow.h.mozilla-1562827 firefox-69.0/widget/gtk/nsWindow.h diff --git a/mozilla-1566876-webrtc-ind.patch b/mozilla-1566876-webrtc-ind.patch deleted file mode 100644 index 598f58f..0000000 --- a/mozilla-1566876-webrtc-ind.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -3504,12 +3504,6 @@ - mBounds = aRect; - ConstrainSize(&mBounds.width, &mBounds.height); - -- // eWindowType_child is not supported on Wayland. Just switch to toplevel -- // as a workaround. -- if (!mIsX11Display && mWindowType == eWindowType_child) { -- mWindowType = eWindowType_toplevel; -- } -- - // figure out our parent window - GtkWidget* parentMozContainer = nullptr; - GtkContainer* parentGtkContainer = nullptr; -@@ -3543,6 +3537,18 @@ - topLevelParent = GTK_WINDOW(gtk_widget_get_toplevel(parentMozContainer)); - } - -+ if (!mIsX11Display) { -+ if (mWindowType == eWindowType_child) { -+ // eWindowType_child is not supported on Wayland. Just switch to toplevel -+ // as a workaround. -+ mWindowType = eWindowType_toplevel; -+ } else if (mWindowType == eWindowType_popup && !topLevelParent) { -+ // Workaround for Wayland where the popup windows always need to have -+ // parent window. For example webrtc ui is a popup window without parent. -+ mWindowType = eWindowType_toplevel; -+ } -+ } -+ - // ok, create our windows - switch (mWindowType) { - case eWindowType_dialog: - diff --git a/mozilla-1567434-1.patch b/mozilla-1567434-1.patch deleted file mode 100644 index 446cd6b..0000000 --- a/mozilla-1567434-1.patch +++ /dev/null @@ -1,226 +0,0 @@ -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -616,8 +616,6 @@ - } - - if (!aFullScreenUpdate) { -- NS_WARNING( -- "We can't create a new Wayland buffer for non-fullscreen updates!"); - return nullptr; - } - -@@ -674,8 +672,6 @@ - (void*)buffer)); - - if (!buffer) { -- NS_WARNING( -- "WindowSurfaceWayland::LockWaylandBuffer(): No buffer available"); - return nullptr; - } - -diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h ---- a/widget/gtk/nsWindow.h -+++ b/widget/gtk/nsWindow.h -@@ -487,6 +487,7 @@ - GtkWidget* mShell; - MozContainer* mContainer; - GdkWindow* mGdkWindow; -+ GtkWindow* mToplevelParentWindow; - bool mWindowShouldStartDragging = false; - PlatformCompositorWidgetDelegate* mCompositorWidgetDelegate; - -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -401,6 +401,7 @@ - mContainer = nullptr; - mGdkWindow = nullptr; - mShell = nullptr; -+ mToplevelParentWindow = nullptr; - mCompositorWidgetDelegate = nullptr; - mHasMappedToplevel = false; - mIsFullyObscured = false; -@@ -1144,6 +1145,8 @@ - nsWindow* window = - static_cast(gVisibleWaylandPopupWindows->data); - if (window->mPopupType != ePopupTypeTooltip) break; -+ LOG(("nsWindow::HideWaylandTooltips [%p] hidding tooltip [%p].\n", -+ (void*)this, window)); - window->HideWaylandWindow(); - gVisibleWaylandPopupWindows = g_list_delete_link( - gVisibleWaylandPopupWindows, gVisibleWaylandPopupWindows); -@@ -1172,9 +1175,12 @@ - // before we open another one on that level. It means that every open - // popup needs to have an unique parent. - GtkWidget* nsWindow::ConfigureWaylandPopupWindows() { -+ LOG(("nsWindow::ConfigureWaylandPopupWindows [%p]\n", (void*)this)); -+ - // Check if we're already configured. - if (gVisibleWaylandPopupWindows && - g_list_find(gVisibleWaylandPopupWindows, this)) { -+ LOG(("...[%p] is already configured.\n", (void*)this)); - return GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); - } - -@@ -1182,9 +1188,15 @@ - // as it's short lived temporary window. - HideWaylandTooltips(); - -- GtkWindow* parentWidget = nullptr; -+ GtkWindow* parentWidget = mToplevelParentWindow; - if (gVisibleWaylandPopupWindows) { -+ LOG(("... there's visible active popup [%p]\n", -+ gVisibleWaylandPopupWindows->data)); -+ - if (mPopupType == ePopupTypeTooltip) { -+ LOG(("...[%p] is tooltip, parent [%p]\n", (void*)this, -+ gVisibleWaylandPopupWindows->data)); -+ - // Attach tooltip window to the latest popup window - // to have both visible. - nsWindow* window = -@@ -1200,12 +1212,19 @@ - // nsWindow::Create()) or we're toplevel popup without parent. - // In both cases just use parent which was passed to nsWindow::Create(). - if (!menuPopupFrame) { -- return GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(mShell))); -+ LOG(("...[%p] menuPopupFrame = null, using given parent widget [%p]\n", -+ (void*)this, parentWidget)); -+ return GTK_WIDGET(parentWidget); - } - - nsWindow* parentWindow = - static_cast(menuPopupFrame->GetParentMenuWidget()); -+ LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow)); -+ - if (!parentWindow) { -+ LOG(("...[%p] using active/visible popups as a parent [%p]\n", -+ (void*)this, gVisibleWaylandPopupWindows->data)); -+ - // We're toplevel popup menu attached to another menu. Just use our - // latest popup as a parent. - parentWindow = -@@ -1234,10 +1253,10 @@ - } - } - -+ MOZ_ASSERT(parentWidget, "Missing parent widget for wayland popup!"); - if (parentWidget) { -+ LOG(("...[%p] set parent widget [%p]\n", (void*)this, parentWidget)); - gtk_window_set_transient_for(GTK_WINDOW(mShell), parentWidget); -- } else { -- parentWidget = gtk_window_get_transient_for(GTK_WINDOW(mShell)); - } - gVisibleWaylandPopupWindows = - g_list_prepend(gVisibleWaylandPopupWindows, this); -@@ -1248,9 +1267,11 @@ - static void NativeMoveResizeWaylandPopupCallback( - GdkWindow* window, const GdkRectangle* flipped_rect, - const GdkRectangle* final_rect, gboolean flipped_x, gboolean flipped_y, -- void* unused) { -- LOG(("%s flipped %d %d\n", __FUNCTION__, flipped_rect->x, flipped_rect->y)); -- LOG(("%s final %d %d\n", __FUNCTION__, final_rect->x, final_rect->y)); -+ void* aWindow) { -+ LOG(("%s [%p] flipped %d %d\n", __FUNCTION__, aWindow, flipped_rect->x, -+ flipped_rect->y)); -+ LOG(("%s [%p] final %d %d\n", __FUNCTION__, aWindow, final_rect->x, -+ final_rect->y)); - } - #endif - -@@ -1264,6 +1285,8 @@ - // Compositor may be confused by windows with width/height = 0 - // and positioning such windows leads to Bug 1555866. - if (!AreBoundsSane()) { -+ LOG(("nsWindow::NativeMoveResizeWaylandPopup [%p] Bounds are not sane\n", -+ (void*)this)); - return; - } - -@@ -1277,6 +1300,8 @@ - // - gdk_window_move_to_rect() is not available - // - the widget doesn't have a valid GdkWindow - if (!sGdkWindowMoveToRect || !gdkWindow) { -+ LOG(("nsWindow::NativeMoveResizeWaylandPopup [%p] use gtk_window_move()\n", -+ (void*)this)); - gtk_window_move(GTK_WINDOW(mShell), aPosition->x, aPosition->y); - return; - } -@@ -1302,8 +1327,12 @@ - } - LOG((" request result %d %d\n", rect.x, rect.y)); - #ifdef DEBUG -- g_signal_connect(gdkWindow, "moved-to-rect", -- G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this); -+ if (!g_signal_handler_find( -+ gdkWindow, G_SIGNAL_MATCH_FUNC, 0, 0, nullptr, -+ FuncToGpointer(NativeMoveResizeWaylandPopupCallback), this)) { -+ g_signal_connect(gdkWindow, "moved-to-rect", -+ G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this); -+ } - #endif - - GdkGravity rectAnchor = GDK_GRAVITY_NORTH_WEST; -@@ -3508,7 +3537,6 @@ - GtkWidget* parentMozContainer = nullptr; - GtkContainer* parentGtkContainer = nullptr; - GdkWindow* parentGdkWindow = nullptr; -- GtkWindow* topLevelParent = nullptr; - nsWindow* parentnsWindow = nullptr; - GtkWidget* eventWidget = nullptr; - bool drawToContainer = false; -@@ -3534,7 +3562,8 @@ - - // get the toplevel window just in case someone needs to use it - // for setting transients or whatever. -- topLevelParent = GTK_WINDOW(gtk_widget_get_toplevel(parentMozContainer)); -+ mToplevelParentWindow = -+ GTK_WINDOW(gtk_widget_get_toplevel(parentMozContainer)); - } - - if (!mIsX11Display) { -@@ -3542,7 +3571,7 @@ - // eWindowType_child is not supported on Wayland. Just switch to toplevel - // as a workaround. - mWindowType = eWindowType_toplevel; -- } else if (mWindowType == eWindowType_popup && !topLevelParent) { -+ } else if (mWindowType == eWindowType_popup && !mToplevelParentWindow) { - // Workaround for Wayland where the popup windows always need to have - // parent window. For example webrtc ui is a popup window without parent. - mWindowType = eWindowType_toplevel; -@@ -3677,7 +3706,7 @@ - gdk_get_program_class()); - gtk_window_set_type_hint(GTK_WINDOW(mShell), - GDK_WINDOW_TYPE_HINT_DIALOG); -- gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); -+ gtk_window_set_transient_for(GTK_WINDOW(mShell), mToplevelParentWindow); - } else if (mWindowType == eWindowType_popup) { - gtk_window_set_wmclass(GTK_WINDOW(mShell), "Popup", - gdk_get_program_class()); -@@ -3730,10 +3759,11 @@ - } - gtk_window_set_type_hint(GTK_WINDOW(mShell), gtkTypeHint); - -- if (topLevelParent) { -+ if (mToplevelParentWindow) { - LOG(("nsWindow::Create [%p] Set popup parent %p\n", (void*)this, -- topLevelParent)); -- gtk_window_set_transient_for(GTK_WINDOW(mShell), topLevelParent); -+ mToplevelParentWindow)); -+ gtk_window_set_transient_for(GTK_WINDOW(mShell), -+ mToplevelParentWindow); - } - - // We need realized mShell at NativeMove(). -@@ -4011,7 +4041,8 @@ - #endif - } - -- LOG(("nsWindow [%p]\n", (void*)this)); -+ LOG(("nsWindow [%p] %s\n", (void*)this, -+ mWindowType == eWindowType_toplevel ? "Toplevel" : "Popup")); - if (mShell) { - LOG(("\tmShell %p mContainer %p mGdkWindow %p 0x%lx\n", mShell, mContainer, - mGdkWindow, mIsX11Display ? gdk_x11_window_get_xid(mGdkWindow) : 0)); - diff --git a/mozilla-1567434-2.patch b/mozilla-1567434-2.patch deleted file mode 100644 index 966118a..0000000 --- a/mozilla-1567434-2.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -1208,6 +1208,7 @@ - if (frame) { - menuPopupFrame = do_QueryFrame(frame); - } -+ - // The popup is not fully created yet (we're called from - // nsWindow::Create()) or we're toplevel popup without parent. - // In both cases just use parent which was passed to nsWindow::Create(). -@@ -1217,10 +1218,22 @@ - return GTK_WIDGET(parentWidget); - } - -+ LOG(("...[%p] is %s\n", (void*)this, -+ menuPopupFrame->IsContextMenu() ? "context menu" : "popup")); -+ - nsWindow* parentWindow = - static_cast(menuPopupFrame->GetParentMenuWidget()); - LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow)); - -+ // If the popup is a regular menu but GetParentMenuWidget() returns -+ // nullptr which means it's connected non-menu parent -+ // (bookmark toolbar for instance). -+ // In this case use a parent given at nsWindow::Create(). -+ if (!parentWindow && !menuPopupFrame->IsContextMenu()) { -+ parentWindow = -+ get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow)); -+ } -+ - if (!parentWindow) { - LOG(("...[%p] using active/visible popups as a parent [%p]\n", - (void*)this, gVisibleWaylandPopupWindows->data)); - diff --git a/mozilla-1573813.patch b/mozilla-1573813.patch deleted file mode 100644 index e9fca07..0000000 --- a/mozilla-1573813.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -6577,11 +6577,22 @@ - } - - gint nsWindow::GdkScaleFactor() { -+ // For popup windows with parent window we need to get scale factor of the -+ // parent window. Otherwise the scale factor of the popup is not updated -+ // during it's hidden. -+ GdkWindow* scaledGdkWindow = mGdkWindow; -+ if (mToplevelParentWindow) { -+ scaledGdkWindow = gtk_widget_get_window(GTK_WIDGET(mToplevelParentWindow)); -+ // Fallback for windows which parent has been unrealized. -+ if (!scaledGdkWindow) { -+ scaledGdkWindow = mGdkWindow; -+ } -+ } - // Available as of GTK 3.10+ - static auto sGdkWindowGetScaleFactorPtr = - (gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor"); -- if (sGdkWindowGetScaleFactorPtr && mGdkWindow) -- return (*sGdkWindowGetScaleFactorPtr)(mGdkWindow); -+ if (sGdkWindowGetScaleFactorPtr && scaledGdkWindow) -+ return (*sGdkWindowGetScaleFactorPtr)(scaledGdkWindow); - return ScreenHelperGTK::GetGTKMonitorScaleFactor(); - } - - diff --git a/mozilla-1574036.patch b/mozilla-1574036.patch deleted file mode 100644 index c3ecdc7..0000000 --- a/mozilla-1574036.patch +++ /dev/null @@ -1,425 +0,0 @@ -diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h ---- a/widget/gtk/WindowSurfaceWayland.h -+++ b/widget/gtk/WindowSurfaceWayland.h -@@ -177,12 +177,9 @@ - - private: - WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); -- WindowBackBuffer* GetWaylandBufferToDraw(int aWidth, int aHeight, -- bool aFullScreenUpdate); -+ WindowBackBuffer* GetWaylandBufferToDraw(bool aCanSwitchBuffer); - -- already_AddRefed LockWaylandBuffer(int aWidth, int aHeight, -- bool aClearBuffer, -- bool aFullScreenUpdate); -+ already_AddRefed LockWaylandBuffer(bool aCanSwitchBuffer); - void UnlockWaylandBuffer(); - - already_AddRefed LockImageSurface( -@@ -198,7 +195,10 @@ - - // TODO: Do we need to hold a reference to nsWindow object? - nsWindow* mWindow; -- LayoutDeviceIntRect mLastScreenRect; -+ // Buffer screen rects helps us understand if we operate on -+ // the same window size as we're called on WindowSurfaceWayland::Lock(). -+ // mBufferScreenRect is window size when our wayland buffer was allocated. -+ LayoutDeviceIntRect mBufferScreenRect; - nsWaylandDisplay* mWaylandDisplay; - WindowBackBuffer* mWaylandBuffer; - LayoutDeviceIntRegion mWaylandBufferDamage; -@@ -211,7 +211,8 @@ - AutoTArray mDelayedImageCommits; - bool mDrawToWaylandBufferDirectly; - bool mPendingCommit; -- bool mWaylandBufferFullScreenDamage; -+ bool mWholeWindowBufferDamage; -+ bool mBufferNeedsClear; - bool mIsMainThread; - bool mNeedScaleFactorUpdate; - -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -499,7 +499,8 @@ - mDelayedCommitHandle(nullptr), - mDrawToWaylandBufferDirectly(true), - mPendingCommit(false), -- mWaylandBufferFullScreenDamage(false), -+ mWholeWindowBufferDamage(false), -+ mBufferNeedsClear(false), - mIsMainThread(NS_IsMainThread()), - mNeedScaleFactorUpdate(true) { - for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; -@@ -565,18 +566,20 @@ - } - - WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( -- int aWidth, int aHeight, bool aFullScreenUpdate) { -+ bool aCanSwitchBuffer) { - LOGWAYLAND(("%s [%p] Requested buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, aWidth, aHeight)); -+ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); - - // There's no buffer created yet, create a new one. - if (!mWaylandBuffer) { -- MOZ_ASSERT(aFullScreenUpdate, "Created new buffer for partial drawing!"); -+ MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage, -+ "Created new buffer for partial drawing!"); - LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, aWidth, aHeight)); -+ (void*)this, mBufferScreenRect.width, -+ mBufferScreenRect.height)); - -- mWaylandBuffer = CreateWaylandBuffer(aWidth, aHeight); -- mWaylandBufferFullScreenDamage = true; -+ mWaylandBuffer = -+ CreateWaylandBuffer(mBufferScreenRect.width, mBufferScreenRect.height); - mNeedScaleFactorUpdate = true; - return mWaylandBuffer; - } -@@ -593,29 +596,31 @@ - LOGWAYLAND( - ("%s [%p] Use recent buffer.\n", __PRETTY_FUNCTION__, (void*)this)); - -- if (mWaylandBuffer->IsMatchingSize(aWidth, aHeight)) { -+ if (mWaylandBuffer->IsMatchingSize(mBufferScreenRect.width, -+ mBufferScreenRect.height)) { - LOGWAYLAND(("%s [%p] Size is ok, use the buffer [%d x %d]\n", -- __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); -+ __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, -+ mBufferScreenRect.height)); - return mWaylandBuffer; - } - -- if (!aFullScreenUpdate) { -+ if (!aCanSwitchBuffer) { - NS_WARNING("We can't resize Wayland buffer for non-fullscreen updates!"); - return nullptr; - } - - LOGWAYLAND(("%s [%p] Reuse buffer with resize [%d x %d]\n", -- __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); -+ __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, -+ mBufferScreenRect.height)); - -- mWaylandBuffer->Resize(aWidth, aHeight); -+ mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); - // There's a chance that scale factor has been changed - // when buffer size changed -- mWaylandBufferFullScreenDamage = true; - mNeedScaleFactorUpdate = true; - return mWaylandBuffer; - } - -- if (!aFullScreenUpdate) { -+ if (!aCanSwitchBuffer) { - return nullptr; - } - -@@ -625,8 +630,10 @@ - availableBuffer++) { - if (!mBackupBuffer[availableBuffer]) { - LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, aWidth, aHeight)); -- mBackupBuffer[availableBuffer] = CreateWaylandBuffer(aWidth, aHeight); -+ (void*)this, mBufferScreenRect.width, -+ mBufferScreenRect.height)); -+ mBackupBuffer[availableBuffer] = CreateWaylandBuffer( -+ mBufferScreenRect.width, mBufferScreenRect.height); - break; - } - -@@ -650,23 +657,23 @@ - __PRETTY_FUNCTION__, (void*)this, (void*)lastWaylandBuffer, - (void*)mWaylandBuffer)); - -- mWaylandBufferFullScreenDamage = true; - mNeedScaleFactorUpdate = true; - -- bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize(aWidth, aHeight); -+ bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize( -+ mBufferScreenRect.width, mBufferScreenRect.height); - if (bufferNeedsResize) { - LOGWAYLAND(("%s [%p] Resize buffer to [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, aWidth, aHeight)); -- mWaylandBuffer->Resize(aWidth, aHeight); -+ (void*)this, mBufferScreenRect.width, -+ mBufferScreenRect.height)); -+ mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); - } - - return mWaylandBuffer; - } - - already_AddRefed WindowSurfaceWayland::LockWaylandBuffer( -- int aWidth, int aHeight, bool aClearBuffer, bool aFullScreenUpdate) { -- WindowBackBuffer* buffer = -- GetWaylandBufferToDraw(aWidth, aHeight, aFullScreenUpdate); -+ bool aCanSwitchBuffer) { -+ WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer); - - LOGWAYLAND(("%s [%p] Got buffer %p\n", __PRETTY_FUNCTION__, (void*)this, - (void*)buffer)); -@@ -675,8 +682,9 @@ - return nullptr; - } - -- if (aClearBuffer) { -+ if (mBufferNeedsClear && mWholeWindowBufferDamage) { - buffer->Clear(); -+ mBufferNeedsClear = false; - } - - return buffer->Lock(); -@@ -744,7 +752,7 @@ - const LayoutDeviceIntRegion& aRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); - -- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); -+ LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); - gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); - -@@ -753,54 +761,77 @@ - mWindow->IsWaylandPopup() && - (eTransparencyTransparent == mWindow->GetTransparencyMode()); - -- mDrawToWaylandBufferDirectly = -- isTransparentPopup ? IsPopupFullScreenUpdate(screenRect, aRegion) -- : IsWindowFullScreenUpdate(screenRect, aRegion); -+ // We have request to lock whole buffer/window. -+ mWholeWindowBufferDamage = -+ isTransparentPopup ? IsPopupFullScreenUpdate(lockedScreenRect, aRegion) -+ : IsWindowFullScreenUpdate(lockedScreenRect, aRegion); - -- bool needsClear = mWindow->WaylandSurfaceNeedsClear() || -- (isTransparentPopup && mDrawToWaylandBufferDirectly); -+ // Clear buffer when we (re)draw new transparent popup window, -+ // otherwise leave it as-is, mBufferNeedsClear can be set from previous -+ // (already pending) commits which are cached now. -+ if (mWholeWindowBufferDamage) { -+ mBufferNeedsClear = -+ mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup; -+ } - - LOGWAYLAND(("%s [%p] lockSize [%d x %d] windowSize [%d x %d]\n", - __PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height, -- screenRect.width, screenRect.height)); -+ lockedScreenRect.width, lockedScreenRect.height)); - LOGWAYLAND((" nsWindow = %p\n", mWindow)); - LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup())); - LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup)); - LOGWAYLAND((" IsPopupFullScreenUpdate = %d\n", -- IsPopupFullScreenUpdate(screenRect, aRegion))); -+ IsPopupFullScreenUpdate(lockedScreenRect, aRegion))); - LOGWAYLAND((" IsWindowFullScreenUpdate = %d\n", -- IsWindowFullScreenUpdate(screenRect, aRegion))); -- LOGWAYLAND((" needsClear = %d\n", needsClear)); -- LOGWAYLAND( -- (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); -+ IsWindowFullScreenUpdate(lockedScreenRect, aRegion))); -+ LOGWAYLAND((" mBufferNeedsClear = %d\n", mBufferNeedsClear)); -+ LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); -+ -+#if DEBUG -+ if (!(mBufferScreenRect == lockedScreenRect)) { -+ LOGWAYLAND((" screen size changed\n")); -+ } -+#endif - -- // Allow full screen allocation and clear -- // when window size changed. -- bool bufferRedraw = !(screenRect == mLastScreenRect); -- if (bufferRedraw) { -- mDrawToWaylandBufferDirectly = true; -- needsClear = true; -+ if (!(mBufferScreenRect == lockedScreenRect)) { -+ // Screen (window) size changed and we still have some painting pending -+ // for the last window size. That can happen when window is resized. -+ // We can't commit them any more as they're for former window size, so -+ // scratch them. -+ mDelayedImageCommits.Clear(); -+ -+ if (!mWholeWindowBufferDamage) { -+ NS_WARNING("Partial screen update when window is resized!"); -+ // This should not happen. Screen size changed but we got only -+ // partal screen update instead of whole screen. Discard this painting -+ // as it produces artifacts. -+ return nullptr; -+ } -+ mBufferScreenRect = lockedScreenRect; - } - -- if (mDrawToWaylandBufferDirectly) { -+ if (mWholeWindowBufferDamage) { -+ // We can lock/commit entire buffer direcly. -+ mDrawToWaylandBufferDirectly = true; -+ - // If there's any pending image commit scratch them as we're going - // to redraw the whole sceen anyway. - mDelayedImageCommits.Clear(); - -- RefPtr dt = -- LockWaylandBuffer(screenRect.width, screenRect.height, needsClear, -- /* aFullScreenUpdate */ true); -+ RefPtr dt = LockWaylandBuffer( -+ /* aCanSwitchBuffer */ mWholeWindowBufferDamage); - if (dt) { -- if (bufferRedraw) { -- mLastScreenRect = screenRect; -- } - return dt.forget(); - } -+ } - -- // We don't have any front buffer available. Try indirect drawing -- // to mImageSurface which is mirrored to front buffer at commit. -- mDrawToWaylandBufferDirectly = false; -- } -+ // We do indirect drawing due to: -+ // -+ // 1) We don't have any front buffer available. Try indirect drawing -+ // to mImageSurface which is mirrored to front buffer at commit. -+ // 2) Only part of the screen is locked. We can't lock entire screen for -+ // such drawing as it produces visible artifacts. -+ mDrawToWaylandBufferDirectly = false; - - LOGWAYLAND((" Indirect drawing.\n")); - return LockImageSurface(lockSize); -@@ -851,16 +882,14 @@ - LayoutDeviceIntRegion& aWaylandBufferDamage) { - MOZ_ASSERT(!mDrawToWaylandBufferDirectly); - -- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); -+#ifdef DEBUG - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -- - gfx::Rect rect(bounds); -- if (rect.IsEmpty()) { -- return false; -- } -+ MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?"); -+#endif - - LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, screenRect.width, screenRect.height)); -+ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); - - RefPtr surf = - gfx::Factory::CreateSourceSurfaceForCairoSurface( -@@ -871,13 +900,8 @@ - return false; - } - -- // Allow full screen allocation and clear -- // when window size changed. -- bool bufferRedraw = !(screenRect == mLastScreenRect); -- RefPtr dt = -- LockWaylandBuffer(screenRect.width, screenRect.height, -- /* needs clear*/ bufferRedraw, -- /* aFullScreenUpdate */ bufferRedraw); -+ RefPtr dt = LockWaylandBuffer( -+ /* aCanSwitchBuffer */ mWholeWindowBufferDamage); - if (dt) { - LOGWAYLAND( - (" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", -@@ -885,14 +909,11 @@ - - // Draw any delayed image commits first - DrawDelayedImageCommits(dt, aWaylandBufferDamage); -+ // Draw image from recent WindowSurfaceWayland::Lock(). - WindowImageSurface::Draw(surf, dt, aRegion); - // Submit all drawing to final Wayland buffer upload - aWaylandBufferDamage.OrWith(aRegion); - UnlockWaylandBuffer(); -- -- if (bufferRedraw) { -- mLastScreenRect = screenRect; -- } - } else { - mDelayedImageCommits.AppendElement(WindowImageSurface(surf, aRegion)); - LOGWAYLAND((" Added WindowImageSurfaces, cached surfaces %ld\n", -@@ -930,29 +951,25 @@ - LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); - LOGWAYLAND( - (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); -- LOGWAYLAND((" mWaylandBufferFullScreenDamage = %d\n", -- mWaylandBufferFullScreenDamage)); -+ LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); - LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); - LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); - LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); - - if (!mDrawToWaylandBufferDirectly) { -+ MOZ_ASSERT(mDelayedImageCommits.Length(), -+ "Indirect drawing without any image?"); -+ - // There's some cached drawings - try to flush them now. -- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); -- bool bufferRedraw = !(screenRect == mLastScreenRect); -- RefPtr dt = -- LockWaylandBuffer(screenRect.width, screenRect.height, -- /* needsClear */ bufferRedraw, -- /* full screen update */ bufferRedraw); -+ RefPtr dt = LockWaylandBuffer( -+ /* aCanSwitchBuffer */ mWholeWindowBufferDamage); -+ - if (dt) { - LOGWAYLAND(("%s [%p] flushed indirect drawing\n", __PRETTY_FUNCTION__, - (void*)this)); - DrawDelayedImageCommits(dt, mWaylandBufferDamage); - UnlockWaylandBuffer(); - mDrawToWaylandBufferDirectly = true; -- if (bufferRedraw) { -- mLastScreenRect = screenRect; -- } - } - } - -@@ -1000,10 +1017,10 @@ - mLastCommittedSurface = nullptr; - } - -- if (mWaylandBufferFullScreenDamage) { -- LayoutDeviceIntRect rect = mWindow->GetBounds(); -- wl_surface_damage(waylandSurface, 0, 0, rect.width, rect.height); -- mWaylandBufferFullScreenDamage = false; -+ if (mWholeWindowBufferDamage) { -+ wl_surface_damage(waylandSurface, 0, 0, mBufferScreenRect.width, -+ mBufferScreenRect.height); -+ mWholeWindowBufferDamage = false; - mNeedScaleFactorUpdate = true; - } else { - gint scaleFactor = mWindow->GdkScaleFactor(); -@@ -1043,24 +1060,24 @@ - - #ifdef DEBUG - { -- LayoutDeviceIntRect screenRect = mWindow->GetBounds(); - gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); - gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); - - LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", - __PRETTY_FUNCTION__, (void*)this, lockSize.width, -- lockSize.height, screenRect.width, screenRect.height)); -+ lockSize.height, mBufferScreenRect.width, -+ mBufferScreenRect.height)); - LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", - mDrawToWaylandBufferDirectly)); -- LOGWAYLAND((" mWaylandBufferFullScreenDamage = %d\n", -- mWaylandBufferFullScreenDamage)); -+ LOGWAYLAND( -+ (" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); - } - #endif - - if (mDrawToWaylandBufferDirectly) { - MOZ_ASSERT(mWaylandBuffer->IsLocked()); - // If we're not at fullscreen damage add drawing area from aInvalidRegion -- if (!mWaylandBufferFullScreenDamage) { -+ if (!mWholeWindowBufferDamage) { - mWaylandBufferDamage.OrWith(aInvalidRegion); - } - UnlockWaylandBuffer(); - diff --git a/mozilla-1576268.patch b/mozilla-1576268.patch deleted file mode 100644 index 85fd1a8..0000000 --- a/mozilla-1576268.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp ---- a/widget/gtk/nsClipboardWayland.cpp -+++ b/widget/gtk/nsClipboardWayland.cpp -@@ -195,6 +195,12 @@ - uint32_t all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY | - WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE; - -+ /* Default to move D&D action (Bug 1576268). -+ */ -+ if (dnd_actions == 0) { -+ all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE; -+ } -+ - wl_data_offer_set_actions(mWaylandDataOffer, all_actions, dnd_actions); - - /* Workaround Wayland D&D architecture here. To get the data_device_drop() - diff --git a/mozilla-1577024.patch b/mozilla-1577024.patch deleted file mode 100644 index b81f103..0000000 --- a/mozilla-1577024.patch +++ /dev/null @@ -1,90 +0,0 @@ -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-18 08:34:50.568111279 +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. - - */ - -@@ -519,9 +519,11 @@ WindowSurfaceWayland::WindowSurfaceWayla - mBufferNeedsClear(false), - mIsMainThread(NS_IsMainThread()), - mNeedScaleFactorUpdate(true) { -- for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; -- mRenderingCacheMode = CACHE_ALL; -- -+ for (int i = 0; i < BACK_BUFFER_NUM; i++) { -+ mBackupBuffer[i] = nullptr; -+ } -+ mRenderingCacheMode = static_cast( -+ mWaylandDisplay->GetRenderingCacheModePref()); - } - - WindowSurfaceWayland::~WindowSurfaceWayland() { -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1577024 firefox-69.0/widget/gtk/WindowSurfaceWayland.h diff --git a/mozilla-1579794-1.patch b/mozilla-1579794-1.patch deleted file mode 100644 index 60c8cab..0000000 --- a/mozilla-1579794-1.patch +++ /dev/null @@ -1,134 +0,0 @@ -diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h ---- a/widget/gtk/WindowSurfaceWayland.h -+++ b/widget/gtk/WindowSurfaceWayland.h -@@ -154,11 +154,12 @@ - void Draw(gfx::DrawTarget* aDest, - LayoutDeviceIntRegion& aWaylandBufferDamage); - -- WindowImageSurface(gfx::SourceSurface* aSurface, -+ WindowImageSurface(gfxImageSurface* aImageSurface, - const LayoutDeviceIntRegion& aUpdateRegion); - - private: - RefPtr mSurface; -+ RefPtr mImageSurface; - const LayoutDeviceIntRegion mUpdateRegion; - }; - -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -890,8 +890,12 @@ - } - - WindowImageSurface::WindowImageSurface( -- gfx::SourceSurface* aSurface, const LayoutDeviceIntRegion& aUpdateRegion) -- : mSurface(aSurface), mUpdateRegion(aUpdateRegion){}; -+ gfxImageSurface* aImageSurface, const LayoutDeviceIntRegion& aUpdateRegion) -+ : mImageSurface(aImageSurface), mUpdateRegion(aUpdateRegion) { -+ mSurface = gfx::Factory::CreateSourceSurfaceForCairoSurface( -+ mImageSurface->CairoSurface(), mImageSurface->GetSize(), -+ mImageSurface->Format()); -+} - - void WindowSurfaceWayland::DrawDelayedImageCommits( - gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { -@@ -915,36 +919,24 @@ - LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__, - (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); - -- RefPtr surf = -- gfx::Factory::CreateSourceSurfaceForCairoSurface( -- mImageSurface->CairoSurface(), mImageSurface->GetSize(), -- mImageSurface->Format()); -- if (!surf) { -- NS_WARNING("Failed to create source cairo surface!"); -- return false; -- } -+ mDelayedImageCommits.AppendElement( -+ WindowImageSurface(mImageSurface, aRegion)); -+ // mImageSurface is owned by mDelayedImageCommits -+ mImageSurface = nullptr; - - RefPtr dt = LockWaylandBuffer( - /* aCanSwitchBuffer */ mWholeWindowBufferDamage); -- if (dt) { -- LOGWAYLAND( -- (" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", -- long(mDelayedImageCommits.Length() + 1))); -- -- // Draw any delayed image commits first -- DrawDelayedImageCommits(dt, aWaylandBufferDamage); -- // Draw image from recent WindowSurfaceWayland::Lock(). -- WindowImageSurface::Draw(surf, dt, aRegion); -- // Submit all drawing to final Wayland buffer upload -- aWaylandBufferDamage.OrWith(aRegion); -- UnlockWaylandBuffer(); -- } else { -- mDelayedImageCommits.AppendElement(WindowImageSurface(surf, aRegion)); -- LOGWAYLAND((" Added WindowImageSurfaces, cached surfaces %ld\n", -- long(mDelayedImageCommits.Length()))); -+ if (!dt) { - return false; - } - -+ LOGWAYLAND((" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", -+ long(mDelayedImageCommits.Length() + 1))); -+ -+ // Draw any delayed image commits first -+ DrawDelayedImageCommits(dt, aWaylandBufferDamage); -+ UnlockWaylandBuffer(); -+ - return true; - } - -@@ -980,23 +972,6 @@ - LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); - LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); - -- if (!mDrawToWaylandBufferDirectly) { -- MOZ_ASSERT(mDelayedImageCommits.Length(), -- "Indirect drawing without any image?"); -- -- // There's some cached drawings - try to flush them now. -- RefPtr dt = LockWaylandBuffer( -- /* aCanSwitchBuffer */ mWholeWindowBufferDamage); -- -- if (dt) { -- LOGWAYLAND(("%s [%p] flushed indirect drawing\n", __PRETTY_FUNCTION__, -- (void*)this)); -- DrawDelayedImageCommits(dt, mWaylandBufferDamage); -- UnlockWaylandBuffer(); -- mDrawToWaylandBufferDirectly = true; -- } -- } -- - wl_surface* waylandSurface = mWindow->GetWaylandSurface(); - if (!waylandSurface) { - LOGWAYLAND(("%s [%p] mWindow->GetWaylandSurface() failed, delay commit.\n", -@@ -1105,6 +1080,7 @@ - mWaylandBufferDamage.OrWith(aInvalidRegion); - } - UnlockWaylandBuffer(); -+ mPendingCommit = true; - } else { - MOZ_ASSERT(!mWaylandBuffer->IsLocked(), - "Drawing to already locked buffer?"); -@@ -1112,12 +1088,13 @@ - mWaylandBufferDamage)) { - // Our cached drawing is flushed, we can draw fullscreen again. - mDrawToWaylandBufferDirectly = true; -+ mPendingCommit = true; - } - } - -- // We're ready to commit. -- mPendingCommit = true; -- CommitWaylandBuffer(); -+ if (mPendingCommit) { -+ CommitWaylandBuffer(); -+ } - } - - void WindowSurfaceWayland::FrameCallbackHandler() { - diff --git a/mozilla-1579794-2.patch b/mozilla-1579794-2.patch deleted file mode 100644 index a8c249b..0000000 --- a/mozilla-1579794-2.patch +++ /dev/null @@ -1,166 +0,0 @@ -diff --git a/widget/gtk/WindowSurfaceWayland.h b/widget/gtk/WindowSurfaceWayland.h ---- a/widget/gtk/WindowSurfaceWayland.h -+++ b/widget/gtk/WindowSurfaceWayland.h -@@ -204,7 +204,6 @@ - const LayoutDeviceIntRegion& aRegion, - LayoutDeviceIntRegion& aWaylandBufferDamage); - void CommitWaylandBuffer(); -- void CalcRectScale(LayoutDeviceIntRect& aRect, int scale); - - void DrawDelayedImageCommits(gfx::DrawTarget* aDrawTarget, - LayoutDeviceIntRegion& aWaylandBufferDamage); -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -951,16 +951,6 @@ - } - } - --void WindowSurfaceWayland::CalcRectScale(LayoutDeviceIntRect& aRect, -- int aScale) { -- aRect.x = aRect.x / aScale; -- aRect.y = aRect.y / aScale; -- -- // We don't need exact damage size - just safely cover the round errors. -- aRect.width = (aRect.width / aScale) + 2; -- aRect.height = (aRect.height / aScale) + 2; --} -- - void WindowSurfaceWayland::CommitWaylandBuffer() { - MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); - -@@ -1022,16 +1012,10 @@ - mWholeWindowBufferDamage = false; - mNeedScaleFactorUpdate = true; - } else { -- gint scaleFactor = mWindow->GdkScaleFactor(); - for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); - iter.Next()) { - mozilla::LayoutDeviceIntRect r = iter.Get(); -- // We need to remove the scale factor because the wl_surface_damage -- // also multiplies by current scale factor. -- if (scaleFactor > 1) { -- CalcRectScale(r, scaleFactor); -- } -- wl_surface_damage(waylandSurface, r.x, r.y, r.width, r.height); -+ wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); - } - } - -diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp ---- a/widget/gtk/mozcontainer.cpp -+++ b/widget/gtk/mozcontainer.cpp -@@ -578,16 +578,12 @@ - return nullptr; - } - GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(container)); -+ nsWaylandDisplay* waylandDisplay = WaylandDisplayGet(display); - - // Available as of GTK 3.8+ -- static auto sGdkWaylandDisplayGetWlCompositor = -- (wl_compositor * (*)(GdkDisplay*)) -- dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_compositor"); -- struct wl_compositor* compositor = -- sGdkWaylandDisplayGetWlCompositor(display); -+ struct wl_compositor* compositor = waylandDisplay->GetCompositor(); - container->surface = wl_compositor_create_surface(compositor); - -- nsWaylandDisplay* waylandDisplay = WaylandDisplayGet(display); - container->subsurface = wl_subcompositor_get_subsurface( - waylandDisplay->GetSubcompositor(), container->surface, - moz_container_get_gtk_container_surface(container)); -diff --git a/widget/gtk/mozwayland/mozwayland.h b/widget/gtk/mozwayland/mozwayland.h ---- a/widget/gtk/mozwayland/mozwayland.h -+++ b/widget/gtk/mozwayland/mozwayland.h -@@ -108,6 +108,17 @@ - } - #endif - -+#ifndef WL_SURFACE_DAMAGE_BUFFER -+# define WL_SURFACE_DAMAGE_BUFFER 9 -+ -+static inline void wl_surface_damage_buffer(struct wl_surface* wl_surface, -+ int32_t x, int32_t y, int32_t width, -+ int32_t height) { -+ wl_proxy_marshal((struct wl_proxy*)wl_surface, WL_SURFACE_DAMAGE_BUFFER, x, y, -+ width, height); -+} -+#endif -+ - #ifdef __cplusplus - } - #endif -diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c ---- a/widget/gtk/mozwayland/mozwayland.c -+++ b/widget/gtk/mozwayland/mozwayland.c -@@ -30,6 +30,7 @@ - const struct wl_interface wl_seat_interface; - const struct wl_interface wl_surface_interface; - const struct wl_interface wl_subsurface_interface; -+const struct wl_interface wl_compositor_interface; - const struct wl_interface wl_subcompositor_interface; - #pragma GCC visibility pop - -diff --git a/widget/gtk/nsWaylandDisplay.h b/widget/gtk/nsWaylandDisplay.h ---- a/widget/gtk/nsWaylandDisplay.h -+++ b/widget/gtk/nsWaylandDisplay.h -@@ -45,6 +45,7 @@ - MessageLoop* GetDispatcherThreadLoop() { return mDispatcherThreadLoop; } - wl_display* GetDisplay() { return mDisplay; }; - wl_event_queue* GetEventQueue() { return mEventQueue; }; -+ wl_compositor* GetCompositor(void) { return mCompositor; }; - wl_subcompositor* GetSubcompositor(void) { return mSubcompositor; }; - wl_data_device_manager* GetDataDeviceManager(void) { - return mDataDeviceManager; -@@ -56,6 +57,7 @@ - }; - - void SetShm(wl_shm* aShm); -+ void SetCompositor(wl_compositor* aCompositor); - void SetSubcompositor(wl_subcompositor* aSubcompositor); - void SetDataDeviceManager(wl_data_device_manager* aDataDeviceManager); - void SetSeat(wl_seat* aSeat); -@@ -88,6 +90,7 @@ - wl_display* mDisplay; - wl_event_queue* mEventQueue; - wl_data_device_manager* mDataDeviceManager; -+ wl_compositor* mCompositor; - wl_subcompositor* mSubcompositor; - wl_seat* mSeat; - wl_shm* mShm; -diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp ---- a/widget/gtk/nsWaylandDisplay.cpp -+++ b/widget/gtk/nsWaylandDisplay.cpp -@@ -116,6 +116,10 @@ - - void nsWaylandDisplay::SetShm(wl_shm* aShm) { mShm = aShm; } - -+void nsWaylandDisplay::SetCompositor(wl_compositor* aCompositor) { -+ mCompositor = aCompositor; -+} -+ - void nsWaylandDisplay::SetSubcompositor(wl_subcompositor* aSubcompositor) { - mSubcompositor = aSubcompositor; - } -@@ -223,6 +227,12 @@ - wl_proxy_set_queue((struct wl_proxy*)primary_selection_device_manager, - display->GetEventQueue()); - display->SetPrimarySelectionDeviceManager(primary_selection_device_manager); -+ } else if (strcmp(interface, "wl_compositor") == 0) { -+ // Requested wl_compositor version 4 as we need wl_surface_damage_buffer(). -+ auto compositor = static_cast( -+ wl_registry_bind(registry, id, &wl_compositor_interface, 4)); -+ wl_proxy_set_queue((struct wl_proxy*)compositor, display->GetEventQueue()); -+ display->SetCompositor(compositor); - } else if (strcmp(interface, "wl_subcompositor") == 0) { - auto subcompositor = static_cast( - wl_registry_bind(registry, id, &wl_subcompositor_interface, 1)); -@@ -306,6 +316,7 @@ - mDisplay(aDisplay), - mEventQueue(nullptr), - mDataDeviceManager(nullptr), -+ mCompositor(nullptr), - mSubcompositor(nullptr), - mSeat(nullptr), - mShm(nullptr), - diff --git a/mozilla-1579823.patch b/mozilla-1579823.patch deleted file mode 100644 index 9e00d4f..0000000 --- a/mozilla-1579823.patch +++ /dev/null @@ -1,306 +0,0 @@ -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1579823 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1579823 2019-09-12 07:53:06.119602913 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-12 07:54:47.410105270 +0200 -@@ -326,13 +326,13 @@ void WindowBackBufferShm::Create(int aWi - mHeight = aHeight; - - LOGWAYLAND(( -- "%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, -+ "WindowBackBufferShm::Create [%p] wl_buffer %p ID %d\n", (void*)this, - (void*)mWaylandBuffer, - mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); - } - - void WindowBackBufferShm::Release() { -- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND(("WindowBackBufferShm::Release [%p]\n", (void*)this)); - - wl_buffer_destroy(mWaylandBuffer); - mWidth = mHeight = 0; -@@ -358,8 +358,8 @@ WindowBackBufferShm::~WindowBackBufferSh - bool WindowBackBufferShm::Resize(int aWidth, int aHeight) { - if (aWidth == mWidth && aHeight == mHeight) return true; - -- LOGWAYLAND( -- ("%s [%p] %d %d\n", __PRETTY_FUNCTION__, (void*)this, aWidth, aHeight)); -+ LOGWAYLAND(("WindowBackBufferShm::Resize [%p] %d %d\n", (void*)this, aWidth, -+ aHeight)); - - Release(); - Create(aWidth, aHeight); -@@ -369,7 +369,7 @@ bool WindowBackBufferShm::Resize(int aWi - - void WindowBackBuffer::Attach(wl_surface* aSurface) { - LOGWAYLAND( -- ("%s [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ ("WindowBackBuffer::Attach [%p] wl_surface %p ID %d wl_buffer %p ID %d\n", - (void*)this, (void*)aSurface, - aSurface ? wl_proxy_get_id((struct wl_proxy*)aSurface) : -1, - (void*)GetWlBuffer(), -@@ -382,8 +382,8 @@ void WindowBackBuffer::Attach(wl_surface - } - - void WindowBackBufferShm::Detach(wl_buffer* aBuffer) { -- LOGWAYLAND(("%s [%p] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, (void*)this, -- (void*)aBuffer, -+ LOGWAYLAND(("WindowBackBufferShm::Detach [%p] wl_buffer %p ID %d\n", -+ (void*)this, (void*)aBuffer, - aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1)); - - mAttached = false; -@@ -404,7 +404,7 @@ bool WindowBackBufferShm::SetImageDataFr - - already_AddRefed WindowBackBufferShm::Lock() { - LOGWAYLAND(( -- "%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ "WindowBackBufferShm::Lock [%p] [%d x %d] wl_buffer %p ID %d\n", - (void*)this, mWidth, mHeight, (void*)mWaylandBuffer, - mWaylandBuffer ? wl_proxy_get_id((struct wl_proxy*)mWaylandBuffer) : -1)); - -@@ -419,16 +419,17 @@ WindowBackBufferDMABuf::WindowBackBuffer - nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight) - : WindowBackBuffer(aWaylandDisplay) { - mDMAbufSurface.Create(aWidth, aHeight); -- -- LOGWAYLAND(("%s [%p] Created DMABuf buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, aWidth, aHeight)); -+ LOGWAYLAND( -+ ("WindowBackBufferDMABuf::WindowBackBufferDMABuf [%p] Created DMABuf " -+ "buffer [%d x %d]\n", -+ (void*)this, aWidth, aHeight)); - } - - WindowBackBufferDMABuf::~WindowBackBufferDMABuf() { mDMAbufSurface.Release(); } - - already_AddRefed WindowBackBufferDMABuf::Lock() { - LOGWAYLAND( -- ("%s [%p] [%d x %d] wl_buffer %p ID %d\n", __PRETTY_FUNCTION__, -+ ("WindowBackBufferDMABuf::Lock [%p] [%d x %d] wl_buffer %p ID %d\n", - (void*)this, GetWidth(), GetHeight(), (void*)GetWlBuffer(), - GetWlBuffer() ? wl_proxy_get_id((struct wl_proxy*)GetWlBuffer()) : -1)); - -@@ -534,7 +535,8 @@ WindowSurfaceWayland::~WindowSurfaceWayl - bool WindowSurfaceWayland::UseDMABufBackend() { - if (!mUseDMABufInitialized) { - mUseDMABuf = nsWaylandDisplay::IsDMABufEnabled(); -- LOGWAYLAND(("%s DMABuf state %d\n", __PRETTY_FUNCTION__, mUseDMABuf)); -+ LOGWAYLAND(("WindowSurfaceWayland::UseDMABufBackend DMABuf state %d\n", -+ mUseDMABuf)); - mUseDMABufInitialized = true; - } - return mUseDMABuf; -@@ -567,15 +569,16 @@ WindowBackBuffer* WindowSurfaceWayland:: - - WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( - bool aCanSwitchBuffer) { -- LOGWAYLAND(("%s [%p] Requested buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::GetWaylandBufferToDraw [%p] Requested buffer [%d " -+ "x %d]\n", -+ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); - - // There's no buffer created yet, create a new one. - if (!mWaylandBuffer) { - MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage, - "Created new buffer for partial drawing!"); -- LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, mBufferScreenRect.width, -+ LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width, - mBufferScreenRect.height)); - - mWaylandBuffer = -@@ -586,21 +589,19 @@ WindowBackBuffer* WindowSurfaceWayland:: - - #ifdef DEBUG - if (mWaylandBuffer->IsAttached()) { -- LOGWAYLAND(("%s [%p] Buffer %p is attached, need to find a new one.\n", -- __PRETTY_FUNCTION__, (void*)this, mWaylandBuffer)); -+ LOGWAYLAND((" Buffer %p is attached, need to find a new one.\n", -+ mWaylandBuffer)); - } - #endif - - // Reuse existing buffer - if (!mWaylandBuffer->IsAttached()) { -- LOGWAYLAND( -- ("%s [%p] Use recent buffer.\n", __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND((" Use recent buffer.\n")); - - if (mWaylandBuffer->IsMatchingSize(mBufferScreenRect.width, - mBufferScreenRect.height)) { -- LOGWAYLAND(("%s [%p] Size is ok, use the buffer [%d x %d]\n", -- __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, -- mBufferScreenRect.height)); -+ LOGWAYLAND((" Size is ok, use the buffer [%d x %d]\n", -+ mBufferScreenRect.width, mBufferScreenRect.height)); - return mWaylandBuffer; - } - -@@ -609,9 +610,8 @@ WindowBackBuffer* WindowSurfaceWayland:: - return nullptr; - } - -- LOGWAYLAND(("%s [%p] Reuse buffer with resize [%d x %d]\n", -- __PRETTY_FUNCTION__, (void*)this, mBufferScreenRect.width, -- mBufferScreenRect.height)); -+ LOGWAYLAND((" Reuse buffer with resize [%d x %d]\n", -+ mBufferScreenRect.width, mBufferScreenRect.height)); - - mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); - // There's a chance that scale factor has been changed -@@ -629,8 +629,7 @@ WindowBackBuffer* WindowSurfaceWayland:: - for (availableBuffer = 0; availableBuffer < BACK_BUFFER_NUM; - availableBuffer++) { - if (!mBackupBuffer[availableBuffer]) { -- LOGWAYLAND(("%s [%p] Created new buffer [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, mBufferScreenRect.width, -+ LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width, - mBufferScreenRect.height)); - mBackupBuffer[availableBuffer] = CreateWaylandBuffer( - mBufferScreenRect.width, mBufferScreenRect.height); -@@ -643,8 +642,7 @@ WindowBackBuffer* WindowSurfaceWayland:: - } - - if (MOZ_UNLIKELY(availableBuffer == BACK_BUFFER_NUM)) { -- LOGWAYLAND(("%s [%p] No drawing buffer available!\n", __PRETTY_FUNCTION__, -- (void*)this)); -+ LOGWAYLAND((" No drawing buffer available!\n")); - NS_WARNING("No drawing buffer available"); - return nullptr; - } -@@ -653,17 +651,15 @@ WindowBackBuffer* WindowSurfaceWayland:: - mWaylandBuffer = mBackupBuffer[availableBuffer]; - mBackupBuffer[availableBuffer] = lastWaylandBuffer; - -- LOGWAYLAND(("%s [%p] Buffer flip new back %p new front %p \n", -- __PRETTY_FUNCTION__, (void*)this, (void*)lastWaylandBuffer, -- (void*)mWaylandBuffer)); -+ LOGWAYLAND((" Buffer flip new back %p new front %p \n", -+ (void*)lastWaylandBuffer, (void*)mWaylandBuffer)); - - mNeedScaleFactorUpdate = true; - - bool bufferNeedsResize = !mWaylandBuffer->IsMatchingSize( - mBufferScreenRect.width, mBufferScreenRect.height); - if (bufferNeedsResize) { -- LOGWAYLAND(("%s [%p] Resize buffer to [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, mBufferScreenRect.width, -+ LOGWAYLAND((" Resize buffer to [%d x %d]\n", mBufferScreenRect.width, - mBufferScreenRect.height)); - mWaylandBuffer->Resize(mBufferScreenRect.width, mBufferScreenRect.height); - } -@@ -675,8 +671,8 @@ already_AddRefed Window - bool aCanSwitchBuffer) { - WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer); - -- LOGWAYLAND(("%s [%p] Got buffer %p\n", __PRETTY_FUNCTION__, (void*)this, -- (void*)buffer)); -+ LOGWAYLAND(("WindowSurfaceWayland::LockWaylandBuffer [%p] Got buffer %p\n", -+ (void*)this, (void*)buffer)); - - if (!buffer) { - return nullptr; -@@ -691,7 +687,7 @@ already_AddRefed Window - } - - void WindowSurfaceWayland::UnlockWaylandBuffer() { -- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND(("WindowSurfaceWayland::UnlockWaylandBuffer [%p]\n", (void*)this)); - mWaylandBuffer->Unlock(); - } - -@@ -774,9 +770,11 @@ already_AddRefed Window - mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup; - } - -- LOGWAYLAND(("%s [%p] lockSize [%d x %d] windowSize [%d x %d]\n", -- __PRETTY_FUNCTION__, (void*)this, lockSize.width, lockSize.height, -- lockedScreenRect.width, lockedScreenRect.height)); -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::Lock [%p] lockSize [%d x %d] windowSize [%d x " -+ "%d]\n", -+ (void*)this, lockSize.width, lockSize.height, lockedScreenRect.width, -+ lockedScreenRect.height)); - LOGWAYLAND((" nsWindow = %p\n", mWindow)); - LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup())); - LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup)); -@@ -892,8 +890,10 @@ bool WindowSurfaceWayland::CommitImageSu - MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?"); - #endif - -- LOGWAYLAND(("%s [%p] screenSize [%d x %d]\n", __PRETTY_FUNCTION__, -- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer [%p] " -+ "screenSize [%d x %d]\n", -+ (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); - - mDelayedImageCommits.AppendElement( - WindowImageSurface(mImageSurface, aRegion)); -@@ -930,7 +930,7 @@ static void WaylandBufferDelayCommitHand - void WindowSurfaceWayland::CommitWaylandBuffer() { - MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); - -- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); - LOGWAYLAND( - (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); - LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); -@@ -940,8 +940,8 @@ void WindowSurfaceWayland::CommitWayland - - wl_surface* waylandSurface = mWindow->GetWaylandSurface(); - if (!waylandSurface) { -- LOGWAYLAND(("%s [%p] mWindow->GetWaylandSurface() failed, delay commit.\n", -- __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND((" [%p] mWindow->GetWaylandSurface() failed, delay commit.\n", -+ (void*)this)); - - // Target window is not created yet - delay the commit. This can happen only - // when the window is newly created and there's no active -@@ -969,8 +969,7 @@ void WindowSurfaceWayland::CommitWayland - // We have an active frame callback request so handle it. - if (mFrameCallback) { - if (waylandSurface == mLastCommittedSurface) { -- LOGWAYLAND(("%s [%p] wait for frame callback.\n", __PRETTY_FUNCTION__, -- (void*)this)); -+ LOGWAYLAND((" [%p] wait for frame callback.\n", (void*)this)); - // We have an active frame callback pending from our recent surface. - // It means we should defer the commit to FrameCallbackHandler(). - return; -@@ -1022,10 +1021,11 @@ void WindowSurfaceWayland::Commit(const - gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); - gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); - -- LOGWAYLAND(("%s [%p] lockSize [%d x %d] screenSize [%d x %d]\n", -- __PRETTY_FUNCTION__, (void*)this, lockSize.width, -- lockSize.height, mBufferScreenRect.width, -- mBufferScreenRect.height)); -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::Commit [%p] lockSize [%d x %d] screenSize [%d " -+ "x %d]\n", -+ (void*)this, lockSize.width, lockSize.height, mBufferScreenRect.width, -+ mBufferScreenRect.height)); - LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", - mDrawToWaylandBufferDirectly)); - LOGWAYLAND( -@@ -1064,7 +1064,8 @@ void WindowSurfaceWayland::FrameCallback - MOZ_ASSERT(mLastCommittedSurface != nullptr, - "FrameCallbackHandler() called without valid wl_surface!"); - -- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::FrameCallbackHandler [%p]\n", (void*)this)); - - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; -@@ -1077,7 +1078,8 @@ void WindowSurfaceWayland::FrameCallback - void WindowSurfaceWayland::DelayedCommitHandler() { - MOZ_ASSERT(mDelayedCommitHandle != nullptr, "Missing mDelayedCommitHandle!"); - -- LOGWAYLAND(("%s [%p]\n", __PRETTY_FUNCTION__, (void*)this)); -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::DelayedCommitHandler [%p]\n", (void*)this)); - - *mDelayedCommitHandle = nullptr; - free(mDelayedCommitHandle); diff --git a/mozilla-1579849.patch b/mozilla-1579849.patch deleted file mode 100644 index fb3e8c2..0000000 --- a/mozilla-1579849.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.old firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.old 2019-09-11 14:34:36.687382704 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-11 14:39:02.000391578 +0200 -@@ -751,6 +751,10 @@ static bool IsPopupFullScreenUpdate(Layo - already_AddRefed WindowSurfaceWayland::Lock( - const LayoutDeviceIntRegion& aRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); -+ -+ // Disable all commits from frame callback handler and delayed comit handler -+ // as we're updated by gecko compositor. -+ mPendingCommit = false; - - LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); diff --git a/mozilla-1580152.patch b/mozilla-1580152.patch deleted file mode 100644 index 6260d3c..0000000 --- a/mozilla-1580152.patch +++ /dev/null @@ -1,618 +0,0 @@ -diff -up firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 firefox-69.0/widget/gtk/mozwayland/mozwayland.h ---- firefox-69.0/widget/gtk/mozwayland/mozwayland.h.mozilla-1580152 2019-09-16 11:11:30.081299217 +0200 -+++ firefox-69.0/widget/gtk/mozwayland/mozwayland.h 2019-09-16 11:11:30.089299191 +0200 -@@ -27,6 +27,9 @@ MOZ_EXPORT struct wl_proxy* wl_proxy_mar - struct wl_proxy* proxy, uint32_t opcode, - const struct wl_interface* interface, ...); - -+MOZ_EXPORT void* wl_proxy_create_wrapper(void* proxy); -+MOZ_EXPORT void wl_proxy_wrapper_destroy(void* proxy_wrapper); -+ - /* We need implement some missing functions from wayland-client-protocol.h - */ - #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM -diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 firefox-69.0/widget/gtk/nsWaylandDisplay.cpp ---- firefox-69.0/widget/gtk/nsWaylandDisplay.cpp.mozilla-1580152 2019-09-16 11:11:30.081299217 +0200 -+++ firefox-69.0/widget/gtk/nsWaylandDisplay.cpp 2019-09-16 11:11:30.089299191 +0200 -@@ -243,6 +243,61 @@ bool nsWaylandDisplay::DispatchEventQueu - return true; - } - -+void nsWaylandDisplay::SyncEnd() { -+ wl_callback_destroy(mSyncCallback); -+ mSyncCallback = NULL; -+} -+ -+static void wayland_sync_callback(void* data, struct wl_callback* callback, -+ uint32_t time) { -+ auto display = static_cast(data); -+ display->SyncEnd(); -+} -+ -+static const struct wl_callback_listener sync_callback_listener = { -+ .done = wayland_sync_callback}; -+ -+void nsWaylandDisplay::SyncBegin() { -+ WaitForSyncEnd(); -+ -+ // Use wl_display_sync() to synchronize wayland events. -+ // See dri2_wl_swap_buffers_with_damage() from MESA -+ // or wl_display_roundtrip_queue() from wayland-client. -+ struct wl_display* displayWrapper = -+ static_cast(wl_proxy_create_wrapper((void*)mDisplay)); -+ if (!displayWrapper) { -+ NS_WARNING("Failed to create wl_proxy wrapper!"); -+ return; -+ } -+ -+ wl_proxy_set_queue((struct wl_proxy*)displayWrapper, mEventQueue); -+ mSyncCallback = wl_display_sync(displayWrapper); -+ wl_proxy_wrapper_destroy((void*)displayWrapper); -+ -+ if (!mSyncCallback) { -+ NS_WARNING("Failed to create wl_display_sync callback!"); -+ return; -+ } -+ -+ wl_callback_add_listener(mSyncCallback, &sync_callback_listener, this); -+ wl_display_flush(mDisplay); -+} -+ -+void nsWaylandDisplay::WaitForSyncEnd() { -+ // We're done here -+ if (!mSyncCallback) { -+ return; -+ } -+ -+ while (mSyncCallback != NULL) { -+ if (wl_display_dispatch_queue(mDisplay, mEventQueue) == -1) { -+ NS_WARNING("wl_display_dispatch_queue failed!"); -+ SyncEnd(); -+ return; -+ } -+ } -+} -+ - bool nsWaylandDisplay::Matches(wl_display* aDisplay) { - return mThreadId == PR_GetCurrentThread() && aDisplay == mDisplay; - } -@@ -305,6 +360,7 @@ nsWaylandDisplay::nsWaylandDisplay(wl_di - mSubcompositor(nullptr), - mSeat(nullptr), - mShm(nullptr), -+ mSyncCallback(nullptr), - mPrimarySelectionDeviceManager(nullptr), - mRegistry(nullptr), - mGbmDevice(nullptr), -diff -up firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 firefox-69.0/widget/gtk/nsWaylandDisplay.h ---- firefox-69.0/widget/gtk/nsWaylandDisplay.h.mozilla-1580152 2019-09-16 11:11:30.081299217 +0200 -+++ firefox-69.0/widget/gtk/nsWaylandDisplay.h 2019-09-16 11:11:30.089299191 +0200 -@@ -41,6 +41,11 @@ class nsWaylandDisplay { - virtual ~nsWaylandDisplay(); - - bool DispatchEventQueue(); -+ -+ void SyncBegin(); -+ void SyncEnd(); -+ void WaitForSyncEnd(); -+ - bool Matches(wl_display* aDisplay); - - MessageLoop* GetDispatcherThreadLoop() { return mDispatcherThreadLoop; } -@@ -90,6 +95,7 @@ class nsWaylandDisplay { - wl_subcompositor* mSubcompositor; - wl_seat* mSeat; - wl_shm* mShm; -+ wl_callback* mSyncCallback; - gtk_primary_selection_device_manager* mPrimarySelectionDeviceManager; - wl_registry* mRegistry; - zwp_linux_dmabuf_v1* mDmabuf; -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1580152 2019-09-16 11:11:30.086299200 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-16 11:57:35.462193492 +0200 -@@ -32,6 +32,9 @@ extern mozilla::LazyLogModule gWidgetWay - # define LOGWAYLAND(args) - #endif /* MOZ_LOGGING */ - -+// Maximal compositin timeout it miliseconds -+#define COMPOSITING_TIMEOUT 200 -+ - namespace mozilla { - namespace widget { - -@@ -198,6 +201,10 @@ available and gfx.wayland_dmabuf_backend - #define BUFFER_BPP 4 - gfx::SurfaceFormat WindowBackBuffer::mFormat = gfx::SurfaceFormat::B8G8R8A8; - -+nsWaylandDisplay* WindowBackBuffer::GetWaylandDisplay() { -+ return mWindowSurfaceWayland->GetWaylandDisplay(); -+} -+ - int WaylandShmPool::CreateTemporaryFile(int aSize) { - const char* tmppath = getenv("XDG_RUNTIME_DIR"); - MOZ_RELEASE_ASSERT(tmppath, "Missing XDG_RUNTIME_DIR env variable."); -@@ -342,10 +349,11 @@ void WindowBackBufferShm::Clear() { - memset(mShmPool.GetImageData(), 0, mHeight * mWidth * BUFFER_BPP); - } - --WindowBackBufferShm::WindowBackBufferShm(nsWaylandDisplay* aWaylandDisplay, -- int aWidth, int aHeight) -- : WindowBackBuffer(aWaylandDisplay), -- mShmPool(aWaylandDisplay, aWidth * aHeight * BUFFER_BPP), -+WindowBackBufferShm::WindowBackBufferShm( -+ WindowSurfaceWayland* aWindowSurfaceWayland, int aWidth, int aHeight) -+ : WindowBackBuffer(aWindowSurfaceWayland), -+ mShmPool(aWindowSurfaceWayland->GetWaylandDisplay(), -+ aWidth * aHeight * BUFFER_BPP), - mWaylandBuffer(nullptr), - mWidth(aWidth), - mHeight(aHeight), -@@ -387,6 +395,9 @@ void WindowBackBufferShm::Detach(wl_buff - aBuffer ? wl_proxy_get_id((struct wl_proxy*)aBuffer) : -1)); - - mAttached = false; -+ -+ // Commit any potential cached drawings from latest Lock()/Commit() cycle. -+ mWindowSurfaceWayland->CommitWaylandBuffer(); - } - - bool WindowBackBufferShm::SetImageDataFromBuffer( -@@ -416,8 +427,8 @@ already_AddRefed Window - } - - WindowBackBufferDMABuf::WindowBackBufferDMABuf( -- nsWaylandDisplay* aWaylandDisplay, int aWidth, int aHeight) -- : WindowBackBuffer(aWaylandDisplay) { -+ WindowSurfaceWayland* aWindowSurfaceWayland, int aWidth, int aHeight) -+ : WindowBackBuffer(aWindowSurfaceWayland) { - mDMAbufSurface.Create(aWidth, aHeight); - LOGWAYLAND( - ("WindowBackBufferDMABuf::WindowBackBufferDMABuf [%p] Created DMABuf " -@@ -475,6 +486,9 @@ bool WindowBackBufferDMABuf::SetImageDat - - void WindowBackBufferDMABuf::Detach(wl_buffer* aBuffer) { - mDMAbufSurface.WLBufferDetach(); -+ -+ // Commit any potential cached drawings from latest Lock()/Commit() cycle. -+ mWindowSurfaceWayland->CommitWaylandBuffer(); - } - - void WindowBackBufferDMABuf::Clear() { mDMAbufSurface.Clear(); } -@@ -496,10 +510,11 @@ WindowSurfaceWayland::WindowSurfaceWayla - mWaylandBuffer(nullptr), - mFrameCallback(nullptr), - mLastCommittedSurface(nullptr), -- mDisplayThreadMessageLoop(MessageLoop::current()), - mDelayedCommitHandle(nullptr), -+ mLastCommitTime(0), - mDrawToWaylandBufferDirectly(true), -- mPendingCommit(false), -+ mBufferPendingCommit(false), -+ mBufferCommitAllowed(false), - mWholeWindowBufferDamage(false), - mBufferNeedsClear(false), - mIsMainThread(NS_IsMainThread()), -@@ -508,7 +523,7 @@ WindowSurfaceWayland::WindowSurfaceWayla - } - - WindowSurfaceWayland::~WindowSurfaceWayland() { -- if (mPendingCommit) { -+ if (mBufferPendingCommit) { - NS_WARNING("Deleted WindowSurfaceWayland with a pending commit!"); - } - -@@ -547,7 +562,7 @@ WindowBackBuffer* WindowSurfaceWayland:: - if (UseDMABufBackend()) { - static bool sDMABufBufferCreated = false; - WindowBackBuffer* buffer = -- new WindowBackBufferDMABuf(mWaylandDisplay, aWidth, aHeight); -+ new WindowBackBufferDMABuf(this, aWidth, aHeight); - if (buffer) { - sDMABufBufferCreated = true; - return buffer; -@@ -564,7 +579,7 @@ WindowBackBuffer* WindowSurfaceWayland:: - } - } - -- return new WindowBackBufferShm(mWaylandDisplay, aWidth, aHeight); -+ return new WindowBackBufferShm(this, aWidth, aHeight); - } - - WindowBackBuffer* WindowSurfaceWayland::GetWaylandBufferToDraw( -@@ -675,6 +690,11 @@ already_AddRefed Window - (void*)this, (void*)buffer)); - - if (!buffer) { -+ if (mLastCommitTime && (g_get_monotonic_time() / 1000) - mLastCommitTime > -+ COMPOSITING_TIMEOUT) { -+ NS_WARNING( -+ "Slow response from Wayland compositor, visual glitches ahead."); -+ } - return nullptr; - } - -@@ -724,10 +744,9 @@ static bool IsPopupFullScreenUpdate(Layo - // box is equal to window borders. - if (aRegion.GetNumRects() > 2) return false; - -- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); -- -- return (screenRect.width == lockSize.width && -+ IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); -+ return (lockSize.x == 0 && lockSize.y == 0 && -+ screenRect.width == lockSize.width && - screenRect.height == lockSize.height); - } - -@@ -738,8 +757,7 @@ static bool IsPopupFullScreenUpdate(Layo - to clip/buffer the drawing and we can return wl_buffer directly - for drawing. - - mWaylandBuffer is available - that's an ideal situation. -- - mWaylandBuffer is locked by compositor - flip buffers and draw. -- - if we can't flip buffers - go B) -+ - mWaylandBuffer is locked by compositor - go B) - - B) Lock() is requested for part(s) of screen. We need to provide temporary - surface to draw into and copy result (clipped) to target wl_surface. -@@ -747,14 +765,17 @@ static bool IsPopupFullScreenUpdate(Layo - already_AddRefed WindowSurfaceWayland::Lock( - const LayoutDeviceIntRegion& aRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); -- -- // Disable all commits from frame callback handler and delayed comit handler -- // as we're updated by gecko compositor. -- mPendingCommit = false; -+ -+ // Wait until all pending events are processed. There may be queued -+ // wl_buffer release event which releases our wl_buffer for further rendering. -+ mWaylandDisplay->WaitForSyncEnd(); -+ -+ // Disable all commits (from potential frame callback/delayed handlers) -+ // until next WindowSurfaceWayland::Commit() call. -+ mBufferCommitAllowed = false; - - LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); -- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); -+ gfx::IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); - - // Are we asked for entire nsWindow to draw? - bool isTransparentPopup = -@@ -775,10 +796,10 @@ already_AddRefed Window - } - - LOGWAYLAND( -- ("WindowSurfaceWayland::Lock [%p] lockSize [%d x %d] windowSize [%d x " -- "%d]\n", -- (void*)this, lockSize.width, lockSize.height, lockedScreenRect.width, -- lockedScreenRect.height)); -+ ("WindowSurfaceWayland::Lock [%p] [%d,%d] -> [%d x %d] rects %d " -+ "windowSize [%d x %d]\n", -+ (void*)this, lockSize.x, lockSize.y, lockSize.width, lockSize.height, -+ aRegion.GetNumRects(), lockedScreenRect.width, lockedScreenRect.height)); - LOGWAYLAND((" nsWindow = %p\n", mWindow)); - LOGWAYLAND((" isPopup = %d\n", mWindow->IsWaylandPopup())); - LOGWAYLAND((" isTransparentPopup = %d\n", isTransparentPopup)); -@@ -789,7 +810,7 @@ already_AddRefed Window - LOGWAYLAND((" mBufferNeedsClear = %d\n", mBufferNeedsClear)); - LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); - --#if DEBUG -+#if MOZ_LOGGING - if (!(mBufferScreenRect == lockedScreenRect)) { - LOGWAYLAND((" screen size changed\n")); - } -@@ -836,7 +857,7 @@ already_AddRefed Window - mDrawToWaylandBufferDirectly = false; - - LOGWAYLAND((" Indirect drawing.\n")); -- return LockImageSurface(lockSize); -+ return LockImageSurface(gfx::IntSize(lockSize.XMost(), lockSize.YMost())); - } - - void WindowImageSurface::Draw(gfx::SourceSurface* aSurface, -@@ -875,34 +896,42 @@ WindowImageSurface::WindowImageSurface( - mImageSurface->Format()); - } - -+void WindowSurfaceWayland::CacheImageSurface( -+ const LayoutDeviceIntRegion& aRegion) { -+#ifdef MOZ_LOGGING -+ gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -+ LOGWAYLAND(("WindowSurfaceWayland::CacheImageSurface [%p]\n", (void*)this)); -+ LOGWAYLAND((" rects num %d\n", aRegion.GetNumRects())); -+ LOGWAYLAND((" bounds [ %d, %d] -> [%d x %d]\n", bounds.x, bounds.y, -+ bounds.width, bounds.height)); -+#endif -+ -+ mDelayedImageCommits.AppendElement( -+ WindowImageSurface(mImageSurface, aRegion)); -+ // mImageSurface is owned by mDelayedImageCommits -+ mImageSurface = nullptr; -+ -+ LOGWAYLAND( -+ (" There's %d cached images\n", int(mDelayedImageCommits.Length()))); -+} -+ - void WindowSurfaceWayland::DrawDelayedImageCommits( - gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::DrawDelayedImageCommits [%p]\n", (void*)this)); -+ - for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { - mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); - } - mDelayedImageCommits.Clear(); - } - --bool WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer( -- const LayoutDeviceIntRegion& aRegion, -- LayoutDeviceIntRegion& aWaylandBufferDamage) { -- MOZ_ASSERT(!mDrawToWaylandBufferDirectly); -- --#ifdef DEBUG -- gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -- gfx::Rect rect(bounds); -- MOZ_ASSERT(!rect.IsEmpty(), "Empty drawing?"); --#endif -- -- LOGWAYLAND( -- ("WindowSurfaceWayland::CommitImageSurfaceToWaylandBuffer [%p] " -- "screenSize [%d x %d]\n", -- (void*)this, mBufferScreenRect.width, mBufferScreenRect.height)); -+bool WindowSurfaceWayland::CommitImageCacheToWaylandBuffer() { -+ if (!mDelayedImageCommits.Length()) { -+ return false; -+ } - -- mDelayedImageCommits.AppendElement( -- WindowImageSurface(mImageSurface, aRegion)); -- // mImageSurface is owned by mDelayedImageCommits -- mImageSurface = nullptr; -+ MOZ_ASSERT(!mDrawToWaylandBufferDirectly); - - RefPtr dt = LockWaylandBuffer( - /* aCanSwitchBuffer */ mWholeWindowBufferDamage); -@@ -911,10 +940,10 @@ bool WindowSurfaceWayland::CommitImageSu - } - - LOGWAYLAND((" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", -- long(mDelayedImageCommits.Length() + 1))); -+ long(mDelayedImageCommits.Length()))); - - // Draw any delayed image commits first -- DrawDelayedImageCommits(dt, aWaylandBufferDamage); -+ DrawDelayedImageCommits(dt, mWaylandBufferDamage); - UnlockWaylandBuffer(); - - return true; -@@ -932,7 +961,8 @@ static void WaylandBufferDelayCommitHand - } - - void WindowSurfaceWayland::CommitWaylandBuffer() { -- MOZ_ASSERT(mPendingCommit, "Committing empty surface!"); -+ MOZ_ASSERT(!mWaylandBuffer->IsAttached(), -+ "We can't draw to attached wayland buffer!"); - - LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); - LOGWAYLAND( -@@ -941,6 +971,21 @@ void WindowSurfaceWayland::CommitWayland - LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); - LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); - LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); -+ LOGWAYLAND((" mBufferPendingCommit = %d\n", mBufferPendingCommit)); -+ LOGWAYLAND((" mBufferCommitAllowed = %d\n", mBufferCommitAllowed)); -+ -+ if (!mBufferCommitAllowed) { -+ return; -+ } -+ -+ if (CommitImageCacheToWaylandBuffer()) { -+ mBufferPendingCommit = true; -+ } -+ -+ // There's nothing to do here -+ if (!mBufferPendingCommit) { -+ return; -+ } - - wl_surface* waylandSurface = mWindow->GetWaylandSurface(); - if (!waylandSurface) { -@@ -986,6 +1031,7 @@ void WindowSurfaceWayland::CommitWayland - } - - if (mWholeWindowBufferDamage) { -+ LOGWAYLAND((" send whole screen damage\n")); - wl_surface_damage(waylandSurface, 0, 0, mBufferScreenRect.width, - mBufferScreenRect.height); - mWholeWindowBufferDamage = false; -@@ -994,6 +1040,8 @@ void WindowSurfaceWayland::CommitWayland - for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); - iter.Next()) { - mozilla::LayoutDeviceIntRect r = iter.Get(); -+ LOGWAYLAND((" wl_surface_damage_buffer [%d, %d] -> [%d, %d]\n", r.x, -+ r.y, r.width, r.height)); - wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); - } - } -@@ -1012,24 +1060,31 @@ void WindowSurfaceWayland::CommitWayland - - mWaylandBuffer->Attach(waylandSurface); - mLastCommittedSurface = waylandSurface; -+ mLastCommitTime = g_get_monotonic_time() / 1000; -+ -+ // Ask wl_display to start events synchronization. We're going wait -+ // until all events are processed before next WindowSurfaceWayland::Lock() -+ // as we need freed wl_buffer there. -+ mWaylandDisplay->SyncBegin(); - - // There's no pending commit, all changes are sent to compositor. -- mPendingCommit = false; -+ mBufferPendingCommit = false; - } - - void WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); - --#ifdef DEBUG -- { -- gfx::IntRect bounds = aInvalidRegion.GetBounds().ToUnknownRect(); -- gfx::IntSize lockSize(bounds.XMost(), bounds.YMost()); -+ // Flush all waiting events explicitly as we need -+ // mWaylandDisplay->FlushEventQueue(); - -+#ifdef MOZ_LOGGING -+ { -+ gfx::IntRect lockSize = aInvalidRegion.GetBounds().ToUnknownRect(); - LOGWAYLAND( -- ("WindowSurfaceWayland::Commit [%p] lockSize [%d x %d] screenSize [%d " -- "x %d]\n", -- (void*)this, lockSize.width, lockSize.height, mBufferScreenRect.width, -- mBufferScreenRect.height)); -+ ("WindowSurfaceWayland::Commit [%p] damage size [%d, %d] -> [%d x %d]" -+ "screenSize [%d x %d]\n", -+ (void*)this, lockSize.x, lockSize.y, lockSize.width, lockSize.height, -+ mBufferScreenRect.width, mBufferScreenRect.height)); - LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", - mDrawToWaylandBufferDirectly)); - LOGWAYLAND( -@@ -1044,21 +1099,15 @@ void WindowSurfaceWayland::Commit(const - mWaylandBufferDamage.OrWith(aInvalidRegion); - } - UnlockWaylandBuffer(); -- mPendingCommit = true; -+ mBufferPendingCommit = true; - } else { - MOZ_ASSERT(!mWaylandBuffer->IsLocked(), - "Drawing to already locked buffer?"); -- if (CommitImageSurfaceToWaylandBuffer(aInvalidRegion, -- mWaylandBufferDamage)) { -- // Our cached drawing is flushed, we can draw fullscreen again. -- mDrawToWaylandBufferDirectly = true; -- mPendingCommit = true; -- } -+ CacheImageSurface(aInvalidRegion); - } - -- if (mPendingCommit) { -- CommitWaylandBuffer(); -- } -+ mBufferCommitAllowed = true; -+ CommitWaylandBuffer(); - } - - void WindowSurfaceWayland::FrameCallbackHandler() { -@@ -1074,9 +1123,7 @@ void WindowSurfaceWayland::FrameCallback - wl_callback_destroy(mFrameCallback); - mFrameCallback = nullptr; - -- if (mPendingCommit) { -- CommitWaylandBuffer(); -- } -+ CommitWaylandBuffer(); - } - - void WindowSurfaceWayland::DelayedCommitHandler() { -@@ -1089,9 +1136,7 @@ void WindowSurfaceWayland::DelayedCommit - free(mDelayedCommitHandle); - mDelayedCommitHandle = nullptr; - -- if (mPendingCommit) { -- CommitWaylandBuffer(); -- } -+ CommitWaylandBuffer(); - } - - } // namespace widget -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 firefox-69.0/widget/gtk/WindowSurfaceWayland.h ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1580152 2019-09-16 11:11:30.080299221 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.h 2019-09-16 11:11:30.090299187 +0200 -@@ -17,6 +17,8 @@ - namespace mozilla { - namespace widget { - -+class WindowSurfaceWayland; -+ - // Allocates and owns shared memory for Wayland drawing surface - class WaylandShmPool { - public: -@@ -69,20 +71,22 @@ class WindowBackBuffer { - - static gfx::SurfaceFormat GetSurfaceFormat() { return mFormat; } - -- nsWaylandDisplay* GetWaylandDisplay() { return mWaylandDisplay; }; -+ nsWaylandDisplay* GetWaylandDisplay(); - -- WindowBackBuffer(nsWaylandDisplay* aWaylandDisplay) -- : mWaylandDisplay(aWaylandDisplay){}; -+ WindowBackBuffer(WindowSurfaceWayland* aWindowSurfaceWayland) -+ : mWindowSurfaceWayland(aWindowSurfaceWayland){}; - virtual ~WindowBackBuffer(){}; - -+ protected: -+ WindowSurfaceWayland* mWindowSurfaceWayland; -+ - private: - static gfx::SurfaceFormat mFormat; -- nsWaylandDisplay* mWaylandDisplay; - }; - - class WindowBackBufferShm : public WindowBackBuffer { - public: -- WindowBackBufferShm(nsWaylandDisplay* aWaylandDisplay, int aWidth, -+ WindowBackBufferShm(WindowSurfaceWayland* aWindowSurfaceWayland, int aWidth, - int aHeight); - ~WindowBackBufferShm(); - -@@ -121,8 +125,8 @@ class WindowBackBufferShm : public Windo - - class WindowBackBufferDMABuf : public WindowBackBuffer { - public: -- WindowBackBufferDMABuf(nsWaylandDisplay* aWaylandDisplay, int aWidth, -- int aHeight); -+ WindowBackBufferDMABuf(WindowSurfaceWayland* aWindowSurfaceWayland, -+ int aWidth, int aHeight); - ~WindowBackBufferDMABuf(); - - bool IsAttached(); -@@ -175,6 +179,9 @@ class WindowSurfaceWayland : public Wind - void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final; - void FrameCallbackHandler(); - void DelayedCommitHandler(); -+ void CommitWaylandBuffer(); -+ -+ nsWaylandDisplay* GetWaylandDisplay() { return mWaylandDisplay; }; - - private: - WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); -@@ -185,10 +192,9 @@ class WindowSurfaceWayland : public Wind - - already_AddRefed LockImageSurface( - const gfx::IntSize& aLockSize); -- bool CommitImageSurfaceToWaylandBuffer( -- const LayoutDeviceIntRegion& aRegion, -- LayoutDeviceIntRegion& aWaylandBufferDamage); -- void CommitWaylandBuffer(); -+ -+ void CacheImageSurface(const LayoutDeviceIntRegion& aRegion); -+ bool CommitImageCacheToWaylandBuffer(); - - void DrawDelayedImageCommits(gfx::DrawTarget* aDrawTarget, - LayoutDeviceIntRegion& aWaylandBufferDamage); -@@ -205,12 +211,13 @@ class WindowSurfaceWayland : public Wind - WindowBackBuffer* mBackupBuffer[BACK_BUFFER_NUM]; - wl_callback* mFrameCallback; - wl_surface* mLastCommittedSurface; -- MessageLoop* mDisplayThreadMessageLoop; - WindowSurfaceWayland** mDelayedCommitHandle; - RefPtr mImageSurface; - AutoTArray mDelayedImageCommits; -+ int64_t mLastCommitTime; - bool mDrawToWaylandBufferDirectly; -- bool mPendingCommit; -+ bool mBufferPendingCommit; -+ bool mBufferCommitAllowed; - bool mWholeWindowBufferDamage; - bool mBufferNeedsClear; - bool mIsMainThread; diff --git a/mozilla-1581748.patch b/mozilla-1581748.patch deleted file mode 100644 index 9177f5b..0000000 --- a/mozilla-1581748.patch +++ /dev/null @@ -1,574 +0,0 @@ -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1581748 firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp.mozilla-1581748 2019-09-17 13:19:47.190908284 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.cpp 2019-09-17 13:19:47.196908262 +0200 -@@ -32,7 +32,7 @@ extern mozilla::LazyLogModule gWidgetWay - # define LOGWAYLAND(args) - #endif /* MOZ_LOGGING */ - --// Maximal compositin timeout it miliseconds -+// Maximal compositing timeout it miliseconds - #define COMPOSITING_TIMEOUT 200 - - namespace mozilla { -@@ -513,13 +513,15 @@ WindowSurfaceWayland::WindowSurfaceWayla - mDelayedCommitHandle(nullptr), - mLastCommitTime(0), - mDrawToWaylandBufferDirectly(true), -+ mCanSwitchWaylandBuffer(true), - mBufferPendingCommit(false), - mBufferCommitAllowed(false), -- mWholeWindowBufferDamage(false), - mBufferNeedsClear(false), - mIsMainThread(NS_IsMainThread()), - mNeedScaleFactorUpdate(true) { - for (int i = 0; i < BACK_BUFFER_NUM; i++) mBackupBuffer[i] = nullptr; -+ mRenderingCacheMode = CACHE_ALL; -+ - } - - WindowSurfaceWayland::~WindowSurfaceWayland() { -@@ -591,8 +593,6 @@ WindowBackBuffer* WindowSurfaceWayland:: - - // There's no buffer created yet, create a new one. - if (!mWaylandBuffer) { -- MOZ_ASSERT(aCanSwitchBuffer && mWholeWindowBufferDamage, -- "Created new buffer for partial drawing!"); - LOGWAYLAND((" Created new buffer [%d x %d]\n", mBufferScreenRect.width, - mBufferScreenRect.height)); - -@@ -682,9 +682,8 @@ WindowBackBuffer* WindowSurfaceWayland:: - return mWaylandBuffer; - } - --already_AddRefed WindowSurfaceWayland::LockWaylandBuffer( -- bool aCanSwitchBuffer) { -- WindowBackBuffer* buffer = GetWaylandBufferToDraw(aCanSwitchBuffer); -+already_AddRefed WindowSurfaceWayland::LockWaylandBuffer() { -+ WindowBackBuffer* buffer = GetWaylandBufferToDraw(mCanSwitchWaylandBuffer); - - LOGWAYLAND(("WindowSurfaceWayland::LockWaylandBuffer [%p] Got buffer %p\n", - (void*)this, (void*)buffer)); -@@ -698,7 +697,9 @@ already_AddRefed Window - return nullptr; - } - -- if (mBufferNeedsClear && mWholeWindowBufferDamage) { -+ mCanSwitchWaylandBuffer = false; -+ -+ if (mBufferNeedsClear) { - buffer->Clear(); - mBufferNeedsClear = false; - } -@@ -728,40 +729,30 @@ already_AddRefed Window - WindowBackBuffer::GetSurfaceFormat()); - } - --static bool IsWindowFullScreenUpdate(LayoutDeviceIntRect& screenRect, -- const LayoutDeviceIntRegion& aRegion) { -- if (aRegion.GetNumRects() > 1) return false; -- -- IntRect rect = aRegion.RectIter().Get().ToUnknownRect(); -- return (rect.x == 0 && rect.y == 0 && screenRect.width == rect.width && -- screenRect.height == rect.height); -+static bool IsWindowFullScreenUpdate( -+ LayoutDeviceIntRect& aScreenRect, -+ const LayoutDeviceIntRegion& aUpdatedRegion) { -+ if (aUpdatedRegion.GetNumRects() > 1) return false; -+ -+ IntRect rect = aUpdatedRegion.RectIter().Get().ToUnknownRect(); -+ return (rect.x == 0 && rect.y == 0 && aScreenRect.width == rect.width && -+ aScreenRect.height == rect.height); - } - --static bool IsPopupFullScreenUpdate(LayoutDeviceIntRect& screenRect, -- const LayoutDeviceIntRegion& aRegion) { -+static bool IsPopupFullScreenUpdate( -+ LayoutDeviceIntRect& aScreenRect, -+ const LayoutDeviceIntRegion& aUpdatedRegion) { - // We know that popups can be drawn from two parts; a panel and an arrow. - // Assume we redraw whole popups when we have two rects and bounding - // box is equal to window borders. -- if (aRegion.GetNumRects() > 2) return false; -+ if (aUpdatedRegion.GetNumRects() > 2) return false; - -- IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); -+ gfx::IntRect lockSize = aUpdatedRegion.GetBounds().ToUnknownRect(); - return (lockSize.x == 0 && lockSize.y == 0 && -- screenRect.width == lockSize.width && -- screenRect.height == lockSize.height); -+ aScreenRect.width == lockSize.width && -+ aScreenRect.height == lockSize.height); - } - --/* -- There are some situations which can happen here: -- -- A) Lock() is called to whole surface. In that case we don't need -- to clip/buffer the drawing and we can return wl_buffer directly -- for drawing. -- - mWaylandBuffer is available - that's an ideal situation. -- - mWaylandBuffer is locked by compositor - go B) -- -- B) Lock() is requested for part(s) of screen. We need to provide temporary -- surface to draw into and copy result (clipped) to target wl_surface. -- */ - already_AddRefed WindowSurfaceWayland::Lock( - const LayoutDeviceIntRegion& aRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); -@@ -777,22 +768,31 @@ already_AddRefed Window - LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds(); - gfx::IntRect lockSize = aRegion.GetBounds().ToUnknownRect(); - -- // Are we asked for entire nsWindow to draw? - bool isTransparentPopup = - mWindow->IsWaylandPopup() && - (eTransparencyTransparent == mWindow->GetTransparencyMode()); - -- // We have request to lock whole buffer/window. -- mWholeWindowBufferDamage = -- isTransparentPopup ? IsPopupFullScreenUpdate(lockedScreenRect, aRegion) -- : IsWindowFullScreenUpdate(lockedScreenRect, aRegion); -- -- // Clear buffer when we (re)draw new transparent popup window, -- // otherwise leave it as-is, mBufferNeedsClear can be set from previous -- // (already pending) commits which are cached now. -- if (mWholeWindowBufferDamage) { -+ bool windowRedraw = isTransparentPopup -+ ? IsPopupFullScreenUpdate(lockedScreenRect, aRegion) -+ : IsWindowFullScreenUpdate(lockedScreenRect, aRegion); -+ if (windowRedraw) { -+ // Clear buffer when we (re)draw new transparent popup window, -+ // otherwise leave it as-is, mBufferNeedsClear can be set from previous -+ // (already pending) commits which are cached now. - mBufferNeedsClear = - mWindow->WaylandSurfaceNeedsClear() || isTransparentPopup; -+ -+ // Store info that we can switch WaylandBuffer when we flush -+ // mImageSurface / mDelayedImageCommits. Don't clear it - it's cleared -+ // at LockWaylandBuffer() when we actualy switch the buffer. -+ mCanSwitchWaylandBuffer = windowRedraw; -+ -+ // We do full buffer repaint so clear our cached drawings. -+ mDelayedImageCommits.Clear(); -+ mWaylandBufferDamage.SetEmpty(); -+ -+ // Also do scale factor update for whole window updates just to be sure. -+ mNeedScaleFactorUpdate = true; - } - - LOGWAYLAND( -@@ -808,7 +808,7 @@ already_AddRefed Window - LOGWAYLAND((" IsWindowFullScreenUpdate = %d\n", - IsWindowFullScreenUpdate(lockedScreenRect, aRegion))); - LOGWAYLAND((" mBufferNeedsClear = %d\n", mBufferNeedsClear)); -- LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); -+ LOGWAYLAND((" windowRedraw = %d\n", windowRedraw)); - - #if MOZ_LOGGING - if (!(mBufferScreenRect == lockedScreenRect)) { -@@ -822,8 +822,9 @@ already_AddRefed Window - // We can't commit them any more as they're for former window size, so - // scratch them. - mDelayedImageCommits.Clear(); -+ mWaylandBufferDamage.SetEmpty(); - -- if (!mWholeWindowBufferDamage) { -+ if (!windowRedraw) { - NS_WARNING("Partial screen update when window is resized!"); - // This should not happen. Screen size changed but we got only - // partal screen update instead of whole screen. Discard this painting -@@ -833,52 +834,56 @@ already_AddRefed Window - mBufferScreenRect = lockedScreenRect; - } - -- if (mWholeWindowBufferDamage) { -- // We can lock/commit entire buffer direcly. -- mDrawToWaylandBufferDirectly = true; -- -- // If there's any pending image commit scratch them as we're going -- // to redraw the whole sceen anyway. -- mDelayedImageCommits.Clear(); -+ mDrawToWaylandBufferDirectly = -+ (windowRedraw || mRenderingCacheMode != CACHE_ALL); - -- RefPtr dt = LockWaylandBuffer( -- /* aCanSwitchBuffer */ mWholeWindowBufferDamage); -+ if (mDrawToWaylandBufferDirectly) { -+ LOGWAYLAND((" Direct drawing\n")); -+ RefPtr dt = LockWaylandBuffer(); - if (dt) { -+ if (!windowRedraw) { -+ DrawDelayedImageCommits(dt, mWaylandBufferDamage); -+ } - return dt.forget(); - } - } - -- // We do indirect drawing due to: -- // -- // 1) We don't have any front buffer available. Try indirect drawing -- // to mImageSurface which is mirrored to front buffer at commit. -- // 2) Only part of the screen is locked. We can't lock entire screen for -- // such drawing as it produces visible artifacts. -+ // Any caching is disabled and we don't have any back buffer available. -+ if (mRenderingCacheMode == CACHE_NONE) { -+ return nullptr; -+ } -+ -+ // We do indirect drawing because there isn't any front buffer available. -+ // Do indirect drawing to mImageSurface which is commited to wayland -+ // wl_buffer by DrawDelayedImageCommits() later. - mDrawToWaylandBufferDirectly = false; - - LOGWAYLAND((" Indirect drawing.\n")); - return LockImageSurface(gfx::IntSize(lockSize.XMost(), lockSize.YMost())); - } - -+bool WindowImageSurface::OverlapsSurface( -+ class WindowImageSurface& aBottomSurface) { -+ return mUpdateRegion.Contains(aBottomSurface.mUpdateRegion); -+} -+ - void WindowImageSurface::Draw(gfx::SourceSurface* aSurface, - gfx::DrawTarget* aDest, - const LayoutDeviceIntRegion& aRegion) { -- uint32_t numRects = aRegion.GetNumRects(); -- if (numRects != 1) { -- AutoTArray rects; -- rects.SetCapacity(numRects); -- for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { -- rects.AppendElement(iter.Get().ToUnknownRect()); -- } -- aDest->PushDeviceSpaceClipRects(rects.Elements(), rects.Length()); -- } -- -+#ifdef MOZ_LOGGING - gfx::IntRect bounds = aRegion.GetBounds().ToUnknownRect(); -- gfx::Rect rect(bounds); -- aDest->DrawSurface(aSurface, rect, rect); -+ LOGWAYLAND(("WindowImageSurface::Draw\n")); -+ LOGWAYLAND((" rects num %d\n", aRegion.GetNumRects())); -+ LOGWAYLAND((" bounds [ %d, %d] -> [%d x %d]\n", bounds.x, bounds.y, -+ bounds.width, bounds.height)); -+#endif - -- if (numRects != 1) { -- aDest->PopClip(); -+ for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) { -+ mozilla::LayoutDeviceIntRect r = iter.Get(); -+ gfx::Rect rect(r.ToUnknownRect()); -+ LOGWAYLAND((" draw rect [%f,%f] -> [%f x %f]\n", rect.x, rect.y, -+ rect.width, rect.height)); -+ aDest->DrawSurface(aSurface, rect, rect); - } - } - -@@ -896,6 +901,18 @@ WindowImageSurface::WindowImageSurface( - mImageSurface->Format()); - } - -+void WindowSurfaceWayland::DrawDelayedImageCommits( -+ gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { -+ LOGWAYLAND( -+ ("WindowSurfaceWayland::DrawDelayedImageCommits [%p]\n", (void*)this)); -+ MOZ_ASSERT(mDelayedImageCommits.Length() > 0, "Nothing to draw?"); -+ -+ for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { -+ mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); -+ } -+ mDelayedImageCommits.Clear(); -+} -+ - void WindowSurfaceWayland::CacheImageSurface( - const LayoutDeviceIntRegion& aRegion) { - #ifdef MOZ_LOGGING -@@ -906,8 +923,26 @@ void WindowSurfaceWayland::CacheImageSur - bounds.width, bounds.height)); - #endif - -- mDelayedImageCommits.AppendElement( -- WindowImageSurface(mImageSurface, aRegion)); -+ WindowImageSurface surf = WindowImageSurface(mImageSurface, aRegion); -+ -+ if (mDelayedImageCommits.Length()) { -+ int lastSurf = mDelayedImageCommits.Length() - 1; -+ if (surf.OverlapsSurface(mDelayedImageCommits[lastSurf])) { -+#ifdef MOZ_LOGGING -+ { -+ gfx::IntRect size = mDelayedImageCommits[lastSurf] -+ .GetUpdateRegion() -+ ->GetBounds() -+ .ToUnknownRect(); -+ LOGWAYLAND((" removing [ %d, %d] -> [%d x %d]\n", size.x, size.y, -+ size.width, size.height)); -+ } -+#endif -+ mDelayedImageCommits.RemoveElementAt(lastSurf); -+ } -+ } -+ -+ mDelayedImageCommits.AppendElement(surf); - // mImageSurface is owned by mDelayedImageCommits - mImageSurface = nullptr; - -@@ -915,17 +950,6 @@ void WindowSurfaceWayland::CacheImageSur - (" There's %d cached images\n", int(mDelayedImageCommits.Length()))); - } - --void WindowSurfaceWayland::DrawDelayedImageCommits( -- gfx::DrawTarget* aDrawTarget, LayoutDeviceIntRegion& aWaylandBufferDamage) { -- LOGWAYLAND( -- ("WindowSurfaceWayland::DrawDelayedImageCommits [%p]\n", (void*)this)); -- -- for (unsigned int i = 0; i < mDelayedImageCommits.Length(); i++) { -- mDelayedImageCommits[i].Draw(aDrawTarget, aWaylandBufferDamage); -- } -- mDelayedImageCommits.Clear(); --} -- - bool WindowSurfaceWayland::CommitImageCacheToWaylandBuffer() { - if (!mDelayedImageCommits.Length()) { - return false; -@@ -933,8 +957,7 @@ bool WindowSurfaceWayland::CommitImageCa - - MOZ_ASSERT(!mDrawToWaylandBufferDirectly); - -- RefPtr dt = LockWaylandBuffer( -- /* aCanSwitchBuffer */ mWholeWindowBufferDamage); -+ RefPtr dt = LockWaylandBuffer(); - if (!dt) { - return false; - } -@@ -942,7 +965,6 @@ bool WindowSurfaceWayland::CommitImageCa - LOGWAYLAND((" Flushing %ld cached WindowImageSurfaces to Wayland buffer\n", - long(mDelayedImageCommits.Length()))); - -- // Draw any delayed image commits first - DrawDelayedImageCommits(dt, mWaylandBufferDamage); - UnlockWaylandBuffer(); - -@@ -967,7 +989,7 @@ void WindowSurfaceWayland::CommitWayland - LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); - LOGWAYLAND( - (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); -- LOGWAYLAND((" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); -+ LOGWAYLAND((" mCanSwitchWaylandBuffer = %d\n", mCanSwitchWaylandBuffer)); - LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); - LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); - LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); -@@ -1030,20 +1052,11 @@ void WindowSurfaceWayland::CommitWayland - mLastCommittedSurface = nullptr; - } - -- if (mWholeWindowBufferDamage) { -- LOGWAYLAND((" send whole screen damage\n")); -- wl_surface_damage(waylandSurface, 0, 0, mBufferScreenRect.width, -- mBufferScreenRect.height); -- mWholeWindowBufferDamage = false; -- mNeedScaleFactorUpdate = true; -- } else { -- for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); -- iter.Next()) { -- mozilla::LayoutDeviceIntRect r = iter.Get(); -- LOGWAYLAND((" wl_surface_damage_buffer [%d, %d] -> [%d, %d]\n", r.x, -- r.y, r.width, r.height)); -- wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); -- } -+ for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done(); iter.Next()) { -+ mozilla::LayoutDeviceIntRect r = iter.Get(); -+ LOGWAYLAND((" wl_surface_damage_buffer [%d, %d] -> [%d, %d]\n", r.x, r.y, -+ r.width, r.height)); -+ wl_surface_damage_buffer(waylandSurface, r.x, r.y, r.width, r.height); - } - - // Clear all back buffer damage as we're committing -@@ -1062,9 +1075,9 @@ void WindowSurfaceWayland::CommitWayland - mLastCommittedSurface = waylandSurface; - mLastCommitTime = g_get_monotonic_time() / 1000; - -- // Ask wl_display to start events synchronization. We're going wait -+ // Ask wl_display to start events synchronization. We're going to wait - // until all events are processed before next WindowSurfaceWayland::Lock() -- // as we need freed wl_buffer there. -+ // as we hope for free wl_buffer there. - mWaylandDisplay->SyncBegin(); - - // There's no pending commit, all changes are sent to compositor. -@@ -1074,9 +1087,6 @@ void WindowSurfaceWayland::CommitWayland - void WindowSurfaceWayland::Commit(const LayoutDeviceIntRegion& aInvalidRegion) { - MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); - -- // Flush all waiting events explicitly as we need -- // mWaylandDisplay->FlushEventQueue(); -- - #ifdef MOZ_LOGGING - { - gfx::IntRect lockSize = aInvalidRegion.GetBounds().ToUnknownRect(); -@@ -1087,17 +1097,12 @@ void WindowSurfaceWayland::Commit(const - mBufferScreenRect.width, mBufferScreenRect.height)); - LOGWAYLAND((" mDrawToWaylandBufferDirectly = %d\n", - mDrawToWaylandBufferDirectly)); -- LOGWAYLAND( -- (" mWholeWindowBufferDamage = %d\n", mWholeWindowBufferDamage)); - } - #endif - - if (mDrawToWaylandBufferDirectly) { - MOZ_ASSERT(mWaylandBuffer->IsLocked()); -- // If we're not at fullscreen damage add drawing area from aInvalidRegion -- if (!mWholeWindowBufferDamage) { -- mWaylandBufferDamage.OrWith(aInvalidRegion); -- } -+ mWaylandBufferDamage.OrWith(aInvalidRegion); - UnlockWaylandBuffer(); - mBufferPendingCommit = true; - } else { -diff -up firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1581748 firefox-69.0/widget/gtk/WindowSurfaceWayland.h ---- firefox-69.0/widget/gtk/WindowSurfaceWayland.h.mozilla-1581748 2019-09-17 13:19:47.191908280 +0200 -+++ firefox-69.0/widget/gtk/WindowSurfaceWayland.h 2019-09-17 13:19:47.197908258 +0200 -@@ -161,6 +161,10 @@ class WindowImageSurface { - WindowImageSurface(gfxImageSurface* aImageSurface, - const LayoutDeviceIntRegion& aUpdateRegion); - -+ bool OverlapsSurface(class WindowImageSurface& aBottomSurface); -+ -+ const LayoutDeviceIntRegion* GetUpdateRegion() { return &mUpdateRegion; }; -+ - private: - RefPtr mSurface; - RefPtr mImageSurface; -@@ -174,20 +178,59 @@ class WindowSurfaceWayland : public Wind - explicit WindowSurfaceWayland(nsWindow* aWindow); - ~WindowSurfaceWayland(); - -+ // Lock() / Commit() are called by gecko when Firefox -+ // wants to display something. Lock() returns a DrawTarget -+ // where gecko paints. When gecko is done it calls Commit() -+ // and we try to send the DrawTarget (backed by wl_buffer) -+ // to wayland compositor. -+ // -+ // If we fail (wayland compositor is busy, -+ // wl_surface is not created yet) we queue the painting -+ // and we send it to wayland compositor in FrameCallbackHandler()/ -+ // DelayedCommitHandler/CommitWaylandBuffer(). - already_AddRefed Lock( - const LayoutDeviceIntRegion& aRegion) override; - void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final; -+ -+ // It's called from wayland compositor when there's the right -+ // time to send wl_buffer to display. It's no-op if there's no -+ // queued commits. - void FrameCallbackHandler(); -+ -+ // When a new window is created we may not have a valid wl_surface -+ // for drawing (Gtk haven't created it yet). All commits are queued -+ // and DelayedCommitHandler() is called by timer when wl_surface is ready -+ // for drawing. - void DelayedCommitHandler(); -+ -+ // Try to commit all queued drawings to Wayland compositor. This is usually -+ // called from other routines but can be used to explicitly flush -+ // all drawings as we do when wl_buffer is released -+ // (see WindowBackBufferShm::Detach() for instance). - void CommitWaylandBuffer(); - - nsWaylandDisplay* 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. -+ // Suitable for fullscreen content only like fullscreen video playback and -+ // may work well with dmabuf backend. -+ CACHE_NONE = 2 -+ } RenderingCacheMode; -+ - private: - WindowBackBuffer* CreateWaylandBuffer(int aWidth, int aHeight); - WindowBackBuffer* GetWaylandBufferToDraw(bool aCanSwitchBuffer); - -- already_AddRefed LockWaylandBuffer(bool aCanSwitchBuffer); -+ already_AddRefed LockWaylandBuffer(); - void UnlockWaylandBuffer(); - - already_AddRefed LockImageSurface( -@@ -206,23 +249,71 @@ class WindowSurfaceWayland : public Wind - // mBufferScreenRect is window size when our wayland buffer was allocated. - LayoutDeviceIntRect mBufferScreenRect; - nsWaylandDisplay* mWaylandDisplay; -+ -+ // Actual buffer (backed by wl_buffer) where all drawings go into. -+ // Drawn areas are stored at mWaylandBufferDamage and if there's -+ // any uncommited drawings which needs to be send to wayland compositor -+ // the mBufferPendingCommit is set. - WindowBackBuffer* mWaylandBuffer; -- LayoutDeviceIntRegion mWaylandBufferDamage; - WindowBackBuffer* mBackupBuffer[BACK_BUFFER_NUM]; -+ LayoutDeviceIntRegion mWaylandBufferDamage; -+ -+ // After every commit to wayland compositor a frame callback is requested. -+ // Any next commit to wayland compositor will happen when frame callback -+ // comes from wayland compositor back as it's the best time to do the commit. - wl_callback* mFrameCallback; - wl_surface* mLastCommittedSurface; -+ -+ // Registered reference to pending DelayedCommitHandler() call. - WindowSurfaceWayland** mDelayedCommitHandle; -+ -+ // Cached drawings. If we can't get WaylandBuffer (wl_buffer) at -+ // WindowSurfaceWayland::Lock() we direct gecko rendering to -+ // mImageSurface. -+ // If we can't get WaylandBuffer at WindowSurfaceWayland::Commit() -+ // time, mImageSurface is moved to mDelayedImageCommits which -+ // holds all cached drawings. -+ // mDelayedImageCommits can be drawn by FrameCallbackHandler(), -+ // DelayedCommitHandler() or when WaylandBuffer is detached. - RefPtr mImageSurface; - AutoTArray mDelayedImageCommits; -+ - int64_t mLastCommitTime; -+ -+ // Indicates that we don't have any cached drawings at mDelayedImageCommits -+ // and WindowSurfaceWayland::Lock() returned WaylandBuffer to gecko -+ // to draw into. - bool mDrawToWaylandBufferDirectly; -+ -+ // Set when our cached drawings (mDelayedImageCommits) contains -+ // full screen damage. That means we can safely switch WaylandBuffer -+ // at LockWaylandBuffer(). -+ bool mCanSwitchWaylandBuffer; -+ -+ // Set when actual WaylandBuffer contains drawings which are not send to -+ // wayland compositor yet. - bool mBufferPendingCommit; -+ -+ // We can't send WaylandBuffer (wl_buffer) to compositor when gecko -+ // is rendering into it (i.e. between WindowSurfaceWayland::Lock() / -+ // WindowSurfaceWayland::Commit()). -+ // Thus we use mBufferCommitAllowed to disable commit by callbacks -+ // (FrameCallbackHandler(), DelayedCommitHandler()) - bool mBufferCommitAllowed; -- bool mWholeWindowBufferDamage; -+ -+ // We need to clear WaylandBuffer when entire transparent window is repainted. -+ // This typically apply to popup windows. - bool mBufferNeedsClear; -+ - bool mIsMainThread; -+ -+ // When new WaylandBuffer (wl_buffer) is send to wayland compositor -+ // (buffer switch or resize) we also need to set its scale factor. - bool mNeedScaleFactorUpdate; - -+ // Image caching strategy, see RenderingCacheMode for details. -+ RenderingCacheMode mRenderingCacheMode; -+ - static bool UseDMABufBackend(); - static bool mUseDMABufInitialized; - static bool mUseDMABuf; diff --git a/pgo.patch b/pgo.patch index 20eb98d..1eef0d9 100644 --- a/pgo.patch +++ b/pgo.patch @@ -1,9 +1,10 @@ -diff -up firefox-64.0/build/unix/mozconfig.unix.pgo firefox-64.0/build/unix/mozconfig.unix ---- firefox-64.0/build/unix/mozconfig.unix.pgo 2019-01-03 15:23:16.792980384 +0100 -+++ firefox-64.0/build/unix/mozconfig.unix 2019-01-03 15:24:29.978693550 +0100 +diff -up firefox-70.0/build/mozconfig.pgo firefox-70.0/build/mozconfig +diff -up firefox-70.0/build/unix/mozconfig.unix.pgo firefox-70.0/build/unix/mozconfig.unix +--- firefox-70.0/build/unix/mozconfig.unix.pgo 2019-10-18 18:05:36.461701704 +0200 ++++ firefox-70.0/build/unix/mozconfig.unix 2019-10-18 20:25:48.036037912 +0200 @@ -6,6 +6,15 @@ if [ -n "$FORCE_GCC" ]; then - CC="$TOOLTOOL_DIR/gcc/bin/gcc" - CXX="$TOOLTOOL_DIR/gcc/bin/g++" + CC="$MOZ_FETCHES_DIR/gcc/bin/gcc" + CXX="$MOZ_FETCHES_DIR/gcc/bin/g++" + if [ -n "$MOZ_PGO" ]; then + if [ -z "$USE_ARTIFACT" ]; then @@ -16,11 +17,11 @@ diff -up firefox-64.0/build/unix/mozconfig.unix.pgo firefox-64.0/build/unix/mozc + # We want to make sure we use binutils and other binaries in the tooltool # package. - mk_add_options "export PATH=$TOOLTOOL_DIR/gcc/bin:$PATH" -diff -up firefox-64.0/extensions/spellcheck/src/moz.build.pgo firefox-64.0/extensions/spellcheck/src/moz.build ---- firefox-64.0/extensions/spellcheck/src/moz.build.pgo 2018-12-07 03:56:27.000000000 +0100 -+++ firefox-64.0/extensions/spellcheck/src/moz.build 2019-01-03 15:21:32.793385074 +0100 -@@ -28,3 +28,5 @@ EXPORTS.mozilla += [ + mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH" +diff -up firefox-70.0/extensions/spellcheck/src/moz.build.pgo firefox-70.0/extensions/spellcheck/src/moz.build +--- firefox-70.0/extensions/spellcheck/src/moz.build.pgo 2019-10-16 23:20:18.000000000 +0200 ++++ firefox-70.0/extensions/spellcheck/src/moz.build 2019-10-18 18:05:36.461701704 +0200 +@@ -31,3 +31,5 @@ EXPORTS.mozilla += [ if CONFIG['CC_TYPE'] in ('clang', 'gcc'): CXXFLAGS += ['-Wno-error=shadow'] diff --git a/sources b/sources index ec7b042..23e2fcc 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = 88afa0bc6af525cbb46bc75578b90419b28b95b396d5002fbf299a78a173681b840096ff83ef6e48553d1a5e0aa04e79383ab4d09bf431f3b864fcbacc7de46d -SHA512 (firefox-69.0.3.source.tar.xz) = bc4020c5f1a1eac82944f6402aa374c830231a0f168c6cdab8924a1c7a1b296381b45bce0a0567811ad86c2688972a35fda3f6c15e562b03a47d48617fe7611a -SHA512 (firefox-langpacks-69.0.3-20191010.tar.xz) = e293903557dffa0231345a2ae4085705ae3b5b9c1935c1fc2890d042e63862d45134a03403bbebec1fbe068b9d590797946feb8153e2d4129e5f4e309065381a +SHA512 (firefox-70.0.source.tar.xz) = c2643d88d59012dfd762357d66005c8892dec066b0ae9d8d33a29ea4427d1e5ae4a0376725c7d960c0025d5c9567eca816eb612b4ea987069e455c06fc442973 +SHA512 (firefox-langpacks-70.0-20191018.tar.xz) = aa17651aa8d4bc82d014846db559df9e896c329d58acfc145433480ad60cebf5a0a3774958e452d76b3f78bb70545e27208dbe226cfa13fc0a42c65ddfd48d46 From a534d9f0a514af006a540d6ecb19121f27f6ee17 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Mon, 21 Oct 2019 15:15:55 +0200 Subject: [PATCH 0082/1136] relax nss version --- firefox-nss-version.patch | 14 ++++++++++++++ firefox.spec | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 firefox-nss-version.patch diff --git a/firefox-nss-version.patch b/firefox-nss-version.patch new file mode 100644 index 0000000..a025e09 --- /dev/null +++ b/firefox-nss-version.patch @@ -0,0 +1,14 @@ +diff -up firefox-70.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-70.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium +diff -up firefox-70.0/media/webrtc/trunk/Makefile.old firefox-70.0/media/webrtc/trunk/Makefile +diff -up firefox-70.0/old-configure.in.old firefox-70.0/old-configure.in +--- firefox-70.0/old-configure.in.old 2019-10-21 15:13:50.777374423 +0200 ++++ firefox-70.0/old-configure.in 2019-10-21 15:13:59.803371294 +0200 +@@ -1530,7 +1530,7 @@ MOZ_ARG_WITH_BOOL(system-nss, + _USE_SYSTEM_NSS=1 ) + + if test -n "$_USE_SYSTEM_NSS"; then +- AM_PATH_NSS(3.46.1, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])]) ++ AM_PATH_NSS(3.46.0, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])]) + fi + + NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss" diff --git a/firefox.spec b/firefox.spec index 7a3dffc..1c42369 100644 --- a/firefox.spec +++ b/firefox.spec @@ -132,6 +132,7 @@ Patch40: build-aarch64-skia.patch Patch41: build-disable-elfhack.patch Patch44: build-arm-libopus.patch #Patch45: build-disable-multijobs-rust.patch +Patch46: firefox-nss-version.patch # Fedora specific patches Patch215: firefox-enable-addons.patch @@ -340,6 +341,7 @@ This package contains results of tests executed during build. %if 0%{?big_endian} %patch26 -p1 -b .icu %endif +%patch46 -p1 -b .nss-version # Fedora patches %patch215 -p1 -b .addons From a65dd614c617db34aefdf6e20ae6195e5b2186da Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Tue, 22 Oct 2019 12:04:14 +0200 Subject: [PATCH 0083/1136] - Put cbindgen .cargo/config to separate dir to avoid overwriting original stuff --- firefox.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 1c42369..873a00d 100644 --- a/firefox.spec +++ b/firefox.spec @@ -466,19 +466,19 @@ chmod -x third_party/rust/itertools/src/lib.rs mkdir -p my_rust_vendor cd my_rust_vendor %{__tar} xf %{SOURCE2} -cd - mkdir -p .cargo cat > .cargo/config < Date: Tue, 22 Oct 2019 12:38:47 +0200 Subject: [PATCH 0084/1136] Resolves: #1466936 Fixed aarch build patch rhbz-1354671.patch --- rhbz-1354671.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rhbz-1354671.patch b/rhbz-1354671.patch index 1f867eb..b6e8bbd 100644 --- a/rhbz-1354671.patch +++ b/rhbz-1354671.patch @@ -1,12 +1,12 @@ -diff -up firefox-65.0/layout/base/PresShell.h.1354671 firefox-65.0/layout/base/PresShell.h ---- firefox-65.0/layout/base/PresShell.h.1354671 2019-01-29 11:50:08.516649643 +0100 -+++ firefox-65.0/layout/base/PresShell.h 2019-01-29 11:51:48.930258629 +0100 -@@ -205,7 +205,7 @@ class nsIPresShell : public nsStubDocume +diff -up firefox-70.0/layout/base/PresShell.h.1354671 firefox-70.0/layout/base/PresShell.h +--- firefox-70.0/layout/base/PresShell.h.1354671 2019-10-22 12:33:12.987775587 +0200 ++++ firefox-70.0/layout/base/PresShell.h 2019-10-22 12:36:39.999366086 +0200 +@@ -257,7 +257,7 @@ class PresShell final : public nsStubDoc * to the same aSize value. AllocateFrame is infallible and will abort * on out-of-memory. */ - void* AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) { + void* __attribute__((optimize("no-lifetime-dse"))) AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) { - void* result = mFrameArena.AllocateByFrameID(aID, aSize); - RecordAlloc(result); - return result; + #define FRAME_ID(classname, ...) \ + static_assert(size_t(nsQueryFrame::FrameIID::classname##_id) == \ + size_t(eArenaObjectID_##classname), \ From 360cf1b9a86c4cc3157143c492bcbe647cc67ed5 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 31 Oct 2019 23:40:24 +0100 Subject: [PATCH 0085/1136] Switched to in-tree nss due to rhbz#1752303 --- firefox.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 1c42369..4861773 100644 --- a/firefox.spec +++ b/firefox.spec @@ -10,7 +10,7 @@ ExcludeArch: s390x ExcludeArch: ppc64le %endif -%global system_nss 1 +%global system_nss 0 %global system_ffi 1 # libvpx is too new for Firefox 65 %if 0%{?fedora} < 30 @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 70.0 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -949,6 +949,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Oct 31 2019 Martin Stransky - 70.0-2 +- Switched to in-tree nss due to rhbz#1752303 + * Tue Oct 15 2019 Martin Stransky - 70.0-1 - Updated to 70.0 From 34e361640a00da55dfa097f7ad534553b990ad4e Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Fri, 1 Nov 2019 11:56:18 +0100 Subject: [PATCH 0086/1136] Updated to 70.0.1, Built with system-nss (reverted 70.0-2 change) --- .gitignore | 2 ++ firefox.spec | 12 ++++++++---- sources | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 7077731..165f434 100644 --- a/.gitignore +++ b/.gitignore @@ -368,3 +368,5 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-69.0.3-20191010.tar.xz /firefox-70.0.source.tar.xz /firefox-langpacks-70.0-20191018.tar.xz +/firefox-70.0.1.source.tar.xz +/firefox-langpacks-70.0.1-20191101.tar.xz diff --git a/firefox.spec b/firefox.spec index dd7bab4..dfbb3c5 100644 --- a/firefox.spec +++ b/firefox.spec @@ -10,7 +10,7 @@ ExcludeArch: s390x ExcludeArch: ppc64le %endif -%global system_nss 0 +%global system_nss 1 %global system_ffi 1 # libvpx is too new for Firefox 65 %if 0%{?fedora} < 30 @@ -93,13 +93,13 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox -Version: 70.0 -Release: 2%{?pre_tag}%{?dist} +Version: 70.0.1 +Release: 1%{?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 %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20191018.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20191101.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source10: firefox-mozconfig @@ -949,6 +949,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Fri Nov 1 2019 Martin Stransky - 70.0.1-1 +- Updated to 70.0.1 +- Built with system-nss (reverted 70.0-2 change). + * Thu Oct 31 2019 Martin Stransky - 70.0-2 - Switched to in-tree nss due to rhbz#1752303 diff --git a/sources b/sources index 23e2fcc..1708286 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (cbindgen-vendor.tar.xz) = 88afa0bc6af525cbb46bc75578b90419b28b95b396d5002fbf299a78a173681b840096ff83ef6e48553d1a5e0aa04e79383ab4d09bf431f3b864fcbacc7de46d -SHA512 (firefox-70.0.source.tar.xz) = c2643d88d59012dfd762357d66005c8892dec066b0ae9d8d33a29ea4427d1e5ae4a0376725c7d960c0025d5c9567eca816eb612b4ea987069e455c06fc442973 -SHA512 (firefox-langpacks-70.0-20191018.tar.xz) = aa17651aa8d4bc82d014846db559df9e896c329d58acfc145433480ad60cebf5a0a3774958e452d76b3f78bb70545e27208dbe226cfa13fc0a42c65ddfd48d46 +SHA512 (firefox-70.0.1.source.tar.xz) = 798e18620e50ef10f184b6e43c88cfbad8a446ae005204582bccc2958107910617375b0ff622c85fb768b48d490a31ea7674eef9f0c415aa72cd958f09a9f725 +SHA512 (firefox-langpacks-70.0.1-20191101.tar.xz) = 307c9d14980ad66b5cfd1ad6a0bd2f4f60d09d9ea9478876b9537c31ae713b5cbe05410b8c01822084aa669f58d017a15ba4f7c6bcbcb07f144437658da72ff4 From 57463ac2b6fa83c256f62ef2c8d10707d521dfcb Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Mon, 4 Nov 2019 09:56:33 +0100 Subject: [PATCH 0087/1136] git diff --- D49289-wayland-monitor-size.diff | 370 +++++++++++++++++++++++++++++++ firefox.spec | 2 + 2 files changed, 372 insertions(+) create mode 100644 D49289-wayland-monitor-size.diff diff --git a/D49289-wayland-monitor-size.diff b/D49289-wayland-monitor-size.diff new file mode 100644 index 0000000..ff2ce05 --- /dev/null +++ b/D49289-wayland-monitor-size.diff @@ -0,0 +1,370 @@ +diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp +--- a/layout/xul/nsMenuPopupFrame.cpp ++++ b/layout/xul/nsMenuPopupFrame.cpp +@@ -1502,7 +1502,7 @@ + + nscoord oldAlignmentOffset = mAlignmentOffset; + +- bool inWayland = false; ++ static bool inWayland = false; + #ifdef MOZ_WAYLAND + inWayland = !GDK_IS_X11_DISPLAY(gdk_display_get_default()); + #endif +@@ -1512,9 +1512,9 @@ + // However, if a panel is already constrained or flipped (mIsOffset), then we + // want to continue to calculate this. Also, always do this for content + // shells, so that the popup doesn't extend outside the containing frame. +- if (!inWayland && (mInContentShell || (mFlip != FlipType_None && +- (!aIsMove || mIsOffset || +- mPopupType != ePopupTypePanel)))) { ++ if (mInContentShell || ++ (mFlip != FlipType_None && ++ (!aIsMove || mIsOffset || mPopupType != ePopupTypePanel))) { + int32_t appPerDev = presContext->AppUnitsPerDevPixel(); + LayoutDeviceIntRect anchorRectDevPix = + LayoutDeviceIntRect::FromAppUnitsToNearest(anchorRect, appPerDev); +@@ -1532,60 +1532,66 @@ + if (mRect.width > screenRect.width) mRect.width = screenRect.width; + if (mRect.height > screenRect.height) mRect.height = screenRect.height; + +- // at this point the anchor (anchorRect) is within the available screen +- // area (screenRect) and the popup is known to be no larger than the screen. ++ // We can't get the subsequent change of the popup position under ++ // waylande where gdk_window_move_to_rect is used to place them ++ // because we don't know the absolute position of the window on the screen. ++ if (!inWayland) { ++ // at this point the anchor (anchorRect) is within the available screen ++ // area (screenRect) and the popup is known to be no larger than the ++ // screen. + +- // We might want to "slide" an arrow if the panel is of the correct type - +- // but we can only slide on one axis - the other axis must be "flipped or +- // resized" as normal. +- bool slideHorizontal = false, slideVertical = false; +- if (mFlip == FlipType_Slide) { +- int8_t position = GetAlignmentPosition(); +- slideHorizontal = position >= POPUPPOSITION_BEFORESTART && +- position <= POPUPPOSITION_AFTEREND; +- slideVertical = position >= POPUPPOSITION_STARTBEFORE && +- position <= POPUPPOSITION_ENDAFTER; +- } ++ // We might want to "slide" an arrow if the panel is of the correct type - ++ // but we can only slide on one axis - the other axis must be "flipped or ++ // resized" as normal. ++ bool slideHorizontal = false, slideVertical = false; ++ if (mFlip == FlipType_Slide) { ++ int8_t position = GetAlignmentPosition(); ++ slideHorizontal = position >= POPUPPOSITION_BEFORESTART && ++ position <= POPUPPOSITION_AFTEREND; ++ slideVertical = position >= POPUPPOSITION_STARTBEFORE && ++ position <= POPUPPOSITION_ENDAFTER; ++ } + +- // Next, check if there is enough space to show the popup at full size when +- // positioned at screenPoint. If not, flip the popups to the opposite side +- // of their anchor point, or resize them as necessary. +- bool endAligned = IsDirectionRTL() +- ? mPopupAlignment == POPUPALIGNMENT_TOPLEFT || +- mPopupAlignment == POPUPALIGNMENT_BOTTOMLEFT +- : mPopupAlignment == POPUPALIGNMENT_TOPRIGHT || +- mPopupAlignment == POPUPALIGNMENT_BOTTOMRIGHT; +- nscoord preOffsetScreenPoint = screenPoint.x; +- if (slideHorizontal) { +- mRect.width = SlideOrResize(screenPoint.x, mRect.width, screenRect.x, +- screenRect.XMost(), &mAlignmentOffset); +- } else { +- mRect.width = FlipOrResize( +- screenPoint.x, mRect.width, screenRect.x, screenRect.XMost(), +- anchorRect.x, anchorRect.XMost(), margin.left, margin.right, +- offsetForContextMenu.x, hFlip, endAligned, &mHFlip); +- } +- mIsOffset = preOffsetScreenPoint != screenPoint.x; ++ // Next, check if there is enough space to show the popup at full size ++ // when positioned at screenPoint. If not, flip the popups to the opposite ++ // side of their anchor point, or resize them as necessary. ++ bool endAligned = IsDirectionRTL() ++ ? mPopupAlignment == POPUPALIGNMENT_TOPLEFT || ++ mPopupAlignment == POPUPALIGNMENT_BOTTOMLEFT ++ : mPopupAlignment == POPUPALIGNMENT_TOPRIGHT || ++ mPopupAlignment == POPUPALIGNMENT_BOTTOMRIGHT; ++ nscoord preOffsetScreenPoint = screenPoint.x; ++ if (slideHorizontal) { ++ mRect.width = SlideOrResize(screenPoint.x, mRect.width, screenRect.x, ++ screenRect.XMost(), &mAlignmentOffset); ++ } else { ++ mRect.width = FlipOrResize( ++ screenPoint.x, mRect.width, screenRect.x, screenRect.XMost(), ++ anchorRect.x, anchorRect.XMost(), margin.left, margin.right, ++ offsetForContextMenu.x, hFlip, endAligned, &mHFlip); ++ } ++ mIsOffset = preOffsetScreenPoint != screenPoint.x; + +- endAligned = mPopupAlignment == POPUPALIGNMENT_BOTTOMLEFT || +- mPopupAlignment == POPUPALIGNMENT_BOTTOMRIGHT; +- preOffsetScreenPoint = screenPoint.y; +- if (slideVertical) { +- mRect.height = SlideOrResize(screenPoint.y, mRect.height, screenRect.y, +- screenRect.YMost(), &mAlignmentOffset); +- } else { +- mRect.height = FlipOrResize( +- screenPoint.y, mRect.height, screenRect.y, screenRect.YMost(), +- anchorRect.y, anchorRect.YMost(), margin.top, margin.bottom, +- offsetForContextMenu.y, vFlip, endAligned, &mVFlip); ++ endAligned = mPopupAlignment == POPUPALIGNMENT_BOTTOMLEFT || ++ mPopupAlignment == POPUPALIGNMENT_BOTTOMRIGHT; ++ preOffsetScreenPoint = screenPoint.y; ++ if (slideVertical) { ++ mRect.height = SlideOrResize(screenPoint.y, mRect.height, screenRect.y, ++ screenRect.YMost(), &mAlignmentOffset); ++ } else { ++ mRect.height = FlipOrResize( ++ screenPoint.y, mRect.height, screenRect.y, screenRect.YMost(), ++ anchorRect.y, anchorRect.YMost(), margin.top, margin.bottom, ++ offsetForContextMenu.y, vFlip, endAligned, &mVFlip); ++ } ++ mIsOffset = mIsOffset || (preOffsetScreenPoint != screenPoint.y); ++ ++ NS_ASSERTION(screenPoint.x >= screenRect.x && ++ screenPoint.y >= screenRect.y && ++ screenPoint.x + mRect.width <= screenRect.XMost() && ++ screenPoint.y + mRect.height <= screenRect.YMost(), ++ "Popup is offscreen"); + } +- mIsOffset = mIsOffset || (preOffsetScreenPoint != screenPoint.y); +- +- NS_ASSERTION(screenPoint.x >= screenRect.x && +- screenPoint.y >= screenRect.y && +- screenPoint.x + mRect.width <= screenRect.XMost() && +- screenPoint.y + mRect.height <= screenRect.YMost(), +- "Popup is offscreen"); + } + + // snap the popup's position in screen coordinates to device pixels, +@@ -1687,6 +1693,14 @@ + screen->GetAvailRect(&screenRectPixels.x, &screenRectPixels.y, + &screenRectPixels.width, &screenRectPixels.height); + } ++#ifdef MOZ_WAYLAND ++ else { ++ if (GetWidget() && ++ GetWidget()->GetScreenRect(&screenRectPixels) != NS_OK) { ++ NS_WARNING("Cannot get screen rect from widget!"); ++ } ++ } ++#endif + } + + if (mInContentShell) { +diff --git a/widget/ScreenManager.cpp b/widget/ScreenManager.cpp +--- a/widget/ScreenManager.cpp ++++ b/widget/ScreenManager.cpp +@@ -11,6 +11,11 @@ + #include "mozilla/dom/DOMTypes.h" + #include "mozilla/Logging.h" + #include "mozilla/StaticPtr.h" ++#ifdef MOZ_WAYLAND ++# include ++# include ++# include ++#endif /* MOZ_WAYLAND */ + + static mozilla::LazyLogModule sScreenLog("WidgetScreen"); + +@@ -104,6 +109,15 @@ + NS_IMETHODIMP + ScreenManager::ScreenForRect(int32_t aX, int32_t aY, int32_t aWidth, + int32_t aHeight, nsIScreen** aOutScreen) { ++#ifdef MOZ_WAYLAND ++ static bool inWayland = !GDK_IS_X11_DISPLAY(gdk_display_get_default()); ++ ++ if (inWayland) { ++ *aOutScreen = nullptr; ++ return NS_OK; ++ } ++#endif ++ + if (mScreenList.IsEmpty()) { + MOZ_LOG(sScreenLog, LogLevel::Warning, + ("No screen available. This can happen in xpcshell.")); +diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h +--- a/widget/gtk/nsWindow.h ++++ b/widget/gtk/nsWindow.h +@@ -398,6 +398,9 @@ + static bool HideTitlebarByDefault(); + static bool GetTopLevelWindowActiveState(nsIFrame* aFrame); + static bool TitlebarCanUseShapeMask(); ++#ifdef MOZ_WAYLAND ++ virtual nsresult GetScreenRect(LayoutDeviceIntRect* aRect) override; ++#endif + + protected: + virtual ~nsWindow(); +@@ -630,6 +633,7 @@ + void HideWaylandTooltips(); + void HideWaylandPopupAndAllChildren(); + void CleanupWaylandPopups(); ++ GtkWindow* GetCurrentTopmostWindow(); + + /** + * |mIMContext| takes all IME related stuff. +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1294,10 +1294,14 @@ + GdkWindow* window, const GdkRectangle* flipped_rect, + const GdkRectangle* final_rect, gboolean flipped_x, gboolean flipped_y, + void* aWindow) { +- LOG(("%s [%p] flipped %d %d\n", __FUNCTION__, aWindow, flipped_rect->x, +- flipped_rect->y)); +- LOG(("%s [%p] final %d %d\n", __FUNCTION__, aWindow, final_rect->x, +- final_rect->y)); ++ LOG(("%s [%p] flipped_x %d flipped_y %d\n", __FUNCTION__, aWindow, flipped_x, ++ flipped_y)); ++ ++ LOG(("%s [%p] flipped %d %d w:%d h:%d\n", __FUNCTION__, aWindow, ++ flipped_rect->x, flipped_rect->y, flipped_rect->width, ++ flipped_rect->height)); ++ LOG(("%s [%p] final %d %d w:%d h:%d\n", __FUNCTION__, aWindow, final_rect->x, ++ final_rect->y, final_rect->width, final_rect->height)); + } + #endif + +@@ -1384,6 +1388,16 @@ + HideWaylandWindow(); + } + ++ LOG( ++ ("nsWindow::NativeMoveResizeWaylandPopup [%p]: requested rect: x%d y%d " ++ "w%d h%d\n", ++ this, rect.x, rect.y, rect.width, rect.height)); ++ if (aSize) { ++ LOG((" aSize: x%d y%d w%d h%d\n", aSize->x, aSize->y, aSize->width, ++ aSize->height)); ++ } else { ++ LOG((" No aSize given")); ++ } + sGdkWindowMoveToRect(gdkWindow, &rect, rectAnchor, menuAnchor, hints, 0, 0); + + if (isWidgetVisible) { +@@ -1399,7 +1413,8 @@ + LOG(("nsWindow::NativeMove [%p] %d %d\n", (void*)this, point.x, point.y)); + + if (IsWaylandPopup()) { +- NativeMoveResizeWaylandPopup(&point, nullptr); ++ GdkRectangle size = DevicePixelsToGdkSizeRoundUp(mBounds.Size()); ++ NativeMoveResizeWaylandPopup(&point, &size); + } else if (mIsTopLevel) { + gtk_window_move(GTK_WINDOW(mShell), point.x, point.y); + } else if (mGdkWindow) { +@@ -6724,6 +6739,16 @@ + } + } + ++GtkWindow* nsWindow::GetCurrentTopmostWindow() { ++ GtkWindow* parentWindow = GTK_WINDOW(GetGtkWidget()); ++ GtkWindow* topmostParentWindow; ++ while (parentWindow) { ++ topmostParentWindow = parentWindow; ++ parentWindow = gtk_window_get_transient_for(parentWindow); ++ } ++ return topmostParentWindow; ++} ++ + gint nsWindow::GdkScaleFactor() { + GdkWindow* scaledGdkWindow = mGdkWindow; + if (!mIsX11Display) { +@@ -6732,12 +6757,7 @@ + // not updated during it's hidden. + if (mWindowType == eWindowType_popup || mWindowType == eWindowType_dialog) { + // Get toplevel window for scale factor: +- GtkWindow* parentWindow = GTK_WINDOW(GetGtkWidget()); +- GtkWindow* topmostParentWindow; +- while (parentWindow) { +- topmostParentWindow = parentWindow; +- parentWindow = gtk_window_get_transient_for(parentWindow); +- } ++ GtkWindow* topmostParentWindow = GetCurrentTopmostWindow(); + if (topmostParentWindow) { + scaledGdkWindow = + gtk_widget_get_window(GTK_WIDGET(topmostParentWindow)); +@@ -7268,6 +7288,41 @@ + return window.forget(); + } + ++#ifdef MOZ_WAYLAND ++nsresult nsWindow::GetScreenRect(LayoutDeviceIntRect* aRect) { ++ typedef struct _GdkMonitor GdkMonitor; ++ static auto s_gdk_display_get_monitor_at_window = ++ (GdkMonitor * (*)(GdkDisplay*, GdkWindow*)) ++ dlsym(RTLD_DEFAULT, "gdk_display_get_monitor_at_window"); ++ ++ static auto s_gdk_monitor_get_workarea = ++ (void (*)(GdkMonitor*, GdkRectangle*))dlsym(RTLD_DEFAULT, ++ "gdk_monitor_get_workarea"); ++ ++ if (!s_gdk_display_get_monitor_at_window || !s_gdk_monitor_get_workarea) { ++ return NS_ERROR_NOT_IMPLEMENTED; ++ } ++ ++ GtkWindow* topmostParentWindow = GetCurrentTopmostWindow(); ++ GdkWindow* gdkWindow = gtk_widget_get_window(GTK_WIDGET(topmostParentWindow)); ++ ++ GdkMonitor* monitor = ++ s_gdk_display_get_monitor_at_window(gdk_display_get_default(), gdkWindow); ++ if (monitor) { ++ GdkRectangle workArea; ++ s_gdk_monitor_get_workarea(monitor, &workArea); ++ aRect->x = workArea.x; ++ aRect->y = workArea.y; ++ aRect->width = workArea.width; ++ aRect->height = workArea.height; ++ LOG((" workarea for [%p], monitor %p: x%d y%d w%d h%d\n", this, monitor, ++ workArea.x, workArea.y, workArea.width, workArea.height)); ++ return NS_OK; ++ } ++ return NS_ERROR_NOT_IMPLEMENTED; ++} ++#endif ++ + bool nsWindow::GetTopLevelWindowActiveState(nsIFrame* aFrame) { + // Used by window frame and button box rendering. We can end up in here in + // the content process when rendering one of these moz styles freely in a +diff --git a/widget/moz.build b/widget/moz.build +--- a/widget/moz.build ++++ b/widget/moz.build +@@ -210,7 +210,6 @@ + 'PuppetBidiKeyboard.cpp', + 'PuppetWidget.cpp', + 'Screen.cpp', +- 'ScreenManager.cpp', + 'SharedWidgetUtils.cpp', + 'TextEventDispatcher.cpp', + 'VsyncDispatcher.cpp', +@@ -242,6 +241,7 @@ + SOURCES += [ + 'nsBaseDragService.cpp', + 'nsBaseWidget.cpp', ++ 'ScreenManager.cpp', + ] + + if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']: +diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h +--- a/widget/nsIWidget.h ++++ b/widget/nsIWidget.h +@@ -1713,6 +1713,15 @@ + return NS_ERROR_NOT_IMPLEMENTED; + } + ++ // Get rectangle of the screen where the window is placed. ++ // It's used to detect popup overflow under Wayland because ++ // Screenmanager does not work under it. ++#ifdef MOZ_WAYLAND ++ virtual nsresult GetScreenRect(LayoutDeviceIntRect* aRect) { ++ return NS_ERROR_NOT_IMPLEMENTED; ++ } ++#endif ++ + private: + class LongTapInfo { + public: + diff --git a/firefox.spec b/firefox.spec index dfbb3c5..5e8c0f2 100644 --- a/firefox.spec +++ b/firefox.spec @@ -152,6 +152,7 @@ Patch417: bug1375074-save-restore-x28.patch Patch419: mozilla-1568569.patch Patch421: mozilla-1579023.patch Patch422: mozilla-1580174-webrtc-popup.patch +Patch423: D49289-wayland-monitor-size.diff # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -361,6 +362,7 @@ This package contains results of tests executed during build. %endif %patch419 -p1 -b .1568569 %patch421 -p1 -b .1579023 +%patch423 -p1 -b .D49289 # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire From f1a7e5d3a1dacdc6b072b841ae169b7a2d3a93bb Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Mon, 4 Nov 2019 09:58:01 +0100 Subject: [PATCH 0088/1136] Added fix for non-scrollable popups and bump release --- firefox.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 5e8c0f2..4e779ea 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 70.0.1 -Release: 1%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -951,6 +951,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Mon Nov 04 2019 Jan Horak - 70.0.1-2 +- Added fix for non-scrollable popups + * Fri Nov 1 2019 Martin Stransky - 70.0.1-1 - Updated to 70.0.1 - Built with system-nss (reverted 70.0-2 change). From 84bc31d257813fbaedfbb34568c5a7de020dc841 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Thu, 7 Nov 2019 13:59:28 +0100 Subject: [PATCH 0089/1136] Test build with in-tree nss (rhbz#1752303) --- firefox.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index 4e779ea..5a239cf 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 70.0.1 -Release: 2%{?pre_tag}%{?dist} +Release: 3.nss%{?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 @@ -951,6 +951,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Nov 7 2019 Martin Stransky - 70.0-3.nss +- Test build with in-tree nss (rhbz#1752303) + * Mon Nov 04 2019 Jan Horak - 70.0.1-2 - Added fix for non-scrollable popups From d58c8650ea0621b1914d1b8ecc09a0e57ab2ada9 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 14 Nov 2019 10:12:10 +0100 Subject: [PATCH 0090/1136] Revert in-tree nss testbuild --- firefox.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/firefox.spec b/firefox.spec index 5a239cf..4e779ea 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 70.0.1 -Release: 3.nss%{?pre_tag}%{?dist} +Release: 2%{?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 @@ -951,9 +951,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Thu Nov 7 2019 Martin Stransky - 70.0-3.nss -- Test build with in-tree nss (rhbz#1752303) - * Mon Nov 04 2019 Jan Horak - 70.0.1-2 - Added fix for non-scrollable popups From a961f01c1b48c78dd69d400c7c60564a73a03a2f Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 14 Nov 2019 10:49:25 +0100 Subject: [PATCH 0091/1136] Bump release for rebuild --- firefox.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 4e779ea..8a0a3c8 100644 --- a/firefox.spec +++ b/firefox.spec @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 70.0.1 -Release: 2%{?pre_tag}%{?dist} +Release: 4%{?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 @@ -951,7 +951,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog -* Mon Nov 04 2019 Jan Horak - 70.0.1-2 +* Mon Nov 04 2019 Jan Horak - 70.0.1-4 - Added fix for non-scrollable popups * Fri Nov 1 2019 Martin Stransky - 70.0.1-1 From c18a8a0ffc4e916477a55b4d68a559e73d613c14 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 19 Nov 2019 13:18:09 +0100 Subject: [PATCH 0092/1136] Built with in-tree nss (rhbz#1752303) --- firefox.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/firefox.spec b/firefox.spec index 8a0a3c8..ff8612a 100644 --- a/firefox.spec +++ b/firefox.spec @@ -10,7 +10,7 @@ ExcludeArch: s390x ExcludeArch: ppc64le %endif -%global system_nss 1 +%global system_nss 0 %global system_ffi 1 # libvpx is too new for Firefox 65 %if 0%{?fedora} < 30 @@ -94,7 +94,7 @@ ExcludeArch: ppc64le Summary: Mozilla Firefox Web browser Name: firefox Version: 70.0.1 -Release: 4%{?pre_tag}%{?dist} +Release: 5.nss%{?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 @@ -951,6 +951,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Tue Nov 19 2019 Martin Stransky - 70.0.1-5.nss +- Built with in-tree nss (rhbz#1752303). + * Mon Nov 04 2019 Jan Horak - 70.0.1-4 - Added fix for non-scrollable popups From 905a7b26dd88c85c2adc0470ac671d89a710416d Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 19 Nov 2019 15:27:22 +0100 Subject: [PATCH 0093/1136] Build against rust 1.38 --- firefox.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index ff8612a..10e032a 100644 --- a/firefox.spec +++ b/firefox.spec @@ -257,7 +257,7 @@ BuildRequires: xorg-x11-server-Xvfb %if 0%{?pgo_wayland} BuildRequires: mutter %endif -BuildRequires: rust +BuildRequires: rust = 1.38 BuildRequires: cargo BuildRequires: clang-devel From 1ed5beacbb6a9d98b9092d3653fb1902edbc0a35 Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Thu, 21 Nov 2019 15:55:32 +0100 Subject: [PATCH 0094/1136] Added fixes for missing overflow widget windows and