From f97491aa5b4b45112aaa92920e8e8355a2b8c137ca5afaebd504ed01c102335f Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 3 Nov 2023 07:45:26 +0000 Subject: [PATCH] Accepting request 1121694 from GNOME:Next - Add webkit2gtk3-disable-dmabuf-nvidia.patch: disable DMABuf renderer for NVIDIA proprietary drivers (boo#1216778). OBS-URL: https://build.opensuse.org/request/show/1121694 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/webkit2gtk3?expand=0&rev=428 --- webkit2gtk3-disable-dmabuf-nvidia.patch | 63 +++++++++++++++++++++++++ webkit2gtk3.changes | 6 +++ webkit2gtk3.spec | 3 ++ 3 files changed, 72 insertions(+) create mode 100644 webkit2gtk3-disable-dmabuf-nvidia.patch diff --git a/webkit2gtk3-disable-dmabuf-nvidia.patch b/webkit2gtk3-disable-dmabuf-nvidia.patch new file mode 100644 index 0000000..7d8ff15 --- /dev/null +++ b/webkit2gtk3-disable-dmabuf-nvidia.patch @@ -0,0 +1,63 @@ +From: Carlos Garcia Campos +Subject: Disable DMABuf renderer for NVIDIA proprietary drivers +Bug: https://bugs.webkit.org/show_bug.cgi?id=262607 +Bug-Debian: https://bugs.debian.org/1039720 +Origin: https://github.com/WebKit/WebKit/pull/18614 +Index: webkitgtk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp +=================================================================== +--- webkitgtk.orig/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp ++++ webkitgtk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp +@@ -36,11 +36,13 @@ + #include + #include + #include ++#include + #include + #include + + #if USE(GBM) + #include ++#include + #include + static constexpr uint64_t s_dmabufInvalidModifier = uint64_t(WebCore::DMABufFormat::Modifier::Invalid); + #else +@@ -53,6 +55,29 @@ static constexpr uint64_t s_dmabufInvali + + namespace WebKit { + ++static bool isNVIDIA() ++{ ++ const char* forceDMABuf = getenv("WEBKIT_FORCE_DMABUF_RENDERER"); ++ if (forceDMABuf && strcmp(forceDMABuf, "0")) ++ return false; ++ ++ std::unique_ptr platformDisplay; ++#if USE(GBM) ++ const char* disableGBM = getenv("WEBKIT_DMABUF_RENDERER_DISABLE_GBM"); ++ if (!disableGBM || !strcmp(disableGBM, "0")) { ++ if (auto* device = WebCore::PlatformDisplay::sharedDisplay().gbmDevice()) ++ platformDisplay = WebCore::PlatformDisplayGBM::create(device); ++ } ++#endif ++ if (!platformDisplay) ++ platformDisplay = WebCore::PlatformDisplaySurfaceless::create(); ++ ++ WebCore::GLContext::ScopedGLContext glContext(WebCore::GLContext::createOffscreen(platformDisplay ? *platformDisplay : WebCore::PlatformDisplay::sharedDisplay())); ++ if (strstr(reinterpret_cast(glGetString(GL_VENDOR)), "NVIDIA")) ++ return true; ++ return false; ++} ++ + OptionSet AcceleratedBackingStoreDMABuf::rendererBufferMode() + { + static OptionSet mode; +@@ -68,6 +93,9 @@ OptionSet Acce + return; + } + ++ if (isNVIDIA()) ++ return; ++ + mode.add(DMABufRendererBufferMode::SharedMemory); + + const auto& eglExtensions = WebCore::PlatformDisplay::sharedDisplay().eglExtensions(); diff --git a/webkit2gtk3.changes b/webkit2gtk3.changes index ea30186..02f1f93 100644 --- a/webkit2gtk3.changes +++ b/webkit2gtk3.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 1 19:52:33 UTC 2023 - Mike Gorse + +- Add webkit2gtk3-disable-dmabuf-nvidia.patch: disable DMABuf + renderer for NVIDIA proprietary drivers (boo#1216778). + ------------------------------------------------------------------- Mon Oct 23 18:48:15 UTC 2023 - Mike Gorse diff --git a/webkit2gtk3.spec b/webkit2gtk3.spec index 927f653..b692359 100644 --- a/webkit2gtk3.spec +++ b/webkit2gtk3.spec @@ -89,6 +89,8 @@ Source99: webkit2gtk3.keyring Patch0: reproducibility.patch # PATCH-FIX-UPSTREAM webkit2gtk3-create-destroy-egl-image.patch boo#1216483 mgorse@suse.com -- fix "No provider of EglDestroyImage found". Patch1: webkit2gtk3-create-destroy-egl-image.patch +# PATCH-FIX-UPSTREAM webkit2gtk3-disable-dmabuf-nvidia.patch boo#1216778 mgorse@suse.com -- disable the DMABuf renderer for NVIDIA proprietary drivers. +Patch2: webkit2gtk3-disable-dmabuf-nvidia.patch BuildRequires: Mesa-libEGL-devel BuildRequires: Mesa-libGL-devel @@ -426,6 +428,7 @@ Group: Development/Tools/Other A small test browswer from webkit, useful for testing features. # Expand %%lang_package to Obsoletes its older-name counterpart + %package -n WebKitGTK-%{_apiver}-lang Summary: Translations for package %{name} Group: System/Localization