webkit2gtk3/webkit2gtk3-disable-dmabuf-nvidia.patch
Dominique Leuenberger 15cddb5c5d - Update to version 2.44.4:
+ Add quirk to allow totale.rosettastone.com to load properly.
  + Fix webkit_web_resource_get_data() not working properly in some
    sites.
  + Fix not being able to jump-to-source in Web Inspector canvas
    traces.
  + Fix not being able to scroll list of WebGL shader programs in
    the Web Inspector.
  + Fix linker relocation errors on Debug/RelWithDebInfo builds.
  + Fix crashes when built with Clang with Link-Time Optimization
    (LTO).
  + Fix several crashes and rendering issues.
- Drop revert-271175.patch: Fixed upstream.
- Enable LTO again, pass define _lto_cflags for only select targets

OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/webkit2gtk3?expand=0&rev=479
2024-09-11 14:28:56 +00:00

66 lines
2.4 KiB
Diff

From: Carlos Garcia Campos <cgarcia@igalia.com>
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-2.44.0/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
===================================================================
--- webkitgtk-2.44.0.orig/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
+++ webkitgtk-2.44.0/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
@@ -37,6 +37,7 @@
#include <WebCore/GLContext.h>
#include <WebCore/IntRect.h>
#include <WebCore/PlatformDisplay.h>
+#include <WebCore/PlatformDisplaySurfaceless.h>
#include <WebCore/ShareableBitmap.h>
#include <WebCore/SharedMemory.h>
#include <epoxy/egl.h>
@@ -45,6 +46,7 @@
#if USE(GBM)
#include <drm_fourcc.h>
+#include <WebCore/PlatformDisplayGBM.h>
#include <gbm.h>
static constexpr uint64_t s_dmabufInvalidModifier = DRM_FORMAT_MOD_INVALID;
@@ -58,6 +60,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<WebCore::PlatformDisplay> 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<const char*>(glGetString(GL_VENDOR)), "NVIDIA"))
+ return true;
+ return false;
+}
+
OptionSet<DMABufRendererBufferMode> AcceleratedBackingStoreDMABuf::rendererBufferMode()
{
static OptionSet<DMABufRendererBufferMode> mode;
@@ -73,6 +98,9 @@ OptionSet<DMABufRendererBufferMode> Acce
return;
}
+ if (isNVIDIA())
+ return;
+
mode.add(DMABufRendererBufferMode::SharedMemory);
const char* forceSHM = getenv("WEBKIT_DMABUF_RENDERER_FORCE_SHM");