Merge lp:~albaguirre/qtubuntu/use-mir-rs-api into lp:qtubuntu
- use-mir-rs-api
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~albaguirre/qtubuntu/use-mir-rs-api |
Merge into: | lp:qtubuntu |
Diff against target: |
592 lines (+154/-188) 7 files modified
debian/control (+3/-4) src/ubuntumirclient/qmirclientcursor.cpp (+68/-25) src/ubuntumirclient/qmirclientinput.cpp (+0/-4) src/ubuntumirclient/qmirclientintegration.cpp (+1/-2) src/ubuntumirclient/qmirclientintegration.h (+1/-2) src/ubuntumirclient/qmirclientwindow.cpp (+80/-150) src/ubuntumirclient/ubuntumirclient.pro (+1/-1) |
To merge this branch: | bzr merge lp:~albaguirre/qtubuntu/use-mir-rs-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Needs Fixing | |
Gerry Boland (community) | Needs Information | ||
Alan Griffiths | Needs Information | ||
Review via email: mp+321627@code.launchpad.net |
Commit message
Avoid use of deprecated mir EGL related apis.
With the new mesa update, the EGLNativeDispla
Ignore deprecation warnings on use of MirRenderSurface - its "deprecated" because it'll be renamed in mir 1.0.
Description of the change
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Alan Griffiths (alan-griffiths) wrote : | # |
This would be nicely simplified by lp:~alan-griffiths/mir/deprecation-macros plus -DMIR_DEPRECATE
Alan Griffiths (alan-griffiths) wrote : | # |
Looks mostly sensible, but I need to get more familiar with qtubuntu to be sure.
Can we aim to land lp:~alan-griffiths/mir/deprecation-macros and use -DMIR_DEPRECATE
Gerry Boland (gerboland) wrote : | # |
I have a question about how pixel formats work with the newer Mir API. I see you've removed code where Qt could set a desired pixel format on the mir surface - is this feature impossible to replicate?
This was done because sometimes the EGL config chosen may have an alpha buffer enabled, even if Qt doesn't need it. We used the mir pixel format to inform the Mir compositor that blending is not required in that case - a nice optimisation.
Gerry Boland (gerboland) wrote : | # |
I agree with Alan that using his deprecation bits would be nice, but I'd be ok with landing this in the current state if we need this to land first.
Alan Griffiths (alan-griffiths) wrote : | # |
> I have a question about how pixel formats work with the newer Mir API. I see
> you've removed code where Qt could set a desired pixel format on the mir
> surface - is this feature impossible to replicate?
Mir currently has "Window" and "RenderSurface" but not "surface". I assume you mean "RenderSurface"?
> This was done because sometimes the EGL config chosen may have an alpha buffer
> enabled, even if Qt doesn't need it. We used the mir pixel format to inform
> the Mir compositor that blending is not required in that case - a nice
> optimisation.
I don't see that in the RS code, but I'm still learning my way around it.
Gerry Boland (gerboland) wrote : | # |
And the obvious question: can we jump to using non-deprecated APIs in one go?
Alan Griffiths (alan-griffiths) wrote : | # |
> And the obvious question: can we jump to using non-deprecated APIs in one go?
It depends.
The reason for the current situation being that we can't introduce the intended "surface" APIs until we delete the current ones.
The RS APIs are a temporary workaround to enable the "surface" functionality without a name clash.
If we decide not to rename MirRenderSurface => MirSurface in 1.0 we can just remove the deprecation of render surface.
Gerry Boland (gerboland) wrote : | # |
+ // Assume that the buffer size matches the surface size at creation time
I'd rather not make that assumption. Does the new API loose this functionality?
Gerry Boland (gerboland) wrote : | # |
+bool UbuntuSurface:
+{
+ return mNeedsRepaint;
This can totally go away AFAICS, since this changes the buffer "ownership" drastically. Before when we got a surface resize event, we had to keep swapping buffers until we got one sized at the new size - so we had to keep force repainting until that happened. Now since Qt owns the buffer, it can resize immediately.
Removing all the needsRepaint stuff also makes resizing smoother IMO in my tests here.
Gerry Boland (gerboland) wrote : | # |
overall looks ok, I just
- miss the pixel format optimisation
- would ultimately like to remove any deprecated api use (but not necessarily in this MP)
Alberto Aguirre (albaguirre) wrote : | # |
> I have a question about how pixel formats work with the newer Mir API. I see
> you've removed code where Qt could set a desired pixel format on the mir
> surface - is this feature impossible to replicate?
>
> This was done because sometimes the EGL config chosen may have an alpha buffer
> enabled, even if Qt doesn't need it. We used the mir pixel format to inform
> the Mir compositor that blending is not required in that case - a nice
> optimisation.
The pixel format for EGL rendering is now set through the chosen EGLConfig. The new mir mesa path will actually obey the pixel format selected.
If you want to use mir_pixel_format enums, you can specify a EGL_NATIVE_
Alberto Aguirre (albaguirre) wrote : | # |
> + // Assume that the buffer size matches the surface size at creation time
> I'd rather not make that assumption. Does the new API loose this
> functionality?
If the size chosen by the server is changed, it now gets delivered as a resize event as long as the event handler was registered through the window spec. This means that the same resizing logic is applied.
I tested this slightly by using the fullscreen window manager option in mir's demo server.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:396
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alberto Aguirre (albaguirre) wrote : | # |
> overall looks ok, I just
> - miss the pixel format optimisation
I'll look into that, I should just be able to use EGL_NATIVE_
Alberto Aguirre (albaguirre) wrote : | # |
> Looks mostly sensible, but I need to get more familiar with qtubuntu to be
> sure.
>
> Can we aim to land lp:~alan-griffiths/mir/deprecation-macros and use
> -DMIR_DEPRECATE
Shouldn't be an issue on a local machine, but qtubuntu's CI would be.
- 397. By Alberto Aguirre
-
Cleanup #pragmas and unneeded repaints when resizing.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:397
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
- 397. By Alberto Aguirre
-
Cleanup #pragmas and unneeded repaints when resizing.
- 396. By Alberto Aguirre
-
Avoid using mir_window_
get_parameters, it will be deprecated - 395. By Alberto Aguirre
-
Remove mir_event_type_key and mir_event_
type_motion as they are deprecated. - 394. By Alberto Aguirre
-
Use MirRenderSurface for pixmap cursors.
Creating buffer streams directly will be deprecated in mir in the near future, instead use render surfaces.
- 393. By Alberto Aguirre
-
Update resizing now that client can drive the buffer size through mir_render_
surface_ set_size. - 392. By Alberto Aguirre
-
Avoid use of deprecated mir EGL related apis.
With the new mesa update, the EGLNativeDispla
yType is MirConnection and the EGLNativeWindowType is a MirRenderSurface.
Ignore deprecation warnings on use of MirRenderSurface - its "deprecated" because it'll be renamed in mir 1.0.
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2017-01-10 06:41:48 +0000 | |||
3 | +++ debian/control 2017-05-27 01:33:26 +0000 | |||
4 | @@ -4,14 +4,13 @@ | |||
5 | 4 | Build-Depends: debhelper (>= 9), | 4 | Build-Depends: debhelper (>= 9), |
6 | 5 | libatspi2.0-dev, | 5 | libatspi2.0-dev, |
7 | 6 | libcontent-hub-dev (>= 0.2), | 6 | libcontent-hub-dev (>= 0.2), |
9 | 7 | libegl1-mesa-dev, | 7 | libegl1-mesa-dev (>= 17.0.2), |
10 | 8 | libfontconfig1-dev, | 8 | libfontconfig1-dev, |
11 | 9 | libfreetype6-dev, | 9 | libfreetype6-dev, |
13 | 10 | libgles2-mesa-dev, | 10 | libgles2-mesa-dev (>= 17.0.2), |
14 | 11 | libglib2.0-dev, | 11 | libglib2.0-dev, |
15 | 12 | libinput-dev, | 12 | libinput-dev, |
18 | 13 | libmirclient-dev (>= 0.25.0), | 13 | libmirclient-dev (>= 0.26.1), |
17 | 14 | libmirclient-debug-extension-dev, | ||
19 | 15 | libmtdev-dev, | 14 | libmtdev-dev, |
20 | 16 | libubuntu-application-api-dev (>= 2.9.0), | 15 | libubuntu-application-api-dev (>= 2.9.0), |
21 | 17 | libudev-dev, | 16 | libudev-dev, |
22 | 18 | 17 | ||
23 | === modified file 'src/ubuntumirclient/qmirclientcursor.cpp' | |||
24 | --- src/ubuntumirclient/qmirclientcursor.cpp 2017-03-28 17:12:13 +0000 | |||
25 | +++ src/ubuntumirclient/qmirclientcursor.cpp 2017-05-27 01:33:26 +0000 | |||
26 | @@ -138,11 +138,17 @@ | |||
27 | 138 | { | 138 | { |
28 | 139 | public: | 139 | public: |
29 | 140 | CursorWindowSpec(MirConnection *connection, const char *name) | 140 | CursorWindowSpec(MirConnection *connection, const char *name) |
31 | 141 | : spec(mir_create_window_spec(connection)) | 141 | : CursorWindowSpec(connection) |
32 | 142 | { | 142 | { |
33 | 143 | mir_window_spec_set_cursor_name(spec, name); | 143 | mir_window_spec_set_cursor_name(spec, name); |
34 | 144 | } | 144 | } |
35 | 145 | 145 | ||
36 | 146 | CursorWindowSpec(MirConnection *connection, MirRenderSurface *surface, int hotspotX, int hotspotY) | ||
37 | 147 | : CursorWindowSpec(connection) | ||
38 | 148 | { | ||
39 | 149 | mir_window_spec_set_cursor_render_surface(spec, surface, hotspotX, hotspotY); | ||
40 | 150 | } | ||
41 | 151 | |||
42 | 146 | ~CursorWindowSpec() | 152 | ~CursorWindowSpec() |
43 | 147 | { | 153 | { |
44 | 148 | mir_window_spec_release(spec); | 154 | mir_window_spec_release(spec); |
45 | @@ -153,8 +159,60 @@ | |||
46 | 153 | mir_window_apply_spec(window, spec); | 159 | mir_window_apply_spec(window, spec); |
47 | 154 | } | 160 | } |
48 | 155 | private: | 161 | private: |
49 | 162 | CursorWindowSpec(MirConnection *connection) : spec(mir_create_window_spec(connection)) {} | ||
50 | 156 | MirWindowSpec * const spec; | 163 | MirWindowSpec * const spec; |
51 | 157 | }; | 164 | }; |
52 | 165 | |||
53 | 166 | class BufferStream | ||
54 | 167 | { | ||
55 | 168 | public: | ||
56 | 169 | BufferStream(MirRenderSurface *surface, int width, int height) | ||
57 | 170 | : stream(mir_render_surface_get_buffer_stream(surface, width, height, mir_pixel_format_argb_8888)) | ||
58 | 171 | { | ||
59 | 172 | } | ||
60 | 173 | |||
61 | 174 | void draw(QImage const& image) | ||
62 | 175 | { | ||
63 | 176 | MirGraphicsRegion region; | ||
64 | 177 | const bool validRegion = mir_buffer_stream_get_graphics_region(stream, ®ion); | ||
65 | 178 | if (!validRegion) | ||
66 | 179 | throw std::runtime_error("Could not get graphics region to draw into"); | ||
67 | 180 | |||
68 | 181 | auto regionLine = region.vaddr; | ||
69 | 182 | Q_ASSERT(image.bytesPerLine() <= region.stride); | ||
70 | 183 | |||
71 | 184 | for (int i = 0; i < image.height(); ++i) { | ||
72 | 185 | memcpy(regionLine, image.scanLine(i), image.bytesPerLine()); | ||
73 | 186 | regionLine += region.stride; | ||
74 | 187 | } | ||
75 | 188 | mir_buffer_stream_swap_buffers_sync(stream); | ||
76 | 189 | } | ||
77 | 190 | |||
78 | 191 | private: | ||
79 | 192 | MirBufferStream * const stream; | ||
80 | 193 | }; | ||
81 | 194 | |||
82 | 195 | class RenderSurface | ||
83 | 196 | { | ||
84 | 197 | public: | ||
85 | 198 | RenderSurface(MirConnection *connection, int width, int height) | ||
86 | 199 | : surface(mir_connection_create_render_surface_sync(connection, width, height)), | ||
87 | 200 | stream(surface, width, height) | ||
88 | 201 | { | ||
89 | 202 | if (!mir_render_surface_is_valid(surface)) { | ||
90 | 203 | throw std::runtime_error(mir_render_surface_get_error_message(surface)); | ||
91 | 204 | } | ||
92 | 205 | } | ||
93 | 206 | |||
94 | 207 | ~RenderSurface() { mir_render_surface_release(surface); } | ||
95 | 208 | operator MirRenderSurface *() const { return surface; } | ||
96 | 209 | void draw(QImage const& image) { stream.draw(image); } | ||
97 | 210 | |||
98 | 211 | private: | ||
99 | 212 | MirRenderSurface * const surface; | ||
100 | 213 | BufferStream stream; | ||
101 | 214 | }; | ||
102 | 215 | |||
103 | 158 | } // anonymous namespace | 216 | } // anonymous namespace |
104 | 159 | 217 | ||
105 | 160 | void QMirClientCursor::changeCursor(QCursor *windowCursor, QWindow *window) | 218 | void QMirClientCursor::changeCursor(QCursor *windowCursor, QWindow *window) |
106 | @@ -196,30 +254,15 @@ | |||
107 | 196 | image = image.convertToFormat(QImage::Format_ARGB32); | 254 | image = image.convertToFormat(QImage::Format_ARGB32); |
108 | 197 | } | 255 | } |
109 | 198 | 256 | ||
134 | 199 | MirBufferStream *bufferStream = mir_connection_create_buffer_stream_sync(mConnection, | 257 | try { |
135 | 200 | image.width(), image.height(), mir_pixel_format_argb_8888, mir_buffer_usage_software); | 258 | RenderSurface surface(mConnection, image.width(), image.height()); |
136 | 201 | 259 | surface.draw(image); | |
137 | 202 | { | 260 | |
138 | 203 | MirGraphicsRegion region; | 261 | CursorWindowSpec spec(mConnection, surface, cursor.hotSpot().x(), cursor.hotSpot().y()); |
139 | 204 | mir_buffer_stream_get_graphics_region(bufferStream, ®ion); | 262 | spec.apply(window); |
140 | 205 | 263 | } catch(std::exception const& e) { | |
141 | 206 | char *regionLine = region.vaddr; | 264 | qWarning("Error applying pixmap cursor: %s", e.what()); |
142 | 207 | Q_ASSERT(image.bytesPerLine() <= region.stride); | 265 | } |
119 | 208 | for (int i = 0; i < image.height(); ++i) { | ||
120 | 209 | memcpy(regionLine, image.scanLine(i), image.bytesPerLine()); | ||
121 | 210 | regionLine += region.stride; | ||
122 | 211 | } | ||
123 | 212 | } | ||
124 | 213 | |||
125 | 214 | mir_buffer_stream_swap_buffers_sync(bufferStream); | ||
126 | 215 | |||
127 | 216 | { | ||
128 | 217 | auto configuration = mir_cursor_configuration_from_buffer_stream(bufferStream, cursor.hotSpot().x(), cursor.hotSpot().y()); | ||
129 | 218 | mir_window_configure_cursor(window, configuration); | ||
130 | 219 | mir_cursor_configuration_destroy(configuration); | ||
131 | 220 | } | ||
132 | 221 | |||
133 | 222 | mir_buffer_stream_release_sync(bufferStream); | ||
143 | 223 | } | 266 | } |
144 | 224 | 267 | ||
145 | 225 | void QMirClientCursor::applyDefaultCursorConfiguration(MirWindow *window) | 268 | void QMirClientCursor::applyDefaultCursorConfiguration(MirWindow *window) |
146 | 226 | 269 | ||
147 | === modified file 'src/ubuntumirclient/qmirclientinput.cpp' | |||
148 | --- src/ubuntumirclient/qmirclientinput.cpp 2017-02-21 18:24:45 +0000 | |||
149 | +++ src/ubuntumirclient/qmirclientinput.cpp 2017-05-27 01:33:26 +0000 | |||
150 | @@ -232,10 +232,6 @@ | |||
151 | 232 | { | 232 | { |
152 | 233 | switch (t) | 233 | switch (t) |
153 | 234 | { | 234 | { |
154 | 235 | case mir_event_type_key: | ||
155 | 236 | return "key"; | ||
156 | 237 | case mir_event_type_motion: | ||
157 | 238 | return "motion"; | ||
158 | 239 | case mir_event_type_window: | 235 | case mir_event_type_window: |
159 | 240 | return "window"; | 236 | return "window"; |
160 | 241 | case mir_event_type_resize: | 237 | case mir_event_type_resize: |
161 | 242 | 238 | ||
162 | === modified file 'src/ubuntumirclient/qmirclientintegration.cpp' | |||
163 | --- src/ubuntumirclient/qmirclientintegration.cpp 2017-04-04 00:46:48 +0000 | |||
164 | +++ src/ubuntumirclient/qmirclientintegration.cpp 2017-05-27 01:33:26 +0000 | |||
165 | @@ -130,8 +130,7 @@ | |||
166 | 130 | QSurfaceFormat::setDefaultFormat(defaultFormat); | 130 | QSurfaceFormat::setDefaultFormat(defaultFormat); |
167 | 131 | 131 | ||
168 | 132 | // Initialize EGL. | 132 | // Initialize EGL. |
171 | 133 | mEglNativeDisplay = mir_connection_get_egl_native_display(mMirConnection); | 133 | ASSERT((mEglDisplay = eglGetDisplay(mMirConnection)) != EGL_NO_DISPLAY); |
170 | 134 | ASSERT((mEglDisplay = eglGetDisplay(mEglNativeDisplay)) != EGL_NO_DISPLAY); | ||
172 | 135 | ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE); | 134 | ASSERT(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_TRUE); |
173 | 136 | 135 | ||
174 | 137 | // Has debug mode been requsted, either with "-testability" switch or QT_LOAD_TESTABILITY env var | 136 | // Has debug mode been requsted, either with "-testability" switch or QT_LOAD_TESTABILITY env var |
175 | 138 | 137 | ||
176 | === modified file 'src/ubuntumirclient/qmirclientintegration.h' | |||
177 | --- src/ubuntumirclient/qmirclientintegration.h 2017-03-15 09:21:47 +0000 | |||
178 | +++ src/ubuntumirclient/qmirclientintegration.h 2017-05-27 01:33:26 +0000 | |||
179 | @@ -89,7 +89,7 @@ | |||
180 | 89 | // New methods. | 89 | // New methods. |
181 | 90 | MirConnection *mirConnection() const { return mMirConnection; } | 90 | MirConnection *mirConnection() const { return mMirConnection; } |
182 | 91 | EGLDisplay eglDisplay() const { return mEglDisplay; } | 91 | EGLDisplay eglDisplay() const { return mEglDisplay; } |
184 | 92 | EGLNativeDisplayType eglNativeDisplay() const { return mEglNativeDisplay; } | 92 | EGLNativeDisplayType eglNativeDisplay() const { return mMirConnection; } |
185 | 93 | QMirClientAppStateController *appStateController() const { return mAppStateController.data(); } | 93 | QMirClientAppStateController *appStateController() const { return mAppStateController.data(); } |
186 | 94 | QMirClientScreenObserver *screenObserver() const { return mScreenObserver.data(); } | 94 | QMirClientScreenObserver *screenObserver() const { return mScreenObserver.data(); } |
187 | 95 | QMirClientDebugExtension *debugExtension() const { return mDebugExtension.data(); } | 95 | QMirClientDebugExtension *debugExtension() const { return mDebugExtension.data(); } |
188 | @@ -125,7 +125,6 @@ | |||
189 | 125 | 125 | ||
190 | 126 | // EGL related | 126 | // EGL related |
191 | 127 | EGLDisplay mEglDisplay{EGL_NO_DISPLAY}; | 127 | EGLDisplay mEglDisplay{EGL_NO_DISPLAY}; |
192 | 128 | EGLNativeDisplayType mEglNativeDisplay; | ||
193 | 129 | }; | 128 | }; |
194 | 130 | 129 | ||
195 | 131 | #endif // QMIRCLIENTINTEGRATION_H | 130 | #endif // QMIRCLIENTINTEGRATION_H |
196 | 132 | 131 | ||
197 | === modified file 'src/ubuntumirclient/qmirclientwindow.cpp' | |||
198 | --- src/ubuntumirclient/qmirclientwindow.cpp 2017-03-28 17:12:13 +0000 | |||
199 | +++ src/ubuntumirclient/qmirclientwindow.cpp 2017-05-27 01:33:26 +0000 | |||
200 | @@ -75,12 +75,6 @@ | |||
201 | 75 | 75 | ||
202 | 76 | using Spec = std::unique_ptr<MirWindowSpec, MirSpecDeleter>; | 76 | using Spec = std::unique_ptr<MirWindowSpec, MirSpecDeleter>; |
203 | 77 | 77 | ||
204 | 78 | EGLNativeWindowType nativeWindowFor(MirWindow *surf) | ||
205 | 79 | { | ||
206 | 80 | auto stream = mir_window_get_buffer_stream(surf); | ||
207 | 81 | return reinterpret_cast<EGLNativeWindowType>(mir_buffer_stream_get_egl_native_window(stream)); | ||
208 | 82 | } | ||
209 | 83 | |||
210 | 84 | const char *qtWindowStateToStr(Qt::WindowState state) | 78 | const char *qtWindowStateToStr(Qt::WindowState state) |
211 | 85 | { | 79 | { |
212 | 86 | switch (state) { | 80 | switch (state) { |
213 | @@ -114,24 +108,6 @@ | |||
214 | 114 | Q_UNREACHABLE(); | 108 | Q_UNREACHABLE(); |
215 | 115 | } | 109 | } |
216 | 116 | 110 | ||
217 | 117 | const char *mirPixelFormatToStr(MirPixelFormat pixelFormat) | ||
218 | 118 | { | ||
219 | 119 | switch (pixelFormat) { | ||
220 | 120 | case mir_pixel_format_invalid: return "invalid"; | ||
221 | 121 | case mir_pixel_format_abgr_8888: return "ABGR8888"; | ||
222 | 122 | case mir_pixel_format_xbgr_8888: return "XBGR8888"; | ||
223 | 123 | case mir_pixel_format_argb_8888: return "ARGB8888"; | ||
224 | 124 | case mir_pixel_format_xrgb_8888: return "XRGB8888"; | ||
225 | 125 | case mir_pixel_format_bgr_888: return "BGR888"; | ||
226 | 126 | case mir_pixel_format_rgb_888: return "RGB888"; | ||
227 | 127 | case mir_pixel_format_rgb_565: return "RGB565"; | ||
228 | 128 | case mir_pixel_format_rgba_5551: return "RGBA5551"; | ||
229 | 129 | case mir_pixel_format_rgba_4444: return "RGBA4444"; | ||
230 | 130 | case mir_pixel_formats: Q_UNREACHABLE(); | ||
231 | 131 | } | ||
232 | 132 | Q_UNREACHABLE(); | ||
233 | 133 | } | ||
234 | 134 | |||
235 | 135 | const char *mirWindowTypeToStr(MirWindowType type) | 111 | const char *mirWindowTypeToStr(MirWindowType type) |
236 | 136 | { | 112 | { |
237 | 137 | switch (type) { | 113 | switch (type) { |
238 | @@ -221,12 +197,23 @@ | |||
239 | 221 | return requiresParent(qtWindowTypeToMirWindowType(type)); | 197 | return requiresParent(qtWindowTypeToMirWindowType(type)); |
240 | 222 | } | 198 | } |
241 | 223 | 199 | ||
248 | 224 | Spec makeSurfaceSpec(QWindow *window, MirPixelFormat pixelFormat, QMirClientWindow *parentWindowHandle, | 200 | QRect geometryFor(QWindow *window) |
249 | 225 | MirConnection *connection) | 201 | { |
250 | 226 | { | 202 | auto geometry = window->geometry(); |
251 | 227 | const auto geometry = window->geometry(); | 203 | if (geometry.width() < 1) |
252 | 228 | const int width = geometry.width() > 0 ? geometry.width() : 1; | 204 | geometry.setWidth(1); |
253 | 229 | const int height = geometry.height() > 0 ? geometry.height() : 1; | 205 | if (geometry.height() < 1) |
254 | 206 | geometry.setHeight(1); | ||
255 | 207 | |||
256 | 208 | return geometry; | ||
257 | 209 | } | ||
258 | 210 | |||
259 | 211 | Spec makeWindowSpec(QWindow *window, QMirClientWindow *parentWindowHandle, | ||
260 | 212 | MirRenderSurface *surface, MirConnection *connection) | ||
261 | 213 | { | ||
262 | 214 | const auto geometry = geometryFor(window); | ||
263 | 215 | const int width = geometry.width(); | ||
264 | 216 | const int height = geometry.height(); | ||
265 | 230 | auto type = qtWindowTypeToMirWindowType(window->type()); | 217 | auto type = qtWindowTypeToMirWindowType(window->type()); |
266 | 231 | 218 | ||
267 | 232 | MirRectangle location{geometry.x(), geometry.y(), 0, 0}; | 219 | MirRectangle location{geometry.x(), geometry.y(), 0, 0}; |
268 | @@ -272,7 +259,6 @@ | |||
269 | 272 | // There's no helper function for satellite windows. Guess they're not very popular | 259 | // There's no helper function for satellite windows. Guess they're not very popular |
270 | 273 | spec = Spec{mir_create_window_spec(connection)}; | 260 | spec = Spec{mir_create_window_spec(connection)}; |
271 | 274 | mir_window_spec_set_type(spec.get(), mir_window_type_satellite); | 261 | mir_window_spec_set_type(spec.get(), mir_window_type_satellite); |
272 | 275 | mir_window_spec_set_buffer_usage(spec.get(), mir_buffer_usage_hardware); | ||
273 | 276 | mir_window_spec_set_parent(spec.get(), parent); | 262 | mir_window_spec_set_parent(spec.get(), parent); |
274 | 277 | mir_window_spec_set_width(spec.get(), width); | 263 | mir_window_spec_set_width(spec.get(), width); |
275 | 278 | mir_window_spec_set_height(spec.get(), height); | 264 | mir_window_spec_set_height(spec.get(), height); |
276 | @@ -282,9 +268,9 @@ | |||
277 | 282 | break; | 268 | break; |
278 | 283 | } | 269 | } |
279 | 284 | 270 | ||
281 | 285 | mir_window_spec_set_pixel_format(spec.get(), pixelFormat); | 271 | mir_window_spec_add_render_surface(spec.get(), surface, width, height, 0, 0); |
282 | 286 | 272 | ||
284 | 287 | qCDebug(mirclient, "makeSurfaceSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)", | 273 | qCDebug(mirclient, "makeWindowSpec(window=%p): %s spec (type=0x%x, position=(%d, %d)px, size=(%dx%d)px)", |
285 | 288 | window, mirWindowTypeToStr(type), window->type(), location.left, location.top, width, height); | 274 | window, mirWindowTypeToStr(type), window->type(), location.left, location.top, width, height); |
286 | 289 | 275 | ||
287 | 290 | return spec; | 276 | return spec; |
288 | @@ -331,14 +317,29 @@ | |||
289 | 331 | mir_window_spec_set_input_shape(spec, rects, count); | 317 | mir_window_spec_set_input_shape(spec, rects, count); |
290 | 332 | } | 318 | } |
291 | 333 | 319 | ||
292 | 320 | MirRenderSurface *createMirSurface(QWindow *window, MirConnection *connection) | ||
293 | 321 | { | ||
294 | 322 | const auto geometry = geometryFor(window); | ||
295 | 323 | const int width = geometry.width(); | ||
296 | 324 | const int height = geometry.height(); | ||
297 | 325 | |||
298 | 326 | auto surface = mir_connection_create_render_surface_sync(connection, width, height); | ||
299 | 327 | if (!mir_render_surface_is_valid(surface)) | ||
300 | 328 | { | ||
301 | 329 | auto errorMsg = mir_render_surface_get_error_message(surface); | ||
302 | 330 | qFatal("Failed to create mir surface: %s", errorMsg); | ||
303 | 331 | } | ||
304 | 332 | return surface; | ||
305 | 333 | } | ||
306 | 334 | |||
307 | 334 | MirWindow *createMirWindow(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle, | 335 | MirWindow *createMirWindow(QWindow *window, int mirOutputId, QMirClientWindow *parentWindowHandle, |
310 | 335 | MirPixelFormat pixelFormat, MirConnection *connection, | 336 | MirRenderSurface *surface, MirConnection *connection, |
311 | 336 | MirWindowEventCallback inputCallback, void *inputContext) | 337 | MirWindowEventCallback eventCallback, void *context) |
312 | 337 | { | 338 | { |
314 | 338 | auto spec = makeSurfaceSpec(window, pixelFormat, parentWindowHandle, connection); | 339 | auto spec = makeWindowSpec(window, parentWindowHandle, surface, connection); |
315 | 339 | 340 | ||
316 | 340 | // Install event handler as early as possible | 341 | // Install event handler as early as possible |
318 | 341 | mir_window_spec_set_event_handler(spec.get(), inputCallback, inputContext); | 342 | mir_window_spec_set_event_handler(spec.get(), eventCallback, context); |
319 | 342 | 343 | ||
320 | 343 | const auto title = window->title().toUtf8(); | 344 | const auto title = window->title().toUtf8(); |
321 | 344 | mir_window_spec_set_name(spec.get(), title.constData()); | 345 | mir_window_spec_set_name(spec.get(), title.constData()); |
322 | @@ -358,9 +359,14 @@ | |||
323 | 358 | mir_window_spec_set_state(spec.get(), mir_window_state_hidden); | 359 | mir_window_spec_set_state(spec.get(), mir_window_state_hidden); |
324 | 359 | } | 360 | } |
325 | 360 | 361 | ||
329 | 361 | auto surface = mir_create_window_sync(spec.get()); | 362 | auto mirWindow = mir_create_window_sync(spec.get()); |
330 | 362 | Q_ASSERT(mir_window_is_valid(surface)); | 363 | if (!mir_window_is_valid(mirWindow)) |
331 | 363 | return surface; | 364 | { |
332 | 365 | auto errorMsg = mir_window_get_error_message(mirWindow); | ||
333 | 366 | qFatal("Failed to create mir window: %s", errorMsg); | ||
334 | 367 | } | ||
335 | 368 | |||
336 | 369 | return mirWindow; | ||
337 | 364 | } | 370 | } |
338 | 365 | 371 | ||
339 | 366 | QMirClientWindow *getParentIfNecessary(QWindow *window, QMirClientInput *input) | 372 | QMirClientWindow *getParentIfNecessary(QWindow *window, QMirClientInput *input) |
340 | @@ -377,18 +383,6 @@ | |||
341 | 377 | return parentWindowHandle; | 383 | return parentWindowHandle; |
342 | 378 | } | 384 | } |
343 | 379 | 385 | ||
344 | 380 | MirPixelFormat disableAlphaBufferIfPossible(MirPixelFormat pixelFormat) | ||
345 | 381 | { | ||
346 | 382 | switch (pixelFormat) { | ||
347 | 383 | case mir_pixel_format_abgr_8888: | ||
348 | 384 | return mir_pixel_format_xbgr_8888; | ||
349 | 385 | case mir_pixel_format_argb_8888: | ||
350 | 386 | return mir_pixel_format_xrgb_8888; | ||
351 | 387 | default: // can do nothing, leave it alone | ||
352 | 388 | return pixelFormat; | ||
353 | 389 | } | ||
354 | 390 | } | ||
355 | 391 | |||
356 | 392 | // FIXME - in order to work around https://bugs.launchpad.net/mir/+bug/1346633 | 386 | // FIXME - in order to work around https://bugs.launchpad.net/mir/+bug/1346633 |
357 | 393 | // we need to guess the panel height (3GU) | 387 | // we need to guess the panel height (3GU) |
358 | 394 | int panelHeight() | 388 | int panelHeight() |
359 | @@ -426,7 +420,6 @@ | |||
360 | 426 | 420 | ||
361 | 427 | void onSwapBuffersDone(); | 421 | void onSwapBuffersDone(); |
362 | 428 | void handleSurfaceResized(int width, int height); | 422 | void handleSurfaceResized(int width, int height); |
363 | 429 | int needsRepaint() const; | ||
364 | 430 | 423 | ||
365 | 431 | MirWindowState state() const { return mir_window_get_state(mMirWindow); } | 424 | MirWindowState state() const { return mir_window_get_state(mMirWindow); } |
366 | 432 | void setState(MirWindowState state); | 425 | void setState(MirWindowState state); |
367 | @@ -448,7 +441,7 @@ | |||
368 | 448 | QString persistentSurfaceId(); | 441 | QString persistentSurfaceId(); |
369 | 449 | 442 | ||
370 | 450 | private: | 443 | private: |
372 | 451 | static void surfaceEventCallback(MirWindow* surface, const MirEvent *event, void* context); | 444 | static void windowEventCallback(MirWindow* surface, const MirEvent *event, void* context); |
373 | 452 | void postEvent(const MirEvent *event); | 445 | void postEvent(const MirEvent *event); |
374 | 453 | 446 | ||
375 | 454 | QWindow * const mWindow; | 447 | QWindow * const mWindow; |
376 | @@ -458,14 +451,12 @@ | |||
377 | 458 | QMirClientWindow * mParentWindowHandle{nullptr}; | 451 | QMirClientWindow * mParentWindowHandle{nullptr}; |
378 | 459 | 452 | ||
379 | 460 | MirWindow* mMirWindow; | 453 | MirWindow* mMirWindow; |
380 | 454 | MirRenderSurface* mMirSurface; | ||
381 | 461 | const EGLDisplay mEglDisplay; | 455 | const EGLDisplay mEglDisplay; |
382 | 462 | EGLSurface mEglSurface; | 456 | EGLSurface mEglSurface; |
383 | 463 | 457 | ||
384 | 464 | bool mNeedsRepaint; | ||
385 | 465 | bool mParented; | 458 | bool mParented; |
386 | 466 | QSize mBufferSize; | ||
387 | 467 | QSurfaceFormat mFormat; | 459 | QSurfaceFormat mFormat; |
388 | 468 | MirPixelFormat mPixelFormat; | ||
389 | 469 | 460 | ||
390 | 470 | QMutex mTargetSizeMutex; | 461 | QMutex mTargetSizeMutex; |
391 | 471 | QSize mTargetSize; | 462 | QSize mTargetSize; |
392 | @@ -479,7 +470,6 @@ | |||
393 | 479 | , mInput(input) | 470 | , mInput(input) |
394 | 480 | , mConnection(connection) | 471 | , mConnection(connection) |
395 | 481 | , mEglDisplay(display) | 472 | , mEglDisplay(display) |
396 | 482 | , mNeedsRepaint(false) | ||
397 | 483 | , mParented(mWindow->transientParent() || mWindow->parent()) | 473 | , mParented(mWindow->transientParent() || mWindow->parent()) |
398 | 484 | , mFormat(mWindow->requestedFormat()) | 474 | , mFormat(mWindow->requestedFormat()) |
399 | 485 | , mShellChrome(mWindow->flags() & LowChromeWindowHint ? mir_shell_chrome_low : mir_shell_chrome_normal) | 475 | , mShellChrome(mWindow->flags() & LowChromeWindowHint ? mir_shell_chrome_low : mir_shell_chrome_normal) |
400 | @@ -506,50 +496,33 @@ | |||
401 | 506 | 496 | ||
402 | 507 | mFormat = q_glFormatFromConfig(display, config, mFormat); | 497 | mFormat = q_glFormatFromConfig(display, config, mFormat); |
403 | 508 | 498 | ||
404 | 509 | // Have Mir decide the pixel format most suited to the chosen EGLConfig. This is the only way | ||
405 | 510 | // Mir will know what EGLConfig has been chosen - it cannot deduce it from the buffers. | ||
406 | 511 | mPixelFormat = mir_connection_get_egl_pixel_format(connection, display, config); | ||
407 | 512 | // But the chosen EGLConfig might have an alpha buffer enabled, even if not requested by the client. | ||
408 | 513 | // If that's the case, try to edit the chosen pixel format in order to disable the alpha buffer. | ||
409 | 514 | // This is an optimization for the compositor, as it can avoid blending this surface. | ||
410 | 515 | if (mWindow->requestedFormat().alphaBufferSize() < 0) { | ||
411 | 516 | mPixelFormat = disableAlphaBufferIfPossible(mPixelFormat); | ||
412 | 517 | } | ||
413 | 518 | |||
414 | 519 | const auto outputId = static_cast<QMirClientScreen *>(mWindow->screen()->handle())->mirOutputId(); | 499 | const auto outputId = static_cast<QMirClientScreen *>(mWindow->screen()->handle())->mirOutputId(); |
415 | 520 | 500 | ||
416 | 521 | mParentWindowHandle = getParentIfNecessary(mWindow, input); | 501 | mParentWindowHandle = getParentIfNecessary(mWindow, input); |
417 | 522 | 502 | ||
420 | 523 | mMirWindow = createMirWindow(mWindow, outputId, mParentWindowHandle, mPixelFormat, connection, surfaceEventCallback, this); | 503 | mMirSurface = createMirSurface(mWindow, connection); |
421 | 524 | mEglSurface = eglCreateWindowSurface(mEglDisplay, config, nativeWindowFor(mMirWindow), nullptr); | 504 | mMirWindow = createMirWindow(mWindow, outputId, mParentWindowHandle, mMirSurface, connection, windowEventCallback, this); |
422 | 505 | mEglSurface = eglCreateWindowSurface(mEglDisplay, config, reinterpret_cast<EGLNativeWindowType>(mMirSurface), nullptr); | ||
423 | 525 | 506 | ||
424 | 526 | mNeedsExposeCatchup = mir_window_get_visibility(mMirWindow) == mir_window_visibility_occluded; | 507 | mNeedsExposeCatchup = mir_window_get_visibility(mMirWindow) == mir_window_visibility_occluded; |
425 | 527 | 508 | ||
431 | 528 | // Window manager can give us a final size different from what we asked for | 509 | // Assume that the buffer size matches the surface size at creation time |
427 | 529 | // so let's check what we ended up getting | ||
428 | 530 | MirWindowParameters parameters; | ||
429 | 531 | mir_window_get_parameters(mMirWindow, ¶meters); | ||
430 | 532 | |||
432 | 533 | auto geom = mWindow->geometry(); | 510 | auto geom = mWindow->geometry(); |
433 | 534 | geom.setWidth(parameters.width); | ||
434 | 535 | geom.setHeight(parameters.height); | ||
435 | 536 | |||
436 | 537 | // Assume that the buffer size matches the surface size at creation time | ||
437 | 538 | mBufferSize = geom.size(); | ||
438 | 539 | platformWindow->QPlatformWindow::setGeometry(geom); | ||
439 | 540 | QWindowSystemInterface::handleGeometryChange(mWindow, geom); | ||
440 | 541 | 511 | ||
441 | 542 | qCDebug(mirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title(); | 512 | qCDebug(mirclient) << "Created surface with geometry:" << geom << "title:" << mWindow->title(); |
442 | 543 | qCDebug(mirclientGraphics) | 513 | qCDebug(mirclientGraphics) |
443 | 544 | << "Requested format:" << mWindow->requestedFormat() | 514 | << "Requested format:" << mWindow->requestedFormat() |
446 | 545 | << "\nActual format:" << mFormat | 515 | << "\nActual format:" << mFormat; |
445 | 546 | << "with associated Mir pixel format:" << mirPixelFormatToStr(mPixelFormat); | ||
447 | 547 | } | 516 | } |
448 | 548 | 517 | ||
449 | 549 | UbuntuSurface::~UbuntuSurface() | 518 | UbuntuSurface::~UbuntuSurface() |
450 | 550 | { | 519 | { |
452 | 551 | if (mEglSurface != EGL_NO_SURFACE) | 520 | if (mEglSurface != EGL_NO_SURFACE) { |
453 | 552 | eglDestroySurface(mEglDisplay, mEglSurface); | 521 | eglDestroySurface(mEglDisplay, mEglSurface); |
454 | 522 | } | ||
455 | 523 | if (mMirSurface) { | ||
456 | 524 | mir_render_surface_release(mMirSurface); | ||
457 | 525 | } | ||
458 | 553 | if (mMirWindow) { | 526 | if (mMirWindow) { |
459 | 554 | mir_window_release_sync(mMirWindow); | 527 | mir_window_release_sync(mMirWindow); |
460 | 555 | } | 528 | } |
461 | @@ -606,30 +579,23 @@ | |||
462 | 606 | { | 579 | { |
463 | 607 | QMutexLocker lock(&mTargetSizeMutex); | 580 | QMutexLocker lock(&mTargetSizeMutex); |
464 | 608 | 581 | ||
487 | 609 | // mir's resize event is mainly a signal that we need to redraw our content. We use the | 582 | // There could have been a flurry of resize events, only process the latest event |
488 | 610 | // width/height as identifiers to figure out if this is the latest surface resize event | 583 | const bool needsResize = mTargetSize.width() == width && mTargetSize.height() == height; |
489 | 611 | // that has posted, discarding any old ones. This avoids issuing too many redraw events. | 584 | if (needsResize) { |
490 | 612 | // see TODO in postEvent as the ideal way we should handle this. | 585 | // Resize the buffers |
491 | 613 | // The actual buffer size may or may have not changed at this point, so let the rendering | 586 | mir_render_surface_set_size(mMirSurface, width, height); |
492 | 614 | // thread drive the window geometry updates. | 587 | |
493 | 615 | mNeedsRepaint = mTargetSize.width() == width && mTargetSize.height() == height; | 588 | //Resize the window |
494 | 616 | } | 589 | Spec spec{mir_create_window_spec(mConnection)}; |
495 | 617 | 590 | mir_window_spec_add_render_surface(spec.get(), mMirSurface, width, height, 0, 0); | |
496 | 618 | int UbuntuSurface::needsRepaint() const | 591 | mir_window_apply_spec(mMirWindow, spec.get()); |
497 | 619 | { | 592 | |
498 | 620 | if (mNeedsRepaint) { | 593 | QRect newGeometry = mPlatformWindow->geometry(); |
499 | 621 | if (mTargetSize != mBufferSize) { | 594 | newGeometry.setSize(mTargetSize); |
500 | 622 | //If the buffer hasn't changed yet, we need at least two redraws, | 595 | |
501 | 623 | //once to get the new buffer size and propagate the geometry changes | 596 | mPlatformWindow->QPlatformWindow::setGeometry(newGeometry); |
502 | 624 | //and the second to redraw the content at the new size | 597 | QWindowSystemInterface::handleGeometryChange(mWindow, newGeometry); |
481 | 625 | return 2; | ||
482 | 626 | } else { | ||
483 | 627 | // The buffer size has already been updated so we only need one redraw | ||
484 | 628 | // to render at the new size | ||
485 | 629 | return 1; | ||
486 | 630 | } | ||
503 | 631 | } | 598 | } |
504 | 632 | return 0; | ||
505 | 633 | } | 599 | } |
506 | 634 | 600 | ||
507 | 635 | void UbuntuSurface::setState(MirWindowState state) | 601 | void UbuntuSurface::setState(MirWindowState state) |
508 | @@ -653,35 +619,13 @@ | |||
509 | 653 | static int sFrameNumber = 0; | 619 | static int sFrameNumber = 0; |
510 | 654 | ++sFrameNumber; | 620 | ++sFrameNumber; |
511 | 655 | 621 | ||
536 | 656 | EGLint eglSurfaceWidth = -1; | 622 | qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d]", |
537 | 657 | EGLint eglSurfaceHeight = -1; | 623 | mWindow, sFrameNumber); |
514 | 658 | eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, &eglSurfaceWidth); | ||
515 | 659 | eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, &eglSurfaceHeight); | ||
516 | 660 | |||
517 | 661 | const bool validSize = eglSurfaceWidth > 0 && eglSurfaceHeight > 0; | ||
518 | 662 | |||
519 | 663 | if (validSize && (mBufferSize.width() != eglSurfaceWidth || mBufferSize.height() != eglSurfaceHeight)) { | ||
520 | 664 | |||
521 | 665 | qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - size changed (%d, %d) => (%d, %d)", | ||
522 | 666 | mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height(), eglSurfaceWidth, eglSurfaceHeight); | ||
523 | 667 | |||
524 | 668 | mBufferSize.rwidth() = eglSurfaceWidth; | ||
525 | 669 | mBufferSize.rheight() = eglSurfaceHeight; | ||
526 | 670 | |||
527 | 671 | QRect newGeometry = mPlatformWindow->geometry(); | ||
528 | 672 | newGeometry.setSize(mBufferSize); | ||
529 | 673 | |||
530 | 674 | mPlatformWindow->QPlatformWindow::setGeometry(newGeometry); | ||
531 | 675 | QWindowSystemInterface::handleGeometryChange(mWindow, newGeometry); | ||
532 | 676 | } else { | ||
533 | 677 | qCDebug(mirclientBufferSwap, "onSwapBuffersDone(window=%p) [%d] - buffer size (%d,%d)", | ||
534 | 678 | mWindow, sFrameNumber, mBufferSize.width(), mBufferSize.height()); | ||
535 | 679 | } | ||
538 | 680 | } | 624 | } |
539 | 681 | 625 | ||
541 | 682 | void UbuntuSurface::surfaceEventCallback(MirWindow *surface, const MirEvent *event, void* context) | 626 | void UbuntuSurface::windowEventCallback(MirWindow *window, const MirEvent *event, void* context) |
542 | 683 | { | 627 | { |
544 | 684 | Q_UNUSED(surface); | 628 | Q_UNUSED(window); |
545 | 685 | Q_ASSERT(context != nullptr); | 629 | Q_ASSERT(context != nullptr); |
546 | 686 | 630 | ||
547 | 687 | auto s = static_cast<UbuntuSurface *>(context); | 631 | auto s = static_cast<UbuntuSurface *>(context); |
548 | @@ -692,9 +636,8 @@ | |||
549 | 692 | { | 636 | { |
550 | 693 | const auto eventType = mir_event_get_type(event); | 637 | const auto eventType = mir_event_get_type(event); |
551 | 694 | if (mir_event_type_resize == eventType) { | 638 | if (mir_event_type_resize == eventType) { |
555 | 695 | // TODO: The current event queue just accumulates all resize events; | 639 | // The event queue just accumulates all resize events; |
556 | 696 | // It would be nicer if we could update just one event if that event has not been dispatched. | 640 | // Use the width and height as an identifier of this latest event |
554 | 697 | // As a workaround, we use the width/height as an identifier of this latest event | ||
557 | 698 | // so the event handler (handleSurfaceResized) can discard/ignore old ones. | 641 | // so the event handler (handleSurfaceResized) can discard/ignore old ones. |
558 | 699 | const auto resizeEvent = mir_event_get_resize_event(event); | 642 | const auto resizeEvent = mir_event_get_resize_event(event); |
559 | 700 | const auto width = mir_resize_event_get_width(resizeEvent); | 643 | const auto width = mir_resize_event_get_width(resizeEvent); |
560 | @@ -786,19 +729,6 @@ | |||
561 | 786 | qCDebug(mirclient, "handleSurfaceResize(window=%p, size=(%dx%d)px", window(), width, height); | 729 | qCDebug(mirclient, "handleSurfaceResize(window=%p, size=(%dx%d)px", window(), width, height); |
562 | 787 | 730 | ||
563 | 788 | mSurface->handleSurfaceResized(width, height); | 731 | mSurface->handleSurfaceResized(width, height); |
564 | 789 | |||
565 | 790 | // This resize event could have occurred just after the last buffer swap for this window. | ||
566 | 791 | // This means the client may still be holding a buffer with the older size. The first redraw call | ||
567 | 792 | // will then render at the old size. After swapping the client now will get a new buffer with the | ||
568 | 793 | // updated size but it still needs re-rendering so another redraw may be needed. | ||
569 | 794 | // A mir API to drop the currently held buffer would help here, so that we wouldn't have to redraw twice | ||
570 | 795 | auto const numRepaints = mSurface->needsRepaint(); | ||
571 | 796 | lock.unlock(); | ||
572 | 797 | qCDebug(mirclient, "handleSurfaceResize(window=%p) redraw %d times", window(), numRepaints); | ||
573 | 798 | for (int i = 0; i < numRepaints; i++) { | ||
574 | 799 | qCDebug(mirclient, "handleSurfaceResize(window=%p) repainting size=(%dx%d)dp", window(), geometry().size().width(), geometry().size().height()); | ||
575 | 800 | QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); | ||
576 | 801 | } | ||
577 | 802 | } | 732 | } |
578 | 803 | 733 | ||
579 | 804 | void QMirClientWindow::handleSurfaceExposeChange(bool exposed) | 734 | void QMirClientWindow::handleSurfaceExposeChange(bool exposed) |
580 | 805 | 735 | ||
581 | === modified file 'src/ubuntumirclient/ubuntumirclient.pro' | |||
582 | --- src/ubuntumirclient/ubuntumirclient.pro 2017-03-29 13:39:50 +0000 | |||
583 | +++ src/ubuntumirclient/ubuntumirclient.pro 2017-05-27 01:33:26 +0000 | |||
584 | @@ -6,7 +6,7 @@ | |||
585 | 6 | 6 | ||
586 | 7 | CONFIG += plugin no_keywords qpa/genericunixfontdatabase | 7 | CONFIG += plugin no_keywords qpa/genericunixfontdatabase |
587 | 8 | 8 | ||
589 | 9 | DEFINES += MESA_EGL_NO_X11_HEADERS | 9 | DEFINES += MESA_EGL_NO_X11_HEADERS MIR_DEPRECATE_RENDERSURFACES=0 MIR_ENABLE_DEPRECATIONS=0 |
590 | 10 | # CONFIG += c++11 # only enables C++0x | 10 | # CONFIG += c++11 # only enables C++0x |
591 | 11 | QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -Werror -Wall | 11 | QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -Werror -Wall |
592 | 12 | QMAKE_LFLAGS += -std=c++11 -Wl,-no-undefined | 12 | QMAKE_LFLAGS += -std=c++11 -Wl,-no-undefined |
FAILED: Continuous integration, rev:392 /unity8- jenkins. ubuntu. com/job/ lp-qtubuntu- ci/222/ /unity8- jenkins. ubuntu. com/job/ build/4820/ console /unity8- jenkins. ubuntu. com/job/ build-0- fetch/4848 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4659/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4659 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4659/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4659/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4659 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4659/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4659/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4659 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4659/ artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-qtubuntu- ci/222/ rebuild
https:/