summaryrefslogtreecommitdiff
path: root/dev-qt/qtwebengine
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2025-09-07 10:45:23 -0400
committerIonen Wolkens <ionen@gentoo.org>2025-09-07 13:09:46 -0400
commit9a12ab68275cf9776ff1dc9177dce00ededd5031 (patch)
tree6ca1001ed66465baff169bd2790d9deb6cbfeaf9 /dev-qt/qtwebengine
parent976560544f43e0912fd0d5595de5674e3f0de294 (diff)
downloadgentoo-9a12ab68275cf9776ff1dc9177dce00ededd5031.tar.gz
gentoo-9a12ab68275cf9776ff1dc9177dce00ededd5031.tar.bz2
gentoo-9a12ab68275cf9776ff1dc9177dce00ededd5031.zip
dev-qt/qtwebengine: fix QTBUG-139424 patch in live
Forgot that it needs an additional revert that wasn't in 6.9.2, else hits a build failure due to missing headers. Also fix the commit link in the old patch. Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'dev-qt/qtwebengine')
-rw-r--r--dev-qt/qtwebengine/files/qtwebengine-6.9.2-QTBUG-139424.patch2
-rw-r--r--dev-qt/qtwebengine/files/qtwebengine-6.9.3-QTBUG-139424.patch181
-rw-r--r--dev-qt/qtwebengine/qtwebengine-6.10.9999.ebuild2
-rw-r--r--dev-qt/qtwebengine/qtwebengine-6.9.9999.ebuild2
4 files changed, 184 insertions, 3 deletions
diff --git a/dev-qt/qtwebengine/files/qtwebengine-6.9.2-QTBUG-139424.patch b/dev-qt/qtwebengine/files/qtwebengine-6.9.2-QTBUG-139424.patch
index 340bf86ae8b9..d1a577f253b4 100644
--- a/dev-qt/qtwebengine/files/qtwebengine-6.9.2-QTBUG-139424.patch
+++ b/dev-qt/qtwebengine/files/qtwebengine-6.9.2-QTBUG-139424.patch
@@ -1,5 +1,5 @@
Revert of [1] from [2] for [3][4]
-[1] https://github.com/qt/qtwebengine/commit/812bf186b15
+[1] https://github.com/qt/qtwebengine/commit/ddcd30454a
[2] https://bugreports.qt.io/browse/QTBUG-136257
[3] https://bugreports.qt.io/browse/QTBUG-139424
[4] https://bugs.gentoo.org/962055
diff --git a/dev-qt/qtwebengine/files/qtwebengine-6.9.3-QTBUG-139424.patch b/dev-qt/qtwebengine/files/qtwebengine-6.9.3-QTBUG-139424.patch
new file mode 100644
index 000000000000..59f1dcfa68b4
--- /dev/null
+++ b/dev-qt/qtwebengine/files/qtwebengine-6.9.3-QTBUG-139424.patch
@@ -0,0 +1,181 @@
+Revert of [1]+[2] from [3] for [4][5]
+[1] https://github.com/qt/qtwebengine/commit/ddcd30454a
+[2] https://github.com/qt/qtwebengine/commit/9168bc6f53
+[3] https://bugreports.qt.io/browse/QTBUG-136257
+[4] https://bugreports.qt.io/browse/QTBUG-139424
+[5] https://bugs.gentoo.org/962055
+--- a/src/core/ozone/egl_helper.cpp
++++ b/src/core/ozone/egl_helper.cpp
+@@ -7,5 +7,7 @@
+ #include "web_engine_context.h"
+
++#include <QtCore/qthread.h>
+ #include <QtGui/qguiapplication.h>
++#include <QtGui/qoffscreensurface.h>
+ #include <QtGui/qopenglcontext.h>
+ #include <QtGui/qopenglfunctions.h>
+@@ -58,4 +60,82 @@
+ QT_BEGIN_NAMESPACE
+
++class ScopedGLContext
++{
++public:
++ ScopedGLContext(QOffscreenSurface *surface, EGLHelper::EGLFunctions *eglFun)
++ : m_context(new QOpenGLContext()), m_eglFun(eglFun)
++ {
++ if ((m_previousEGLContext = m_eglFun->eglGetCurrentContext())) {
++ m_previousEGLDrawSurface = m_eglFun->eglGetCurrentSurface(EGL_DRAW);
++ m_previousEGLReadSurface = m_eglFun->eglGetCurrentSurface(EGL_READ);
++ m_previousEGLDisplay = m_eglFun->eglGetCurrentDisplay();
++ }
++
++ if (!m_context->create()) {
++ qWarning("Failed to create OpenGL context.");
++ return;
++ }
++
++ Q_ASSERT(surface->isValid());
++ if (!m_context->makeCurrent(surface)) {
++ qWarning("Failed to make OpenGL context current.");
++ return;
++ }
++ }
++
++ ~ScopedGLContext()
++ {
++ if (!m_textures.empty()) {
++ auto *glFun = m_context->functions();
++ glFun->glDeleteTextures(m_textures.size(), m_textures.data());
++ }
++
++ if (m_previousEGLContext) {
++ // Make sure the scoped context is not current when restoring the previous
++ // EGL context otherwise the QOpenGLContext destructor resets the restored
++ // current context.
++ m_context->doneCurrent();
++
++ m_eglFun->eglMakeCurrent(m_previousEGLDisplay, m_previousEGLDrawSurface,
++ m_previousEGLReadSurface, m_previousEGLContext);
++ if (m_eglFun->eglGetError() != EGL_SUCCESS)
++ qWarning("Failed to restore EGL context.");
++ }
++ }
++
++ bool isValid() const { return m_context->isValid() && (m_context->surface() != nullptr); }
++
++ EGLContext eglContext() const
++ {
++ QNativeInterface::QEGLContext *nativeInterface =
++ m_context->nativeInterface<QNativeInterface::QEGLContext>();
++ return nativeInterface->nativeContext();
++ }
++
++ uint createTexture(int width, int height)
++ {
++ auto *glFun = m_context->functions();
++
++ uint glTexture;
++ glFun->glGenTextures(1, &glTexture);
++ glFun->glBindTexture(GL_TEXTURE_2D, glTexture);
++ glFun->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
++ NULL);
++ glFun->glBindTexture(GL_TEXTURE_2D, 0);
++
++ m_textures.push_back(glTexture);
++ return glTexture;
++ }
++
++private:
++ QScopedPointer<QOpenGLContext> m_context;
++ EGLHelper::EGLFunctions *m_eglFun;
++ EGLContext m_previousEGLContext = nullptr;
++ EGLSurface m_previousEGLDrawSurface = nullptr;
++ EGLSurface m_previousEGLReadSurface = nullptr;
++ EGLDisplay m_previousEGLDisplay = nullptr;
++ std::vector<uint> m_textures;
++};
++
+ EGLHelper::EGLFunctions::EGLFunctions()
+ {
+@@ -64,6 +144,4 @@
+ eglCreateImage =
+ reinterpret_cast<PFNEGLCREATEIMAGEPROC>(context->getProcAddress("eglCreateImage"));
+- eglCreateDRMImageMESA = reinterpret_cast<PFNEGLCREATEDRMIMAGEMESAPROC>(
+- context->getProcAddress("eglCreateDRMImageMESA"));
+ eglDestroyImage =
+ reinterpret_cast<PFNEGLDESTROYIMAGEPROC>(context->getProcAddress("eglDestroyImage"));
+@@ -94,4 +172,5 @@
+ : m_eglDisplay(qApp->platformNativeInterface()->nativeResourceForIntegration("egldisplay"))
+ , m_functions(new EGLHelper::EGLFunctions())
++ , m_offscreenSurface(new QOffscreenSurface())
+ {
+ const char *extensions = m_functions->eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+@@ -111,4 +190,7 @@
+ }
+
++ Q_ASSERT(QThread::currentThread() == qApp->thread());
++ m_offscreenSurface->create();
++
+ m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported();
+
+@@ -118,5 +200,4 @@
+ m_isDmaBufSupported = strstr(displayExtensions, "EGL_EXT_image_dma_buf_import")
+ && strstr(displayExtensions, "EGL_EXT_image_dma_buf_import_modifiers")
+- && strstr(displayExtensions, "EGL_MESA_drm_image")
+ && strstr(displayExtensions, "EGL_MESA_image_dma_buf_export");
+ }
+@@ -139,15 +220,17 @@
+ return;
+
+- // clang-format off
+- EGLint attribs[] = {
+- EGL_WIDTH, width,
+- EGL_HEIGHT, height,
+- EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
+- EGL_DRM_BUFFER_USE_MESA, EGL_DRM_BUFFER_USE_SHARE_MESA,
+- EGL_NONE
+- };
+- // clang-format on
++ ScopedGLContext context(m_offscreenSurface.get(), m_functions.get());
++ if (!context.isValid())
++ return;
++
++ EGLContext eglContext = context.eglContext();
++ if (!eglContext) {
++ qWarning("EGL: No EGLContext.");
++ return;
++ }
+
+- EGLImage eglImage = m_functions->eglCreateDRMImageMESA(m_eglDisplay, attribs);
++ uint64_t textureId = context.createTexture(width, height);
++ EGLImage eglImage = m_functions->eglCreateImage(m_eglDisplay, eglContext, EGL_GL_TEXTURE_2D,
++ (EGLClientBuffer)textureId, NULL);
+ if (eglImage == EGL_NO_IMAGE) {
+ qWarning("EGL: Failed to create EGLImage: %s", getLastEGLErrorString());
+--- a/src/core/ozone/egl_helper.h
++++ b/src/core/ozone/egl_helper.h
+@@ -13,5 +13,4 @@
+
+ #undef eglCreateImage
+-#undef eglCreateDRMImageMESA
+ #undef eglDestroyImage
+ #undef eglExportDMABUFImageMESA
+@@ -26,4 +25,6 @@
+ QT_BEGIN_NAMESPACE
+
++class QOffscreenSurface;
++
+ class EGLHelper
+ {
+@@ -34,5 +35,4 @@
+
+ PFNEGLCREATEIMAGEPROC eglCreateImage;
+- PFNEGLCREATEDRMIMAGEMESAPROC eglCreateDRMImageMESA;
+ PFNEGLDESTROYIMAGEPROC eglDestroyImage;
+ PFNEGLEXPORTDMABUFIMAGEMESAPROC eglExportDMABUFImageMESA;
+@@ -60,4 +60,5 @@
+ EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
+ QScopedPointer<EGLFunctions> m_functions;
++ QScopedPointer<QOffscreenSurface> m_offscreenSurface;
+ bool m_isDmaBufSupported = false;
+ };
diff --git a/dev-qt/qtwebengine/qtwebengine-6.10.9999.ebuild b/dev-qt/qtwebengine/qtwebengine-6.10.9999.ebuild
index f0ce2d085399..f47779e87c29 100644
--- a/dev-qt/qtwebengine/qtwebengine-6.10.9999.ebuild
+++ b/dev-qt/qtwebengine/qtwebengine-6.10.9999.ebuild
@@ -109,7 +109,7 @@ PATCHES=( "${WORKDIR}"/patches/${PN} )
PATCHES+=(
# add extras as needed here, may merge in set if carries across versions
"${FILESDIR}"/${PN}-6.9.2-clang-21.patch
- "${FILESDIR}"/${PN}-6.9.2-QTBUG-139424.patch
+ "${FILESDIR}"/${PN}-6.9.3-QTBUG-139424.patch
)
python_check_deps() {
diff --git a/dev-qt/qtwebengine/qtwebengine-6.9.9999.ebuild b/dev-qt/qtwebengine/qtwebengine-6.9.9999.ebuild
index 7c05e1c18c87..495a147c727f 100644
--- a/dev-qt/qtwebengine/qtwebengine-6.9.9999.ebuild
+++ b/dev-qt/qtwebengine/qtwebengine-6.9.9999.ebuild
@@ -109,7 +109,7 @@ PATCHES=( "${WORKDIR}"/patches/${PN} )
PATCHES+=(
# add extras as needed here, may merge in set if carries across versions
"${FILESDIR}"/${PN}-6.9.2-clang-21.patch
- "${FILESDIR}"/${PN}-6.9.2-QTBUG-139424.patch
+ "${FILESDIR}"/${PN}-6.9.3-QTBUG-139424.patch
)
python_check_deps() {