Merge lp:~gerboland/qtmir/nouveau-workaround into lp:qtmir

Proposed by Gerry Boland
Status: Needs review
Proposed branch: lp:~gerboland/qtmir/nouveau-workaround
Merge into: lp:qtmir
Diff against target: 110 lines (+64/-1)
3 files modified
src/platforms/mirserver/logging.cpp (+1/-0)
src/platforms/mirserver/logging.h (+1/-0)
src/platforms/mirserver/mirserverintegration.cpp (+62/-1)
To merge this branch: bzr merge lp:~gerboland/qtmir/nouveau-workaround
Reviewer Review Type Date Requested Status
Unity8 CI Bot (community) continuous-integration Approve
Mir development team Pending
Review via email: mp+321286@code.launchpad.net

Commit message

Disable threaded rendering for nouveau

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:626
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/643/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4764
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4792
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4615
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4615/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4615
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4615/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4615
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4615/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4615
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4615/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4615
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4615/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4615
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4615/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/643/rebuild

review: Approve (continuous-integration)

Unmerged revisions

626. By Gerry Boland

Disable threaded rendering for nouveau

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/mirserver/logging.cpp'
2--- src/platforms/mirserver/logging.cpp 2017-02-07 20:59:34 +0000
3+++ src/platforms/mirserver/logging.cpp 2017-03-29 12:27:06 +0000
4@@ -24,5 +24,6 @@
5 Q_LOGGING_CATEGORY(QTMIR_MIR_KEYMAP, "qtmir.mir.keymap")
6 Q_LOGGING_CATEGORY(QTMIR_CLIPBOARD, "qtmir.clipboard")
7 Q_LOGGING_CATEGORY(QTMIR_SENSOR_MESSAGES, "qtmir.sensor")
8+Q_LOGGING_CATEGORY(QTMIR_GRAPHICS, "qtmir.graphics")
9 Q_LOGGING_CATEGORY(QTMIR_SCREENS, "qtmir.screens")
10 Q_LOGGING_CATEGORY(QTMIR_DBUS, "qtmir.dbus", QtWarningMsg)
11
12=== modified file 'src/platforms/mirserver/logging.h'
13--- src/platforms/mirserver/logging.h 2016-09-29 15:46:59 +0000
14+++ src/platforms/mirserver/logging.h 2017-03-29 12:27:06 +0000
15@@ -26,6 +26,7 @@
16 Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_INPUT)
17 Q_DECLARE_LOGGING_CATEGORY(QTMIR_MIR_KEYMAP)
18 Q_DECLARE_LOGGING_CATEGORY(QTMIR_CLIPBOARD)
19+Q_DECLARE_LOGGING_CATEGORY(QTMIR_GRAPHICS)
20 Q_DECLARE_LOGGING_CATEGORY(QTMIR_SCREENS)
21 Q_DECLARE_LOGGING_CATEGORY(QTMIR_DBUS)
22
23
24=== modified file 'src/platforms/mirserver/mirserverintegration.cpp'
25--- src/platforms/mirserver/mirserverintegration.cpp 2017-02-21 18:53:48 +0000
26+++ src/platforms/mirserver/mirserverintegration.cpp 2017-03-29 12:27:06 +0000
27@@ -27,6 +27,7 @@
28 #include <qpa/qwindowsysteminterface.h>
29
30 #include <QGuiApplication>
31+#include <QOffscreenSurface>
32 #include <QStringList>
33 #include <QDebug>
34
35@@ -47,6 +48,66 @@
36 #include "ubuntutheme.h"
37 #include "logging.h"
38
39+namespace {
40+
41+static bool mGLContextQueried{false};
42+static bool mGLSupportsThreadedRendering{false};
43+
44+void queryGLContext()
45+{
46+ // Based on similar logic in the XCB plugin. Am supporting the same debug env vars too.
47+ if (mGLContextQueried)
48+ return;
49+ mGLContextQueried = true;
50+
51+ static bool skip = qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK");
52+ if (skip)
53+ return;
54+
55+ QOpenGLContext *oldContext = QOpenGLContext::currentContext();
56+ QSurface *oldSurface = nullptr;
57+ if (oldContext)
58+ oldSurface = oldContext->surface();
59+
60+ QOffscreenSurface *surface = new QOffscreenSurface;
61+ surface->create();
62+
63+ QOpenGLContext context;
64+ if (!context.create() || !context.makeCurrent(surface)) {
65+ qWarning("MirServerIntegration: Failed to create dummy context to query");
66+ mGLSupportsThreadedRendering = false;
67+ return;
68+ }
69+
70+ mGLSupportsThreadedRendering = true;
71+
72+ if (const char *vendor = (const char *) glGetString(GL_VENDOR)) {
73+ if (strstr(vendor, "nouveau") != 0) {
74+ qCInfo(QTMIR_GRAPHICS) << "Multithreaded OpenGL disabled: nouveau is blacklisted";
75+ mGLSupportsThreadedRendering = false;
76+ }
77+ }
78+
79+ context.doneCurrent();
80+ if (oldContext && oldSurface)
81+ oldContext->makeCurrent(oldSurface);
82+
83+ if (!mGLSupportsThreadedRendering) {
84+ qCInfo(QTMIR_GRAPHICS) << "Force-enable multithreaded OpenGL by setting "
85+ "environment variable QT_OPENGL_NO_SANITY_CHECK";
86+ }
87+}
88+
89+bool supportsThreadedRendering()
90+{
91+ queryGLContext();
92+ return mGLSupportsThreadedRendering;
93+}
94+
95+} // namespace
96+
97+
98+
99 namespace mg = mir::graphics;
100 using qtmir::Clipboard;
101
102@@ -88,7 +149,7 @@
103 switch (cap) {
104 case ThreadedPixmaps: return true;
105 case OpenGL: return true;
106- case ThreadedOpenGL: return true;
107+ case ThreadedOpenGL: return supportsThreadedRendering();
108 case BufferQueueingOpenGL: return true;
109 case MultipleWindows: return true; // multi-monitor support
110 case WindowManagement: return false; // platform has no WM, as this implements the WM!

Subscribers

People subscribed via source and target branches