From a8affa912c883c59f7052779a2440c796715ced8 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sat, 15 Jan 2022 20:09:44 +0100 Subject: [PATCH] chromium: Backport important fixes for Wayland This is 843508dad46 for M97 (upstream didn't backport them so far). --- .../networking/browsers/chromium/common.nix | 12 ++++++- ...-ozone-wayland-fix-surface_augmenter.patch | 31 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/networking/browsers/chromium/patches/m97-ozone-wayland-fix-surface_augmenter.patch diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index b4fdf61d1668..d9385ceb0427 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -161,13 +161,23 @@ let ./patches/no-build-timestamps.patch # For bundling Widevine (DRM), might be replaceable via bundle_widevine_cdm=true in gnFlags: ./patches/widevine-79.patch - ] ++ lib.optionals (versionRange "98" "99") [ + ] ++ lib.optionals (versionRange "97" "98") [ # A critical Ozone/Wayland fix: + # (Note: The patch for surface_augmenter.cc doesn't apply on M97 so we extract that part.) + (fetchpatch { + # [linux/wayland] Fixed terminate caused by binding to wrong version. + url = "https://github.com/chromium/chromium/commit/dd4c3ddadbb9869f59cee201a38e9ca3b9154f4d.patch"; + excludes = [ "ui/ozone/platform/wayland/host/surface_augmenter.cc" ]; + sha256 = "sha256-lp4kxPNAkafdE9NfD3ittTCpomRpX9Hqhtt9GFf4Ntw="; + }) + ./patches/m97-ozone-wayland-fix-surface_augmenter.patch + ] ++ lib.optionals (versionRange "98" "99") [ (githubPatch { # [linux/wayland] Fixed terminate caused by binding to wrong version. commit = "dd4c3ddadbb9869f59cee201a38e9ca3b9154f4d"; sha256 = "sha256-FH7lBQTruMzkBT2XQ+kgADmJA0AxJfaV/gvtoqfQ4a4="; }) + ] ++ lib.optionals (versionRange "97" "99") [ (githubPatch { # [linux/wayland] Fixed terminate caused by binding to wrong version. (fixup) commit = "a84b79daa8897b822336b8f348ef4daaae07af37"; diff --git a/pkgs/applications/networking/browsers/chromium/patches/m97-ozone-wayland-fix-surface_augmenter.patch b/pkgs/applications/networking/browsers/chromium/patches/m97-ozone-wayland-fix-surface_augmenter.patch new file mode 100644 index 000000000000..e63000fabc1c --- /dev/null +++ b/pkgs/applications/networking/browsers/chromium/patches/m97-ozone-wayland-fix-surface_augmenter.patch @@ -0,0 +1,31 @@ +diff --git a/ui/ozone/platform/wayland/host/surface_augmenter.cc b/ui/ozone/platform/wayland/host/surface_augmenter.cc +index d971d15e71426..6e5408398bcea 100644 +--- a/ui/ozone/platform/wayland/host/surface_augmenter.cc ++++ b/ui/ozone/platform/wayland/host/surface_augmenter.cc +@@ -13,7 +13,8 @@ + namespace ui { + + namespace { +-constexpr uint32_t kMaxSurfaceAugmenterVersion = 1; ++constexpr uint32_t kMinVersion = 1; ++constexpr uint32_t kMaxVersion = 1; + } + + // static +@@ -27,11 +28,13 @@ void SurfaceAugmenter::Instantiate(WaylandConnection* connection, + uint32_t version) { + DCHECK_EQ(interface, kInterfaceName); + +- if (connection->surface_augmenter_) ++ if (connection->surface_augmenter_ || ++ !wl::CanBind(interface, version, kMinVersion, kMaxVersion)) { + return; ++ } + +- auto augmenter = wl::Bind( +- registry, name, std::min(version, kMaxSurfaceAugmenterVersion)); ++ auto augmenter = wl::Bind(registry, name, ++ std::min(version, kMaxVersion)); + if (!augmenter) { + LOG(ERROR) << "Failed to bind surface_augmenter"; + return;