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
=== added file 'src/ubuntumirclient/desktopwindow.cpp'
--- src/ubuntumirclient/desktopwindow.cpp 1970-01-01 00:00:00 +0000
+++ src/ubuntumirclient/desktopwindow.cpp 2016-07-05 12:48:24 +0000
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "desktopwindow.h"
18
19// local
20#include "logging.h"
21
22UbuntuDesktopWindow::UbuntuDesktopWindow(QWindow *window)
23 : QPlatformWindow(window)
24{
25 qCDebug(ubuntumirclient, "UbuntuDesktopWindow(window=%p)", window);
26}
027
=== added file 'src/ubuntumirclient/desktopwindow.h'
--- src/ubuntumirclient/desktopwindow.h 1970-01-01 00:00:00 +0000
+++ src/ubuntumirclient/desktopwindow.h 2016-07-05 12:48:24 +0000
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef UBUNTU_DESKTOP_WINDOW_H
18#define UBUNTU_DESKTOP_WINDOW_H
19
20#include <qpa/qplatformwindow.h>
21
22// TODO Implement it. For now it's just an empty, dummy class.
23class UbuntuDesktopWindow : public QPlatformWindow
24{
25public:
26 UbuntuDesktopWindow(QWindow*);
27};
28
29#endif // UBUNTU_DESKTOP_WINDOW_H
030
=== modified file 'src/ubuntumirclient/glcontext.cpp'
--- src/ubuntumirclient/glcontext.cpp 2016-07-05 12:48:23 +0000
+++ src/ubuntumirclient/glcontext.cpp 2016-07-05 12:48:24 +0000
@@ -16,7 +16,6 @@
1616
17#include "glcontext.h"17#include "glcontext.h"
18#include "logging.h"18#include "logging.h"
19#include "offscreensurface.h"
20#include "window.h"19#include "window.h"
2120
22#include <QOpenGLFramebufferObject>21#include <QOpenGLFramebufferObject>
@@ -74,25 +73,16 @@
74{73{
75 Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);74 Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
7675
77 if (surface->surface()->surfaceClass() == QSurface::Offscreen) {76 const bool ret = QEGLPlatformContext::makeCurrent(surface);
78 auto offscreen = static_cast<UbuntuOffscreenSurface *>(surface);77
79 if (!offscreen->buffer()) {78 if (Q_LIKELY(ret)) {
80 auto buffer = new QOpenGLFramebufferObject(surface->surface()->size());79 QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
81 offscreen->setBuffer(buffer);80 if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) {
82 }81 ctx_d->workaround_brokenFBOReadBack = true;
83 return offscreen->buffer()->bind();82 }
84 } else {
85 const bool ret = QEGLPlatformContext::makeCurrent(surface);
86
87 if (Q_LIKELY(ret)) {
88 QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
89 if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) {
90 ctx_d->workaround_brokenFBOReadBack = true;
91 }
92 }
93
94 return ret;
95 }83 }
84
85 return ret;
96}86}
9787
98// WORKAROUND for bug 1594198 - avoid having Qt use GLESv388// WORKAROUND for bug 1594198 - avoid having Qt use GLESv3
9989
=== modified file 'src/ubuntumirclient/integration.cpp'
--- src/ubuntumirclient/integration.cpp 2016-07-05 12:48:23 +0000
+++ src/ubuntumirclient/integration.cpp 2016-07-05 12:48:24 +0000
@@ -18,11 +18,11 @@
18#include "integration.h"18#include "integration.h"
19#include "backingstore.h"19#include "backingstore.h"
20#include "clipboard.h"20#include "clipboard.h"
21#include "desktopwindow.h"
21#include "glcontext.h"22#include "glcontext.h"
22#include "input.h"23#include "input.h"
23#include "logging.h"24#include "logging.h"
24#include "nativeinterface.h"25#include "nativeinterface.h"
25#include "offscreensurface.h"
26#include "screen.h"26#include "screen.h"
27#include "theme.h"27#include "theme.h"
28#include "window.h"28#include "window.h"
@@ -30,6 +30,7 @@
30// Qt30// Qt
31#include <QFileInfo>31#include <QFileInfo>
32#include <QGuiApplication>32#include <QGuiApplication>
33#include <private/qeglpbuffer_p.h>
33#include <qpa/qplatformnativeinterface.h>34#include <qpa/qplatformnativeinterface.h>
34#include <qpa/qplatforminputcontextfactory_p.h>35#include <qpa/qplatforminputcontextfactory_p.h>
35#include <qpa/qplatforminputcontext.h>36#include <qpa/qplatforminputcontext.h>
@@ -211,7 +212,12 @@
211212
212QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const213QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const
213{214{
214 return new UbuntuWindow(window, mClipboard, mInput, mNativeInterface, mEglDisplay, mMirConnection);215 if (window->type() == Qt::Desktop) {
216 // Desktop windows should not be backed up by a mir surface as they don't draw anything (nor should).
217 return new UbuntuDesktopWindow(window);
218 } else {
219 return new UbuntuWindow(window, mClipboard, mInput, mNativeInterface, mEglDisplay, mMirConnection);
220 }
215}221}
216222
217bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const223bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
@@ -235,6 +241,7 @@
235 }241 }
236 case MultipleWindows:242 case MultipleWindows:
237 case NonFullScreenWindows:243 case NonFullScreenWindows:
244 case RasterGLSurface:
238 return true;245 return true;
239 default:246 default:
240 return QPlatformIntegration::hasCapability(cap);247 return QPlatformIntegration::hasCapability(cap);
@@ -316,7 +323,7 @@
316QPlatformOffscreenSurface *UbuntuClientIntegration::createPlatformOffscreenSurface(323QPlatformOffscreenSurface *UbuntuClientIntegration::createPlatformOffscreenSurface(
317 QOffscreenSurface *surface) const324 QOffscreenSurface *surface) const
318{325{
319 return new UbuntuOffscreenSurface(surface);326 return new QEGLPbuffer(mEglDisplay, QSurfaceFormat::defaultFormat(), surface);
320}327}
321328
322void UbuntuClientIntegration::destroyScreen(UbuntuScreen *screen)329void UbuntuClientIntegration::destroyScreen(UbuntuScreen *screen)
323330
=== removed file 'src/ubuntumirclient/offscreensurface.cpp'
--- src/ubuntumirclient/offscreensurface.cpp 2016-01-04 17:18:51 +0000
+++ src/ubuntumirclient/offscreensurface.cpp 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "offscreensurface.h"
18
19#include <QOffscreenSurface>
20#include <QOpenGLFramebufferObject>
21
22UbuntuOffscreenSurface::UbuntuOffscreenSurface(QOffscreenSurface *offscreenSurface)
23 : QPlatformOffscreenSurface(offscreenSurface)
24 , m_buffer(nullptr)
25 , m_format(offscreenSurface->requestedFormat())
26{
27}
28
29QSurfaceFormat UbuntuOffscreenSurface::format() const
30{
31 return m_format;
32}
33
34bool UbuntuOffscreenSurface::isValid() const
35{
36 return m_buffer != nullptr && m_buffer->isValid();
37}
38
39QOpenGLFramebufferObject* UbuntuOffscreenSurface::buffer() const
40{
41 return m_buffer;
42}
43
44void UbuntuOffscreenSurface::setBuffer(QOpenGLFramebufferObject *buffer)
45{
46 m_buffer = buffer;
47}
480
=== removed file 'src/ubuntumirclient/offscreensurface.h'
--- src/ubuntumirclient/offscreensurface.h 2016-01-04 17:18:51 +0000
+++ src/ubuntumirclient/offscreensurface.h 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef UBUNTU_OFFSCREEN_SURFACE_H
18#define UBUNTU_OFFSCREEN_SURFACE_H
19
20#include <qpa/qplatformoffscreensurface.h>
21#include <QSurfaceFormat>
22
23class QOpenGLFramebufferObject;
24
25class UbuntuOffscreenSurface : public QPlatformOffscreenSurface
26{
27public:
28 UbuntuOffscreenSurface(QOffscreenSurface *offscreenSurface);
29
30 QSurfaceFormat format() const override;
31 bool isValid() const override;
32
33 QOpenGLFramebufferObject* buffer() const;
34 void setBuffer(QOpenGLFramebufferObject *buffer);
35
36private:
37 QOpenGLFramebufferObject *m_buffer;
38 QSurfaceFormat m_format;
39};
40
41#endif // UBUNTU_OFFSCREEN_SURFACE_H
420
=== modified file 'src/ubuntumirclient/ubuntumirclient.pro'
--- src/ubuntumirclient/ubuntumirclient.pro 2016-05-30 17:14:14 +0000
+++ src/ubuntumirclient/ubuntumirclient.pro 2016-07-05 12:48:24 +0000
@@ -18,11 +18,11 @@
18 backingstore.cpp \18 backingstore.cpp \
19 clipboard.cpp \19 clipboard.cpp \
20 cursor.cpp \20 cursor.cpp \
21 desktopwindow.cpp \
21 glcontext.cpp \22 glcontext.cpp \
22 input.cpp \23 input.cpp \
23 integration.cpp \24 integration.cpp \
24 nativeinterface.cpp \25 nativeinterface.cpp \
25 offscreensurface.cpp \
26 platformservices.cpp \26 platformservices.cpp \
27 plugin.cpp \27 plugin.cpp \
28 screen.cpp \28 screen.cpp \
@@ -34,12 +34,12 @@
34 backingstore.h \34 backingstore.h \
35 clipboard.h \35 clipboard.h \
36 cursor.h \36 cursor.h \
37 desktopwindow.h \
37 glcontext.h \38 glcontext.h \
38 input.h \39 input.h \
39 integration.h \40 integration.h \
40 logging.h \41 logging.h \
41 nativeinterface.h \42 nativeinterface.h \
42 offscreensurface.h \
43 orientationchangeevent_p.h \43 orientationchangeevent_p.h \
44 platformservices.h \44 platformservices.h \
45 plugin.h \45 plugin.h \

Subscribers

People subscribed via source and target branches