Beispiel #1
0
 def test_func_fake(self, qapp, monkeypatch):
     monkeypatch.setenv('QUTE_FAKE_OPENGL', 'Outtel Inc., 3.0 Messiah 20.0')
     info = version.opengl_info()
     assert info.vendor == 'Outtel Inc.'
     assert info.version_str == '3.0 Messiah 20.0'
     assert info.version == (3, 0)
     assert info.vendor_specific == 'Messiah 20.0'
Beispiel #2
0
    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 = objects.qapp.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 += ("<p><b>Disable WebGL (recommended)</b></p>"
                 "This sets the <i>content.webgl = False</i> option "
                 "(if you have a <i>config.py</i> file, you'll need to "
                 "set this manually).</p>")

        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)
Beispiel #3
0
    def _handle_nouveau_graphics(self) -> None:
        """Force software rendering when using the Nouveau driver.

        WORKAROUND for
        https://bugreports.qt.io/browse/QTBUG-41242
        Should be fixed in Qt 5.10 via
        https://codereview.qt-project.org/#/c/208664/
        """
        self._assert_backend(usertypes.Backend.QtWebEngine)

        if os.environ.get('QUTE_SKIP_NOUVEAU_CHECK'):
            return

        if qtutils.version_check('5.10', compiled=False):
            return

        opengl_info = version.opengl_info()
        if opengl_info is None or opengl_info.vendor != 'nouveau':
            return

        if (os.environ.get('LIBGL_ALWAYS_SOFTWARE') == '1' or
                # qt.force_software_rendering = 'software-opengl'
                'QT_XCB_FORCE_SOFTWARE_OPENGL' in os.environ or
                # qt.force_software_rendering = 'chromium', also see:
                # https://build.opensuse.org/package/view_file/openSUSE:Factory/libqt5-qtwebengine/disable-gpu-when-using-nouveau-boo-1005323.diff?expand=1
                'QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND' in os.environ):
            return

        button = _Button("Force software rendering",
                         'qt.force_software_rendering',
                         'chromium')
        self._show_dialog(
            backend=usertypes.Backend.QtWebEngine,
            because="you're using Nouveau graphics",
            text=("<p>There are two ways to fix this:</p>" +
                  self.SOFTWARE_RENDERING_TEXT),
            buttons=[button],
        )

        raise utils.Unreachable
Beispiel #4
0
 def test_func(self, qapp):
     """Simply call version.opengl_info() and see if it doesn't crash."""
     pytest.importorskip("PyQt5.QtOpenGL")
     version.opengl_info()