From deba7273785638de7ddd6921db0a50d88771e21c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 1 Jun 2020 13:43:59 +0200 Subject: backendproblem: Suggest to disable WebGL with older OpenGL versions Also make it a bit clearer that using QtWebKit isn't the preferred solution to those problems. Fixes #5313 --- doc/changelog.asciidoc | 3 ++ qutebrowser/misc/backendproblem.py | 95 ++++++++++++++++++++++++++++++-------- 2 files changed, 79 insertions(+), 19 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index b982c8763..8d8deaec0 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -75,6 +75,9 @@ Fixed - A site specific quirk to allow typing accented characters on Google Docs was active for docs.google.com, but not drive.google.com. It is now applied for both subdomains. +- With older graphics hardware (OpenGL < 4.3) with Qt 5.14 on Wayland, WebGL + causes segfaults. Now qutebrowser detects that combination and suggests to + disable WebGL or use XWayland. v1.11.1 (2020-05-07) -------------------- diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index 01cfc988a..5c8e1002d 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -79,19 +79,21 @@ def _error_text(because: str, text: str, backend: usertypes.Backend) -> str: if other_backend == usertypes.Backend.QtWebKit: warning = ("Note that QtWebKit hasn't been updated since " "July 2017 (including security updates).") + suffix = " (not recommended)" else: warning = "" + suffix = "" return ("Failed to start with the {backend} backend!" "

qutebrowser tried to start with the {backend} backend but " "failed because {because}.

{text}" - "

Forcing the {other_backend.name} backend

" + "

Forcing the {other_backend.name} backend{suffix}

" "

This forces usage of the {other_backend.name} backend by " "setting the backend = '{other_setting}' option " "(if you have a config.py file, you'll need to set " "this manually). {warning}

".format( backend=backend.name, because=because, text=text, other_backend=other_backend, other_setting=other_setting, - warning=warning)) + warning=warning, suffix=suffix)) class _Dialog(QDialog): @@ -253,23 +255,8 @@ class _BackendProblemChecker: raise utils.Unreachable - def _handle_wayland(self) -> None: - self._assert_backend(usertypes.Backend.QtWebEngine) - - if os.environ.get('QUTE_SKIP_WAYLAND_CHECK'): - return - - platform = QApplication.instance().platformName() - if platform not in ['wayland', 'wayland-egl']: - return - - has_qt511 = qtutils.version_check('5.11', compiled=False) - if has_qt511 and config.val.qt.force_software_rendering == 'chromium': - return - - if qtutils.version_check('5.11.2', compiled=False): - return - + def _xwayland_options(self) -> typing.Tuple[typing.List[_Button], str]: + """Get buttons/text for a possible XWayland solution.""" buttons = [] text = "

You can work around this in one of the following ways:

" @@ -288,6 +275,27 @@ class _BackendProblemChecker: "

This allows you to use the newer QtWebEngine backend " "(based on Chromium). ") + return text, buttons + + def _handle_wayland(self) -> None: + self._assert_backend(usertypes.Backend.QtWebEngine) + + if os.environ.get('QUTE_SKIP_WAYLAND_CHECK'): + return + + platform = QApplication.instance().platformName() + if platform not in ['wayland', 'wayland-egl']: + return + + has_qt511 = qtutils.version_check('5.11', compiled=False) + if has_qt511 and config.val.qt.force_software_rendering == 'chromium': + return + + if qtutils.version_check('5.11.2', compiled=False): + return + + text, buttons = self._xwayland_options() + if has_qt511: buttons.append(_Button("Force software rendering", 'qt.force_software_rendering', @@ -299,6 +307,54 @@ class _BackendProblemChecker: text=text, buttons=buttons) + def _handle_wayland_webgl(self) -> None: + """On older graphic hardware, WebGL on Wayland causes segfaults. + + See https://github.com/qutebrowser/qutebrowser/issues/5313 + """ + self._assert_backend(usertypes.Backend.QtWebEngine) + + if os.environ.get('QUTE_SKIP_WAYLAND_WEBGL_CHECK'): + return + + platform = QApplication.instance().platformName() + if platform not in ['wayland', 'wayland-egl']: + return + + # Only Qt 5.14 should be affected + if not qtutils.version_check('5.14', compiled=False): + return + if qtutils.version_check('5.15', compiled=False): + return + + # Newer graphic hardware isn't affected + opengl_info = version.opengl_info() + if (opengl_info is None or + opengl_info.gles or + opengl_info.version is None or + opengl_info.version >= (4, 3)): + return + + # If WebGL is turned off, we're fine + if not config.val.content.webgl: + return + + text, buttons = self._xwayland_options() + + buttons.append(_Button("Turn off WebGL (recommended)", + 'content.webgl', + False)) + text += ("

Disable WebGL (recommended)

" + "This sets the content.webgl = False option " + "(if you have a config.py file, you'll need to " + "set this manually).

") + + self._show_dialog(backend=usertypes.Backend.QtWebEngine, + because=("of frequent crashes with Qt 5.14 on " + "Wayland with older graphics hardware"), + text=text, + buttons=buttons) + def _try_import_backends(self) -> _BackendImports: """Check whether backends can be imported and return BackendImports.""" # pylint: disable=unused-import @@ -480,6 +536,7 @@ class _BackendProblemChecker: self._handle_ssl_support() self._handle_wayland() self._nvidia_shader_workaround() + self._handle_wayland_webgl() self._handle_nouveau_graphics() self._handle_cache_nuking() self._handle_serviceworker_nuking() -- cgit v1.2.3-54-g00ecf