Merge lp:~dandrader/qtubuntu/rasterGLSurface into lp:qtubuntu

Proposed by Daniel d'Andrada
Status: Work in progress
Proposed branch: lp:~dandrader/qtubuntu/rasterGLSurface
Merge into: lp:qtubuntu
Prerequisite: lp:~gerboland/qtubuntu/eglconvenience-retry
Diff against target: 296 lines (+76/-112)
7 files modified
src/ubuntumirclient/desktopwindow.cpp (+26/-0)
src/ubuntumirclient/desktopwindow.h (+29/-0)
src/ubuntumirclient/glcontext.cpp (+9/-19)
src/ubuntumirclient/integration.cpp (+10/-3)
src/ubuntumirclient/offscreensurface.cpp (+0/-47)
src/ubuntumirclient/offscreensurface.h (+0/-41)
src/ubuntumirclient/ubuntumirclient.pro (+2/-2)
To merge this branch: bzr merge lp:~dandrader/qtubuntu/rasterGLSurface
Reviewer Review Type Date Requested Status
Gerry Boland (community) Needs Information
Unity8 CI Bot continuous-integration Approve
Review via email: mp+299141@code.launchpad.net

Commit message

Add support for QQuickWidgets

- Advertise RasterGLSurface capability

- Implement proper offscreen rendering support using EGL pixel buffers.

- Don't create mir surfaces for Qt::Desktop QWindows. Proper
implementation still pending

Description of the change

To test:
Build & run lp:~dandrader/+junk/qwidget

If you can see the "Hello World" in a red rect, it's working.

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

PASSED: Continuous integration, rev:330
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/94/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2216
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2244
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2150
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2150
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2150
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2141/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2141
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2141/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

- return new UbuntuOffscreenSurface(surface);
+ return new QEGLPbuffer(mEglDisplay, QSurfaceFormat::defaultFormat(), surface);

Please test this on all the devices you have to hand. I vaguely recall not using PBuffers as some driver we had didn't support it, so adopting FBO instead.

+++ src/ubuntumirclient/desktopwindow.cpp
I don't see the point in making this dummy class at all... If client requests a Desktop window, they should get a regular window back, so at least the contents will be drawn on screen. This dummy window will show nothing on screen.

Can we compare with what qtwayland does please?

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

On 05/07/2016 13:24, Gerry Boland wrote:
> Review: Needs Information
>
> - return new UbuntuOffscreenSurface(surface);
> + return new QEGLPbuffer(mEglDisplay, QSurfaceFormat::defaultFormat(), surface);
>
> Please test this on all the devices you have to hand. I vaguely recall not using PBuffers as some driver we had didn't support it, so adopting FBO instead.

Right, doesn't work on mako.

Unmerged revisions

330. By Daniel d'Andrada

Add support for QQuickWidgets

- Advertise RasterGLSurface capability

- Implement proper offscreen rendering support using EGL pixel buffers.

- Don't create mir surfaces for Qt::Desktop QWindows. Proper
implementation still pending

329. By Daniel d'Andrada

merge lp:~gerboland/qtubuntu/eglconvenience-retry

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'src/ubuntumirclient/desktopwindow.cpp'
2--- src/ubuntumirclient/desktopwindow.cpp 1970-01-01 00:00:00 +0000
3+++ src/ubuntumirclient/desktopwindow.cpp 2016-07-05 12:48:24 +0000
4@@ -0,0 +1,26 @@
5+/*
6+ * Copyright (C) 2016 Canonical, Ltd.
7+ *
8+ * This program is free software: you can redistribute it and/or modify it under
9+ * the terms of the GNU Lesser General Public License version 3, as published by
10+ * the Free Software Foundation.
11+ *
12+ * This program is distributed in the hope that it will be useful, but WITHOUT
13+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
14+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+ * Lesser General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+#include "desktopwindow.h"
22+
23+// local
24+#include "logging.h"
25+
26+UbuntuDesktopWindow::UbuntuDesktopWindow(QWindow *window)
27+ : QPlatformWindow(window)
28+{
29+ qCDebug(ubuntumirclient, "UbuntuDesktopWindow(window=%p)", window);
30+}
31
32=== added file 'src/ubuntumirclient/desktopwindow.h'
33--- src/ubuntumirclient/desktopwindow.h 1970-01-01 00:00:00 +0000
34+++ src/ubuntumirclient/desktopwindow.h 2016-07-05 12:48:24 +0000
35@@ -0,0 +1,29 @@
36+/*
37+ * Copyright (C) 2016 Canonical, Ltd.
38+ *
39+ * This program is free software: you can redistribute it and/or modify it under
40+ * the terms of the GNU Lesser General Public License version 3, as published by
41+ * the Free Software Foundation.
42+ *
43+ * This program is distributed in the hope that it will be useful, but WITHOUT
44+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
45+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
46+ * Lesser General Public License for more details.
47+ *
48+ * You should have received a copy of the GNU Lesser General Public License
49+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
50+ */
51+
52+#ifndef UBUNTU_DESKTOP_WINDOW_H
53+#define UBUNTU_DESKTOP_WINDOW_H
54+
55+#include <qpa/qplatformwindow.h>
56+
57+// TODO Implement it. For now it's just an empty, dummy class.
58+class UbuntuDesktopWindow : public QPlatformWindow
59+{
60+public:
61+ UbuntuDesktopWindow(QWindow*);
62+};
63+
64+#endif // UBUNTU_DESKTOP_WINDOW_H
65
66=== modified file 'src/ubuntumirclient/glcontext.cpp'
67--- src/ubuntumirclient/glcontext.cpp 2016-07-05 12:48:23 +0000
68+++ src/ubuntumirclient/glcontext.cpp 2016-07-05 12:48:24 +0000
69@@ -16,7 +16,6 @@
70
71 #include "glcontext.h"
72 #include "logging.h"
73-#include "offscreensurface.h"
74 #include "window.h"
75
76 #include <QOpenGLFramebufferObject>
77@@ -74,25 +73,16 @@
78 {
79 Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
80
81- if (surface->surface()->surfaceClass() == QSurface::Offscreen) {
82- auto offscreen = static_cast<UbuntuOffscreenSurface *>(surface);
83- if (!offscreen->buffer()) {
84- auto buffer = new QOpenGLFramebufferObject(surface->surface()->size());
85- offscreen->setBuffer(buffer);
86- }
87- return offscreen->buffer()->bind();
88- } else {
89- const bool ret = QEGLPlatformContext::makeCurrent(surface);
90-
91- if (Q_LIKELY(ret)) {
92- QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
93- if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) {
94- ctx_d->workaround_brokenFBOReadBack = true;
95- }
96- }
97-
98- return ret;
99+ const bool ret = QEGLPlatformContext::makeCurrent(surface);
100+
101+ if (Q_LIKELY(ret)) {
102+ QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
103+ if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) {
104+ ctx_d->workaround_brokenFBOReadBack = true;
105+ }
106 }
107+
108+ return ret;
109 }
110
111 // WORKAROUND for bug 1594198 - avoid having Qt use GLESv3
112
113=== modified file 'src/ubuntumirclient/integration.cpp'
114--- src/ubuntumirclient/integration.cpp 2016-07-05 12:48:23 +0000
115+++ src/ubuntumirclient/integration.cpp 2016-07-05 12:48:24 +0000
116@@ -18,11 +18,11 @@
117 #include "integration.h"
118 #include "backingstore.h"
119 #include "clipboard.h"
120+#include "desktopwindow.h"
121 #include "glcontext.h"
122 #include "input.h"
123 #include "logging.h"
124 #include "nativeinterface.h"
125-#include "offscreensurface.h"
126 #include "screen.h"
127 #include "theme.h"
128 #include "window.h"
129@@ -30,6 +30,7 @@
130 // Qt
131 #include <QFileInfo>
132 #include <QGuiApplication>
133+#include <private/qeglpbuffer_p.h>
134 #include <qpa/qplatformnativeinterface.h>
135 #include <qpa/qplatforminputcontextfactory_p.h>
136 #include <qpa/qplatforminputcontext.h>
137@@ -211,7 +212,12 @@
138
139 QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const
140 {
141- return new UbuntuWindow(window, mClipboard, mInput, mNativeInterface, mEglDisplay, mMirConnection);
142+ if (window->type() == Qt::Desktop) {
143+ // Desktop windows should not be backed up by a mir surface as they don't draw anything (nor should).
144+ return new UbuntuDesktopWindow(window);
145+ } else {
146+ return new UbuntuWindow(window, mClipboard, mInput, mNativeInterface, mEglDisplay, mMirConnection);
147+ }
148 }
149
150 bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
151@@ -235,6 +241,7 @@
152 }
153 case MultipleWindows:
154 case NonFullScreenWindows:
155+ case RasterGLSurface:
156 return true;
157 default:
158 return QPlatformIntegration::hasCapability(cap);
159@@ -316,7 +323,7 @@
160 QPlatformOffscreenSurface *UbuntuClientIntegration::createPlatformOffscreenSurface(
161 QOffscreenSurface *surface) const
162 {
163- return new UbuntuOffscreenSurface(surface);
164+ return new QEGLPbuffer(mEglDisplay, QSurfaceFormat::defaultFormat(), surface);
165 }
166
167 void UbuntuClientIntegration::destroyScreen(UbuntuScreen *screen)
168
169=== removed file 'src/ubuntumirclient/offscreensurface.cpp'
170--- src/ubuntumirclient/offscreensurface.cpp 2016-01-04 17:18:51 +0000
171+++ src/ubuntumirclient/offscreensurface.cpp 1970-01-01 00:00:00 +0000
172@@ -1,47 +0,0 @@
173-/*
174- * Copyright (C) 2016 Canonical, Ltd.
175- *
176- * This program is free software: you can redistribute it and/or modify it under
177- * the terms of the GNU Lesser General Public License version 3, as published by
178- * the Free Software Foundation.
179- *
180- * This program is distributed in the hope that it will be useful, but WITHOUT
181- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
182- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
183- * Lesser General Public License for more details.
184- *
185- * You should have received a copy of the GNU Lesser General Public License
186- * along with this program. If not, see <http://www.gnu.org/licenses/>.
187- */
188-
189-#include "offscreensurface.h"
190-
191-#include <QOffscreenSurface>
192-#include <QOpenGLFramebufferObject>
193-
194-UbuntuOffscreenSurface::UbuntuOffscreenSurface(QOffscreenSurface *offscreenSurface)
195- : QPlatformOffscreenSurface(offscreenSurface)
196- , m_buffer(nullptr)
197- , m_format(offscreenSurface->requestedFormat())
198-{
199-}
200-
201-QSurfaceFormat UbuntuOffscreenSurface::format() const
202-{
203- return m_format;
204-}
205-
206-bool UbuntuOffscreenSurface::isValid() const
207-{
208- return m_buffer != nullptr && m_buffer->isValid();
209-}
210-
211-QOpenGLFramebufferObject* UbuntuOffscreenSurface::buffer() const
212-{
213- return m_buffer;
214-}
215-
216-void UbuntuOffscreenSurface::setBuffer(QOpenGLFramebufferObject *buffer)
217-{
218- m_buffer = buffer;
219-}
220
221=== removed file 'src/ubuntumirclient/offscreensurface.h'
222--- src/ubuntumirclient/offscreensurface.h 2016-01-04 17:18:51 +0000
223+++ src/ubuntumirclient/offscreensurface.h 1970-01-01 00:00:00 +0000
224@@ -1,41 +0,0 @@
225-/*
226- * Copyright (C) 2016 Canonical, Ltd.
227- *
228- * This program is free software: you can redistribute it and/or modify it under
229- * the terms of the GNU Lesser General Public License version 3, as published by
230- * the Free Software Foundation.
231- *
232- * This program is distributed in the hope that it will be useful, but WITHOUT
233- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
234- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
235- * Lesser General Public License for more details.
236- *
237- * You should have received a copy of the GNU Lesser General Public License
238- * along with this program. If not, see <http://www.gnu.org/licenses/>.
239- */
240-
241-#ifndef UBUNTU_OFFSCREEN_SURFACE_H
242-#define UBUNTU_OFFSCREEN_SURFACE_H
243-
244-#include <qpa/qplatformoffscreensurface.h>
245-#include <QSurfaceFormat>
246-
247-class QOpenGLFramebufferObject;
248-
249-class UbuntuOffscreenSurface : public QPlatformOffscreenSurface
250-{
251-public:
252- UbuntuOffscreenSurface(QOffscreenSurface *offscreenSurface);
253-
254- QSurfaceFormat format() const override;
255- bool isValid() const override;
256-
257- QOpenGLFramebufferObject* buffer() const;
258- void setBuffer(QOpenGLFramebufferObject *buffer);
259-
260-private:
261- QOpenGLFramebufferObject *m_buffer;
262- QSurfaceFormat m_format;
263-};
264-
265-#endif // UBUNTU_OFFSCREEN_SURFACE_H
266
267=== modified file 'src/ubuntumirclient/ubuntumirclient.pro'
268--- src/ubuntumirclient/ubuntumirclient.pro 2016-05-30 17:14:14 +0000
269+++ src/ubuntumirclient/ubuntumirclient.pro 2016-07-05 12:48:24 +0000
270@@ -18,11 +18,11 @@
271 backingstore.cpp \
272 clipboard.cpp \
273 cursor.cpp \
274+ desktopwindow.cpp \
275 glcontext.cpp \
276 input.cpp \
277 integration.cpp \
278 nativeinterface.cpp \
279- offscreensurface.cpp \
280 platformservices.cpp \
281 plugin.cpp \
282 screen.cpp \
283@@ -34,12 +34,12 @@
284 backingstore.h \
285 clipboard.h \
286 cursor.h \
287+ desktopwindow.h \
288 glcontext.h \
289 input.h \
290 integration.h \
291 logging.h \
292 nativeinterface.h \
293- offscreensurface.h \
294 orientationchangeevent_p.h \
295 platformservices.h \
296 plugin.h \

Subscribers

People subscribed via source and target branches