Merge lp:~nick-dedekind/qtubuntu/lp1596524.use-pbuffers into lp:qtubuntu

Proposed by Nick Dedekind
Status: Merged
Approved by: Gerry Boland
Approved revision: 341
Merged at revision: 343
Proposed branch: lp:~nick-dedekind/qtubuntu/lp1596524.use-pbuffers
Merge into: lp:qtubuntu
Diff against target: 224 lines (+22/-116)
5 files modified
src/ubuntumirclient/glcontext.cpp (+19/-24)
src/ubuntumirclient/integration.cpp (+3/-2)
src/ubuntumirclient/offscreensurface.cpp (+0/-47)
src/ubuntumirclient/offscreensurface.h (+0/-41)
src/ubuntumirclient/ubuntumirclient.pro (+0/-2)
To merge this branch: bzr merge lp:~nick-dedekind/qtubuntu/lp1596524.use-pbuffers
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+303151@code.launchpad.net

Commit message

Use pbuffer for offscreen surfaces.

Description of the change

Use pbuffer for offscreen surfaces.

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

+ return static_cast<QEGLPbuffer *>(surface)->pbuffer();
bad indent

Revision history for this message
Gerry Boland (gerboland) wrote :

+ if (surface->surface()->surfaceClass() == QSurface::Window)
+ return static_cast<UbuntuWindow *>(surface)->eglSurface();
+ else {
+ return static_cast<QEGLPbuffer *>(surface)->pbuffer();
+ }
and you're mixing & matching brace/no-brace style. Braces please

review: Needs Fixing
340. By Nick Dedekind

fixed coding style

341. By Nick Dedekind

added check for surface type

Revision history for this message
Gerry Boland (gerboland) :
review: Approve (code)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:339
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/105/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2583
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2611
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2491
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2491
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2491
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2485/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2485
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2485/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:341
https://unity8-jenkins.ubuntu.com/job/lp-qtubuntu-ci/106/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2587
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2615
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2493
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2493
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2493
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2487/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Just tested on arale running rc-proposed, this appears to fix the issue I’m describing at https://bugs.launchpad.net/ubuntu/+source/webbrowser-app/+bug/1596524/comments/3.

Revision history for this message
Gerry Boland (gerboland) wrote :

I've tested this with my mako, flo, arale, krillin and desktop. No adverse behaviour detected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntumirclient/glcontext.cpp'
2--- src/ubuntumirclient/glcontext.cpp 2016-08-09 23:00:32 +0000
3+++ src/ubuntumirclient/glcontext.cpp 2016-08-17 15:32:47 +0000
4@@ -16,11 +16,11 @@
5
6 #include "glcontext.h"
7 #include "logging.h"
8-#include "offscreensurface.h"
9 #include "window.h"
10
11 #include <QOpenGLFramebufferObject>
12 #include <QtPlatformSupport/private/qeglconvenience_p.h>
13+#include <QtPlatformSupport/private/qeglpbuffer_p.h>
14 #include <QtGui/private/qopenglcontext_p.h>
15
16 Q_LOGGING_CATEGORY(ubuntumirclientGraphics, "ubuntumirclient.graphics", QtWarningMsg)
17@@ -76,40 +76,35 @@
18 {
19 Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
20
21- if (surface->surface()->surfaceClass() == QSurface::Offscreen) {
22- auto offscreen = static_cast<UbuntuOffscreenSurface *>(surface);
23- if (!offscreen->buffer()) {
24- auto buffer = new QOpenGLFramebufferObject(surface->surface()->size());
25- offscreen->setBuffer(buffer);
26- }
27- return offscreen->buffer()->bind();
28- } else {
29- const bool ret = QEGLPlatformContext::makeCurrent(surface);
30-
31- if (Q_LIKELY(ret)) {
32- QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
33- if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) {
34- ctx_d->workaround_brokenFBOReadBack = true;
35- }
36- }
37-
38- return ret;
39+ const bool ret = QEGLPlatformContext::makeCurrent(surface);
40+
41+ if (Q_LIKELY(ret)) {
42+ QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
43+ if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) {
44+ ctx_d->workaround_brokenFBOReadBack = true;
45+ }
46 }
47+ return ret;
48 }
49
50 // Following method used internally in the base class QEGLPlatformContext to access
51 // the egl surface of a QPlatformSurface/UbuntuWindow
52 EGLSurface UbuntuOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
53 {
54- auto ubuntuWindow = static_cast<UbuntuWindow *>(surface);
55- return ubuntuWindow->eglSurface();
56+ if (surface->surface()->surfaceClass() == QSurface::Window) {
57+ return static_cast<UbuntuWindow *>(surface)->eglSurface();
58+ } else {
59+ return static_cast<QEGLPbuffer *>(surface)->pbuffer();
60+ }
61 }
62
63 void UbuntuOpenGLContext::swapBuffers(QPlatformSurface *surface)
64 {
65 QEGLPlatformContext::swapBuffers(surface);
66
67- // notify window on swap completion
68- auto ubuntuWindow = static_cast<UbuntuWindow *>(surface);
69- ubuntuWindow->onSwapBuffersDone();
70+ if (surface->surface()->surfaceClass() == QSurface::Window) {
71+ // notify window on swap completion
72+ auto ubuntuWindow = static_cast<UbuntuWindow *>(surface);
73+ ubuntuWindow->onSwapBuffersDone();
74+ }
75 }
76
77=== modified file 'src/ubuntumirclient/integration.cpp'
78--- src/ubuntumirclient/integration.cpp 2016-06-22 17:07:57 +0000
79+++ src/ubuntumirclient/integration.cpp 2016-08-17 15:32:47 +0000
80@@ -22,7 +22,6 @@
81 #include "input.h"
82 #include "logging.h"
83 #include "nativeinterface.h"
84-#include "offscreensurface.h"
85 #include "screen.h"
86 #include "theme.h"
87 #include "window.h"
88@@ -36,7 +35,9 @@
89 #include <QtPlatformSupport/private/qeglconvenience_p.h>
90 #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
91 #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
92+#include <QtPlatformSupport/private/qeglpbuffer_p.h>
93 #include <QOpenGLContext>
94+#include <QOffscreenSurface>
95
96 // platform-api
97 #include <ubuntu/application/lifecycle_delegate.h>
98@@ -316,7 +317,7 @@
99 QPlatformOffscreenSurface *UbuntuClientIntegration::createPlatformOffscreenSurface(
100 QOffscreenSurface *surface) const
101 {
102- return new UbuntuOffscreenSurface(surface);
103+ return new QEGLPbuffer(mEglDisplay, surface->requestedFormat(), surface);
104 }
105
106 void UbuntuClientIntegration::destroyScreen(UbuntuScreen *screen)
107
108=== removed file 'src/ubuntumirclient/offscreensurface.cpp'
109--- src/ubuntumirclient/offscreensurface.cpp 2016-01-04 17:18:51 +0000
110+++ src/ubuntumirclient/offscreensurface.cpp 1970-01-01 00:00:00 +0000
111@@ -1,47 +0,0 @@
112-/*
113- * Copyright (C) 2016 Canonical, Ltd.
114- *
115- * This program is free software: you can redistribute it and/or modify it under
116- * the terms of the GNU Lesser General Public License version 3, as published by
117- * the Free Software Foundation.
118- *
119- * This program is distributed in the hope that it will be useful, but WITHOUT
120- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
121- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
122- * Lesser General Public License for more details.
123- *
124- * You should have received a copy of the GNU Lesser General Public License
125- * along with this program. If not, see <http://www.gnu.org/licenses/>.
126- */
127-
128-#include "offscreensurface.h"
129-
130-#include <QOffscreenSurface>
131-#include <QOpenGLFramebufferObject>
132-
133-UbuntuOffscreenSurface::UbuntuOffscreenSurface(QOffscreenSurface *offscreenSurface)
134- : QPlatformOffscreenSurface(offscreenSurface)
135- , m_buffer(nullptr)
136- , m_format(offscreenSurface->requestedFormat())
137-{
138-}
139-
140-QSurfaceFormat UbuntuOffscreenSurface::format() const
141-{
142- return m_format;
143-}
144-
145-bool UbuntuOffscreenSurface::isValid() const
146-{
147- return m_buffer != nullptr && m_buffer->isValid();
148-}
149-
150-QOpenGLFramebufferObject* UbuntuOffscreenSurface::buffer() const
151-{
152- return m_buffer;
153-}
154-
155-void UbuntuOffscreenSurface::setBuffer(QOpenGLFramebufferObject *buffer)
156-{
157- m_buffer = buffer;
158-}
159
160=== removed file 'src/ubuntumirclient/offscreensurface.h'
161--- src/ubuntumirclient/offscreensurface.h 2016-01-04 17:18:51 +0000
162+++ src/ubuntumirclient/offscreensurface.h 1970-01-01 00:00:00 +0000
163@@ -1,41 +0,0 @@
164-/*
165- * Copyright (C) 2016 Canonical, Ltd.
166- *
167- * This program is free software: you can redistribute it and/or modify it under
168- * the terms of the GNU Lesser General Public License version 3, as published by
169- * the Free Software Foundation.
170- *
171- * This program is distributed in the hope that it will be useful, but WITHOUT
172- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
173- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
174- * Lesser General Public License for more details.
175- *
176- * You should have received a copy of the GNU Lesser General Public License
177- * along with this program. If not, see <http://www.gnu.org/licenses/>.
178- */
179-
180-#ifndef UBUNTU_OFFSCREEN_SURFACE_H
181-#define UBUNTU_OFFSCREEN_SURFACE_H
182-
183-#include <qpa/qplatformoffscreensurface.h>
184-#include <QSurfaceFormat>
185-
186-class QOpenGLFramebufferObject;
187-
188-class UbuntuOffscreenSurface : public QPlatformOffscreenSurface
189-{
190-public:
191- UbuntuOffscreenSurface(QOffscreenSurface *offscreenSurface);
192-
193- QSurfaceFormat format() const override;
194- bool isValid() const override;
195-
196- QOpenGLFramebufferObject* buffer() const;
197- void setBuffer(QOpenGLFramebufferObject *buffer);
198-
199-private:
200- QOpenGLFramebufferObject *m_buffer;
201- QSurfaceFormat m_format;
202-};
203-
204-#endif // UBUNTU_OFFSCREEN_SURFACE_H
205
206=== modified file 'src/ubuntumirclient/ubuntumirclient.pro'
207--- src/ubuntumirclient/ubuntumirclient.pro 2016-05-30 17:14:14 +0000
208+++ src/ubuntumirclient/ubuntumirclient.pro 2016-08-17 15:32:47 +0000
209@@ -22,7 +22,6 @@
210 input.cpp \
211 integration.cpp \
212 nativeinterface.cpp \
213- offscreensurface.cpp \
214 platformservices.cpp \
215 plugin.cpp \
216 screen.cpp \
217@@ -39,7 +38,6 @@
218 integration.h \
219 logging.h \
220 nativeinterface.h \
221- offscreensurface.h \
222 orientationchangeevent_p.h \
223 platformservices.h \
224 plugin.h \

Subscribers

People subscribed via source and target branches