Merge lp:~vanvugt/mir/swap-then-flip into lp:mir
- swap-then-flip
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alberto Aguirre |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2183 |
Proposed branch: | lp:~vanvugt/mir/swap-then-flip |
Merge into: | lp:mir |
Prerequisite: | lp:~vanvugt/mir/swap-swaps |
Diff against target: |
655 lines (+157/-61) 29 files modified
benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp (+5/-1) examples/render_to_fb.cpp (+2/-1) include/platform/mir/graphics/display_buffer.h (+27/-2) platform-ABI-sha1sums (+1/-1) playground/demo-shell/demo_compositor.cpp (+13/-1) server-ABI-sha1sums (+1/-1) src/platform/symbols.map (+0/-1) src/platforms/android/display_buffer.cpp (+5/-1) src/platforms/android/display_buffer.h (+2/-1) src/platforms/mesa/display_buffer.cpp (+13/-18) src/platforms/mesa/display_buffer.h (+3/-2) src/server/compositor/default_display_buffer_compositor.cpp (+12/-1) src/server/compositor/screencast_display_buffer.cpp (+5/-1) src/server/compositor/screencast_display_buffer.h (+2/-1) src/server/graphics/nested/nested_output.cpp (+5/-1) src/server/graphics/nested/nested_output.h (+2/-1) src/server/graphics/offscreen/display_buffer.cpp (+5/-1) src/server/graphics/offscreen/display_buffer.h (+2/-1) tests/include/mir_test_doubles/mock_display_buffer.h (+2/-1) tests/include/mir_test_doubles/null_display_buffer.h (+2/-1) tests/include/mir_test_doubles/stub_display_builder.h (+2/-1) tests/integration-tests/graphics/android/test_display_integration.cpp (+4/-2) tests/integration-tests/test_surface_stack_with_compositor.cpp (+5/-1) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+15/-5) tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+2/-2) tests/unit-tests/graphics/android/test_display_buffer.cpp (+2/-1) tests/unit-tests/graphics/mesa/test_display.cpp (+4/-2) tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+9/-5) tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+5/-3) |
To merge this branch: | bzr merge lp:~vanvugt/mir/swap-then-flip |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Aguirre (community) | Approve | ||
Cemil Azizoglu (community) | Approve | ||
Alan Griffiths | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Robert Carr (community) | Approve | ||
Review via email: mp+245081@code.launchpad.net |
Commit message
Split post_update() into separate gl_swap_buffers() and flip().
On some platforms this provides a significant performance boost, as
GL resources and client buffers can be released after the gl_swap_buffers
without having to wait for the flip.
This solves most of LP: #1264934, and unblocks work on LP: #1350716 and
possibly unblocks LP: #1350725 too.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Alan Griffiths (alan-griffiths) wrote : | # |
Mostly good. But surely:
456 - void post_update() override
457 + void gl_swap_buffers() override
458 + {
459 + increment_
460 + }
461 +
462 + void flip() override
463 {
464 increment_
465 }
"post_count" is now a misnomer and also is incremented by two calls where it would have been incremented once before.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
egl_swap_buffers (i.e. the driver) is supposed to flip the buffer to the screen. I don't understand why we have to do this manually on Mesa? Besides, when swap_buffers returns, GPU is still rendering into the (now front) buffer. If we flip prematurely, it'll tear. The only way to guarantee no tearing is if the swapbuffers implementation flips the buffer itself once rendering is completed.
Other nits :
57 + * an unacceptable performance hit to wait for both before before freeing
duplicate "before"
137 - mir::graphics:
Shouldn't we be adding "gl_swap_buffers" and "flip" to symbols.map?
Robert Carr (robertcarr) wrote : | # |
Cemils comment was discussed in IRC. I believe the driver handles this synchronization.
I'm not so sure if this is a real optimization, e.g. the expensive part of swap is the flush and presumably rendering was already happening in the background anyway. I agree this seems conceptually correct though: Finish GL Rendering, Update EGL State, Mark buffer as new front buffer.
Please get review from someone with better knowledge of this than me, e.g. Alf, Chris, ...?
Daniel van Vugt (vanvugt) wrote : | # |
I understand your confusion and I started off believing the same thing too. As an OpenGL person you come to expect *glSwapBuffers to do all the work, but that's not true on the DRM platform (or reasonably any other low-level platform). Because there's no display server in the Mesa library. We're providing the display server. eglSwapBuffers in Mesa/DRM puts nothing on screen; it doesn't know how. All it does is prepare the next front-buffer for gbm_surface_
Furthermore, eglSwapBuffers does not implement any synchronization on Mesa-DRM either. It is up to us to sync to vblank in how we schedule the page flips. And how would Mesa-DRM have any idea what monitors you wanted to display on? That's up to us in what outputs/connectors we choose to page flip to.
Other nits:
"before before": Fixed and will land here soon.
"symbols.map": Apparently not. Everything works without mentioning it in symbols.map...(?)
P.S. The performance benefits won't be fully realized until we start unwinding the triple buffering a bit more (LP: #1350725).
P.P.S. Some real numbers from my own system (following lp:~vanvugt/mir/fix-1350716), is that this change reduces the time the compositor holds buffers from around ~15ms to ~0.4ms. Still it only consumes a new client buffer every 16.6ms.
Daniel van Vugt (vanvugt) wrote : | # |
Hmm, I've been thinking it might help to reduce confusion with a better name than "flip". Perhaps hw_swap_buffers() would be better...
gl_swap_
hw_swap_
Daniel van Vugt (vanvugt) wrote : | # |
I also plan to clarify things further by separating the generic DisplayBuffer from the (GL-specific)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2177
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) wrote : | # |
To further address the "flip" concerns:
* Page flipping can never tear unless you accidentally steal a buffer that's presently scanning out, which we don't do. And that's why we've been using page flipping forever in Mir, and since 2012 in Compiz. To page flip means you reprogram the display hardware to scan out a different region of memory during vblank. There is no copying or blitting involved that can ever be seen as tearing.
* wait_for_
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
I still have doubts, but not about your MP, about the way Mesa works.
Alberto Aguirre (albaguirre) wrote : | # |
Looks sensible.
Preview Diff
1 | === modified file 'benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp' |
2 | --- benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2014-12-16 18:35:06 +0000 |
3 | +++ benchmarks/frame-uniformity/vsync_simulating_graphics_platform.cpp 2014-12-19 03:08:20 +0000 |
4 | @@ -45,7 +45,11 @@ |
5 | { |
6 | } |
7 | |
8 | - void post_update() override |
9 | + void gl_swap_buffers() override |
10 | + { |
11 | + } |
12 | + |
13 | + void flip() override |
14 | { |
15 | auto now = std::chrono::high_resolution_clock::now(); |
16 | auto next_sync = last_sync + std::chrono::seconds(1) / vsync_rate_in_hz; |
17 | |
18 | === modified file 'examples/render_to_fb.cpp' |
19 | --- examples/render_to_fb.cpp 2014-11-14 02:41:05 +0000 |
20 | +++ examples/render_to_fb.cpp 2014-12-19 03:08:20 +0000 |
21 | @@ -67,7 +67,8 @@ |
22 | |
23 | gl_animation.render_gl(); |
24 | |
25 | - buffer.post_update(); |
26 | + buffer.gl_swap_buffers(); |
27 | + buffer.flip(); |
28 | }); |
29 | |
30 | gl_animation.step(); |
31 | |
32 | === modified file 'include/platform/mir/graphics/display_buffer.h' |
33 | --- include/platform/mir/graphics/display_buffer.h 2014-12-08 04:03:47 +0000 |
34 | +++ include/platform/mir/graphics/display_buffer.h 2014-12-19 03:08:20 +0000 |
35 | @@ -47,8 +47,33 @@ |
36 | /** Releases the current GL rendering target. */ |
37 | virtual void release_current() = 0; |
38 | |
39 | - /** This will trigger OpenGL rendering and post the result to the screen. */ |
40 | - virtual void post_update() = 0; |
41 | + /** |
42 | + * Swap buffers for OpenGL rendering. |
43 | + * After this method returns is the earliest time that it is safe to |
44 | + * free GL-related resources such as textures and buffers. |
45 | + */ |
46 | + virtual void gl_swap_buffers() = 0; |
47 | + |
48 | + /** |
49 | + * After gl_swap_buffers, flip the new front buffer to the screen |
50 | + * This most likely involves a wait for vblank so can be very time |
51 | + * consuming. This function is separate to gl_swap_buffers() because in |
52 | + * real display systems the act of scanning out (or flipping) the |
53 | + * front buffer is a very separate step to the GL buffer swapping. Not |
54 | + * least because "flipping" is a hardware operation that is independent |
55 | + * of the graphics library (OpenGL or other). Also, flip() can be a |
56 | + * dramatically slower operation than gl_swap_buffers() and it would be |
57 | + * an unacceptable performance hit to wait for both before freeing |
58 | + * GL resources. |
59 | + */ |
60 | + virtual void flip() = 0; |
61 | + |
62 | + /** |
63 | + * \deprecated Please try to implement separate gl_swap_buffers and |
64 | + * flip functions instead. If not possible, just move your old |
65 | + * post_update() logic into gl_swap_buffers. |
66 | + */ |
67 | + void post_update() { gl_swap_buffers(); flip(); } |
68 | |
69 | /** This will render renderlist to the screen and post the result to the |
70 | * screen if there is a hardware optimization that can be done. |
71 | |
72 | === modified file 'platform-ABI-sha1sums' |
73 | --- platform-ABI-sha1sums 2014-12-19 01:56:10 +0000 |
74 | +++ platform-ABI-sha1sums 2014-12-19 03:08:20 +0000 |
75 | @@ -33,7 +33,7 @@ |
76 | 748f5c2aab11189aa02c4a89ab900561548e7304 include/platform/mir/graphics/buffer_properties.h |
77 | ffa857f624f1c8cbd50a190107137346fc3204d6 include/platform/mir/graphics/cursor.h |
78 | fe2b5f13ccd3ec6b78d90d3abbb7d88b48238578 include/platform/mir/graphics/cursor_image.h |
79 | -986f5d0d8ea2c6a42cc320f468e682f81fec46ae include/platform/mir/graphics/display_buffer.h |
80 | +0025a5c3e9d916820f3ef27aee9f5d4a9985723b include/platform/mir/graphics/display_buffer.h |
81 | f53a0020b8f1bd4a941a201eb26271cffee0a7dd include/platform/mir/graphics/display_configuration.h |
82 | 6fe08da318c920b0d20ea8b8f560f5ac7ed389fe include/platform/mir/graphics/display_configuration_policy.h |
83 | 41ea906d208b761e3d5d5056095de9de2d4ffa17 include/platform/mir/graphics/display.h |
84 | |
85 | === modified file 'playground/demo-shell/demo_compositor.cpp' |
86 | --- playground/demo-shell/demo_compositor.cpp 2014-12-08 04:03:47 +0000 |
87 | +++ playground/demo-shell/demo_compositor.cpp 2014-12-19 03:08:20 +0000 |
88 | @@ -118,6 +118,7 @@ |
89 | * Actually, there's a third reference held by the texture cache |
90 | * in GLRenderer, but that gets released earlier in render(). |
91 | */ |
92 | + elements.clear(); // Release those that didn't make it to renderable_list |
93 | |
94 | if (!nonrenderlist_elements && |
95 | viewport == display_buffer.view_area() && // no bypass while zoomed |
96 | @@ -134,7 +135,18 @@ |
97 | renderer.set_viewport(viewport); |
98 | renderer.begin(std::move(decoration_skip_list)); |
99 | renderer.render(renderable_list); |
100 | - display_buffer.post_update(); |
101 | + |
102 | + display_buffer.gl_swap_buffers(); |
103 | + // TODO: report->record_end_of_render_time here. (LP: #1350716) |
104 | + |
105 | + // Release buffers back to the clients now that the swap has returned. |
106 | + // It's important to do this before starting on the potentially slow |
107 | + // flip() ... |
108 | + // FIXME: This clear() call is blocking a little (LP: #1395421) |
109 | + renderable_list.clear(); |
110 | + |
111 | + display_buffer.flip(); |
112 | + |
113 | report->finished_frame(false, this); |
114 | } |
115 | } |
116 | |
117 | === modified file 'server-ABI-sha1sums' |
118 | --- server-ABI-sha1sums 2014-12-19 01:56:10 +0000 |
119 | +++ server-ABI-sha1sums 2014-12-19 03:08:20 +0000 |
120 | @@ -33,7 +33,7 @@ |
121 | 748f5c2aab11189aa02c4a89ab900561548e7304 include/platform/mir/graphics/buffer_properties.h |
122 | ffa857f624f1c8cbd50a190107137346fc3204d6 include/platform/mir/graphics/cursor.h |
123 | fe2b5f13ccd3ec6b78d90d3abbb7d88b48238578 include/platform/mir/graphics/cursor_image.h |
124 | -986f5d0d8ea2c6a42cc320f468e682f81fec46ae include/platform/mir/graphics/display_buffer.h |
125 | +0025a5c3e9d916820f3ef27aee9f5d4a9985723b include/platform/mir/graphics/display_buffer.h |
126 | f53a0020b8f1bd4a941a201eb26271cffee0a7dd include/platform/mir/graphics/display_configuration.h |
127 | 6fe08da318c920b0d20ea8b8f560f5ac7ed389fe include/platform/mir/graphics/display_configuration_policy.h |
128 | 41ea906d208b761e3d5d5056095de9de2d4ffa17 include/platform/mir/graphics/display.h |
129 | |
130 | === modified file 'src/platform/symbols.map' |
131 | --- src/platform/symbols.map 2014-12-16 18:35:06 +0000 |
132 | +++ src/platform/symbols.map 2014-12-19 03:08:20 +0000 |
133 | @@ -36,7 +36,6 @@ |
134 | mir::graphics::DisplayBuffer::operator*; |
135 | mir::graphics::DisplayBuffer::orientation*; |
136 | mir::graphics::DisplayBuffer::post_renderables_if_optimizable*; |
137 | - mir::graphics::DisplayBuffer::post_update*; |
138 | mir::graphics::DisplayBuffer::release_current*; |
139 | mir::graphics::DisplayBuffer::uses_alpha*; |
140 | mir::graphics::DisplayBuffer::view_area*; |
141 | |
142 | === modified file 'src/platforms/android/display_buffer.cpp' |
143 | --- src/platforms/android/display_buffer.cpp 2014-12-18 03:10:03 +0000 |
144 | +++ src/platforms/android/display_buffer.cpp 2014-12-19 03:08:20 +0000 |
145 | @@ -96,11 +96,15 @@ |
146 | return display_device->post_overlays(gl_context, renderlist, overlay_program); |
147 | } |
148 | |
149 | -void mga::DisplayBuffer::post_update() |
150 | +void mga::DisplayBuffer::gl_swap_buffers() |
151 | { |
152 | display_device->post_gl(gl_context); |
153 | } |
154 | |
155 | +void mga::DisplayBuffer::flip() |
156 | +{ |
157 | +} |
158 | + |
159 | MirOrientation mga::DisplayBuffer::orientation() const |
160 | { |
161 | /* |
162 | |
163 | === modified file 'src/platforms/android/display_buffer.h' |
164 | --- src/platforms/android/display_buffer.h 2014-12-08 04:03:47 +0000 |
165 | +++ src/platforms/android/display_buffer.h 2014-12-19 03:08:20 +0000 |
166 | @@ -51,7 +51,8 @@ |
167 | geometry::Rectangle view_area() const override; |
168 | void make_current() override; |
169 | void release_current() override; |
170 | - void post_update() override; |
171 | + void gl_swap_buffers() override; |
172 | + void flip() override; |
173 | bool post_renderables_if_optimizable(RenderableList const& renderlist) override; |
174 | |
175 | MirOrientation orientation() const override; |
176 | |
177 | === modified file 'src/platforms/mesa/display_buffer.cpp' |
178 | --- src/platforms/mesa/display_buffer.cpp 2014-12-19 00:35:16 +0000 |
179 | +++ src/platforms/mesa/display_buffer.cpp 2014-12-19 03:08:20 +0000 |
180 | @@ -202,7 +202,7 @@ |
181 | if (bypass_buf->can_bypass() && |
182 | bypass_buf->size() == geom::Size{fb_width,fb_height}) |
183 | { |
184 | - return post_update(bypass_buf); |
185 | + return flip(bypass_buf); |
186 | } |
187 | } |
188 | } |
189 | @@ -210,26 +210,21 @@ |
190 | return false; |
191 | } |
192 | |
193 | -void mgm::DisplayBuffer::post_update() |
194 | -{ |
195 | - post_update(nullptr); |
196 | -} |
197 | - |
198 | -bool mgm::DisplayBuffer::post_update( |
199 | +void mgm::DisplayBuffer::flip() |
200 | +{ |
201 | + flip(nullptr); |
202 | +} |
203 | + |
204 | +void mgm::DisplayBuffer::gl_swap_buffers() |
205 | +{ |
206 | + if (!egl.swap_buffers()) |
207 | + fatal_error("Failed to perform buffer swap"); |
208 | +} |
209 | + |
210 | +bool mgm::DisplayBuffer::flip( |
211 | std::shared_ptr<graphics::Buffer> bypass_buf) |
212 | { |
213 | /* |
214 | - * There are two potentially blocking operations in this function: |
215 | - * 1. egl.swap_buffers() |
216 | - * 2. wait_for_page_flip() |
217 | - * However only the first one has a chance of being implemented by the |
218 | - * driver asynchronously (so it returns before it's finished) as observed |
219 | - * with Intel graphics. So for optimal parallelism EGL swap starts first. |
220 | - */ |
221 | - if (!bypass_buf && !egl.swap_buffers()) |
222 | - fatal_error("Failed to perform buffer swap"); |
223 | - |
224 | - /* |
225 | * We might not have waited for the previous frame to page flip yet. |
226 | * This is good because it maximizes the time available to spend rendering |
227 | * each frame. Just remember wait_for_page_flip() must be called at some |
228 | |
229 | === modified file 'src/platforms/mesa/display_buffer.h' |
230 | --- src/platforms/mesa/display_buffer.h 2014-12-18 03:10:03 +0000 |
231 | +++ src/platforms/mesa/display_buffer.h 2014-12-19 03:08:20 +0000 |
232 | @@ -57,7 +57,8 @@ |
233 | geometry::Rectangle view_area() const override; |
234 | void make_current() override; |
235 | void release_current() override; |
236 | - void post_update() override; |
237 | + void gl_swap_buffers() override; |
238 | + void flip() override; |
239 | bool post_renderables_if_optimizable(RenderableList const& renderlist) override; |
240 | |
241 | MirOrientation orientation() const override; |
242 | @@ -66,7 +67,7 @@ |
243 | void wait_for_page_flip(); |
244 | |
245 | private: |
246 | - bool post_update(std::shared_ptr<graphics::Buffer> bypass_buf); |
247 | + bool flip(std::shared_ptr<graphics::Buffer> bypass_buf); |
248 | |
249 | BufferObject* get_front_buffer_object(); |
250 | BufferObject* get_buffer_object(struct gbm_bo *bo); |
251 | |
252 | === modified file 'src/server/compositor/default_display_buffer_compositor.cpp' |
253 | --- src/server/compositor/default_display_buffer_compositor.cpp 2014-12-08 04:03:47 +0000 |
254 | +++ src/server/compositor/default_display_buffer_compositor.cpp 2014-12-19 03:08:20 +0000 |
255 | @@ -72,6 +72,7 @@ |
256 | * Actually, there's a third reference held by the texture cache |
257 | * in GLRenderer, but that gets released earlier in render(). |
258 | */ |
259 | + scene_elements.clear(); // Those in use are still in renderable_list |
260 | |
261 | if (display_buffer.post_renderables_if_optimizable(renderable_list)) |
262 | { |
263 | @@ -85,7 +86,17 @@ |
264 | renderer->set_rotation(display_buffer.orientation()); |
265 | |
266 | renderer->render(renderable_list); |
267 | - display_buffer.post_update(); |
268 | + |
269 | + display_buffer.gl_swap_buffers(); |
270 | + |
271 | + // TODO: report->record_end_of_render_time here. (LP: #1350716) |
272 | + |
273 | + // Release the buffers we did use back to the clients, before starting |
274 | + // on the potentially slow flip(). |
275 | + // FIXME: This clear() call is blocking a little (LP: #1395421) |
276 | + renderable_list.clear(); |
277 | + |
278 | + display_buffer.flip(); |
279 | |
280 | report->finished_frame(false, this); |
281 | } |
282 | |
283 | === modified file 'src/server/compositor/screencast_display_buffer.cpp' |
284 | --- src/server/compositor/screencast_display_buffer.cpp 2014-12-08 04:03:47 +0000 |
285 | +++ src/server/compositor/screencast_display_buffer.cpp 2014-12-19 03:08:20 +0000 |
286 | @@ -90,11 +90,15 @@ |
287 | return false; |
288 | } |
289 | |
290 | -void mc::ScreencastDisplayBuffer::post_update() |
291 | +void mc::ScreencastDisplayBuffer::gl_swap_buffers() |
292 | { |
293 | glFinish(); |
294 | } |
295 | |
296 | +void mc::ScreencastDisplayBuffer::flip() |
297 | +{ |
298 | +} |
299 | + |
300 | MirOrientation mc::ScreencastDisplayBuffer::orientation() const |
301 | { |
302 | return mir_orientation_normal; |
303 | |
304 | === modified file 'src/server/compositor/screencast_display_buffer.h' |
305 | --- src/server/compositor/screencast_display_buffer.h 2014-12-08 04:03:47 +0000 |
306 | +++ src/server/compositor/screencast_display_buffer.h 2014-12-19 03:08:20 +0000 |
307 | @@ -61,7 +61,8 @@ |
308 | |
309 | bool post_renderables_if_optimizable(graphics::RenderableList const&) override; |
310 | |
311 | - void post_update() override; |
312 | + void gl_swap_buffers() override; |
313 | + void flip() override; |
314 | |
315 | MirOrientation orientation() const override; |
316 | |
317 | |
318 | === modified file 'src/server/graphics/nested/nested_output.cpp' |
319 | --- src/server/graphics/nested/nested_output.cpp 2014-12-08 04:03:47 +0000 |
320 | +++ src/server/graphics/nested/nested_output.cpp 2014-12-19 03:08:20 +0000 |
321 | @@ -63,11 +63,15 @@ |
322 | eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
323 | } |
324 | |
325 | -void mgn::detail::NestedOutput::post_update() |
326 | +void mgn::detail::NestedOutput::gl_swap_buffers() |
327 | { |
328 | eglSwapBuffers(egl_display, egl_surface); |
329 | } |
330 | |
331 | +void mgn::detail::NestedOutput::flip() |
332 | +{ |
333 | +} |
334 | + |
335 | bool mgn::detail::NestedOutput::post_renderables_if_optimizable(RenderableList const&) |
336 | { |
337 | return false; |
338 | |
339 | === modified file 'src/server/graphics/nested/nested_output.h' |
340 | --- src/server/graphics/nested/nested_output.h 2014-12-08 04:03:47 +0000 |
341 | +++ src/server/graphics/nested/nested_output.h 2014-12-19 03:08:20 +0000 |
342 | @@ -47,7 +47,8 @@ |
343 | geometry::Rectangle view_area() const override; |
344 | void make_current() override; |
345 | void release_current() override; |
346 | - void post_update() override; |
347 | + void gl_swap_buffers() override; |
348 | + void flip() override; |
349 | MirOrientation orientation() const override; |
350 | bool uses_alpha() const override; |
351 | |
352 | |
353 | === modified file 'src/server/graphics/offscreen/display_buffer.cpp' |
354 | --- src/server/graphics/offscreen/display_buffer.cpp 2014-12-08 04:03:47 +0000 |
355 | +++ src/server/graphics/offscreen/display_buffer.cpp 2014-12-19 03:08:20 +0000 |
356 | @@ -139,11 +139,15 @@ |
357 | egl_context.release_current(); |
358 | } |
359 | |
360 | -void mgo::DisplayBuffer::post_update() |
361 | +void mgo::DisplayBuffer::gl_swap_buffers() |
362 | { |
363 | glFinish(); |
364 | } |
365 | |
366 | +void mgo::DisplayBuffer::flip() |
367 | +{ |
368 | +} |
369 | + |
370 | bool mgo::DisplayBuffer::post_renderables_if_optimizable(RenderableList const&) |
371 | { |
372 | return false; |
373 | |
374 | === modified file 'src/server/graphics/offscreen/display_buffer.h' |
375 | --- src/server/graphics/offscreen/display_buffer.h 2014-12-08 04:03:47 +0000 |
376 | +++ src/server/graphics/offscreen/display_buffer.h 2014-12-19 03:08:20 +0000 |
377 | @@ -65,7 +65,8 @@ |
378 | geometry::Rectangle view_area() const override; |
379 | void make_current() override; |
380 | void release_current() override; |
381 | - void post_update() override; |
382 | + void gl_swap_buffers() override; |
383 | + void flip() override; |
384 | |
385 | MirOrientation orientation() const override; |
386 | bool uses_alpha() const override; |
387 | |
388 | === modified file 'tests/include/mir_test_doubles/mock_display_buffer.h' |
389 | --- tests/include/mir_test_doubles/mock_display_buffer.h 2014-12-08 04:03:47 +0000 |
390 | +++ tests/include/mir_test_doubles/mock_display_buffer.h 2014-12-19 03:08:20 +0000 |
391 | @@ -42,7 +42,8 @@ |
392 | MOCK_CONST_METHOD0(view_area, geometry::Rectangle()); |
393 | MOCK_METHOD0(make_current, void()); |
394 | MOCK_METHOD0(release_current, void()); |
395 | - MOCK_METHOD0(post_update, void()); |
396 | + MOCK_METHOD0(gl_swap_buffers, void()); |
397 | + MOCK_METHOD0(flip, void()); |
398 | MOCK_METHOD1(post_renderables_if_optimizable, bool(graphics::RenderableList const&)); |
399 | MOCK_CONST_METHOD0(orientation, MirOrientation()); |
400 | MOCK_CONST_METHOD0(uses_alpha, bool()); |
401 | |
402 | === modified file 'tests/include/mir_test_doubles/null_display_buffer.h' |
403 | --- tests/include/mir_test_doubles/null_display_buffer.h 2014-12-08 04:03:47 +0000 |
404 | +++ tests/include/mir_test_doubles/null_display_buffer.h 2014-12-19 03:08:20 +0000 |
405 | @@ -34,7 +34,8 @@ |
406 | geometry::Rectangle view_area() const override { return geometry::Rectangle(); } |
407 | void make_current() override {} |
408 | void release_current() override {} |
409 | - void post_update() override {} |
410 | + void gl_swap_buffers() override {} |
411 | + void flip() override {} |
412 | bool post_renderables_if_optimizable(graphics::RenderableList const&) override { return false; } |
413 | MirOrientation orientation() const override { return mir_orientation_normal; } |
414 | bool uses_alpha() const override { return false; } |
415 | |
416 | === modified file 'tests/include/mir_test_doubles/stub_display_builder.h' |
417 | --- tests/include/mir_test_doubles/stub_display_builder.h 2014-12-17 06:58:58 +0000 |
418 | +++ tests/include/mir_test_doubles/stub_display_builder.h 2014-12-19 03:08:20 +0000 |
419 | @@ -40,7 +40,8 @@ |
420 | geometry::Rectangle view_area() const { return rect; } |
421 | void make_current() {} |
422 | void release_current() {} |
423 | - void post_update() {} |
424 | + void gl_swap_buffers() {} |
425 | + void flip() {} |
426 | bool post_renderables_if_optimizable(graphics::RenderableList const&) { return false; } |
427 | MirOrientation orientation() const override { return mir_orientation_normal; } |
428 | bool uses_alpha() const override { return false; }; |
429 | |
430 | === modified file 'tests/integration-tests/graphics/android/test_display_integration.cpp' |
431 | --- tests/integration-tests/graphics/android/test_display_integration.cpp 2014-12-17 06:58:58 +0000 |
432 | +++ tests/integration-tests/graphics/android/test_display_integration.cpp 2014-12-19 03:08:20 +0000 |
433 | @@ -88,10 +88,12 @@ |
434 | gl_animation.init_gl(); |
435 | |
436 | gl_animation.render_gl(); |
437 | - buffer.post_update(); |
438 | + buffer.gl_swap_buffers(); |
439 | + buffer.flip(); |
440 | |
441 | gl_animation.render_gl(); |
442 | - buffer.post_update(); |
443 | + buffer.gl_swap_buffers(); |
444 | + buffer.flip(); |
445 | }); |
446 | } |
447 | |
448 | |
449 | === modified file 'tests/integration-tests/test_surface_stack_with_compositor.cpp' |
450 | --- tests/integration-tests/test_surface_stack_with_compositor.cpp 2014-12-08 04:03:47 +0000 |
451 | +++ tests/integration-tests/test_surface_stack_with_compositor.cpp 2014-12-19 03:08:20 +0000 |
452 | @@ -69,7 +69,11 @@ |
453 | return false; |
454 | } |
455 | |
456 | - void post_update() override |
457 | + void gl_swap_buffers() override |
458 | + { |
459 | + } |
460 | + |
461 | + void flip() override |
462 | { |
463 | increment_post_count(); |
464 | } |
465 | |
466 | === modified file 'tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp' |
467 | --- tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp 2014-12-08 04:03:47 +0000 |
468 | +++ tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp 2014-12-19 03:08:20 +0000 |
469 | @@ -122,7 +122,9 @@ |
470 | .Times(AtLeast(1)); |
471 | EXPECT_CALL(display_buffer, make_current()) |
472 | .Times(1); |
473 | - EXPECT_CALL(display_buffer, post_update()) |
474 | + EXPECT_CALL(display_buffer, gl_swap_buffers()) |
475 | + .Times(1); |
476 | + EXPECT_CALL(display_buffer, flip()) |
477 | .Times(1); |
478 | |
479 | mc::DefaultDisplayBufferCompositor compositor( |
480 | @@ -229,7 +231,9 @@ |
481 | .InSequence(render_seq); |
482 | EXPECT_CALL(mock_renderer, render(ContainerEq(mg::RenderableList{big, small}))) |
483 | .InSequence(render_seq); |
484 | - EXPECT_CALL(display_buffer, post_update()) |
485 | + EXPECT_CALL(display_buffer, gl_swap_buffers()) |
486 | + .InSequence(render_seq); |
487 | + EXPECT_CALL(display_buffer, flip()) |
488 | .InSequence(render_seq); |
489 | |
490 | mc::DefaultDisplayBufferCompositor compositor( |
491 | @@ -264,7 +268,9 @@ |
492 | .InSequence(seq); |
493 | EXPECT_CALL(mock_renderer, render(IsEmpty())) |
494 | .InSequence(seq); |
495 | - EXPECT_CALL(display_buffer, post_update()) |
496 | + EXPECT_CALL(display_buffer, gl_swap_buffers()) |
497 | + .InSequence(seq); |
498 | + EXPECT_CALL(display_buffer, flip()) |
499 | .InSequence(seq); |
500 | |
501 | EXPECT_CALL(display_buffer, post_renderables_if_optimizable(_)) |
502 | @@ -283,7 +289,9 @@ |
503 | .InSequence(seq); |
504 | EXPECT_CALL(mock_renderer, render(IsEmpty())) |
505 | .InSequence(seq); |
506 | - EXPECT_CALL(display_buffer, post_update()) |
507 | + EXPECT_CALL(display_buffer, gl_swap_buffers()) |
508 | + .InSequence(seq); |
509 | + EXPECT_CALL(display_buffer, flip()) |
510 | .InSequence(seq); |
511 | |
512 | mc::DefaultDisplayBufferCompositor compositor( |
513 | @@ -321,7 +329,9 @@ |
514 | .InSequence(seq); |
515 | EXPECT_CALL(mock_renderer, render(ContainerEq(visible))) |
516 | .InSequence(seq); |
517 | - EXPECT_CALL(display_buffer, post_update()) |
518 | + EXPECT_CALL(display_buffer, gl_swap_buffers()) |
519 | + .InSequence(seq); |
520 | + EXPECT_CALL(display_buffer, flip()) |
521 | .InSequence(seq); |
522 | |
523 | mc::DefaultDisplayBufferCompositor compositor( |
524 | |
525 | === modified file 'tests/unit-tests/compositor/test_screencast_display_buffer.cpp' |
526 | --- tests/unit-tests/compositor/test_screencast_display_buffer.cpp 2014-12-08 04:03:47 +0000 |
527 | +++ tests/unit-tests/compositor/test_screencast_display_buffer.cpp 2014-12-19 03:08:20 +0000 |
528 | @@ -133,7 +133,7 @@ |
529 | db.make_current(); |
530 | } |
531 | |
532 | -TEST_F(ScreencastDisplayBufferTest, forces_rendering_to_complete_on_post_update) |
533 | +TEST_F(ScreencastDisplayBufferTest, forces_rendering_to_complete_on_swap) |
534 | { |
535 | using namespace testing; |
536 | |
537 | @@ -145,7 +145,7 @@ |
538 | Mock::VerifyAndClearExpectations(&mock_gl); |
539 | EXPECT_CALL(mock_gl, glFinish()); |
540 | |
541 | - db.post_update(); |
542 | + db.gl_swap_buffers(); |
543 | } |
544 | |
545 | TEST_F(ScreencastDisplayBufferTest, rejects_attempt_to_optimize) |
546 | |
547 | === modified file 'tests/unit-tests/graphics/android/test_display_buffer.cpp' |
548 | --- tests/unit-tests/graphics/android/test_display_buffer.cpp 2014-12-18 03:10:03 +0000 |
549 | +++ tests/unit-tests/graphics/android/test_display_buffer.cpp 2014-12-19 03:08:20 +0000 |
550 | @@ -99,7 +99,8 @@ |
551 | mg::RenderableList renderlist{}; |
552 | mga::DisplayBuffer db( |
553 | mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory, mga::OverlayOptimization::enabled); |
554 | - db.post_update(); |
555 | + db.gl_swap_buffers(); |
556 | + db.flip(); |
557 | } |
558 | |
559 | TEST_F(DisplayBuffer, posts_overlay_list_returns_display_device_decision) |
560 | |
561 | === modified file 'tests/unit-tests/graphics/mesa/test_display.cpp' |
562 | --- tests/unit-tests/graphics/mesa/test_display.cpp 2014-12-17 06:58:58 +0000 |
563 | +++ tests/unit-tests/graphics/mesa/test_display.cpp 2014-12-19 03:08:20 +0000 |
564 | @@ -439,7 +439,8 @@ |
565 | |
566 | display->for_each_display_buffer([](mg::DisplayBuffer& db) |
567 | { |
568 | - db.post_update(); |
569 | + db.gl_swap_buffers(); |
570 | + db.flip(); |
571 | }); |
572 | } |
573 | |
574 | @@ -477,7 +478,8 @@ |
575 | |
576 | display->for_each_display_buffer([](mg::DisplayBuffer& db) |
577 | { |
578 | - db.post_update(); |
579 | + db.gl_swap_buffers(); |
580 | + db.flip(); |
581 | }); |
582 | }, std::runtime_error); |
583 | } |
584 | |
585 | === modified file 'tests/unit-tests/graphics/mesa/test_display_buffer.cpp' |
586 | --- tests/unit-tests/graphics/mesa/test_display_buffer.cpp 2014-12-19 00:35:16 +0000 |
587 | +++ tests/unit-tests/graphics/mesa/test_display_buffer.cpp 2014-12-19 03:08:20 +0000 |
588 | @@ -294,7 +294,7 @@ |
589 | mock_egl.fake_egl_context); |
590 | } |
591 | |
592 | -TEST_F(MesaDisplayBufferTest, first_post_flips_but_no_wait) |
593 | +TEST_F(MesaDisplayBufferTest, first_flip_flips_but_no_wait) |
594 | { |
595 | EXPECT_CALL(*mock_kms_output, schedule_page_flip(_)) |
596 | .Times(1); |
597 | @@ -311,10 +311,11 @@ |
598 | gl_config, |
599 | mock_egl.fake_egl_context); |
600 | |
601 | - db.post_update(); |
602 | + db.gl_swap_buffers(); |
603 | + db.flip(); |
604 | } |
605 | |
606 | -TEST_F(MesaDisplayBufferTest, waits_for_page_flip_on_second_post) |
607 | +TEST_F(MesaDisplayBufferTest, waits_for_page_flip_on_second_flip) |
608 | { |
609 | InSequence seq; |
610 | |
611 | @@ -339,8 +340,11 @@ |
612 | gl_config, |
613 | mock_egl.fake_egl_context); |
614 | |
615 | - db.post_update(); |
616 | - db.post_update(); |
617 | + db.gl_swap_buffers(); |
618 | + db.flip(); |
619 | + |
620 | + db.gl_swap_buffers(); |
621 | + db.flip(); |
622 | } |
623 | |
624 | TEST_F(MesaDisplayBufferTest, skips_bypass_because_of_incompatible_list) |
625 | |
626 | === modified file 'tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp' |
627 | --- tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp 2014-12-16 09:26:49 +0000 |
628 | +++ tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp 2014-12-19 03:08:20 +0000 |
629 | @@ -315,7 +315,7 @@ |
630 | |
631 | } |
632 | |
633 | -TEST_F(MesaDisplayMultiMonitorTest, post_update_flips_all_connected_crtcs) |
634 | +TEST_F(MesaDisplayMultiMonitorTest, flip_flips_all_connected_crtcs) |
635 | { |
636 | using namespace testing; |
637 | |
638 | @@ -356,14 +356,16 @@ |
639 | /* First frame: Page flips are scheduled, but not waited for */ |
640 | display->for_each_display_buffer([](mg::DisplayBuffer& buffer) |
641 | { |
642 | - buffer.post_update(); |
643 | + buffer.gl_swap_buffers(); |
644 | + buffer.flip(); |
645 | }); |
646 | |
647 | /* Second frame: Previous page flips finish (drmHandleEvent) and new ones |
648 | are scheduled */ |
649 | display->for_each_display_buffer([](mg::DisplayBuffer& buffer) |
650 | { |
651 | - buffer.post_update(); |
652 | + buffer.gl_swap_buffers(); |
653 | + buffer.flip(); |
654 | }); |
655 | } |
656 |
PASSED: Continuous integration, rev:2172 jenkins. qa.ubuntu. com/job/ mir-ci/ 2495/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/619 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/619 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/593 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 492 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 492/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 593 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 593/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/3744 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 16698
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2495/ rebuild
http://