def _handle_nouveau_graphics(): assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend if version.opengl_vendor() != 'nouveau': return if (os.environ.get('LIBGL_ALWAYS_SOFTWARE') == '1' or 'QT_XCB_FORCE_SOFTWARE_OPENGL' in os.environ): return button = _Button("Force software rendering", 'force_software_rendering', True) _show_dialog( backend=usertypes.Backend.QtWebEngine, because="you're using Nouveau graphics", text="<p>There are two ways to fix this:</p>" "<p><b>Forcing software rendering</b></p>" "<p>This allows you to use the newer QtWebEngine backend (based " "on Chromium) but could have noticable performance impact " "(depending on your hardware). " "This sets the <i>force_software_rendering = True</i> option " "(if you have a <i>config.py</i> file, you'll need to set this " "manually).</p>", buttons=[button], ) # Should never be reached assert False
def init(): """Initialize QtWebEngine-specific modules.""" # For some reason we need to keep a reference, otherwise the scheme handler # won't work... # https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038075.html global _qute_scheme_handler app = QApplication.instance() software_rendering = os.environ.get('LIBGL_ALWAYS_SOFTWARE') == '1' if version.opengl_vendor() == 'nouveau' and not software_rendering: # FIXME:qtwebengine display something more sophisticated here raise browsertab.WebTabError( "QtWebEngine is not supported with Nouveau graphics (unless " "LIBGL_ALWAYS_SOFTWARE is set as environment variable).") log.init.debug("Initializing qute://* handler...") _qute_scheme_handler = webenginequtescheme.QuteSchemeHandler(parent=app) _qute_scheme_handler.install(webenginesettings.default_profile) _qute_scheme_handler.install(webenginesettings.private_profile) log.init.debug("Initializing request interceptor...") host_blocker = objreg.get('host-blocker') req_interceptor = interceptor.RequestInterceptor(host_blocker, parent=app) req_interceptor.install(webenginesettings.default_profile) req_interceptor.install(webenginesettings.private_profile) log.init.debug("Initializing QtWebEngine downloads...") download_manager = webenginedownloads.DownloadManager(parent=app) download_manager.install(webenginesettings.default_profile) download_manager.install(webenginesettings.private_profile) objreg.register('webengine-download-manager', download_manager)
def _handle_nouveau_graphics(): assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend if os.environ.get('QUTE_SKIP_NOUVEAU_CHECK'): return if version.opengl_vendor() != 'nouveau': return if (os.environ.get('LIBGL_ALWAYS_SOFTWARE') == '1' or 'QT_XCB_FORCE_SOFTWARE_OPENGL' in os.environ): return button = _Button("Force software rendering", 'qt.force_software_rendering', True) _show_dialog( backend=usertypes.Backend.QtWebEngine, because="you're using Nouveau graphics", text="<p>There are two ways to fix this:</p>" "<p><b>Forcing software rendering</b></p>" "<p>This allows you to use the newer QtWebEngine backend (based " "on Chromium) but could have noticable performance impact " "(depending on your hardware). " "This sets the <i>qt.force_software_rendering = True</i> option " "(if you have a <i>config.py</i> file, you'll need to set this " "manually).</p>", buttons=[button], ) # Should never be reached assert False
def init(): """Initialize QtWebEngine-specific modules.""" # For some reason we need to keep a reference, otherwise the scheme handler # won't work... # https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038075.html global _qute_scheme_handler app = QApplication.instance() software_rendering = (os.environ.get('LIBGL_ALWAYS_SOFTWARE') == '1' or 'QT_XCB_FORCE_SOFTWARE_OPENGL' in os.environ) if version.opengl_vendor() == 'nouveau' and not software_rendering: # FIXME:qtwebengine display something more sophisticated here raise browsertab.WebTabError( "QtWebEngine is not supported with Nouveau graphics (unless " "QT_XCB_FORCE_SOFTWARE_OPENGL is set as environment variable).") log.init.debug("Initializing qute://* handler...") _qute_scheme_handler = webenginequtescheme.QuteSchemeHandler(parent=app) _qute_scheme_handler.install(webenginesettings.default_profile) _qute_scheme_handler.install(webenginesettings.private_profile) log.init.debug("Initializing request interceptor...") host_blocker = objreg.get('host-blocker') req_interceptor = interceptor.RequestInterceptor( host_blocker, parent=app) req_interceptor.install(webenginesettings.default_profile) req_interceptor.install(webenginesettings.private_profile) log.init.debug("Initializing QtWebEngine downloads...") download_manager = webenginedownloads.DownloadManager(parent=app) download_manager.install(webenginesettings.default_profile) download_manager.install(webenginesettings.private_profile) objreg.register('webengine-download-manager', download_manager)
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 if version.opengl_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>" "<p><b>Forcing software rendering</b></p>" "<p>This allows you to use the newer QtWebEngine backend " "(based on Chromium) but could have noticeable performance " "impact (depending on your hardware). This sets the " "<i>qt.force_software_rendering = 'chromium'</i> option " "(if you have a <i>config.py</i> file, you'll need to set " "this manually).</p>"), buttons=[button], ) raise utils.Unreachable
def _handle_nouveau_graphics(): """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/ """ assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend if os.environ.get('QUTE_SKIP_NOUVEAU_CHECK'): return if version.opengl_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') _show_dialog( backend=usertypes.Backend.QtWebEngine, because="you're using Nouveau graphics", text="<p>There are two ways to fix this:</p>" "<p><b>Forcing software rendering</b></p>" "<p>This allows you to use the newer QtWebEngine backend (based " "on Chromium) but could have noticeable performance impact " "(depending on your hardware). " "This sets the <i>qt.force_software_rendering = 'chromium'</i> " "option (if you have a <i>config.py</i> file, you'll need to set " "this manually).</p>", buttons=[button], ) raise utils.Unreachable
def test_opengl_vendor(qapp): """Simply call version.opengl_vendor() and see if it doesn't crash.""" pytest.importorskip("PyQt5.QtOpenGL") return version.opengl_vendor()
def test_opengl_vendor(): """Simply call version.opengl_vendor() and see if it doesn't crash.""" pytest.importorskip("PyQt5.QtOpenGL") return version.opengl_vendor()