Merge lp:~unity-team/qtubuntu/revert-eglconvenience into lp:qtubuntu
- revert-eglconvenience
- Merge into trunk
Proposed by
Michał Sawicz
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Gerry Boland | ||||
Approved revision: | 327 | ||||
Merged at revision: | 327 | ||||
Proposed branch: | lp:~unity-team/qtubuntu/revert-eglconvenience | ||||
Merge into: | lp:qtubuntu | ||||
Diff against target: |
671 lines (+242/-163) 7 files modified
README (+7/-6) src/ubuntumirclient/glcontext.cpp (+165/-30) src/ubuntumirclient/glcontext.h (+19/-11) src/ubuntumirclient/integration.cpp (+25/-27) src/ubuntumirclient/integration.h (+4/-0) src/ubuntumirclient/window.cpp (+21/-86) src/ubuntumirclient/window.h (+1/-3) |
||||
To merge this branch: | bzr merge lp:~unity-team/qtubuntu/revert-eglconvenience | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Approve | |
Gerry Boland | Pending | ||
Review via email: mp+297880@code.launchpad.net |
Commit message
Revert r324 "EGL convenience"
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
N
* Did you perform an exploratory manual test run of your code change and any related functionality?
Y
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' | |||
2 | --- README 2016-05-30 17:14:14 +0000 | |||
3 | +++ README 2016-06-20 08:42:54 +0000 | |||
4 | @@ -23,10 +23,13 @@ | |||
5 | 23 | $ qmlscene -platform ubuntumirclient Foo.qml | 23 | $ qmlscene -platform ubuntumirclient Foo.qml |
6 | 24 | $ QT_QPA_PLATFORM=ubuntumirclient qmlscene Foo.qml | 24 | $ QT_QPA_PLATFORM=ubuntumirclient qmlscene Foo.qml |
7 | 25 | 25 | ||
12 | 26 | This QPA plugin exposes the following environment variables: | 26 | The QPA plugins expose the following environment variables: |
13 | 27 | 27 | ||
14 | 28 | QT_QPA_EGLFS_SWAPINTERVAL: Specifies the required swap interval as an | 28 | QTUBUNTU_SWAPINTERVAL: Specifies the required swap interval as an |
15 | 29 | integer. 1 by default. | 29 | integer. 1 by default. |
16 | 30 | |||
17 | 31 | QTUBUNTU_MULTISAMPLE: Enables multisampling with using 4 samples | ||
18 | 32 | per fragment. | ||
19 | 30 | 33 | ||
20 | 31 | QTUBUNTU_NO_THREADED_OPENGL: Disables QtQuick threaded OpenGL | 34 | QTUBUNTU_NO_THREADED_OPENGL: Disables QtQuick threaded OpenGL |
21 | 32 | rendering. | 35 | rendering. |
22 | @@ -48,8 +51,6 @@ | |||
23 | 48 | * ubuntumirclient.swapBuffers - Messages related to surface buffer swapping. | 51 | * ubuntumirclient.swapBuffers - Messages related to surface buffer swapping. |
24 | 49 | * ubuntumirclient - For all other messages. | 52 | * ubuntumirclient - For all other messages. |
25 | 50 | 53 | ||
26 | 51 | The QT_QPA_EGLFS_DEBUG environment variable prints a little more information | ||
27 | 52 | from Qt's internals. | ||
28 | 53 | 54 | ||
29 | 54 | 4. Building | 55 | 4. Building |
30 | 55 | ----------- | 56 | ----------- |
31 | 56 | 57 | ||
32 | === modified file 'src/ubuntumirclient/glcontext.cpp' | |||
33 | --- src/ubuntumirclient/glcontext.cpp 2016-06-03 09:55:43 +0000 | |||
34 | +++ src/ubuntumirclient/glcontext.cpp 2016-06-20 08:42:54 +0000 | |||
35 | @@ -25,12 +25,58 @@ | |||
36 | 25 | 25 | ||
37 | 26 | namespace { | 26 | namespace { |
38 | 27 | 27 | ||
41 | 28 | void printEglConfig(EGLDisplay display, EGLConfig config) | 28 | void printOpenGLESConfig() { |
42 | 29 | { | 29 | static bool once = true; |
43 | 30 | if (once) { | ||
44 | 31 | const char* string = (const char*) glGetString(GL_VENDOR); | ||
45 | 32 | qCDebug(ubuntumirclient, "OpenGL ES vendor: %s", string); | ||
46 | 33 | string = (const char*) glGetString(GL_RENDERER); | ||
47 | 34 | qCDebug(ubuntumirclient, "OpenGL ES renderer: %s", string); | ||
48 | 35 | string = (const char*) glGetString(GL_VERSION); | ||
49 | 36 | qCDebug(ubuntumirclient, "OpenGL ES version: %s", string); | ||
50 | 37 | string = (const char*) glGetString(GL_SHADING_LANGUAGE_VERSION); | ||
51 | 38 | qCDebug(ubuntumirclient, "OpenGL ES Shading Language version: %s", string); | ||
52 | 39 | string = (const char*) glGetString(GL_EXTENSIONS); | ||
53 | 40 | qCDebug(ubuntumirclient, "OpenGL ES extensions: %s", string); | ||
54 | 41 | once = false; | ||
55 | 42 | } | ||
56 | 43 | } | ||
57 | 44 | |||
58 | 45 | void printEglConfig(EGLDisplay display, EGLConfig config) { | ||
59 | 30 | Q_ASSERT(display != EGL_NO_DISPLAY); | 46 | Q_ASSERT(display != EGL_NO_DISPLAY); |
60 | 31 | Q_ASSERT(config != nullptr); | 47 | Q_ASSERT(config != nullptr); |
61 | 32 | 48 | ||
63 | 33 | const char *string = eglQueryString(display, EGL_VENDOR); | 49 | static const struct { const EGLint attrib; const char* name; } kAttribs[] = { |
64 | 50 | { EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE" }, | ||
65 | 51 | { EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE" }, | ||
66 | 52 | { EGL_BLUE_SIZE, "EGL_BLUE_SIZE" }, | ||
67 | 53 | { EGL_GREEN_SIZE, "EGL_GREEN_SIZE" }, | ||
68 | 54 | { EGL_RED_SIZE, "EGL_RED_SIZE" }, | ||
69 | 55 | { EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE" }, | ||
70 | 56 | { EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE" }, | ||
71 | 57 | { EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT" }, | ||
72 | 58 | { EGL_CONFIG_ID, "EGL_CONFIG_ID" }, | ||
73 | 59 | { EGL_LEVEL, "EGL_LEVEL" }, | ||
74 | 60 | { EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT" }, | ||
75 | 61 | { EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS" }, | ||
76 | 62 | { EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH" }, | ||
77 | 63 | { EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE" }, | ||
78 | 64 | { EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID" }, | ||
79 | 65 | { EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE" }, | ||
80 | 66 | { EGL_SAMPLES, "EGL_SAMPLES" }, | ||
81 | 67 | { EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS" }, | ||
82 | 68 | { EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE" }, | ||
83 | 69 | { EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE" }, | ||
84 | 70 | { EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE" }, | ||
85 | 71 | { EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE" }, | ||
86 | 72 | { EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE" }, | ||
87 | 73 | { EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB" }, | ||
88 | 74 | { EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA" }, | ||
89 | 75 | { EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL" }, | ||
90 | 76 | { EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL" }, | ||
91 | 77 | { -1, NULL } | ||
92 | 78 | }; | ||
93 | 79 | const char* string = eglQueryString(display, EGL_VENDOR); | ||
94 | 34 | qCDebug(ubuntumirclient, "EGL vendor: %s", string); | 80 | qCDebug(ubuntumirclient, "EGL vendor: %s", string); |
95 | 35 | 81 | ||
96 | 36 | string = eglQueryString(display, EGL_VERSION); | 82 | string = eglQueryString(display, EGL_VERSION); |
97 | @@ -39,19 +85,93 @@ | |||
98 | 39 | string = eglQueryString(display, EGL_EXTENSIONS); | 85 | string = eglQueryString(display, EGL_EXTENSIONS); |
99 | 40 | qCDebug(ubuntumirclient, "EGL extensions: %s", string); | 86 | qCDebug(ubuntumirclient, "EGL extensions: %s", string); |
100 | 41 | 87 | ||
103 | 42 | qCDebug(ubuntumirclient, "EGL configuration attributes:"); | 88 | qCDebug(ubuntumirclient, "EGL configuration attibutes:"); |
104 | 43 | q_printEglConfig(display, config); | 89 | for (int index = 0; kAttribs[index].attrib != -1; index++) { |
105 | 90 | EGLint value; | ||
106 | 91 | if (eglGetConfigAttrib(display, config, kAttribs[index].attrib, &value)) | ||
107 | 92 | qCDebug(ubuntumirclient, " %s: %d", kAttribs[index].name, static_cast<int>(value)); | ||
108 | 93 | } | ||
109 | 94 | } | ||
110 | 95 | |||
111 | 96 | QString eglErrorToString(EGLint errorNumber) | ||
112 | 97 | { | ||
113 | 98 | #define EGL_ERROR_CASE(error) case error: return QString(#error); | ||
114 | 99 | |||
115 | 100 | switch (errorNumber) { | ||
116 | 101 | EGL_ERROR_CASE(EGL_SUCCESS) | ||
117 | 102 | EGL_ERROR_CASE(EGL_NOT_INITIALIZED) | ||
118 | 103 | EGL_ERROR_CASE(EGL_BAD_ACCESS) | ||
119 | 104 | EGL_ERROR_CASE(EGL_BAD_ALLOC) | ||
120 | 105 | EGL_ERROR_CASE(EGL_BAD_ATTRIBUTE) | ||
121 | 106 | EGL_ERROR_CASE(EGL_BAD_CONTEXT) | ||
122 | 107 | EGL_ERROR_CASE(EGL_BAD_CONFIG) | ||
123 | 108 | EGL_ERROR_CASE(EGL_BAD_CURRENT_SURFACE) | ||
124 | 109 | EGL_ERROR_CASE(EGL_BAD_DISPLAY) | ||
125 | 110 | EGL_ERROR_CASE(EGL_BAD_SURFACE) | ||
126 | 111 | EGL_ERROR_CASE(EGL_BAD_MATCH) | ||
127 | 112 | EGL_ERROR_CASE(EGL_BAD_PARAMETER) | ||
128 | 113 | EGL_ERROR_CASE(EGL_BAD_NATIVE_PIXMAP) | ||
129 | 114 | EGL_ERROR_CASE(EGL_BAD_NATIVE_WINDOW) | ||
130 | 115 | EGL_ERROR_CASE(EGL_CONTEXT_LOST) | ||
131 | 116 | default: | ||
132 | 117 | return QString("?"); | ||
133 | 118 | } | ||
134 | 119 | |||
135 | 120 | #undef EGL_ERROR_CASE | ||
136 | 121 | } | ||
137 | 122 | |||
138 | 123 | EGLenum api_in_use() | ||
139 | 124 | { | ||
140 | 125 | #ifdef QTUBUNTU_USE_OPENGL | ||
141 | 126 | return EGL_OPENGL_API; | ||
142 | 127 | #else | ||
143 | 128 | return EGL_OPENGL_ES_API; | ||
144 | 129 | #endif | ||
145 | 130 | } | ||
146 | 131 | |||
147 | 132 | const int kSwapInterval = 1; | ||
148 | 133 | |||
149 | 134 | int qGetEnvIntValue(const char *varName, bool *ok) | ||
150 | 135 | { | ||
151 | 136 | return qgetenv(varName).toInt(ok); | ||
152 | 44 | } | 137 | } |
153 | 45 | 138 | ||
154 | 46 | } // anonymous namespace | 139 | } // anonymous namespace |
155 | 47 | 140 | ||
159 | 48 | UbuntuOpenGLContext::UbuntuOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, | 141 | UbuntuOpenGLContext::UbuntuOpenGLContext(const QSurfaceFormat &surfaceFormat, UbuntuOpenGLContext *share, |
160 | 49 | EGLDisplay display) | 142 | EGLDisplay display, EGLConfig config) |
161 | 50 | : QEGLPlatformContext(format, share, display, 0) | 143 | : mSurfaceFormat(surfaceFormat) |
162 | 144 | , mEglDisplay(display) | ||
163 | 51 | { | 145 | { |
164 | 146 | // Create an OpenGL ES 2 context. | ||
165 | 147 | QVector<EGLint> attribs; | ||
166 | 148 | attribs.append(EGL_CONTEXT_CLIENT_VERSION); | ||
167 | 149 | attribs.append(2); | ||
168 | 150 | attribs.append(EGL_NONE); | ||
169 | 151 | ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); | ||
170 | 152 | |||
171 | 52 | if (ubuntumirclient().isDebugEnabled()) { | 153 | if (ubuntumirclient().isDebugEnabled()) { |
173 | 53 | printEglConfig(display, eglConfig()); | 154 | printEglConfig(mEglDisplay, config); |
174 | 54 | } | 155 | } |
175 | 156 | |||
176 | 157 | // Set vblank swap interval. | ||
177 | 158 | bool ok; | ||
178 | 159 | int swapInterval = qGetEnvIntValue("QTUBUNTU_SWAPINTERVAL", &ok); | ||
179 | 160 | if (!ok) | ||
180 | 161 | swapInterval = kSwapInterval; | ||
181 | 162 | |||
182 | 163 | qCDebug(ubuntumirclient, "Setting swap interval to %d", swapInterval); | ||
183 | 164 | eglSwapInterval(mEglDisplay, swapInterval); | ||
184 | 165 | |||
185 | 166 | mEglContext = eglCreateContext(mEglDisplay, config, share ? share->eglContext() : EGL_NO_CONTEXT, | ||
186 | 167 | attribs.constData()); | ||
187 | 168 | |||
188 | 169 | Q_ASSERT(mEglContext != EGL_NO_CONTEXT); | ||
189 | 170 | } | ||
190 | 171 | |||
191 | 172 | UbuntuOpenGLContext::~UbuntuOpenGLContext() | ||
192 | 173 | { | ||
193 | 174 | ASSERT(eglDestroyContext(mEglDisplay, mEglContext) == EGL_TRUE); | ||
194 | 55 | } | 175 | } |
195 | 56 | 176 | ||
196 | 57 | static bool needsFBOReadBackWorkaround() | 177 | static bool needsFBOReadBackWorkaround() |
197 | @@ -59,7 +179,7 @@ | |||
198 | 59 | static bool set = false; | 179 | static bool set = false; |
199 | 60 | static bool needsWorkaround = false; | 180 | static bool needsWorkaround = false; |
200 | 61 | 181 | ||
202 | 62 | if (Q_UNLIKELY(!set)) { | 182 | if (!set) { |
203 | 63 | const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); | 183 | const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); |
204 | 64 | needsWorkaround = qstrncmp(rendererString, "Mali-400", 8) == 0 | 184 | needsWorkaround = qstrncmp(rendererString, "Mali-400", 8) == 0 |
205 | 65 | || qstrncmp(rendererString, "Mali-T7", 7) == 0 | 185 | || qstrncmp(rendererString, "Mali-T7", 7) == 0 |
206 | @@ -82,32 +202,47 @@ | |||
207 | 82 | } | 202 | } |
208 | 83 | return offscreen->buffer()->bind(); | 203 | return offscreen->buffer()->bind(); |
209 | 84 | } else { | 204 | } else { |
220 | 85 | const bool ret = QEGLPlatformContext::makeCurrent(surface); | 205 | EGLSurface eglSurface = static_cast<UbuntuWindow*>(surface)->eglSurface(); |
221 | 86 | 206 | ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); | |
222 | 87 | if (Q_LIKELY(ret)) { | 207 | |
223 | 88 | QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context()); | 208 | EGLBoolean result = eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext); |
224 | 89 | if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) { | 209 | if (result == EGL_FALSE) { |
225 | 90 | ctx_d->workaround_brokenFBOReadBack = true; | 210 | qCCritical(ubuntumirclient, "eglMakeCurrent() failed with %s", |
226 | 91 | } | 211 | qPrintable(eglErrorToString(eglGetError()))); |
227 | 92 | } | 212 | return false; |
228 | 93 | 213 | } | |
229 | 94 | return ret; | 214 | |
230 | 215 | QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context()); | ||
231 | 216 | if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround()) { | ||
232 | 217 | ctx_d->workaround_brokenFBOReadBack = true; | ||
233 | 218 | } | ||
234 | 219 | |||
235 | 220 | if (ubuntumirclient().isDebugEnabled()) { | ||
236 | 221 | printOpenGLESConfig(); | ||
237 | 222 | } | ||
238 | 223 | return true; | ||
239 | 95 | } | 224 | } |
240 | 96 | } | 225 | } |
241 | 97 | 226 | ||
245 | 98 | // Following method used internally in the base class QEGLPlatformContext to access | 227 | void UbuntuOpenGLContext::doneCurrent() |
243 | 99 | // the egl surface of a QPlatformSurface/UbuntuWindow | ||
244 | 100 | EGLSurface UbuntuOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) | ||
246 | 101 | { | 228 | { |
249 | 102 | auto ubuntuWindow = static_cast<UbuntuWindow *>(surface); | 229 | ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); |
250 | 103 | return ubuntuWindow->eglSurface(); | 230 | ASSERT(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_TRUE); |
251 | 104 | } | 231 | } |
252 | 105 | 232 | ||
254 | 106 | void UbuntuOpenGLContext::swapBuffers(QPlatformSurface *surface) | 233 | void UbuntuOpenGLContext::swapBuffers(QPlatformSurface* surface) |
255 | 107 | { | 234 | { |
260 | 108 | QEGLPlatformContext::swapBuffers(surface); | 235 | UbuntuWindow *ubuntuWindow = static_cast<UbuntuWindow*>(surface); |
261 | 109 | 236 | ||
262 | 110 | // notify window on swap completion | 237 | EGLSurface eglSurface = ubuntuWindow->eglSurface(); |
263 | 111 | auto ubuntuWindow = static_cast<UbuntuWindow *>(surface); | 238 | ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); |
264 | 239 | ASSERT(eglSwapBuffers(mEglDisplay, eglSurface) == EGL_TRUE); | ||
265 | 240 | |||
266 | 112 | ubuntuWindow->onSwapBuffersDone(); | 241 | ubuntuWindow->onSwapBuffersDone(); |
267 | 113 | } | 242 | } |
268 | 243 | |||
269 | 244 | void (*UbuntuOpenGLContext::getProcAddress(const QByteArray& procName)) () | ||
270 | 245 | { | ||
271 | 246 | ASSERT(eglBindAPI(api_in_use()) == EGL_TRUE); | ||
272 | 247 | return eglGetProcAddress(procName.constData()); | ||
273 | 248 | } | ||
274 | 114 | 249 | ||
275 | === modified file 'src/ubuntumirclient/glcontext.h' | |||
276 | --- src/ubuntumirclient/glcontext.h 2016-05-19 16:26:30 +0000 | |||
277 | +++ src/ubuntumirclient/glcontext.h 2016-06-20 08:42:54 +0000 | |||
278 | @@ -18,22 +18,30 @@ | |||
279 | 18 | #define UBUNTU_OPENGL_CONTEXT_H | 18 | #define UBUNTU_OPENGL_CONTEXT_H |
280 | 19 | 19 | ||
281 | 20 | #include <qpa/qplatformopenglcontext.h> | 20 | #include <qpa/qplatformopenglcontext.h> |
282 | 21 | #include <private/qeglplatformcontext_p.h> | ||
283 | 22 | 21 | ||
284 | 23 | #include <EGL/egl.h> | 22 | #include <EGL/egl.h> |
285 | 24 | 23 | ||
287 | 25 | class UbuntuOpenGLContext : public QEGLPlatformContext | 24 | class UbuntuOpenGLContext : public QPlatformOpenGLContext |
288 | 26 | { | 25 | { |
289 | 27 | public: | 26 | public: |
299 | 28 | UbuntuOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, | 27 | UbuntuOpenGLContext(const QSurfaceFormat &surfaceFormat, UbuntuOpenGLContext *share, |
300 | 29 | EGLDisplay display); | 28 | EGLDisplay display, EGLConfig config); |
301 | 30 | 29 | virtual ~UbuntuOpenGLContext(); | |
302 | 31 | // QEGLPlatformContext methods. | 30 | |
303 | 32 | void swapBuffers(QPlatformSurface *surface) final; | 31 | // QPlatformOpenGLContext methods. |
304 | 33 | bool makeCurrent(QPlatformSurface *surface) final; | 32 | QSurfaceFormat format() const override { return mSurfaceFormat; } |
305 | 34 | 33 | void swapBuffers(QPlatformSurface *surface) override; | |
306 | 35 | protected: | 34 | bool makeCurrent(QPlatformSurface *surface) override; |
307 | 36 | EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) final; | 35 | void doneCurrent() override; |
308 | 36 | bool isValid() const override { return mEglContext != EGL_NO_CONTEXT; } | ||
309 | 37 | void (*getProcAddress(const QByteArray& procName)) () override; | ||
310 | 38 | |||
311 | 39 | EGLContext eglContext() const { return mEglContext; } | ||
312 | 40 | |||
313 | 41 | private: | ||
314 | 42 | const QSurfaceFormat mSurfaceFormat; | ||
315 | 43 | EGLContext mEglContext; | ||
316 | 44 | EGLDisplay mEglDisplay; | ||
317 | 37 | }; | 45 | }; |
318 | 38 | 46 | ||
319 | 39 | #endif // UBUNTU_OPENGL_CONTEXT_H | 47 | #endif // UBUNTU_OPENGL_CONTEXT_H |
320 | 40 | 48 | ||
321 | === modified file 'src/ubuntumirclient/integration.cpp' | |||
322 | --- src/ubuntumirclient/integration.cpp 2016-06-14 08:33:49 +0000 | |||
323 | +++ src/ubuntumirclient/integration.cpp 2016-06-20 08:42:54 +0000 | |||
324 | @@ -30,6 +30,7 @@ | |||
325 | 30 | // Qt | 30 | // Qt |
326 | 31 | #include <QFileInfo> | 31 | #include <QFileInfo> |
327 | 32 | #include <QGuiApplication> | 32 | #include <QGuiApplication> |
328 | 33 | #include <private/qguiapplication_p.h> | ||
329 | 33 | #include <qpa/qplatformnativeinterface.h> | 34 | #include <qpa/qplatformnativeinterface.h> |
330 | 34 | #include <qpa/qplatforminputcontextfactory_p.h> | 35 | #include <qpa/qplatforminputcontextfactory_p.h> |
331 | 35 | #include <qpa/qplatforminputcontext.h> | 36 | #include <qpa/qplatforminputcontext.h> |
332 | @@ -94,17 +95,31 @@ | |||
333 | 94 | 95 | ||
334 | 95 | mMirConnection = u_application_instance_get_mir_connection(mInstance); | 96 | mMirConnection = u_application_instance_get_mir_connection(mInstance); |
335 | 96 | 97 | ||
336 | 97 | // Choose the default surface format suited to the Mir platform | ||
337 | 98 | QSurfaceFormat defaultFormat; | ||
338 | 99 | defaultFormat.setRedBufferSize(8); | ||
339 | 100 | defaultFormat.setGreenBufferSize(8); | ||
340 | 101 | defaultFormat.setBlueBufferSize(8); | ||
341 | 102 | QSurfaceFormat::setDefaultFormat(defaultFormat); | ||
342 | 103 | |||
343 | 104 | // Initialize EGL. | 98 | // Initialize EGL. |
344 | 99 | ASSERT(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE); | ||
345 | 100 | |||
346 | 105 | mEglNativeDisplay = mir_connection_get_egl_native_display(mMirConnection); | 101 | mEglNativeDisplay = mir_connection_get_egl_native_display(mMirConnection); |
347 | 106 | ASSERT((mEglDisplay = eglGetDisplay(mEglNativeDisplay)) != EGL_NO_DISPLAY); | 102 | ASSERT((mEglDisplay = eglGetDisplay(mEglNativeDisplay)) != EGL_NO_DISPLAY); |
348 | 107 | ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE); | 103 | ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE); |
349 | 104 | |||
350 | 105 | // Configure EGL buffers format for all Windows. | ||
351 | 106 | mSurfaceFormat.setRedBufferSize(8); | ||
352 | 107 | mSurfaceFormat.setGreenBufferSize(8); | ||
353 | 108 | mSurfaceFormat.setBlueBufferSize(8); | ||
354 | 109 | mSurfaceFormat.setAlphaBufferSize(8); | ||
355 | 110 | mSurfaceFormat.setDepthBufferSize(24); | ||
356 | 111 | mSurfaceFormat.setStencilBufferSize(8); | ||
357 | 112 | if (!qEnvironmentVariableIsEmpty("QTUBUNTU_MULTISAMPLE")) { | ||
358 | 113 | mSurfaceFormat.setSamples(4); | ||
359 | 114 | qCDebug(ubuntumirclient, "setting MSAA to 4 samples"); | ||
360 | 115 | } | ||
361 | 116 | #ifdef QTUBUNTU_USE_OPENGL | ||
362 | 117 | mSurfaceFormat.setRenderableType(QSurfaceFormat::OpenGL); | ||
363 | 118 | #else | ||
364 | 119 | mSurfaceFormat.setRenderableType(QSurfaceFormat::OpenGLES); | ||
365 | 120 | #endif | ||
366 | 121 | |||
367 | 122 | mEglConfig = q_configFromGLFormat(mEglDisplay, mSurfaceFormat, true); | ||
368 | 108 | } | 123 | } |
369 | 109 | 124 | ||
370 | 110 | void UbuntuClientIntegration::initialize() | 125 | void UbuntuClientIntegration::initialize() |
371 | @@ -211,7 +226,7 @@ | |||
372 | 211 | 226 | ||
373 | 212 | QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const | 227 | QPlatformWindow* UbuntuClientIntegration::createPlatformWindow(QWindow* window) const |
374 | 213 | { | 228 | { |
376 | 214 | return new UbuntuWindow(window, mClipboard, mInput, mNativeInterface, mEglDisplay, mMirConnection); | 229 | return new UbuntuWindow(window, mClipboard, mInput, mNativeInterface, mEglDisplay, mEglConfig, mMirConnection); |
377 | 215 | } | 230 | } |
378 | 216 | 231 | ||
379 | 217 | bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const | 232 | bool UbuntuClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const |
380 | @@ -254,25 +269,8 @@ | |||
381 | 254 | QPlatformOpenGLContext* UbuntuClientIntegration::createPlatformOpenGLContext( | 269 | QPlatformOpenGLContext* UbuntuClientIntegration::createPlatformOpenGLContext( |
382 | 255 | QOpenGLContext* context) const | 270 | QOpenGLContext* context) const |
383 | 256 | { | 271 | { |
403 | 257 | QSurfaceFormat format(context->format()); | 272 | return new UbuntuOpenGLContext(mSurfaceFormat, static_cast<UbuntuOpenGLContext*>(context->shareHandle()), |
404 | 258 | 273 | mEglDisplay, mEglConfig); | |
386 | 259 | auto platformContext = new UbuntuOpenGLContext(format, context->shareHandle(), mEglDisplay); | ||
387 | 260 | if (!platformContext->isValid()) { | ||
388 | 261 | // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default | ||
389 | 262 | // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a | ||
390 | 263 | // 1.4 context, but the XCB EGL backend tries to honour it, and fails. The 1.4 context appears to | ||
391 | 264 | // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default | ||
392 | 265 | // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455). | ||
393 | 266 | static const bool isMesa = QString(eglQueryString(mEglDisplay, EGL_VENDOR)).contains(QStringLiteral("Mesa")); | ||
394 | 267 | if (isMesa) { | ||
395 | 268 | qCDebug(ubuntumirclient, "Attempting to choose OpenGL 1.4 context which may suit Mesa"); | ||
396 | 269 | format.setMajorVersion(1); | ||
397 | 270 | format.setMinorVersion(4); | ||
398 | 271 | delete platformContext; | ||
399 | 272 | platformContext = new UbuntuOpenGLContext(format, context->shareHandle(), mEglDisplay); | ||
400 | 273 | } | ||
401 | 274 | } | ||
402 | 275 | return platformContext; | ||
405 | 276 | } | 274 | } |
406 | 277 | 275 | ||
407 | 278 | QStringList UbuntuClientIntegration::themeNames() const | 276 | QStringList UbuntuClientIntegration::themeNames() const |
408 | 279 | 277 | ||
409 | === modified file 'src/ubuntumirclient/integration.h' | |||
410 | --- src/ubuntumirclient/integration.h 2016-06-14 08:33:49 +0000 | |||
411 | +++ src/ubuntumirclient/integration.h 2016-06-20 08:42:54 +0000 | |||
412 | @@ -62,7 +62,9 @@ | |||
413 | 62 | 62 | ||
414 | 63 | // New methods. | 63 | // New methods. |
415 | 64 | MirConnection *mirConnection() const { return mMirConnection; } | 64 | MirConnection *mirConnection() const { return mMirConnection; } |
416 | 65 | QSurfaceFormat surfaceFormat() const { return mSurfaceFormat; } | ||
417 | 65 | EGLDisplay eglDisplay() const { return mEglDisplay; } | 66 | EGLDisplay eglDisplay() const { return mEglDisplay; } |
418 | 67 | EGLConfig eglConfig() const { return mEglConfig; } | ||
419 | 66 | EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; } | 68 | EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; } |
420 | 67 | UbuntuScreenObserver *screenObserver() const { return mScreenObserver.data(); } | 69 | UbuntuScreenObserver *screenObserver() const { return mScreenObserver.data(); } |
421 | 68 | 70 | ||
422 | @@ -95,7 +97,9 @@ | |||
423 | 95 | 97 | ||
424 | 96 | // EGL related | 98 | // EGL related |
425 | 97 | EGLDisplay mEglDisplay{EGL_NO_DISPLAY}; | 99 | EGLDisplay mEglDisplay{EGL_NO_DISPLAY}; |
426 | 100 | EGLConfig mEglConfig{nullptr}; | ||
427 | 98 | EGLNativeDisplayType mEglNativeDisplay; | 101 | EGLNativeDisplayType mEglNativeDisplay; |
428 | 102 | QSurfaceFormat mSurfaceFormat; | ||
429 | 99 | }; | 103 | }; |
430 | 100 | 104 | ||
431 | 101 | #endif // UBUNTU_CLIENT_INTEGRATION_H | 105 | #endif // UBUNTU_CLIENT_INTEGRATION_H |
432 | 102 | 106 | ||
433 | === modified file 'src/ubuntumirclient/window.cpp' | |||
434 | --- src/ubuntumirclient/window.cpp 2016-05-30 17:14:14 +0000 | |||
435 | +++ src/ubuntumirclient/window.cpp 2016-06-20 08:42:54 +0000 | |||
436 | @@ -29,7 +29,6 @@ | |||
437 | 29 | #include <QMutexLocker> | 29 | #include <QMutexLocker> |
438 | 30 | #include <QSize> | 30 | #include <QSize> |
439 | 31 | #include <QtMath> | 31 | #include <QtMath> |
440 | 32 | #include <private/qeglconvenience_p.h> | ||
441 | 33 | 32 | ||
442 | 34 | // Platform API | 33 | // Platform API |
443 | 35 | #include <ubuntu/application/instance.h> | 34 | #include <ubuntu/application/instance.h> |
444 | @@ -102,24 +101,6 @@ | |||
445 | 102 | } | 101 | } |
446 | 103 | } | 102 | } |
447 | 104 | 103 | ||
448 | 105 | const char *mirPixelFormatToStr(MirPixelFormat pixelFormat) | ||
449 | 106 | { | ||
450 | 107 | switch (pixelFormat) { | ||
451 | 108 | case mir_pixel_format_invalid: return "invalid"; | ||
452 | 109 | case mir_pixel_format_abgr_8888: return "ABGR8888"; | ||
453 | 110 | case mir_pixel_format_xbgr_8888: return "XBGR8888"; | ||
454 | 111 | case mir_pixel_format_argb_8888: return "ARGB8888"; | ||
455 | 112 | case mir_pixel_format_xrgb_8888: return "XRGB8888"; | ||
456 | 113 | case mir_pixel_format_bgr_888: return "BGR888"; | ||
457 | 114 | case mir_pixel_format_rgb_888: return "RGB888"; | ||
458 | 115 | case mir_pixel_format_rgb_565: return "RGB565"; | ||
459 | 116 | case mir_pixel_format_rgba_5551: return "RGBA5551"; | ||
460 | 117 | case mir_pixel_format_rgba_4444: return "RGBA4444"; | ||
461 | 118 | case mir_pixel_formats: | ||
462 | 119 | default: return "???"; | ||
463 | 120 | } | ||
464 | 121 | } | ||
465 | 122 | |||
466 | 123 | MirSurfaceState qtWindowStateToMirSurfaceState(Qt::WindowState state) | 104 | MirSurfaceState qtWindowStateToMirSurfaceState(Qt::WindowState state) |
467 | 124 | { | 105 | { |
468 | 125 | switch (state) { | 106 | switch (state) { |
469 | @@ -143,6 +124,14 @@ | |||
470 | 143 | return id++; | 124 | return id++; |
471 | 144 | } | 125 | } |
472 | 145 | 126 | ||
473 | 127 | MirPixelFormat defaultPixelFormatFor(MirConnection *connection) | ||
474 | 128 | { | ||
475 | 129 | MirPixelFormat format; | ||
476 | 130 | unsigned int nformats; | ||
477 | 131 | mir_connection_get_available_surface_formats(connection, &format, 1, &nformats); | ||
478 | 132 | return format; | ||
479 | 133 | } | ||
480 | 134 | |||
481 | 146 | UAUiWindowRole roleFor(QWindow *window) | 135 | UAUiWindowRole roleFor(QWindow *window) |
482 | 147 | { | 136 | { |
483 | 148 | QVariant roleVariant = window->property("role"); | 137 | QVariant roleVariant = window->property("role"); |
484 | @@ -162,11 +151,12 @@ | |||
485 | 162 | return parent ? static_cast<UbuntuWindow *>(parent->handle()) : nullptr; | 151 | return parent ? static_cast<UbuntuWindow *>(parent->handle()) : nullptr; |
486 | 163 | } | 152 | } |
487 | 164 | 153 | ||
489 | 165 | Spec makeSurfaceSpec(QWindow *window, UbuntuInput *input, MirPixelFormat pixelFormat, MirConnection *connection) | 154 | Spec makeSurfaceSpec(QWindow *window, UbuntuInput *input, MirConnection *connection) |
490 | 166 | { | 155 | { |
491 | 167 | const auto geom = window->geometry(); | 156 | const auto geom = window->geometry(); |
492 | 168 | const int width = geom.width() > 0 ? geom.width() : 1; | 157 | const int width = geom.width() > 0 ? geom.width() : 1; |
493 | 169 | const int height = geom.height() > 0 ? geom.height() : 1; | 158 | const int height = geom.height() > 0 ? geom.height() : 1; |
494 | 159 | const auto pixelFormat = defaultPixelFormatFor(connection); | ||
495 | 170 | 160 | ||
496 | 171 | if (U_ON_SCREEN_KEYBOARD_ROLE == roleFor(window)) { | 161 | if (U_ON_SCREEN_KEYBOARD_ROLE == roleFor(window)) { |
497 | 172 | qCDebug(ubuntumirclient, "makeSurfaceSpec(window=%p) - creating input method surface (width=%d, height=%d", window, width, height); | 162 | qCDebug(ubuntumirclient, "makeSurfaceSpec(window=%p) - creating input method surface (width=%d, height=%d", window, width, height); |
498 | @@ -227,11 +217,11 @@ | |||
499 | 227 | } | 217 | } |
500 | 228 | } | 218 | } |
501 | 229 | 219 | ||
503 | 230 | MirSurface *createMirSurface(QWindow *window, int mirOutputId, UbuntuInput *input, MirPixelFormat pixelFormat, | 220 | MirSurface *createMirSurface(QWindow *window, int mirOutputId, UbuntuInput *input, |
504 | 231 | MirConnection *connection, mir_surface_event_callback inputCallback, | 221 | MirConnection *connection, mir_surface_event_callback inputCallback, |
505 | 232 | void* inputContext) | 222 | void* inputContext) |
506 | 233 | { | 223 | { |
508 | 234 | auto spec = makeSurfaceSpec(window, input, pixelFormat, connection); | 224 | auto spec = makeSurfaceSpec(window, input, connection); |
509 | 235 | 225 | ||
510 | 236 | // Install event handler as early as possible | 226 | // Install event handler as early as possible |
511 | 237 | mir_surface_spec_set_event_handler(spec.get(), inputCallback, inputContext); | 227 | mir_surface_spec_set_event_handler(spec.get(), inputCallback, inputContext); |
512 | @@ -254,18 +244,6 @@ | |||
513 | 254 | return surface; | 244 | return surface; |
514 | 255 | } | 245 | } |
515 | 256 | 246 | ||
516 | 257 | MirPixelFormat disableAlphaBufferIfPossible(MirPixelFormat pixelFormat) | ||
517 | 258 | { | ||
518 | 259 | switch(pixelFormat) { | ||
519 | 260 | case mir_pixel_format_abgr_8888: | ||
520 | 261 | return mir_pixel_format_xbgr_8888; | ||
521 | 262 | case mir_pixel_format_argb_8888: | ||
522 | 263 | return mir_pixel_format_xrgb_8888; | ||
523 | 264 | default: // can do nothing, leave it alone | ||
524 | 265 | return pixelFormat; | ||
525 | 266 | } | ||
526 | 267 | } | ||
527 | 268 | |||
528 | 269 | // FIXME - in order to work around https://bugs.launchpad.net/mir/+bug/1346633 | 247 | // FIXME - in order to work around https://bugs.launchpad.net/mir/+bug/1346633 |
529 | 270 | // we need to guess the panel height (3GU) | 248 | // we need to guess the panel height (3GU) |
530 | 271 | int panelHeight() | 249 | int panelHeight() |
531 | @@ -288,7 +266,8 @@ | |||
532 | 288 | class UbuntuSurface | 266 | class UbuntuSurface |
533 | 289 | { | 267 | { |
534 | 290 | public: | 268 | public: |
536 | 291 | UbuntuSurface(UbuntuWindow *platformWindow, EGLDisplay display, UbuntuInput *input, MirConnection *connection) | 269 | UbuntuSurface(UbuntuWindow *platformWindow, EGLDisplay display, EGLConfig config, int mirOutputId, |
537 | 270 | UbuntuInput *input, MirConnection *connection) | ||
538 | 292 | : mWindow(platformWindow->window()) | 271 | : mWindow(platformWindow->window()) |
539 | 293 | , mPlatformWindow(platformWindow) | 272 | , mPlatformWindow(platformWindow) |
540 | 294 | , mInput(input) | 273 | , mInput(input) |
541 | @@ -296,44 +275,9 @@ | |||
542 | 296 | , mEglDisplay(display) | 275 | , mEglDisplay(display) |
543 | 297 | , mNeedsRepaint(false) | 276 | , mNeedsRepaint(false) |
544 | 298 | , mParented(mWindow->transientParent() || mWindow->parent()) | 277 | , mParented(mWindow->transientParent() || mWindow->parent()) |
545 | 299 | , mFormat(mWindow->requestedFormat()) | ||
546 | 300 | , mShellChrome(mWindow->flags() & LowChromeWindowHint ? mir_shell_chrome_low : mir_shell_chrome_normal) | 278 | , mShellChrome(mWindow->flags() & LowChromeWindowHint ? mir_shell_chrome_low : mir_shell_chrome_normal) |
547 | 301 | { | 279 | { |
583 | 302 | // Have Qt choose most suitable EGLConfig for the requested surface format, and update format to reflect it | 280 | mMirSurface = createMirSurface(mWindow, mirOutputId, input, connection, surfaceEventCallback, this); |
549 | 303 | EGLConfig config = q_configFromGLFormat(display, mFormat, true); | ||
550 | 304 | if (config == 0) { | ||
551 | 305 | // Older Intel Atom-based devices only support OpenGL 1.4 compatibility profile but by default | ||
552 | 306 | // QML asks for at least OpenGL 2.0. The XCB GLX backend ignores this request and returns a | ||
553 | 307 | // 1.4 context, but the XCB EGL backend tries to honour it, and fails. The 1.4 context appears to | ||
554 | 308 | // have sufficient capabilities on MESA (i915) to render correctly however. So reduce the default | ||
555 | 309 | // requested OpenGL version to 1.0 to ensure EGL will give us a working context (lp:1549455). | ||
556 | 310 | static const bool isMesa = QString(eglQueryString(display, EGL_VENDOR)).contains(QStringLiteral("Mesa")); | ||
557 | 311 | if (isMesa) { | ||
558 | 312 | qCDebug(ubuntumirclient, "Attempting to choose OpenGL 1.4 context which may suit Mesa"); | ||
559 | 313 | mFormat.setMajorVersion(1); | ||
560 | 314 | mFormat.setMinorVersion(4); | ||
561 | 315 | config = q_configFromGLFormat(display, mFormat, true); | ||
562 | 316 | } | ||
563 | 317 | } | ||
564 | 318 | if (config == 0) { | ||
565 | 319 | qCritical() << "Qt failed to choose a suitable EGLConfig to suit the surface format" << mFormat; | ||
566 | 320 | } | ||
567 | 321 | |||
568 | 322 | mFormat = q_glFormatFromConfig(display, config, mFormat); | ||
569 | 323 | |||
570 | 324 | // Have Mir decide the pixel format most suited to the chosen EGLConfig. This is the only way | ||
571 | 325 | // Mir will know what EGLConfig has been chosen - it cannot deduce it from the buffers. | ||
572 | 326 | auto pixelFormat = mir_connection_get_egl_pixel_format(connection, display, config); | ||
573 | 327 | // But the chosen EGLConfig might have an alpha buffer enabled, even if not requested by the client. | ||
574 | 328 | // If that's the case, try to edit the chosen pixel format in order to disable the alpha buffer. | ||
575 | 329 | // This is an optimisation for the compositor, as it can avoid blending this surface. | ||
576 | 330 | if (mWindow->requestedFormat().alphaBufferSize() < 0) { | ||
577 | 331 | pixelFormat = disableAlphaBufferIfPossible(pixelFormat); | ||
578 | 332 | } | ||
579 | 333 | |||
580 | 334 | const auto outputId = static_cast<UbuntuScreen *>(mWindow->screen()->handle())->mirOutputId(); | ||
581 | 335 | |||
582 | 336 | mMirSurface = createMirSurface(mWindow, outputId, input, pixelFormat, connection, surfaceEventCallback, this); | ||
584 | 337 | mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirSurface), nullptr); | 281 | mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirSurface), nullptr); |
585 | 338 | 282 | ||
586 | 339 | // Window manager can give us a final size different from what we asked for | 283 | // Window manager can give us a final size different from what we asked for |
587 | @@ -355,11 +299,8 @@ | |||
588 | 355 | platformWindow->QPlatformWindow::setGeometry(geom); | 299 | platformWindow->QPlatformWindow::setGeometry(geom); |
589 | 356 | QWindowSystemInterface::handleGeometryChange(mWindow, geom); | 300 | QWindowSystemInterface::handleGeometryChange(mWindow, geom); |
590 | 357 | 301 | ||
596 | 358 | qCDebug(ubuntumirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title() | 302 | qCDebug(ubuntumirclient, "created surface at (%d, %d) with size (%d, %d), title '%s', role: '%d'\n", |
597 | 359 | << "role:" << roleFor(mWindow) | 303 | geom.x(), geom.y(), geom.width(), geom.height(), mWindow->title().toUtf8().constData(), roleFor(mWindow)); |
593 | 360 | << "\nRequested format:" << mWindow->requestedFormat() | ||
594 | 361 | << "\nActual format:" << mFormat | ||
595 | 362 | << "with associated Mir pixel format:" << mirPixelFormatToStr(pixelFormat); | ||
598 | 363 | } | 304 | } |
599 | 364 | 305 | ||
600 | 365 | ~UbuntuSurface() | 306 | ~UbuntuSurface() |
601 | @@ -394,8 +335,6 @@ | |||
602 | 394 | void setSurfaceParent(MirSurface*); | 335 | void setSurfaceParent(MirSurface*); |
603 | 395 | bool hasParent() const { return mParented; } | 336 | bool hasParent() const { return mParented; } |
604 | 396 | 337 | ||
605 | 397 | QSurfaceFormat format() const { return mFormat; } | ||
606 | 398 | |||
607 | 399 | private: | 338 | private: |
608 | 400 | static void surfaceEventCallback(MirSurface* surface, const MirEvent *event, void* context); | 339 | static void surfaceEventCallback(MirSurface* surface, const MirEvent *event, void* context); |
609 | 401 | void postEvent(const MirEvent *event); | 340 | void postEvent(const MirEvent *event); |
610 | @@ -412,7 +351,6 @@ | |||
611 | 412 | bool mNeedsRepaint; | 351 | bool mNeedsRepaint; |
612 | 413 | bool mParented; | 352 | bool mParented; |
613 | 414 | QSize mBufferSize; | 353 | QSize mBufferSize; |
614 | 415 | QSurfaceFormat mFormat; | ||
615 | 416 | 354 | ||
616 | 417 | QMutex mTargetSizeMutex; | 355 | QMutex mTargetSizeMutex; |
617 | 418 | QSize mTargetSize; | 356 | QSize mTargetSize; |
618 | @@ -571,7 +509,8 @@ | |||
619 | 571 | } | 509 | } |
620 | 572 | 510 | ||
621 | 573 | UbuntuWindow::UbuntuWindow(QWindow *w, const QSharedPointer<UbuntuClipboard> &clipboard, | 511 | UbuntuWindow::UbuntuWindow(QWindow *w, const QSharedPointer<UbuntuClipboard> &clipboard, |
623 | 574 | UbuntuInput *input, UbuntuNativeInterface *native, EGLDisplay eglDisplay, MirConnection *mirConnection) | 512 | UbuntuInput *input, UbuntuNativeInterface *native, EGLDisplay eglDisplay, |
624 | 513 | EGLConfig eglConfig, MirConnection *mirConnection) | ||
625 | 575 | : QObject(nullptr) | 514 | : QObject(nullptr) |
626 | 576 | , QPlatformWindow(w) | 515 | , QPlatformWindow(w) |
627 | 577 | , mId(makeId()) | 516 | , mId(makeId()) |
628 | @@ -581,7 +520,8 @@ | |||
629 | 581 | , mWindowVisible(false) | 520 | , mWindowVisible(false) |
630 | 582 | , mWindowExposed(true) | 521 | , mWindowExposed(true) |
631 | 583 | , mNativeInterface(native) | 522 | , mNativeInterface(native) |
633 | 584 | , mSurface(new UbuntuSurface{this, eglDisplay, input, mirConnection}) | 523 | , mSurface(new UbuntuSurface{this, eglDisplay, eglConfig, |
634 | 524 | static_cast<UbuntuScreen*>(w->screen()->handle())->mirOutputId(), input, mirConnection}) | ||
635 | 585 | , mScale(1.0) | 525 | , mScale(1.0) |
636 | 586 | , mFormFactor(mir_form_factor_unknown) | 526 | , mFormFactor(mir_form_factor_unknown) |
637 | 587 | { | 527 | { |
638 | @@ -769,11 +709,6 @@ | |||
639 | 769 | return mWindowVisible && mWindowExposed; | 709 | return mWindowVisible && mWindowExposed; |
640 | 770 | } | 710 | } |
641 | 771 | 711 | ||
642 | 772 | QSurfaceFormat UbuntuWindow::format() const | ||
643 | 773 | { | ||
644 | 774 | return mSurface->format(); | ||
645 | 775 | } | ||
646 | 776 | |||
647 | 777 | void* UbuntuWindow::eglSurface() const | 712 | void* UbuntuWindow::eglSurface() const |
648 | 778 | { | 713 | { |
649 | 779 | return mSurface->eglSurface(); | 714 | return mSurface->eglSurface(); |
650 | 780 | 715 | ||
651 | === modified file 'src/ubuntumirclient/window.h' | |||
652 | --- src/ubuntumirclient/window.h 2016-05-11 18:59:46 +0000 | |||
653 | +++ src/ubuntumirclient/window.h 2016-06-20 08:42:54 +0000 | |||
654 | @@ -40,7 +40,7 @@ | |||
655 | 40 | Q_OBJECT | 40 | Q_OBJECT |
656 | 41 | public: | 41 | public: |
657 | 42 | UbuntuWindow(QWindow *w, const QSharedPointer<UbuntuClipboard> &clipboard, | 42 | UbuntuWindow(QWindow *w, const QSharedPointer<UbuntuClipboard> &clipboard, |
659 | 43 | UbuntuInput *input, UbuntuNativeInterface* native, EGLDisplay eglDisplay, | 43 | UbuntuInput *input, UbuntuNativeInterface* native, EGLDisplay eglDisplay, EGLConfig eglConfig, |
660 | 44 | MirConnection *mirConnection); | 44 | MirConnection *mirConnection); |
661 | 45 | virtual ~UbuntuWindow(); | 45 | virtual ~UbuntuWindow(); |
662 | 46 | 46 | ||
663 | @@ -54,8 +54,6 @@ | |||
664 | 54 | void propagateSizeHints() override; | 54 | void propagateSizeHints() override; |
665 | 55 | bool isExposed() const override; | 55 | bool isExposed() const override; |
666 | 56 | 56 | ||
667 | 57 | QSurfaceFormat format() const override; | ||
668 | 58 | |||
669 | 59 | // Additional Window properties exposed by NativeInterface | 57 | // Additional Window properties exposed by NativeInterface |
670 | 60 | MirFormFactor formFactor() const { return mFormFactor; } | 58 | MirFormFactor formFactor() const { return mFormFactor; } |
671 | 61 | float scale() const { return mScale; } | 59 | float scale() const { return mScale; } |
PASSED: Continuous integration, rev:327 /unity8- jenkins. ubuntu. com/job/ lp-qtubuntu- ci/82/ /unity8- jenkins. ubuntu. com/job/ build/2060 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/2088 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1999 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1999 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 1999 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1990/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 1990 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 1990/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-qtubuntu- ci/82/rebuild
https:/