Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package qt6-webengine for openSUSE:Factory 
checked in at 2025-05-07 19:15:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qt6-webengine (Old)
 and      /work/SRC/openSUSE:Factory/.qt6-webengine.new.30101 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qt6-webengine"

Wed May  7 19:15:06 2025 rev:43 rq:1274939 version:6.9.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/qt6-webengine/qt6-webengine.changes      
2025-04-07 17:35:53.186989786 +0200
+++ /work/SRC/openSUSE:Factory/.qt6-webengine.new.30101/qt6-webengine.changes   
2025-05-07 19:15:44.597397043 +0200
@@ -1,0 +2,18 @@
+Tue May  6 09:02:19 UTC 2025 - Christophe Marin <christo...@krop.fr>
+
+- Add upstream fixes:
+  * 0001-Do-not-force-gl-egl-ANGLE-backend-on-Linux.patch (QTBUG-135786)
+  * 0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch (QTBUG-135935)
+  * 0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch 
(QTBUG-135647)
+  * 0001-angle-Always-use-primary-GPU.patch
+  * 0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch 
(QTBUG-135047)
+  * 0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch 
(QTBUG-123607)
+  * 0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch 
(QTBUG-129769)
+  * 0001-Avoid-crash-due-to-long-dictionary-commands.patch
+
+-------------------------------------------------------------------
+Fri Apr  4 07:57:10 UTC 2025 - Christophe Marin <christo...@krop.fr>
+
+- openjpeg2 is too old for Leap 15 builds, use the embedded one
+
+-------------------------------------------------------------------

New:
----
  0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch
  0001-Avoid-crash-due-to-long-dictionary-commands.patch
  0001-Do-not-force-gl-egl-ANGLE-backend-on-Linux.patch
  0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch
  0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch
  0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch
  0001-angle-Always-use-primary-GPU.patch
  0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch

BETA DEBUG BEGIN:
  New:  * 0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch 
(QTBUG-123607)
  * 0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch 
(QTBUG-129769)
  * 0001-Avoid-crash-due-to-long-dictionary-commands.patch
  New:  * 0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch 
(QTBUG-129769)
  * 0001-Avoid-crash-due-to-long-dictionary-commands.patch
  New:- Add upstream fixes:
  * 0001-Do-not-force-gl-egl-ANGLE-backend-on-Linux.patch (QTBUG-135786)
  * 0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch (QTBUG-135935)
  New:  * 0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch (QTBUG-135935)
  * 0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch 
(QTBUG-135647)
  * 0001-angle-Always-use-primary-GPU.patch
  New:  * 0001-angle-Always-use-primary-GPU.patch
  * 0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch 
(QTBUG-135047)
  * 0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch 
(QTBUG-123607)
  New:  * 0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch 
(QTBUG-135047)
  * 0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch 
(QTBUG-123607)
  * 0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch 
(QTBUG-129769)
  New:  * 0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch 
(QTBUG-135647)
  * 0001-angle-Always-use-primary-GPU.patch
  * 0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch 
(QTBUG-135047)
  New:  * 0001-Do-not-force-gl-egl-ANGLE-backend-on-Linux.patch (QTBUG-135786)
  * 0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch (QTBUG-135935)
  * 0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch 
(QTBUG-135647)
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qt6-webengine.spec ++++++
--- /var/tmp/diff_new_pack.oimBoQ/_old  2025-05-07 19:15:47.953537231 +0200
+++ /var/tmp/diff_new_pack.oimBoQ/_new  2025-05-07 19:15:47.953537231 +0200
@@ -40,6 +40,8 @@
 %bcond_without system_tiff
 # Leap 15's ffmpeg is too old since 6.8.0
 %bcond_without system_ffmpeg
+# openjpeg2 is too old and doesn't know opj_decoder_set_strict_mode
+%bcond_without system_openjpeg2
 # and python 3.6 is also too old for this QtWE version
 %define pyver python3
 %else
@@ -62,6 +64,14 @@
 Source99:       qt6-webengine-rpmlintrc
 # Patches 0-100 are upstream patches #
 Patch0:         qtwebengine-glibc_2.41.patch
+Patch1:         0001-Do-not-force-gl-egl-ANGLE-backend-on-Linux.patch
+Patch2:         0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch
+Patch3:         0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch
+Patch4:         0001-angle-Always-use-primary-GPU.patch
+Patch5:         0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch
+Patch6:         0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch
+Patch7:         0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch
+Patch8:         0001-Avoid-crash-due-to-long-dictionary-commands.patch
 # Patches 100-200 are openSUSE and/or non-upstream(able) patches #
 Patch100:       rtc-dont-use-h264.patch
 Patch101:       QtWebEngine_6.8_skip_xnnpack.patch
@@ -140,7 +150,9 @@
 BuildRequires:  pkgconfig(libcrypto)
 BuildRequires:  pkgconfig(libdrm)
 BuildRequires:  pkgconfig(libevent)
+%if %{with system_openjpeg2}
 BuildRequires:  pkgconfig(libopenjp2)
+%endif
 BuildRequires:  pkgconfig(libpci)
 BuildRequires:  pkgconfig(libpulse) >= 0.9.10
 %if %{with system_tiff}
@@ -405,6 +417,9 @@
 %else
   -DFEATURE_webengine_system_icu:BOOL=FALSE \
 %endif
+%if %{without system_openjpeg2}
+  -DFEATURE_webengine_system_libopenjpeg2:BOOL=FALSE \
+%endif
   -DFEATURE_webengine_system_libevent:BOOL=TRUE \
   -DFEATURE_webengine_webrtc:BOOL=TRUE \
   -DFEATURE_webengine_webrtc_pipewire:BOOL=TRUE \

++++++ 0001-Add-default-and-gl-ANGLE-implementation-support-to-O.patch ++++++
>From a56ea1e9cf1004d475932dc954c9cc494fbf32b1 Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Thu, 6 Mar 2025 09:56:13 +0100
Subject: [PATCH] Add "default" and "gl" ANGLE implementation support to Ozone

The EGL_EXT_image_dma_buf_import display extension is not available for
non EGL display thus importing NativePixmap with EGL is not possible.
Make possible to import NativePixmap as X11 pixmap.

This makes
--webEngineArgs --use-gl=angle
--webEngineArgs --use-gl=angle --use-angle=default
--webEngineArgs --use-gl=angle --use-angle=gl
configurations work on Linux.

Pick-to: 6.8
Task-number: QTBUG-129769
Task-number: QTBUG-133570
Change-Id: Ic6a40de373c5fd27c62abc3effb2f3ddee9210a8
Reviewed-by: Moss Heim <moss.h...@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jen...@qt.io>
(cherry picked from commit 75b0d12f6a7f506d8d06a96ab4aa77d89358becd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_...@qt-project.org>
---
 src/core/configure/BUILD.root.gn.in  |  3 ++
 src/core/ozone/gl_ozone_angle_qt.cpp | 62 ++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/src/core/configure/BUILD.root.gn.in 
b/src/core/configure/BUILD.root.gn.in
index a63d9d8db..214ef6e71 100644
--- a/src/core/configure/BUILD.root.gn.in
+++ b/src/core/configure/BUILD.root.gn.in
@@ -405,11 +405,14 @@ source_set("qtwebengine_sources") {
       deps += [
         "//ui/base/x:gl",
         "//ui/gfx/linux:gpu_memory_buffer_support_x11",
+        "//ui/gfx/x",
       ]
 
       sources += [
         "//ui/ozone/platform/x11/gl_egl_utility_x11.cc",
         "//ui/ozone/platform/x11/gl_egl_utility_x11.h",
+        "//ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc",
+        "//ui/ozone/platform/x11/native_pixmap_egl_x11_binding.h",
       ]
     }
   }
diff --git a/src/core/ozone/gl_ozone_angle_qt.cpp 
b/src/core/ozone/gl_ozone_angle_qt.cpp
index b23f3c60f..359d04a45 100644
--- a/src/core/ozone/gl_ozone_angle_qt.cpp
+++ b/src/core/ozone/gl_ozone_angle_qt.cpp
@@ -1,6 +1,10 @@
-// Copyright (C) 2024 The Qt Company Ltd.
+// Copyright (C) 2025 The Qt Company Ltd.
 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
 
+// Copyright 2016 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
 #include "gl_ozone_angle_qt.h"
 
 #include "ui/base/ozone_buildflags.h"
@@ -12,6 +16,8 @@
 
 #if BUILDFLAG(IS_OZONE_X11)
 #include "ozone_util_qt.h"
+
+#include "ui/ozone/platform/x11/native_pixmap_egl_x11_binding.h"
 #endif
 
 extern "C" {
@@ -20,6 +26,34 @@ extern __eglMustCastToProperFunctionPointerType 
EGL_GetProcAddress(const char *p
 }
 
 namespace ui {
+namespace {
+// Based on //ui/ozone/platform/x11/x11_surface_factory.cc
+enum class NativePixmapSupportType {
+    // Importing native pixmaps not supported.
+    kNone,
+
+    // Native pixmaps are imported directly into EGL using the
+    // EGL_EXT_image_dma_buf_import extension.
+    kDMABuf,
+
+    // Native pixmaps are first imported as X11 pixmaps using DRI3 and then 
into
+    // EGL.
+    kX11Pixmap,
+};
+
+NativePixmapSupportType GetNativePixmapSupportType()
+{
+    if 
(gl::GLSurfaceEGL::GetGLDisplayEGL()->ext->b_EGL_EXT_image_dma_buf_import)
+        return NativePixmapSupportType::kDMABuf;
+
+#if BUILDFLAG(IS_OZONE_X11)
+    if (NativePixmapEGLX11Binding::CanImportNativeGLXPixmap())
+        return NativePixmapSupportType::kX11Pixmap;
+#endif
+
+    return NativePixmapSupportType::kNone;
+}
+} // namespace
 
 bool GLOzoneANGLEQt::LoadGLES2Bindings(const gl::GLImplementationParts & 
/*implementation*/)
 {
@@ -73,7 +107,16 @@ gl::EGLDisplayPlatform GLOzoneANGLEQt::GetNativeDisplay()
 
 bool GLOzoneANGLEQt::CanImportNativePixmap(gfx::BufferFormat format)
 {
-    return 
gl::GLSurfaceEGL::GetGLDisplayEGL()->ext->b_EGL_EXT_image_dma_buf_import;
+    switch (GetNativePixmapSupportType()) {
+    case NativePixmapSupportType::kDMABuf:
+        return NativePixmapEGLBinding::IsBufferFormatSupported(format);
+#if BUILDFLAG(IS_OZONE_X11)
+    case NativePixmapSupportType::kX11Pixmap:
+        return NativePixmapEGLX11Binding::IsBufferFormatSupported(format);
+#endif
+    default:
+        return false;
+    }
 }
 
 std::unique_ptr<NativePixmapGLBinding>
@@ -82,8 +125,19 @@ 
GLOzoneANGLEQt::ImportNativePixmap(scoped_refptr<gfx::NativePixmap> pixmap,
                                    gfx::Size plane_size, const gfx::ColorSpace 
&color_space,
                                    GLenum target, GLuint texture_id)
 {
-    return NativePixmapEGLBinding::Create(pixmap, plane_format, plane, 
plane_size, color_space,
-                                          target, texture_id);
+    switch (GetNativePixmapSupportType()) {
+    case NativePixmapSupportType::kDMABuf:
+        return NativePixmapEGLBinding::Create(pixmap, plane_format, plane, 
plane_size, color_space,
+                                              target, texture_id);
+#if BUILDFLAG(IS_OZONE_X11)
+    case NativePixmapSupportType::kX11Pixmap:
+        return NativePixmapEGLX11Binding::Create(pixmap, plane_format, 
plane_size, target,
+                                                 texture_id);
+#endif
+    default:
+        NOTREACHED();
+        return nullptr;
+    }
 }
 
 } // namespace ui
-- 
2.49.0


++++++ 0001-Avoid-crash-due-to-long-dictionary-commands.patch ++++++
>From 92541f48f0a1ef1a737b8f4b1b1f41bf95ad27d4 Mon Sep 17 00:00:00 2001
From: Anu Aliyas <anu.ali...@qt.io>
Date: Mon, 17 Mar 2025 13:46:45 +0100
Subject: [PATCH] Avoid crash due to long dictionary commands

The crash occurs when processing a truncated command. By default, the
buffer size is 64K (65535 bytes). When the command is longer than 65535
characters, the converter will read the command partially, which leads
to a crash. To avoid the crash, logic has been added to read content up
to the line termination.

Task-number: QTBUG-134481
Pick-to:122-based
Change-Id: Ic91cd88d74502668726a3a159b6db13cbfdfa6c0
Reviewed-on: 
https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/632227
Reviewed-by: Michal Klocek <michal.klo...@qt.io>
(cherry picked from commit 01dcb46ce26c95bd43b1662fce0be82d3f0468e6)
Reviewed-on: 
https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/639612
Reviewed-by: Anu Aliyas <anu.ali...@qt.io>
---
 .../tools/convert_dict/hunspell_reader.cc     | 21 ++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/3rdparty/chromium/chrome/tools/convert_dict/hunspell_reader.cc 
b/src/3rdparty/chromium/chrome/tools/convert_dict/hunspell_reader.cc
index 636a8fbf1e6..435665b9116 100644
--- a/src/3rdparty/chromium/chrome/tools/convert_dict/hunspell_reader.cc
+++ b/src/3rdparty/chromium/chrome/tools/convert_dict/hunspell_reader.cc
@@ -29,13 +29,24 @@ void TrimLine(std::string* line) {
 }
 
 std::string ReadLine(FILE* file) {
-  const char* line = fgets(line_buffer, kLineBufferLen - 1, file);
-  if (!line)
+  std::string result;
+  while (fgets(line_buffer, kLineBufferLen, file)) {
+    result.append(line_buffer);
+
+    size_t length = strlen(line_buffer);
+    // This should be true even with CRLF endings.
+    // Checking whether line is truncated.
+    if (length > 0 && line_buffer[length - 1] != '\n')
+      continue;
+
+    break;
+  }
+
+  if (result.empty())
     return std::string();
 
-  std::string str = line;
-  TrimLine(&str);
-  return str;
+  TrimLine(&result);
+  return result;
 }
 
 void StripComment(std::string* line) {
-- 
2.49.0


++++++ 0001-Do-not-force-gl-egl-ANGLE-backend-on-Linux.patch ++++++
>From 2b5df7c931cd4ce2c146c43d9018745de34681eb Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Mon, 5 May 2025 16:22:30 +0200
Subject: [PATCH] Do not force gl-egl ANGLE backend on Linux

Let Chromium decide which ANGLE backend to use by keeping "default"
setting. The "gl" backend is available since
75b0d12f6 Add "default" and "gl" ANGLE implementation support to Ozone

Reportedly, the "gl-egl" backend doesn't work properly with certain GPU
drivers under X11.

Task-number: QTBUG-135786
Pick-to: 6.8 6.9
Change-Id: I1592e3c480059b0cd17831ba375ff709f00791cc
---
 src/core/web_engine_context.cpp | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 2410492..14d3f08 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -879,18 +879,11 @@ WebEngineContext::WebEngineContext()
                       == gl::kGLImplementationANGLEName);
     }
 
-    if (usingANGLE && !parsedCommandLine->HasSwitch(switches::kUseANGLE)) {
-        parsedCommandLine->AppendSwitchASCII(switches::kUseANGLE,
-                                             
gl::kANGLEImplementationOpenGLEGLName);
-    }
-
 #if QT_CONFIG(webengine_vulkan)
     if (QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL && 
usingSupportedSGBackend()) {
         if (usingANGLE && !isGbmSupported()) {
             qWarning("GBM is not supported with the current configuration. "
                      "Fallback to Vulkan rendering in Chromium.");
-            parsedCommandLine->AppendSwitchASCII(switches::kUseANGLE,
-                                                 
gl::kANGLEImplementationDefaultName);
             parsedCommandLine->AppendSwitchASCII(switches::kUseVulkan,
                                                  
switches::kVulkanImplementationNameNative);
             enableFeatures.push_back(features::kVulkan.name);
-- 
2.49.0


++++++ 0001-Do-not-list-GLX-frame-buffer-configurations-unnecess.patch ++++++
>From 58eb9571eb7f1a806e25310508d78dca798331e5 Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Mon, 7 Apr 2025 10:44:22 +0200
Subject: [PATCH] Do not list GLX frame buffer configurations unnecessarily

List it on demand instead of in constructor. It is not used if
dma-buf/GBM/NativePixmap is disabled.

This fixes fatal error when glXChooseFBConfig() fails to return
configuration in XWayland with Nvidia driver.

Fixes: QTBUG-135647
Change-Id: Iab10f6f0cdff54732a2dee8d201f1e3b14146b0e
Reviewed-by: Allan Sandfeld Jensen <allan.jen...@qt.io>
Reviewed-by: Moss Heim <moss.h...@qt.io>
(cherry picked from commit 23cb28fa0c21c3205b398eb177dffada62de6cc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_...@qt-project.org>
---
 src/core/ozone/glx_helper.cpp | 19 ++++++++++++++++---
 src/core/ozone/glx_helper.h   |  2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/core/ozone/glx_helper.cpp b/src/core/ozone/glx_helper.cpp
index 02319e9..4207b7f 100644
--- a/src/core/ozone/glx_helper.cpp
+++ b/src/core/ozone/glx_helper.cpp
@@ -43,8 +43,17 @@ GLXHelper::GLXHelper() : m_functions(new 
GLXHelper::GLXFunctions())
     m_display = x11Application->display();
     m_connection = x11Application->connection();
 
+    m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported()
+            && ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device();
+}
+
+GLXFBConfig GLXHelper::getFBConfig()
+{
+    if (m_configs)
+        return m_configs[0];
+
     // clang-format off
-    const int configAttribs[] = {
+    static const int configAttribs[] = {
         GLX_RED_SIZE, 8,
         GLX_GREEN_SIZE, 8,
         GLX_BLUE_SIZE, 8,
@@ -59,13 +68,17 @@ GLXHelper::GLXHelper() : m_functions(new 
GLXHelper::GLXFunctions())
     };
     // clang-format on
 
+    if (Q_UNLIKELY(!m_isDmaBufSupported)) {
+        qWarning("GLX: Frame buffer configuration is not expected to be used 
without dma-buf "
+                 "support.");
+    }
+
     int numConfigs = 0;
     m_configs = glXChooseFBConfig(m_display, /* screen */ 0, configAttribs, 
&numConfigs);
     if (!m_configs || numConfigs < 1)
         qFatal("GLX: Failed to find frame buffer configuration.");
 
-    m_isDmaBufSupported = QtWebEngineCore::WebEngineContext::isGbmSupported()
-            && ui::GpuMemoryBufferSupportX11::GetInstance()->has_gbm_device();
+    return m_configs[0];
 }
 
 GLXPixmap GLXHelper::importBufferAsPixmap(int dmaBufFd, uint32_t size, 
uint16_t width,
diff --git a/src/core/ozone/glx_helper.h b/src/core/ozone/glx_helper.h
index c142072..963c4a6 100644
--- a/src/core/ozone/glx_helper.h
+++ b/src/core/ozone/glx_helper.h
@@ -30,7 +30,7 @@ public:
     Display *getXDisplay() const { return m_display; }
     GLXFunctions *functions() const { return m_functions.get(); }
 
-    GLXFBConfig getFBConfig() const { return m_configs[0]; }
+    GLXFBConfig getFBConfig();
     GLXPixmap importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t 
width, uint16_t height,
                                    uint16_t stride) const;
     bool isDmaBufSupported() const { return m_isDmaBufSupported; }
-- 
2.49.0


++++++ 0001-NativeSkiaOutputDeviceOpenGL-Fix-leaking-X11-Pixmap.patch ++++++
>From a01da2eca0d2de5e5a1f6938da3b0c761ee360a1 Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Mon, 24 Mar 2025 10:53:12 +0100
Subject: [PATCH] NativeSkiaOutputDeviceOpenGL: Fix leaking X11 Pixmap

Pick-to: 6.8
Fixes: QTBUG-135047
Change-Id: I42b6387407551079241350661adadedf7d71a303
Reviewed-by: Allan Sandfeld Jensen <allan.jen...@qt.io>
(cherry picked from commit dbf459268d4bbc20e0a7e83e7889e0f6da79cf84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_...@qt-project.org>
---
 .../compositor/native_skia_output_device_opengl.cpp    |  5 +++--
 src/core/ozone/glx_helper.cpp                          | 10 ++++++++++
 src/core/ozone/glx_helper.h                            |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/core/compositor/native_skia_output_device_opengl.cpp 
b/src/core/compositor/native_skia_output_device_opengl.cpp
index e48adba..5aa8c6e 100644
--- a/src/core/compositor/native_skia_output_device_opengl.cpp
+++ b/src/core/compositor/native_skia_output_device_opengl.cpp
@@ -213,11 +213,12 @@ QSGTexture 
*NativeSkiaOutputDeviceOpenGL::texture(QQuickWindow *win, uint32_t te
             glxFun->glXBindTexImageEXT(display, glxPixmap, GLX_FRONT_LEFT_EXT, 
nullptr);
             glFun->glBindTexture(GL_TEXTURE_2D, 0);
 
-            m_frontBuffer->textureCleanupCallback = [glFun, glxFun, display, 
glxPixmap,
-                                                     glTexture]() {
+            m_frontBuffer->textureCleanupCallback = [glFun, glxFun, display, 
glxPixmap, glTexture,
+                                                     glxHelper, pixmapId]() {
                 glxFun->glXReleaseTexImageEXT(display, glxPixmap, 
GLX_FRONT_LEFT_EXT);
                 glFun->glDeleteTextures(1, &glTexture);
                 glXDestroyGLXPixmap(display, glxPixmap);
+                glxHelper->freePixmap(pixmapId);
             };
         }
 #endif // BUILDFLAG(IS_OZONE_X11) && QT_CONFIG(xcb_glx_plugin)
diff --git a/src/core/ozone/glx_helper.cpp b/src/core/ozone/glx_helper.cpp
index 4207b7f..e292276 100644
--- a/src/core/ozone/glx_helper.cpp
+++ b/src/core/ozone/glx_helper.cpp
@@ -113,4 +113,14 @@ GLXPixmap GLXHelper::importBufferAsPixmap(int dmaBufFd, 
uint32_t size, uint16_t
     return pixmapId;
 }
 
+void GLXHelper::freePixmap(uint32_t pixmapId) const
+{
+    xcb_void_cookie_t cookie = xcb_free_pixmap_checked(m_connection, pixmapId);
+    xcb_generic_error_t *error = xcb_request_check(m_connection, cookie);
+    if (error) {
+        qWarning("GLX: XCB_FREE_PIXMAP failed with error code: 0x%x", 
error->error_code);
+        free(error);
+    }
+}
+
 QT_END_NAMESPACE
diff --git a/src/core/ozone/glx_helper.h b/src/core/ozone/glx_helper.h
index 963c4a6..20bc715 100644
--- a/src/core/ozone/glx_helper.h
+++ b/src/core/ozone/glx_helper.h
@@ -33,6 +33,7 @@ public:
     GLXFBConfig getFBConfig();
     GLXPixmap importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t 
width, uint16_t height,
                                    uint16_t stride) const;
+    void freePixmap(uint32_t pixmapId) const;
     bool isDmaBufSupported() const { return m_isDmaBufSupported; }
 
 private:
-- 
2.49.0


++++++ 0001-NativeSkiaOutputDeviceVulkan-Use-minimal-set-of-usag.patch ++++++
>From b829ca7c36d3d525b3f794d8c3ebf3417bdcb43a Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Tue, 25 Mar 2025 14:53:38 +0100
Subject: [PATCH] NativeSkiaOutputDeviceVulkan: Use minimal set of usage flags
 for VkImage

VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT usage flag is not necessary because
the native VkImage imported into QSG seems to be only accessed via
sampling. VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT also seems to conflict
with the VK_IMAGE_LAYOUT_UNDEFINED initial layout with Nvidia driver.
VK_IMAGE_LAYOUT_UNDEFINED is a requirement for importing external
texture from Chromium.

Keep VK_IMAGE_USAGE_SAMPLE_BIT usage flag because it is a requirement
for sampling.

Remove the corressponding VK_IMAGE_LAYOUT_PRINITIALIZED initial layout
workaround for Nvidia. It is not necessary without the
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT flag and fixes validation layer
warning.

Also remove VK_IMAGE_USAGE_TRANSFER_DST_BIT and
VK_IMAGE_TRANSFER_SRC_BIT usage flags because those are not used and
seem to be leftover from an earlier implementation.

Pick-to: 6.8
Task-number: QTBUG-123607
Change-Id: If9dba4b6ff9d584e3d103ec8d05b7fe0cdaec339
Reviewed-by: Allan Sandfeld Jensen <allan.jen...@qt.io>
(cherry picked from commit f88fa0c83c7f0c063475539b327065f8615fe9d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_...@qt-project.org>
---
 .../native_skia_output_device_vulkan.cpp      | 24 +++++--------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp 
b/src/core/compositor/native_skia_output_device_vulkan.cpp
index c40530644..924cc951b 100644
--- a/src/core/compositor/native_skia_output_device_vulkan.cpp
+++ b/src/core/compositor/native_skia_output_device_vulkan.cpp
@@ -112,16 +112,6 @@ QSGTexture 
*NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te
     QVulkanFunctions *f = win->vulkanInstance()->functions();
     QVulkanDeviceFunctions *df = 
win->vulkanInstance()->deviceFunctions(qtVulkanDevice);
 
-    VkImageLayout imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
-    VkPhysicalDeviceProperties deviceProperties;
-    f->vkGetPhysicalDeviceProperties(qtPhysicalDevice, &deviceProperties);
-    if (deviceProperties.vendorID == 0x10DE) {
-        // FIXME: This is a workaround for Nvidia driver.
-        // The imported image is empty if the initialLayout is not
-        // VK_IMAGE_LAYOUT_PREINITIALIZED.
-        imageLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
-    }
-
     VkExternalMemoryImageCreateInfoKHR externalMemoryImageCreateInfo = {
         .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR,
         .pNext = nullptr,
@@ -210,10 +200,6 @@ QSGTexture 
*NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te
     Q_ASSERT(sharedHandle != INVALID_HANDLE_VALUE);
 #endif
 
-    constexpr VkImageUsageFlags kUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
-            | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
-            | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
-
     VkImageCreateInfo importedImageCreateInfo = {
         .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
         .pNext = &externalMemoryImageCreateInfo,
@@ -229,11 +215,13 @@ QSGTexture 
*NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te
         .arrayLayers = 1,
         .samples = VK_SAMPLE_COUNT_1_BIT,
         .tiling = VK_IMAGE_TILING_OPTIMAL,
-        .usage = kUsage,
+        // The image is fed into a combined image sampler
+        .usage = VK_IMAGE_USAGE_SAMPLED_BIT,
         .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
         .queueFamilyIndexCount = 0,
         .pQueueFamilyIndices = nullptr,
-        .initialLayout = imageLayout,
+        // VkExternalMemoryImageCreateInfo only allows UNDEFINED
+        .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
     };
 
 #if BUILDFLAG(IS_OZONE)
@@ -314,8 +302,8 @@ QSGTexture 
*NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te
     df->vkBindImageMemory(qtVulkanDevice, importedImage, importedImageMemory, 
0);
 
     QQuickWindow::CreateTextureOptions texOpts(textureOptions);
-    QSGTexture *texture = 
QNativeInterface::QSGVulkanTexture::fromNative(importedImage, imageLayout,
-                                                                         win, 
size(), texOpts);
+    QSGTexture *texture = QNativeInterface::QSGVulkanTexture::fromNative(
+            importedImage, importedImageCreateInfo.initialLayout, win, size(), 
texOpts);
 
     m_frontBuffer->textureCleanupCallback = [=]() {
         df->vkDestroyImage(qtVulkanDevice, importedImage, nullptr);
-- 
2.49.0


++++++ 0001-angle-Always-use-primary-GPU.patch ++++++
>From 03c7dcc3280530dacf58620d169ff9c540c04592 Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Tue, 11 Mar 2025 09:19:16 +0100
Subject: [PATCH] [angle] Always use primary GPU

Since https://crrev.com/c/5320107, ANGLE may choose another GPU what Qt
uses with an EGL configuration. This may lead to sporadic crashes when
ANGLE uses the native EGL context.

It is reproducible with integrated Intel GPU and dedicated Nvidia GPU.
If the primary GPU is Nvidia and the kernel mode setting (KMS) is not
explicitly enabled for the driver, it will fail to access DRM and will
fallback to Intel.

As a workaround, stop prioritizing EGL drivers with DRM support.

Change-Id: I5d346fdc0db59521e4a2d323c8b230a75f128eaa
Reviewed-on: 
https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/630511
Reviewed-by: Moss Heim <moss.h...@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jen...@qt.io>
---
 .../angle/src/libANGLE/renderer/gl/egl/FunctionsEGL.cpp         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/egl/FunctionsEGL.cpp
 
b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/egl/FunctionsEGL.cpp
index f9bd8aa417d..aa68b72f98e 100644
--- 
a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/egl/FunctionsEGL.cpp
+++ 
b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/egl/FunctionsEGL.cpp
@@ -245,7 +245,7 @@ egl::Error FunctionsEGL::initialize(EGLAttrib platformType, 
EGLNativeDisplayType
     // extensions once the display is created and initialized.
     queryExtensions();
 
-#if defined(ANGLE_HAS_LIBDRM)
+#if defined(ANGLE_HAS_LIBDRM) && !defined(TOOLKIT_QT)
     mEGLDisplay = getPreferredDisplay(&majorVersion, &minorVersion);
 #endif  // defined(ANGLE_HAS_LIBDRM)
 
-- 
2.49.0


++++++ 0001-gbm-Add-fallback-for-drmPrimeHandleToFD.patch ++++++
>From ea67e8c8466e298a969df4c02a66798d408faaaa Mon Sep 17 00:00:00 2001
From: Peter Varga <pva...@inf.u-szeged.hu>
Date: Wed, 23 Apr 2025 09:45:33 +0200
Subject: [PATCH] Add fallback for drmPrimeHandleToFD()

drmPrimeHandleToFD() does not seem to work with legacy radeon driver and
returns invalid fd and it may cause QtWebEngine crash.

Chromium replaced gbm_bo_get_plane_fd() with drmPrimeHandleToFD() to
provide file descriptors per plane basis, see https://crrev.com/c/1273059

Since then, Mesa introduced new GBM API to provide fds per plane basis,
see https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5442

To keep legacy GPU drivers supported, use the new GBM API as a fallback
if the drmPrimeHandleToFD() fails.

Fixes: QTBUG-135935
Change-Id: I79f54f861916d3b19f743cab183f756657094b09
Done-with: Kevin B. Hendricks
Reviewed-on: 
https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/641190
Reviewed-by: Allan Sandfeld Jensen <allan.jen...@qt.io>
---
 src/3rdparty/chromium/ui/gfx/linux/gbm_wrapper.cc | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/3rdparty/chromium/ui/gfx/linux/gbm_wrapper.cc 
b/src/3rdparty/chromium/ui/gfx/linux/gbm_wrapper.cc
index 39d9fe6..7b75b74 100644
--- a/src/3rdparty/chromium/ui/gfx/linux/gbm_wrapper.cc
+++ b/src/3rdparty/chromium/ui/gfx/linux/gbm_wrapper.cc
@@ -76,14 +76,26 @@ base::ScopedFD GetPlaneFdForBo(gbm_bo* bo, size_t plane) {
   int ret;
   // Use DRM_RDWR to allow the fd to be mappable in another process.
   ret = drmPrimeHandleToFD(dev_fd, plane_handle, DRM_CLOEXEC | DRM_RDWR, &fd);
-  PLOG_IF(ERROR, ret != 0) << "Failed to get fd for plane.";
+  PLOG_IF(WARNING, ret != 0) << "Failed to get fd for plane with libdrm.";
 
   // Older DRM implementations blocked DRM_RDWR, but gave a read/write mapping
   // anyways
   if (ret) {
     ret = drmPrimeHandleToFD(dev_fd, plane_handle, DRM_CLOEXEC, &fd);
+    PLOG_IF(WARNING, ret != 0) << "Failed to get fd for plane even without 
DRM_RDWR.";
   }
 
+#if BUILDFLAG(IS_QTWEBENGINE)
+  // drmPrimeHandleToFD() does not work with legacy radeon driver. Fallback to
+  // gbm_bo_get_fd_for_plane() which does provide fds per plane basis.
+  if (ret) {
+    fd = gbm_bo_get_fd_for_plane(bo, plane);
+    ret = (fd == -1) ? -1 : 0;
+    PLOG_IF(WARNING, ret != 0) << "Failed to get fd for plane even with GBM.";
+  }
+#endif
+
+  LOG_IF(ERROR, ret != 0) << "Failed to get fd for plane.";
   return ret ? base::ScopedFD() : base::ScopedFD(fd);
 #endif
 }
-- 
2.49.0

Reply via email to