Permalink
Browse files

Add error message for QtWebEngine and Nouveau

See #2368
  • Loading branch information...
The-Compiler committed May 30, 2017
1 parent 048aec1 commit 67755e6f6caee61bd4611bb3fb9d01a4f84d9ea2
Showing with 40 additions and 2 deletions.
  1. +1 −1 qutebrowser/app.py
  2. +9 −1 qutebrowser/browser/webengine/webenginetab.py
  3. +30 −0 qutebrowser/utils/version.py
@@ -136,7 +136,7 @@ def init(args, crash_handler):
try:
_init_modules(args, crash_handler)
except (OSError, UnicodeDecodeError) as e:
except (OSError, UnicodeDecodeError, browsertab.WebTabError) as e:
error.handle_fatal_exc(e, args, "Error while initializing!",
pre_text="Error while initializing")
sys.exit(usertypes.Exit.err_init)
@@ -19,6 +19,7 @@
"""Wrapper over a QWebEngineView."""
import os
import functools
import sip
@@ -35,7 +36,7 @@
webenginesettings)
from qutebrowser.misc import miscwidgets
from qutebrowser.utils import (usertypes, qtutils, log, javascript, utils,
objreg, jinja, debug)
objreg, jinja, debug, version)
_qute_scheme_handler = None
@@ -49,6 +50,13 @@ def init():
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)
@@ -377,3 +377,33 @@ def version():
lines += ['{}: {}'.format(name, path)]
return '\n'.join(lines)
def opengl_vendor(): # pragma: no cover
"""Get the OpenGL vendor used."""
# We're doing those imports here because this is only available with Qt 5.4
# or newer.
from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtOpenGL import QGLWidget
from PyQt5.QtGui import QOpenGLContext, QSurfaceFormat, QOpenGLVersionProfile, QOffscreenSurface
assert QApplication.instance()
assert QOpenGLContext.currentContext() is None
surface = QOffscreenSurface()
surface.create()
ctx = QOpenGLContext()
ok = ctx.create()
assert ok
ok = ctx.makeCurrent(surface)
assert ok
vp = QOpenGLVersionProfile()
vp.setVersion(2, 0)
vf = ctx.versionFunctions(vp)
vendor = vf.glGetString(vf.GL_VENDOR)
ctx.doneCurrent()
return vendor

0 comments on commit 67755e6

Please sign in to comment.