Merge pull request #155203 from primeos/chromium

chromium: Backport important fixes for Wayland
This commit is contained in:
Michael Weiss 2022-01-16 12:20:30 +01:00 committed by GitHub
commit d0a7fc845d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 1 deletions

View file

@ -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";

View file

@ -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<surface_augmenter>(
- registry, name, std::min(version, kMaxSurfaceAugmenterVersion));
+ auto augmenter = wl::Bind<surface_augmenter>(registry, name,
+ std::min(version, kMaxVersion));
if (!augmenter) {
LOG(ERROR) << "Failed to bind surface_augmenter";
return;