public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/qt6-qtwebengine] epel9: Fix broken GPU rendering
@ 2026-10-08 20:25 Sandro Mani
  0 siblings, 0 replies; only message in thread
From: Sandro Mani @ 2026-10-08 20:25 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/qt6-qtwebengine
Branch : epel9
Commit : 46ec64d60cfa0269c50c205b30e2a134d0dd7795
Author : Sandro Mani <manisandro@gmail.com>
Date   : 2025-09-09T07:58:35+02:00
Stats  : +162/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/qt6-qtwebengine/c/46ec64d60cfa0269c50c205b30e2a134d0dd7795?branch=epel9

Log:
Fix broken GPU rendering

---
diff --git a/qt6-qtwebengine.spec b/qt6-qtwebengine.spec
index 81ff8c1..342f0cd 100644
--- a/qt6-qtwebengine.spec
+++ b/qt6-qtwebengine.spec
@@ -86,7 +86,7 @@
 Summary: Qt6 - QtWebEngine components
 Name:    qt6-qtwebengine
 Version: 6.9.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details
 # See also http://qt-project.org/doc/qt-5.0/qtdoc/licensing.html
@@ -127,6 +127,10 @@ Patch4:   qtwebengine-use-openh264.patch
 # FTBS warning: elaborated-type-specifier for a scoped enum must not
 # use the 'class' keyword
 Patch50:  qtwebengine-fix-build.patch
+# https://bugreports.qt.io/browse/QTBUG-139424
+# Revert commit bcee2dbf412cc655c1b467091b581c696d234e3f
+# See also https://gitlab.archlinux.org/archlinux/packaging/packages/qt6-webengine/-/commit/74473e03e9d77895d22659914aa4ae91324a1f0a
+Patch51:  qtwebengine-revert-create-eglimage.patch
 
 ## Upstream patches:
 # https://bugreports.qt.io/browse/QTBUG-129985
@@ -480,6 +484,7 @@ popd
 %patch -P4 -p1 -b .use-openh264
 
 %patch -P50 -p1 -b .fix-build.patch
+%patch -P51 -p1 -b .eglimage
 
 ## upstream patches
 %patch -P80 -p1 -b .fix-arm-build
@@ -842,6 +847,9 @@ done
 %endif
 
 %changelog
+* Mon Sep 08 2025 Sandro Mani <manisandro@gmail.com> - 6.9.2-2
+- Revert commit bcee2dbf412cc655c1b467091b581c696d234e3f
+
 * Fri Aug 29 2025 Jan Grulich <jgrulich@redhat.com> - 6.9.2-1
 - 6.9.2
 

diff --git a/qtwebengine-revert-create-eglimage.patch b/qtwebengine-revert-create-eglimage.patch
new file mode 100644
index 0000000..2d4d6f9
--- /dev/null
+++ b/qtwebengine-revert-create-eglimage.patch
@@ -0,0 +1,153 @@
+diff -rupN qtwebengine-everywhere-src-6.9.2/src/core/ozone/egl_helper.cpp qtwebengine-everywhere-src-6.9.2-new/src/core/ozone/egl_helper.cpp
+--- qtwebengine-everywhere-src-6.9.2/src/core/ozone/egl_helper.cpp	2025-08-18 02:53:11.000000000 +0200
++++ qtwebengine-everywhere-src-6.9.2-new/src/core/ozone/egl_helper.cpp	2025-09-08 22:20:02.398760647 +0200
+@@ -58,14 +58,90 @@ static const char *getEGLErrorString(uin
+ 
+ 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()
+ {
+     QOpenGLContext *context = OzoneUtilQt::getQOpenGLContext();
+ 
+     eglCreateImage =
+             reinterpret_cast<PFNEGLCREATEIMAGEPROC>(context->getProcAddress("eglCreateImage"));
+-    eglCreateDRMImageMESA = reinterpret_cast<PFNEGLCREATEDRMIMAGEMESAPROC>(
+-            context->getProcAddress("eglCreateDRMImageMESA"));
+     eglDestroyImage =
+             reinterpret_cast<PFNEGLDESTROYIMAGEPROC>(context->getProcAddress("eglDestroyImage"));
+     eglExportDMABUFImageMESA = reinterpret_cast<PFNEGLEXPORTDMABUFIMAGEMESAPROC>(
+@@ -122,7 +198,6 @@ EGLHelper::EGLHelper()
+         const char *displayExtensions = m_functions->eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
+         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");
+     }
+ 
+@@ -143,17 +218,19 @@ void EGLHelper::queryDmaBuf(const int wi
+     if (!m_isDmaBufSupported)
+         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());
+         return;
+diff -rupN qtwebengine-everywhere-src-6.9.2/src/core/ozone/egl_helper.h qtwebengine-everywhere-src-6.9.2-new/src/core/ozone/egl_helper.h
+--- qtwebengine-everywhere-src-6.9.2/src/core/ozone/egl_helper.h	2025-08-18 02:53:11.000000000 +0200
++++ qtwebengine-everywhere-src-6.9.2-new/src/core/ozone/egl_helper.h	2025-09-08 22:20:02.399018856 +0200
+@@ -11,7 +11,6 @@
+ #include <EGL/eglext.h>
+ 
+ #undef eglCreateImage
+-#undef eglCreateDRMImageMESA
+ #undef eglDestroyImage
+ #undef eglExportDMABUFImageMESA
+ #undef eglExportDMABUFImageQueryMESA
+@@ -34,7 +33,6 @@ public:
+         EGLFunctions();
+ 
+         PFNEGLCREATEIMAGEPROC eglCreateImage;
+-        PFNEGLCREATEDRMIMAGEMESAPROC eglCreateDRMImageMESA;
+         PFNEGLDESTROYIMAGEPROC eglDestroyImage;
+         PFNEGLEXPORTDMABUFIMAGEMESAPROC eglExportDMABUFImageMESA;
+         PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC eglExportDMABUFImageQueryMESA;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-08 20:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 20:25 [rpms/qt6-qtwebengine] epel9: Fix broken GPU rendering Sandro Mani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox