Merge branch 'nouveau'
This commit is contained in:
commit
b8a32c577f
@ -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 @@ from qutebrowser.browser.webengine import (webview, webengineelem, tabhistory,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user