Fix hardware acceleration on Wayland with Qt <= 6.9

Equivalent to https://codereview.qt-project.org/c/qt/qtwebengine/+/663568

    Specify native platform for ANGLE's EGL backend on Wayland

    Set EGL_PLATFORM=wayland to force ANGLE to obtain EGL display connection
    for wayland platform. Otherwise, the display connection for
    EGL_DEFAULT_DISPLAY may belong to a platform which Nvidia's EGL driver
    doesn't support. In case of unsupported platform, EGL may fallback to
    Mesa software renderer (LLVMPipe) disabling hardware acceleration in
    Chromium.

Fixes #8637
This commit is contained in:
Florian Bruhin 2025-10-10 23:33:28 +02:00
parent 2b4e5757b0
commit 9ddbc964d4
2 changed files with 38 additions and 2 deletions

View File

@ -58,8 +58,12 @@ Fixed
from a `qute://` page to a web page, e.g. when searching on `qute://start` from a `qute://` page to a web page, e.g. when searching on `qute://start`
- Hopefully proper fix for some web pages jumping to the top when the statusbar - Hopefully proper fix for some web pages jumping to the top when the statusbar
is hidden. (#8223) is hidden. (#8223)
- Fix for the page header being shown on YouTube after the fullscreen notification was hidden (#8625). - Fix for the page header being shown on YouTube after the fullscreen
- Fix for videos losing keyboard focus when the fullscreen notification shows (#8174). notification was hidden (#8625).
- Fix for videos losing keyboard focus when the fullscreen notification shows
(#8174).
- On Wayland with Qt <= 6.9, `EGL_PLATFORM=wayland` is now set by qutebrowser to
get hardware rendering. Qt 6.10 includes an equivalent fix (#8637).
[[v3.5.1]] [[v3.5.1]]
v3.5.1 (2025-06-05) v3.5.1 (2025-06-05)

View File

@ -422,6 +422,37 @@ class _BackendProblemChecker:
raise utils.Unreachable raise utils.Unreachable
def _force_wayland_hardware_acceleration(self) -> None:
"""Set environment variable so hardware acceleration works on Wayland.
Set EGL_PLATFORM=wayland to force ANGLE to obtain EGL display connection
for wayland platform. Otherwise, the display connection for
EGL_DEFAULT_DISPLAY may belong to a platform which Nvidia's EGL driver
doesn't support. In case of unsupported platform, EGL may fallback to
Mesa software renderer (LLVMPipe) disabling hardware acceleration in
Chromium.
Equivalent to:
https://codereview.qt-project.org/c/qt/qtwebengine/+/663568
"""
if objects.qapp.platformName() != 'wayland':
return
versions = version.qtwebengine_versions(avoid_init=True)
if versions.webengine >= utils.VersionNumber(6, 10):
# Qt workaround is active
return
egl_platform_var = "EGL_PLATFORM"
egl_platform = os.environ.get(egl_platform_var)
if not egl_platform:
os.environ[egl_platform_var] = "wayland"
elif egl_platform != "wayland":
log.init.warning(
f"{egl_platform_var} environment variable is set to {egl_platform!r}. "
"This may break hardware rendering on Wayland."
)
def _assert_backend(self, backend: usertypes.Backend) -> None: def _assert_backend(self, backend: usertypes.Backend) -> None:
assert objects.backend == backend, objects.backend assert objects.backend == backend, objects.backend
@ -433,6 +464,7 @@ class _BackendProblemChecker:
self._handle_ssl_support() self._handle_ssl_support()
self._handle_serviceworker_nuking() self._handle_serviceworker_nuking()
self._check_software_rendering() self._check_software_rendering()
self._force_wayland_hardware_acceleration()
self._confirm_chromium_version_changes() self._confirm_chromium_version_changes()
else: else:
self._assert_backend(usertypes.Backend.QtWebKit) self._assert_backend(usertypes.Backend.QtWebKit)