From 62f2f0d91173a5bba33ea5be0201aa1247584097 Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Mon, 10 Nov 2025 13:56:41 +0100 Subject: [PATCH] wpewebkit: port custom Digi patches to 2.46.X Out of the three patches we currently apply to v2.44.4, two are no longer needed for v2.46.7: * 0001-Build-fix-when-LAYER_BASED_SVG_ENGINE-is-off.patch is already included in v2.46.X releases * 0001-DMABufVideoSinkGStreamer-disable-sink-unconditionall.patch is no longer needed, since the GL sink is chosen by default in v2.46.7 Only port 0001-UIProcess-WebProcessPool-always-swap-process-when-us.patch to avoid performance issues on platforms with memory restrictions. Keep the v2.44.4 patches in case customers want to use said version, and clearly separate the patchsets for both versions. Signed-off-by: Gabriel Valcazar --- ...x-when-LAYER_BASED_SVG_ENGINE-is-off.patch | 0 ...Streamer-disable-sink-unconditionall.patch | 0 ...cessPool-always-swap-process-when-us.patch | 0 ...cessPool-always-swap-process-when-us.patch | 68 +++++++++++++++++++ .../wpewebkit/wpewebkit_2.44.4.bbappend | 2 +- .../wpewebkit/wpewebkit_2.46.7.bbappend | 6 ++ 6 files changed, 75 insertions(+), 1 deletion(-) rename meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/{wpewebkit => wpewebkit-2.44.4}/0001-Build-fix-when-LAYER_BASED_SVG_ENGINE-is-off.patch (100%) rename meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/{wpewebkit => wpewebkit-2.44.4}/0001-DMABufVideoSinkGStreamer-disable-sink-unconditionall.patch (100%) rename meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/{wpewebkit => wpewebkit-2.44.4}/0002-UIProcess-WebProcessPool-always-swap-process-when-us.patch (100%) create mode 100644 meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.46.7/0001-UIProcess-WebProcessPool-always-swap-process-when-us.patch create mode 100644 meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.46.7.bbappend diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit/0001-Build-fix-when-LAYER_BASED_SVG_ENGINE-is-off.patch b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.44.4/0001-Build-fix-when-LAYER_BASED_SVG_ENGINE-is-off.patch similarity index 100% rename from meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit/0001-Build-fix-when-LAYER_BASED_SVG_ENGINE-is-off.patch rename to meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.44.4/0001-Build-fix-when-LAYER_BASED_SVG_ENGINE-is-off.patch diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit/0001-DMABufVideoSinkGStreamer-disable-sink-unconditionall.patch b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.44.4/0001-DMABufVideoSinkGStreamer-disable-sink-unconditionall.patch similarity index 100% rename from meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit/0001-DMABufVideoSinkGStreamer-disable-sink-unconditionall.patch rename to meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.44.4/0001-DMABufVideoSinkGStreamer-disable-sink-unconditionall.patch diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit/0002-UIProcess-WebProcessPool-always-swap-process-when-us.patch b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.44.4/0002-UIProcess-WebProcessPool-always-swap-process-when-us.patch similarity index 100% rename from meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit/0002-UIProcess-WebProcessPool-always-swap-process-when-us.patch rename to meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.44.4/0002-UIProcess-WebProcessPool-always-swap-process-when-us.patch diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.46.7/0001-UIProcess-WebProcessPool-always-swap-process-when-us.patch b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.46.7/0001-UIProcess-WebProcessPool-always-swap-process-when-us.patch new file mode 100644 index 000000000..7fa2316ad --- /dev/null +++ b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit-2.46.7/0001-UIProcess-WebProcessPool-always-swap-process-when-us.patch @@ -0,0 +1,68 @@ +From: Gabriel Valcazar +Date: Mon, 10 Nov 2025 13:53:41 +0100 +Subject: [PATCH] UIProcess: WebProcessPool: always swap process when using + non-HTTP(S) protocols + +When browsing through a local web application via the file:// protocol, the +same WPEWebProcess is re-used for all pages. Browsing through several memory +intensive pages in a row (especially multimedia) causes the web process to hog +lots of memory, which can cause issues on systems with small RAM sizes. For +example, on ConnectCore platforms with 1 GiB of RAM, opening a WebGL sample +followed by playing a video sometimes causes a kernel panic due to extremely +low CMA memory, which is needed for the video decoding process. + +To avoid this, make sure a new WPEWebProcess is generated each time a page is +opened on non-HTTP(S) protocols such as file://. This adds some loading time +overhead, but it assures that each page's memory is freed when exiting it, +drastically reducing the chances of unexpected behavior. To accomplish this: + + * Set m_processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol to "true" + to ensure the web process isn't re-used when navigating with a + non-HTTP(S) protocol. The WPE version of WebKit doesn't expose the API + that can change this value at runtime, so simply change the default value + * Skip the same-site navigation check when non-HTTP(S) process swap is + enabled and the protocol is non-HTTP(S). Otherwise, the same web process + will get re-used even if non-HTTP(S) process swap is enabled. + +Signed-off-by: Gabriel Valcazar +--- + .../UIProcess/API/APIProcessPoolConfiguration.h | 2 +- + Source/WebKit/UIProcess/WebProcessPool.cpp | 12 +++++++----- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h +index 1ad5ef05e3a2..f4c7c443a8fe 100644 +--- a/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h ++++ b/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h +@@ -183,7 +183,7 @@ private: + std::optional m_processSwapsOnNavigationFromClient; + bool m_processSwapsOnNavigationFromExperimentalFeatures { false }; + bool m_alwaysKeepAndReuseSwappedProcesses { false }; +- bool m_processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol { false }; ++ bool m_processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol { true }; + std::optional m_isAutomaticProcessWarmingEnabledByClient; + bool m_usesWebProcessCache { false }; + bool m_usesBackForwardCache { true }; +diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp +index 5bff0cd202db..a5641d0329b3 100644 +--- a/Source/WebKit/UIProcess/WebProcessPool.cpp ++++ b/Source/WebKit/UIProcess/WebProcessPool.cpp +@@ -2122,11 +2122,13 @@ std::tuple, SuspendedPageProxy*, ASCIILiteral> WebProcessPo + if (!m_configuration->processSwapsOnNavigationWithinSameNonHTTPFamilyProtocol() && !sourceURL.protocolIsInHTTPFamily() && sourceURL.protocol() == targetURL.protocol() && !siteIsolationEnabled) + return { WTFMove(sourceProcess), nullptr, "Navigation within the same non-HTTP(s) protocol"_s }; + +- if (!sourceURL.isValid() +- || !targetURL.isValid() +- || sourceURL.isEmpty() +- || (siteIsolationEnabled ? targetSite.matches(sourceURL) : targetSite.domain().matches(sourceURL))) +- return { WTFMove(sourceProcess), nullptr, "Navigation is same-site"_s }; ++ if (sourceURL.protocolIsInHTTPFamily() && sourceURL.protocol() == targetURL.protocol()) { ++ if (!sourceURL.isValid() ++ || !targetURL.isValid() ++ || sourceURL.isEmpty() ++ || (siteIsolationEnabled ? targetSite.matches(sourceURL) : targetSite.domain().matches(sourceURL))) ++ return { WTFMove(sourceProcess), nullptr, "Navigation is same-site"_s }; ++ } + + if (sourceURL.protocolIsAbout()) { + if (sourceProcess->registrableDomain().matches(targetURL)) diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.44.4.bbappend b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.44.4.bbappend index 02094e80c..47370c738 100644 --- a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.44.4.bbappend +++ b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.44.4.bbappend @@ -1,5 +1,5 @@ # Copyright (C) 2025, Digi International Inc. -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${BP}:" # Backport patch to fix build with "lbse" disabled SRC_URI:append = " \ diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.46.7.bbappend b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.46.7.bbappend new file mode 100644 index 000000000..c3a6401c6 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/wpewebkit/wpewebkit_2.46.7.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2025, Digi International Inc. +FILESEXTRAPATHS:prepend := "${THISDIR}/${BP}:" + +SRC_URI:append = " \ + file://0001-UIProcess-WebProcessPool-always-swap-process-when-us.patch \ +"