Merge pull request #12667 from Rmys/master

webkit2gtk ver. bump
This commit is contained in:
Rmys
2023-10-24 23:14:07 +03:00
committed by GitHub
3 changed files with 181 additions and 4 deletions
@@ -0,0 +1,76 @@
From 745633e606ca70bf926545149beed35aab6450b7 Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <cgarcia@igalia.com>
Date: Wed, 4 Oct 2023 10:19:28 +0200
Subject: [PATCH] [GTK] Disable DMABuf renderer for NVIDIA proprietary drivers
https://bugs.webkit.org/show_bug.cgi?id=262607
Reviewed by NOBODY (OOPS!).
Some NVIDIA users are reporting nothing is rendered, so let's just
disable the DMA-BUF renderer until we figure out how to make it work.
* Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp:
(WebKit::isNVIDIA):
(WebKit::AcceleratedBackingStoreDMABuf::rendererBufferMode):
---
.../gtk/AcceleratedBackingStoreDMABuf.cpp | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
index 9c0f5efdfb0e3..a03842e15db0e 100644
--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
@@ -38,11 +38,13 @@
#include <WebCore/GLContext.h>
#include <WebCore/IntRect.h>
#include <WebCore/PlatformDisplay.h>
+#include <WebCore/PlatformDisplaySurfaceless.h>
#include <epoxy/egl.h>
#include <wtf/glib/GUniquePtr.h>
#if USE(GBM)
#include <WebCore/DMABufFormat.h>
+#include <WebCore/PlatformDisplayGBM.h>
#include <gbm.h>
static constexpr uint64_t s_dmabufInvalidModifier = uint64_t(WebCore::DMABufFormat::Modifier::Invalid);
#else
@@ -55,6 +57,29 @@ static constexpr uint64_t s_dmabufInvalidModifier = ((1ULL << 56) - 1);
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;
@@ -70,6 +95,9 @@ OptionSet<DMABufRendererBufferMode> AcceleratedBackingStoreDMABuf::rendererBuffe
return;
}
+ if (isNVIDIA())
+ return;
+
mode.add(DMABufRendererBufferMode::SharedMemory);
const auto& eglExtensions = WebCore::PlatformDisplay::sharedDisplay().eglExtensions();
@@ -0,0 +1,100 @@
From e07345343415dd2496edc721daa61a3b42703131 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Tue, 19 Sep 2023 12:16:39 -0700
Subject: [PATCH] [GTK] MiniBrowser should hide the toolbar when using
--full-screen #17909 https://bugs.webkit.org/show_bug.cgi?id=261732
Reviewed by Michael Catanzaro.
Entering fullscreen mode with F11 works as expected.
Starting with command line switch `--full-screen` does make the window
fullscreen, but does not hide the toolbar. Let's change that.
Instead of just making the window fullscreen with `gtk_window_fullscreen()`
this introduces a new function `browser_window_fullscreen()` that hides
the toolbar as well.
Also introduce new function `browserWindowUnfullscreen()`, use both
in `toggleFullScreen()`, and drop extra inversion.
* Tools/MiniBrowser/gtk/BrowserWindow.c
* Tools/MiniBrowser/gtk/BrowserWindow.h
* Tools/MiniBrowser/gtk/main.c
Canonical link: https://commits.webkit.org/268141@main
---
Tools/MiniBrowser/gtk/BrowserWindow.c | 27 ++++++++++++++++++---------
Tools/MiniBrowser/gtk/BrowserWindow.h | 1 +
Tools/MiniBrowser/gtk/main.c | 2 +-
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/Tools/MiniBrowser/gtk/BrowserWindow.c b/Tools/MiniBrowser/gtk/BrowserWindow.c
index 626ce2207e845..58eb5ae39e2e0 100644
--- a/Tools/MiniBrowser/gtk/BrowserWindow.c
+++ b/Tools/MiniBrowser/gtk/BrowserWindow.c
@@ -482,6 +482,20 @@ static GtkWidget *webViewCreate(WebKitWebView *webView, WebKitNavigationAction *
return GTK_WIDGET(newWebView);
}
+void browser_window_fullscreen(BrowserWindow *window)
+{
+ gtk_window_fullscreen(GTK_WINDOW(window));
+ gtk_widget_hide(window->toolbar);
+ window->fullScreenIsEnabled = TRUE;
+}
+
+static void browserWindowUnfullscreen(BrowserWindow *window)
+{
+ gtk_window_unfullscreen(GTK_WINDOW(window));
+ gtk_widget_show(window->toolbar);
+ window->fullScreenIsEnabled = FALSE;
+}
+
static gboolean webViewEnterFullScreen(WebKitWebView *webView, BrowserWindow *window)
{
gtk_widget_hide(window->toolbar);
@@ -867,15 +881,10 @@ static void loadHomePage(GSimpleAction *action, GVariant *parameter, gpointer us
static void toggleFullScreen(GSimpleAction *action, GVariant *parameter, gpointer userData)
{
BrowserWindow *window = BROWSER_WINDOW(userData);
- if (!window->fullScreenIsEnabled) {
- gtk_window_fullscreen(GTK_WINDOW(window));
- gtk_widget_hide(window->toolbar);
- window->fullScreenIsEnabled = TRUE;
- } else {
- gtk_window_unfullscreen(GTK_WINDOW(window));
- gtk_widget_show(window->toolbar);
- window->fullScreenIsEnabled = FALSE;
- }
+ if (window->fullScreenIsEnabled)
+ browserWindowUnfullscreen(window);
+ else
+ browser_window_fullscreen(window);
}
static void webKitPrintOperationFailedCallback(WebKitPrintOperation *printOperation, GError *error)
diff --git a/Tools/MiniBrowser/gtk/BrowserWindow.h b/Tools/MiniBrowser/gtk/BrowserWindow.h
index c58ebc2beec7e..1fd07efb828b8 100644
--- a/Tools/MiniBrowser/gtk/BrowserWindow.h
+++ b/Tools/MiniBrowser/gtk/BrowserWindow.h
@@ -58,6 +58,7 @@ GtkWidget* browser_window_new(GtkWindow*, WebKitWebContext*);
#endif
WebKitWebContext* browser_window_get_web_context(BrowserWindow*);
void browser_window_append_view(BrowserWindow*, WebKitWebView*);
+void browser_window_fullscreen(BrowserWindow*);
void browser_window_load_uri(BrowserWindow*, const char *uri);
void browser_window_load_session(BrowserWindow *, const char *sessionFile);
void browser_window_set_background_color(BrowserWindow*, GdkRGBA*);
diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c
index 8be643a541511..451e0333dd4e8 100644
--- a/Tools/MiniBrowser/gtk/main.c
+++ b/Tools/MiniBrowser/gtk/main.c
@@ -925,7 +925,7 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings)
if (darkMode)
g_object_set(gtk_widget_get_settings(GTK_WIDGET(mainWindow)), "gtk-application-prefer-dark-theme", TRUE, NULL);
if (fullScreen)
- gtk_window_fullscreen(GTK_WINDOW(mainWindow));
+ browser_window_fullscreen(mainWindow);
if (backgroundColor)
browser_window_set_background_color(mainWindow, backgroundColor);
+5 -4
View File
@@ -14,7 +14,7 @@
<IsA>library</IsA>
<Summary>An opensource web browser engine for GTK+ applications</Summary>
<Description>The GTK+ port of WebKit is intended to provide a browser component primarily for users of the portable GTK+ UI toolkit on platforms like Linux.</Description>
<Archive sha1sum="c4f2d3c8581d1abe2a959e99f2846bea5d5ddf3c" type="tarxz">https://www.webkitgtk.org/releases/webkitgtk-2.36.4.tar.xz</Archive>
<Archive sha1sum="b9a0f964a157277d80195622316d3eea19c89d0d" type="tarxz">https://www.webkitgtk.org/releases/webkitgtk-2.42.1.tar.xz</Archive>
<BuildDependencies>
<Dependency>cmake</Dependency>
<Dependency>which</Dependency>
@@ -58,7 +58,8 @@
<Dependency>gobject-introspection-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">fix-build.patch</Patch>
<Patch level="1">GTK-MiniBrowser-should-hide-the-toolbar-when-using-full-screen.patch</Patch>
<Patch level="1">GTK-Disable-DMABuf-renderer-for-NVIDIA-proprietary-drivers.patch</Patch>
</Patches>
</Source>
@@ -146,8 +147,8 @@
<History>
<Update release="8">
<Date>2023-10-24</Date>
<Version>2.36.4</Version>
<Comment>Rebuild.</Comment>
<Version>2.42.1</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>