Merge lp:~kdub/mir/connect-fallback-to-hwc-device into lp:mir
- connect-fallback-to-hwc-device
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Kevin DuBois |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1623 |
Proposed branch: | lp:~kdub/mir/connect-fallback-to-hwc-device |
Merge into: | lp:mir |
Diff against target: |
804 lines (+242/-195) 17 files modified
include/test/mir_test_doubles/mock_display_device.h (+3/-2) include/test/mir_test_doubles/mock_renderable_list_compositor.h (+41/-0) include/test/mir_test_doubles/stub_renderable_list_compositor.h (+41/-0) src/platform/graphics/android/display_buffer.cpp (+2/-2) src/platform/graphics/android/display_device.h (+3/-3) src/platform/graphics/android/fb_device.cpp (+5/-7) src/platform/graphics/android/fb_device.h (+2/-2) src/platform/graphics/android/hwc_device.cpp (+7/-14) src/platform/graphics/android/hwc_device.h (+2/-2) src/platform/graphics/android/hwc_fb_device.cpp (+26/-7) src/platform/graphics/android/hwc_fb_device.h (+2/-2) src/platform/graphics/android/overlay_gl_compositor.cpp (+4/-0) src/platform/graphics/android/overlay_gl_compositor.h (+18/-2) tests/unit-tests/graphics/android/test_fb_device.cpp (+8/-14) tests/unit-tests/graphics/android/test_hwc_device.cpp (+67/-127) tests/unit-tests/graphics/android/test_hwc_display.cpp (+1/-1) tests/unit-tests/graphics/android/test_hwc_fb_device.cpp (+10/-10) |
To merge this branch: | bzr merge lp:~kdub/mir/connect-fallback-to-hwc-device |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alan Griffiths | Needs Fixing | ||
Alberto Aguirre (community) | Approve | ||
Robert Carr (community) | Approve | ||
Review via email:
|
Commit message
make the HwcDevice call the render() function on the fallback gl program (l253), instead of calling a std::function that isn't hooked up to anything.
Description of the change
make the HwcDevice call the render() function on the fallback gl program (l253), instead of calling a std::function that isn't hooked up to anything.
note:
In trunk now, the fallback rendering function is just a stub. This MP leaves it stubbed, but will be do something once lp:~kdub/mir/overlay-gl-program lands. The code is currently just used in the overlays demo.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alberto Aguirre (albaguirre) wrote : | # |
OK.
the OverlayGLProgram and overlay_
Shouldn't this branch or the other list a pre-requisite?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
Just nits:
747 +#include "mir_test_
Unused.
~~~~
773 + EXPECT_
774 + .InSequence(seq)
775 + .WillOnce(
776 + {cont.swap_
The lambda body should be further indented than the surrounding .WillOnce call. (Or on the same line.)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1590
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandros Frantzis (afrantzis) wrote : | # |
Alan's concerns have been addressed, so approving.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
> Alan's concerns have been addressed, so approving.
Yep
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
/mir/tests/
/mir/tests/
device.
^
/mir/tests/
device.
Rebase required
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1592
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Kevin DuBois (kdub) wrote : | # |
rebase done, re-top-approving
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'include/test/mir_test_doubles/mock_display_device.h' |
2 | --- include/test/mir_test_doubles/mock_display_device.h 2014-03-26 05:48:59 +0000 |
3 | +++ include/test/mir_test_doubles/mock_display_device.h 2014-05-12 18:27:14 +0000 |
4 | @@ -22,6 +22,7 @@ |
5 | #include "mir/graphics/buffer.h" |
6 | #include "src/platform/graphics/android/display_device.h" |
7 | #include "src/platform/graphics/android/gl_context.h" |
8 | +#include "src/platform/graphics/android/overlay_gl_compositor.h" |
9 | #include <gmock/gmock.h> |
10 | |
11 | namespace mir |
12 | @@ -36,10 +37,10 @@ |
13 | ~MockDisplayDevice() noexcept {} |
14 | MOCK_METHOD1(mode, void(MirPowerMode)); |
15 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); |
16 | - MOCK_METHOD3(render_gl_and_overlays, void( |
17 | + MOCK_METHOD3(prepare_overlays, void( |
18 | graphics::android::SwappingGLContext const&, |
19 | graphics::RenderableList const&, |
20 | - std::function<void(graphics::Renderable const&)> const&)); |
21 | + graphics::android::RenderableListCompositor const&)); |
22 | MOCK_METHOD1(post, void(graphics::Buffer const&)); |
23 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); |
24 | }; |
25 | |
26 | === added file 'include/test/mir_test_doubles/mock_renderable_list_compositor.h' |
27 | --- include/test/mir_test_doubles/mock_renderable_list_compositor.h 1970-01-01 00:00:00 +0000 |
28 | +++ include/test/mir_test_doubles/mock_renderable_list_compositor.h 2014-05-12 18:27:14 +0000 |
29 | @@ -0,0 +1,41 @@ |
30 | +/* |
31 | + * Copyright © 2014 Canonical Ltd. |
32 | + * |
33 | + * This program is free software: you can redistribute it and/or modify it |
34 | + * under the terms of the GNU General Public License version 3, |
35 | + * as published by the Free Software Foundation. |
36 | + * |
37 | + * This program is distributed in the hope that it will be useful, |
38 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
39 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
40 | + * GNU General Public License for more details. |
41 | + * |
42 | + * You should have received a copy of the GNU General Public License |
43 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
44 | + * |
45 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
46 | + */ |
47 | + |
48 | +#ifndef MIR_TEST_DOUBLES_MOCK_RENDERABLE_LIST_COMPOSITOR_H_ |
49 | +#define MIR_TEST_DOUBLES_MOCK_RENDERABLE_LIST_COMPOSITOR_H_ |
50 | + |
51 | +#include "src/platform/graphics/android/overlay_gl_compositor.h" |
52 | +#include <gmock/gmock.h> |
53 | + |
54 | +namespace mir |
55 | +{ |
56 | +namespace test |
57 | +{ |
58 | +namespace doubles |
59 | +{ |
60 | + |
61 | +struct MockRenderableListCompositor : public graphics::android::RenderableListCompositor |
62 | +{ |
63 | + MOCK_CONST_METHOD2(render, |
64 | + void(graphics::RenderableList const&, graphics::android::SwappingGLContext const&)); |
65 | +}; |
66 | + |
67 | +} |
68 | +} |
69 | +} |
70 | +#endif // MIR_TEST_DOUBLES_MOCK_RENDERABLE_LIST_COMPOSITOR_H_ |
71 | |
72 | === added file 'include/test/mir_test_doubles/stub_renderable_list_compositor.h' |
73 | --- include/test/mir_test_doubles/stub_renderable_list_compositor.h 1970-01-01 00:00:00 +0000 |
74 | +++ include/test/mir_test_doubles/stub_renderable_list_compositor.h 2014-05-12 18:27:14 +0000 |
75 | @@ -0,0 +1,41 @@ |
76 | +/* |
77 | + * Copyright © 2014 Canonical Ltd. |
78 | + * |
79 | + * This program is free software: you can redistribute it and/or modify it |
80 | + * under the terms of the GNU General Public License version 3, |
81 | + * as published by the Free Software Foundation. |
82 | + * |
83 | + * This program is distributed in the hope that it will be useful, |
84 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
85 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
86 | + * GNU General Public License for more details. |
87 | + * |
88 | + * You should have received a copy of the GNU General Public License |
89 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
90 | + * |
91 | + * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
92 | + */ |
93 | + |
94 | +#ifndef MIR_TEST_DOUBLES_STUB_RENDERABLE_LIST_COMPOSITOR_H_ |
95 | +#define MIR_TEST_DOUBLES_STUB_RENDERABLE_LIST_COMPOSITOR_H_ |
96 | + |
97 | +#include "src/platform/graphics/android/overlay_gl_compositor.h" |
98 | + |
99 | +namespace mir |
100 | +{ |
101 | +namespace test |
102 | +{ |
103 | +namespace doubles |
104 | +{ |
105 | + |
106 | +struct StubRenderableListCompositor : public graphics::android::RenderableListCompositor |
107 | +{ |
108 | + void render(graphics::RenderableList const&, graphics::android::SwappingGLContext const&) const |
109 | + { |
110 | + } |
111 | +}; |
112 | + |
113 | +} |
114 | +} |
115 | +} |
116 | +#endif // MIR_TEST_DOUBLES_STUB_RENDERABLE_LIST_COMPOSITOR_H_ |
117 | |
118 | === modified file 'src/platform/graphics/android/display_buffer.cpp' |
119 | --- src/platform/graphics/android/display_buffer.cpp 2014-05-01 07:13:02 +0000 |
120 | +++ src/platform/graphics/android/display_buffer.cpp 2014-05-12 18:27:14 +0000 |
121 | @@ -88,7 +88,7 @@ |
122 | |
123 | void mga::DisplayBuffer::render_and_post_update( |
124 | RenderableList const& renderlist, |
125 | - std::function<void(Renderable const&)> const& render_fn) |
126 | + std::function<void(Renderable const&)> const&) |
127 | { |
128 | if (renderlist.empty()) |
129 | { |
130 | @@ -96,7 +96,7 @@ |
131 | } |
132 | else |
133 | { |
134 | - display_device->render_gl_and_overlays(gl_context, renderlist, render_fn); |
135 | + display_device->prepare_overlays(gl_context, renderlist, overlay_program); |
136 | } |
137 | |
138 | post(); |
139 | |
140 | === modified file 'src/platform/graphics/android/display_device.h' |
141 | --- src/platform/graphics/android/display_device.h 2014-03-26 05:48:59 +0000 |
142 | +++ src/platform/graphics/android/display_device.h 2014-05-12 18:27:14 +0000 |
143 | @@ -22,7 +22,6 @@ |
144 | #include "mir/graphics/renderable.h" |
145 | #include "mir_toolkit/common.h" |
146 | #include <EGL/egl.h> |
147 | -#include <list> |
148 | |
149 | namespace mir |
150 | { |
151 | @@ -33,6 +32,7 @@ |
152 | |
153 | namespace android |
154 | { |
155 | +class RenderableListCompositor; |
156 | class SwappingGLContext; |
157 | |
158 | class DisplayDevice |
159 | @@ -42,10 +42,10 @@ |
160 | |
161 | virtual void mode(MirPowerMode mode) = 0; |
162 | virtual void render_gl(SwappingGLContext const& context) = 0; |
163 | - virtual void render_gl_and_overlays( |
164 | + virtual void prepare_overlays( |
165 | SwappingGLContext const& context, |
166 | RenderableList const& list, |
167 | - std::function<void(Renderable const&)> const& render_fn) = 0; |
168 | + RenderableListCompositor const& list_compositor) = 0; |
169 | virtual void post(Buffer const& buffer) = 0; |
170 | virtual bool apply_orientation(MirOrientation orientation) const = 0; |
171 | |
172 | |
173 | === modified file 'src/platform/graphics/android/fb_device.cpp' |
174 | --- src/platform/graphics/android/fb_device.cpp 2014-03-26 05:48:59 +0000 |
175 | +++ src/platform/graphics/android/fb_device.cpp 2014-05-12 18:27:14 +0000 |
176 | @@ -24,6 +24,7 @@ |
177 | #include "fb_device.h" |
178 | #include "framebuffer_bundle.h" |
179 | #include "buffer.h" |
180 | +#include "overlay_gl_compositor.h" |
181 | |
182 | #include <boost/throw_exception.hpp> |
183 | #include <stdexcept> |
184 | @@ -49,15 +50,12 @@ |
185 | context.swap_buffers(); |
186 | } |
187 | |
188 | -void mga::FBDevice::render_gl_and_overlays( |
189 | +void mga::FBDevice::prepare_overlays( |
190 | SwappingGLContext const& context, |
191 | - RenderableList const& renderables, |
192 | - std::function<void(Renderable const&)> const& render_fn) |
193 | + RenderableList const& list, |
194 | + RenderableListCompositor const& compositor) |
195 | { |
196 | - for(auto const& renderable : renderables) |
197 | - render_fn(*renderable); |
198 | - |
199 | - context.swap_buffers(); |
200 | + compositor.render(list, context); |
201 | } |
202 | |
203 | void mga::FBDevice::post(mg::Buffer const& buffer) |
204 | |
205 | === modified file 'src/platform/graphics/android/fb_device.h' |
206 | --- src/platform/graphics/android/fb_device.h 2014-03-26 05:48:59 +0000 |
207 | +++ src/platform/graphics/android/fb_device.h 2014-05-12 18:27:14 +0000 |
208 | @@ -38,10 +38,10 @@ |
209 | bool apply_orientation(MirOrientation orientation) const; |
210 | void mode(MirPowerMode mode); |
211 | virtual void render_gl(SwappingGLContext const& context); |
212 | - virtual void render_gl_and_overlays( |
213 | + virtual void prepare_overlays( |
214 | SwappingGLContext const& context, |
215 | RenderableList const& list, |
216 | - std::function<void(Renderable const&)> const& render_fn); |
217 | + RenderableListCompositor const& list_compositor); |
218 | void post(Buffer const& buffer); |
219 | |
220 | private: |
221 | |
222 | === modified file 'src/platform/graphics/android/hwc_device.cpp' |
223 | --- src/platform/graphics/android/hwc_device.cpp 2014-03-26 05:48:59 +0000 |
224 | +++ src/platform/graphics/android/hwc_device.cpp 2014-05-12 18:27:14 +0000 |
225 | @@ -24,7 +24,7 @@ |
226 | #include "hwc_wrapper.h" |
227 | #include "framebuffer_bundle.h" |
228 | #include "buffer.h" |
229 | -#include "mir/graphics/buffer.h" |
230 | +#include "overlay_gl_compositor.h" |
231 | |
232 | namespace mg = mir::graphics; |
233 | namespace mga=mir::graphics::android; |
234 | @@ -88,10 +88,10 @@ |
235 | context.swap_buffers(); |
236 | } |
237 | |
238 | -void mga::HwcDevice::render_gl_and_overlays( |
239 | +void mga::HwcDevice::prepare_overlays( |
240 | SwappingGLContext const& context, |
241 | RenderableList const& renderables, |
242 | - std::function<void(Renderable const&)> const& render_fn) |
243 | + RenderableListCompositor const& list_compositor) |
244 | { |
245 | if (!(list_needs_commit = hwc_list.update_list_and_check_if_changed(renderables, fbtarget_size))) |
246 | return; |
247 | @@ -99,25 +99,18 @@ |
248 | |
249 | hwc_wrapper->prepare(*hwc_list.native_list().lock()); |
250 | |
251 | - //draw layers that the HWC did not accept for overlays here |
252 | - bool needs_swapbuffers = false; |
253 | + mg::RenderableList rejected_renderables; |
254 | + |
255 | auto layers_it = hwc_list.begin(); |
256 | for(auto const& renderable : renderables) |
257 | { |
258 | - //prepare all layers for draw. |
259 | layers_it->prepare_for_draw(); |
260 | - |
261 | - //trigger GL on the layers that are not overlays |
262 | if (layers_it->needs_gl_render()) |
263 | - { |
264 | - render_fn(*renderable); |
265 | - needs_swapbuffers = true; |
266 | - } |
267 | + rejected_renderables.push_back(renderable); |
268 | layers_it++; |
269 | } |
270 | |
271 | - if (needs_swapbuffers) |
272 | - context.swap_buffers(); |
273 | + list_compositor.render(rejected_renderables, context); |
274 | } |
275 | |
276 | void mga::HwcDevice::post(mg::Buffer const& buffer) |
277 | |
278 | === modified file 'src/platform/graphics/android/hwc_device.h' |
279 | --- src/platform/graphics/android/hwc_device.h 2014-03-26 05:48:59 +0000 |
280 | +++ src/platform/graphics/android/hwc_device.h 2014-05-12 18:27:14 +0000 |
281 | @@ -48,10 +48,10 @@ |
282 | std::shared_ptr<SyncFileOps> const& sync_ops); |
283 | |
284 | virtual void render_gl(SwappingGLContext const& context); |
285 | - virtual void render_gl_and_overlays( |
286 | + virtual void prepare_overlays( |
287 | SwappingGLContext const& context, |
288 | RenderableList const& list, |
289 | - std::function<void(Renderable const&)> const& render_fn); |
290 | + RenderableListCompositor const& list_compositor); |
291 | void post(Buffer const& buffer); |
292 | |
293 | private: |
294 | |
295 | === modified file 'src/platform/graphics/android/hwc_fb_device.cpp' |
296 | --- src/platform/graphics/android/hwc_fb_device.cpp 2014-03-26 05:48:59 +0000 |
297 | +++ src/platform/graphics/android/hwc_fb_device.cpp 2014-05-12 18:27:14 +0000 |
298 | @@ -22,8 +22,10 @@ |
299 | #include "framebuffer_bundle.h" |
300 | #include "android_format_conversion-inl.h" |
301 | #include "hwc_wrapper.h" |
302 | +#include "overlay_gl_compositor.h" |
303 | #include "mir/graphics/buffer.h" |
304 | #include "mir/graphics/android/native_buffer.h" |
305 | +#include "gl_context.h" |
306 | |
307 | #include <boost/throw_exception.hpp> |
308 | #include <sstream> |
309 | @@ -33,6 +35,24 @@ |
310 | namespace mga = mir::graphics::android; |
311 | namespace geom = mir::geometry; |
312 | |
313 | +namespace |
314 | +{ |
315 | +class HWC10Context : public mga::SwappingGLContext |
316 | +{ |
317 | +public: |
318 | + HWC10Context(std::function<void()> const& swapping_fn) |
319 | + : swapping_fn(std::move(swapping_fn)) |
320 | + { |
321 | + } |
322 | + void swap_buffers() const override |
323 | + { |
324 | + swapping_fn(); |
325 | + } |
326 | +private: |
327 | + std::function<void()> const swapping_fn; |
328 | +}; |
329 | +} |
330 | + |
331 | mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
332 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, |
333 | std::shared_ptr<framebuffer_device_t> const& fb_device, |
334 | @@ -84,16 +104,15 @@ |
335 | gpu_render(); |
336 | } |
337 | |
338 | -void mga::HwcFbDevice::render_gl_and_overlays( |
339 | +void mga::HwcFbDevice::prepare_overlays( |
340 | SwappingGLContext const&, |
341 | - RenderableList const& renderables, |
342 | - std::function<void(Renderable const&)> const& render_fn) |
343 | + RenderableList const& list, |
344 | + RenderableListCompositor const& compositor) |
345 | { |
346 | prepare(); |
347 | - //TODO: filter this list based on the results of the preparation |
348 | - for(auto const& renderable : renderables) |
349 | - render_fn(*renderable); |
350 | - gpu_render(); |
351 | + //hwc 1.0 is weird in that the driver gets to call eglSwapBuffers. |
352 | + HWC10Context context(std::bind(&HwcFbDevice::gpu_render, this)); |
353 | + compositor.render(list, context); |
354 | } |
355 | |
356 | void mga::HwcFbDevice::post(mg::Buffer const& buffer) |
357 | |
358 | === modified file 'src/platform/graphics/android/hwc_fb_device.h' |
359 | --- src/platform/graphics/android/hwc_fb_device.h 2014-03-26 05:48:59 +0000 |
360 | +++ src/platform/graphics/android/hwc_fb_device.h 2014-05-12 18:27:14 +0000 |
361 | @@ -41,10 +41,10 @@ |
362 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
363 | |
364 | virtual void render_gl(SwappingGLContext const& context); |
365 | - virtual void render_gl_and_overlays( |
366 | + virtual void prepare_overlays( |
367 | SwappingGLContext const& context, |
368 | RenderableList const& list, |
369 | - std::function<void(Renderable const&)> const& render_fn); |
370 | + RenderableListCompositor const& list_compositor); |
371 | void post(Buffer const& buffer); |
372 | |
373 | private: |
374 | |
375 | === modified file 'src/platform/graphics/android/overlay_gl_compositor.cpp' |
376 | --- src/platform/graphics/android/overlay_gl_compositor.cpp 2014-04-17 23:10:31 +0000 |
377 | +++ src/platform/graphics/android/overlay_gl_compositor.cpp 2014-05-12 18:27:14 +0000 |
378 | @@ -47,3 +47,7 @@ |
379 | overlay_program = factory.create_gl_program(vertex_shader, fragment_shader); |
380 | context.release_current(); |
381 | } |
382 | + |
383 | +void mga::OverlayGLProgram::render(RenderableList const&, SwappingGLContext const&) const |
384 | +{ |
385 | +} |
386 | |
387 | === modified file 'src/platform/graphics/android/overlay_gl_compositor.h' |
388 | --- src/platform/graphics/android/overlay_gl_compositor.h 2014-04-17 22:20:59 +0000 |
389 | +++ src/platform/graphics/android/overlay_gl_compositor.h 2014-05-12 18:27:14 +0000 |
390 | @@ -20,6 +20,7 @@ |
391 | #define MIR_GRAPHICS_ANDROID_OVERLAY_GL_PROGRAM_H_ |
392 | |
393 | #include "mir/graphics/gl_program.h" |
394 | +#include "mir/graphics/renderable.h" |
395 | #include <memory> |
396 | |
397 | namespace mir |
398 | @@ -31,11 +32,26 @@ |
399 | |
400 | namespace android |
401 | { |
402 | - |
403 | -class OverlayGLProgram |
404 | +class SwappingGLContext; |
405 | + |
406 | +class RenderableListCompositor |
407 | +{ |
408 | +public: |
409 | + virtual ~RenderableListCompositor() = default; |
410 | + virtual void render(RenderableList const&, SwappingGLContext const&) const = 0; |
411 | +protected: |
412 | + RenderableListCompositor() = default; |
413 | +private: |
414 | + RenderableListCompositor(RenderableListCompositor const&) = delete; |
415 | + RenderableListCompositor& operator=(RenderableListCompositor const&) = delete; |
416 | +}; |
417 | + |
418 | +class OverlayGLProgram : public RenderableListCompositor |
419 | { |
420 | public: |
421 | OverlayGLProgram(GLProgramFactory const& program_factory, graphics::GLContext const& gl_context); |
422 | + |
423 | + void render(RenderableList const&, SwappingGLContext const&) const; |
424 | private: |
425 | std::unique_ptr<graphics::GLProgram> overlay_program; |
426 | }; |
427 | |
428 | === modified file 'tests/unit-tests/graphics/android/test_fb_device.cpp' |
429 | --- tests/unit-tests/graphics/android/test_fb_device.cpp 2014-03-11 13:44:57 +0000 |
430 | +++ tests/unit-tests/graphics/android/test_fb_device.cpp 2014-05-12 18:27:14 +0000 |
431 | @@ -19,6 +19,7 @@ |
432 | #include "mir_test_doubles/mock_fb_hal_device.h" |
433 | #include "mir_test_doubles/mock_buffer.h" |
434 | #include "src/platform/graphics/android/fb_device.h" |
435 | +#include "src/platform/graphics/android/overlay_gl_compositor.h" |
436 | #include "mir_test_doubles/mock_framebuffer_bundle.h" |
437 | #include "mir_test_doubles/mock_android_hw.h" |
438 | #include "mir_test_doubles/mock_egl.h" |
439 | @@ -27,6 +28,8 @@ |
440 | #include "mir_test_doubles/mock_android_native_buffer.h" |
441 | #include "mir_test_doubles/mock_render_function.h" |
442 | #include "mir_test_doubles/mock_swapping_gl_context.h" |
443 | +#include "mir_test_doubles/stub_renderable_list_compositor.h" |
444 | +#include "mir_test_doubles/mock_renderable_list_compositor.h" |
445 | |
446 | #include <gtest/gtest.h> |
447 | #include <stdexcept> |
448 | @@ -63,7 +66,7 @@ |
449 | mtd::MockSwappingGLContext mock_context; |
450 | }; |
451 | |
452 | -TEST_F(FBDevice, render_overlays_via_gl) |
453 | +TEST_F(FBDevice, prepares_overlays_by_rendering) |
454 | { |
455 | auto renderable1 = std::make_shared<mtd::StubRenderable>(); |
456 | auto renderable2 = std::make_shared<mtd::StubRenderable>(); |
457 | @@ -73,20 +76,11 @@ |
458 | renderable2 |
459 | }; |
460 | |
461 | - mtd::MockRenderFunction mock_call_counter; |
462 | - testing::Sequence seq; |
463 | - EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable1))) |
464 | - .InSequence(seq); |
465 | - EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable2))) |
466 | - .InSequence(seq); |
467 | - EXPECT_CALL(mock_context, swap_buffers()) |
468 | - .InSequence(seq); |
469 | - |
470 | + mtd::MockRenderableListCompositor mock_compositor; |
471 | + EXPECT_CALL(mock_compositor, render(testing::Ref(renderlist),testing::_)) |
472 | + .Times(1); |
473 | mga::FBDevice fbdev(fb_hal_mock); |
474 | - fbdev.render_gl_and_overlays(mock_context, renderlist, [&](mg::Renderable const& renderable) |
475 | - { |
476 | - mock_call_counter.called(renderable); |
477 | - }); |
478 | + fbdev.prepare_overlays(mock_context, renderlist, mock_compositor); |
479 | } |
480 | |
481 | TEST_F(FBDevice, commits_frame_via_post) |
482 | |
483 | === modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp' |
484 | --- tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-05-05 03:36:45 +0000 |
485 | +++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2014-05-12 18:27:14 +0000 |
486 | @@ -34,6 +34,8 @@ |
487 | #include "mir_test_doubles/mock_render_function.h" |
488 | #include "mir_test_doubles/mock_swapping_gl_context.h" |
489 | #include "mir_test_doubles/stub_swapping_gl_context.h" |
490 | +#include "mir_test_doubles/stub_renderable_list_compositor.h" |
491 | +#include "mir_test_doubles/mock_renderable_list_compositor.h" |
492 | #include <gmock/gmock.h> |
493 | #include <gtest/gtest.h> |
494 | #include <stdexcept> |
495 | @@ -230,6 +232,7 @@ |
496 | testing::NiceMock<mtd::MockBuffer> mock_buffer; |
497 | mtd::MockSwappingGLContext mock_context; |
498 | mtd::StubSwappingGLContext stub_context; |
499 | + mtd::StubRenderableListCompositor stub_compositor; |
500 | }; |
501 | |
502 | |
503 | @@ -249,125 +252,62 @@ |
504 | device.render_gl(stub_context); |
505 | } |
506 | |
507 | -TEST_F(HwcDevice, calls_render_fn_and_swap_when_all_overlays_are_rejected) |
508 | -{ |
509 | - using namespace testing; |
510 | - mtd::MockRenderFunction mock_render_fn; |
511 | - auto render_fn = [&](mg::Renderable const& renderable) |
512 | - { |
513 | - mock_render_fn.called(renderable); |
514 | - }; |
515 | - |
516 | - std::list<std::shared_ptr<mg::Renderable>> updated_list({ |
517 | - stub_renderable1, |
518 | - stub_renderable2 |
519 | - }); |
520 | - |
521 | - std::list<hwc_layer_1_t*> expected_list |
522 | - { |
523 | - &comp_layer, |
524 | - &comp_layer, |
525 | - &target_layer |
526 | - }; |
527 | - |
528 | - Sequence seq; |
529 | - EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) |
530 | - .InSequence(seq) |
531 | - .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) |
532 | - { |
533 | - ASSERT_EQ(contents.numHwLayers, 3); |
534 | - contents.hwLayers[0].compositionType = HWC_FRAMEBUFFER; |
535 | - contents.hwLayers[1].compositionType = HWC_FRAMEBUFFER; |
536 | - contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; |
537 | - })); |
538 | - EXPECT_CALL(mock_render_fn, called(Ref(*stub_renderable1))) |
539 | - .InSequence(seq); |
540 | - EXPECT_CALL(mock_render_fn, called(Ref(*stub_renderable2))) |
541 | - .InSequence(seq); |
542 | - EXPECT_CALL(mock_context, swap_buffers()) |
543 | - .InSequence(seq); |
544 | - |
545 | - mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); |
546 | - device.render_gl_and_overlays(mock_context, updated_list, render_fn); |
547 | -} |
548 | - |
549 | -TEST_F(HwcDevice, calls_render_and_swap_when_some_overlays_are_rejected) |
550 | -{ |
551 | - using namespace testing; |
552 | - mtd::MockRenderFunction mock_render_fn; |
553 | - auto render_fn = [&](mg::Renderable const& renderable) |
554 | - { |
555 | - mock_render_fn.called(renderable); |
556 | - }; |
557 | - |
558 | - std::list<std::shared_ptr<mg::Renderable>> updated_list({ |
559 | - stub_renderable1, |
560 | - stub_renderable2 |
561 | - }); |
562 | - |
563 | - std::list<hwc_layer_1_t*> expected_list |
564 | - { |
565 | - &comp_layer, |
566 | - &comp_layer, |
567 | - &target_layer |
568 | - }; |
569 | - |
570 | - Sequence seq; |
571 | - EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) |
572 | - .InSequence(seq) |
573 | - .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) |
574 | - { |
575 | - ASSERT_EQ(contents.numHwLayers, 3); |
576 | - contents.hwLayers[0].compositionType = HWC_OVERLAY; |
577 | - contents.hwLayers[1].compositionType = HWC_FRAMEBUFFER; |
578 | - contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; |
579 | - })); |
580 | - EXPECT_CALL(mock_render_fn, called(Ref(*stub_renderable2))) |
581 | - .InSequence(seq); |
582 | - EXPECT_CALL(mock_context, swap_buffers()) |
583 | - .InSequence(seq); |
584 | - |
585 | - mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); |
586 | - device.render_gl_and_overlays(mock_context, updated_list, render_fn); |
587 | -} |
588 | - |
589 | -TEST_F(HwcDevice, does_not_call_render_or_swap_when_all_overlays_accepted) |
590 | -{ |
591 | - using namespace testing; |
592 | - mtd::MockRenderFunction mock_render_fn; |
593 | - auto render_fn = [&](mg::Renderable const& renderable) |
594 | - { |
595 | - mock_render_fn.called(renderable); |
596 | - }; |
597 | - |
598 | - std::list<std::shared_ptr<mg::Renderable>> updated_list({ |
599 | - stub_renderable1, |
600 | - stub_renderable2 |
601 | - }); |
602 | - |
603 | - std::list<hwc_layer_1_t*> expected_list |
604 | - { |
605 | - &comp_layer, |
606 | - &comp_layer, |
607 | - &target_layer |
608 | - }; |
609 | - |
610 | - EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) |
611 | - .Times(1) |
612 | - .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) |
613 | - { |
614 | - ASSERT_EQ(contents.numHwLayers, 3); |
615 | - contents.hwLayers[0].compositionType = HWC_OVERLAY; |
616 | - contents.hwLayers[1].compositionType = HWC_OVERLAY; |
617 | - contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; |
618 | - })); |
619 | - EXPECT_CALL(mock_render_fn, called(_)) |
620 | - .Times(0); |
621 | - EXPECT_CALL(mock_context, swap_buffers()) |
622 | - .Times(0); |
623 | - |
624 | - mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); |
625 | - device.render_gl_and_overlays(mock_context, updated_list, render_fn); |
626 | +namespace |
627 | +{ |
628 | +MATCHER_P(MatchesRenderableList, value, std::string("")) |
629 | +{ |
630 | + if (value.size() != arg.size()) |
631 | + return false; |
632 | + |
633 | + bool match{true}; |
634 | + auto it = value.begin(); |
635 | + for(auto const& a : arg) |
636 | + { |
637 | + if (a != *it) |
638 | + match = false; |
639 | + it++; |
640 | + } |
641 | + return match; |
642 | +} |
643 | + |
644 | +} |
645 | + |
646 | +TEST_F(HwcDevice, calls_render_with_list_of_rejected_overlays) |
647 | +{ |
648 | + using namespace testing; |
649 | + mtd::MockRenderableListCompositor mock_compositor; |
650 | + |
651 | + std::list<std::shared_ptr<mg::Renderable>> updated_list({ |
652 | + stub_renderable1, |
653 | + stub_renderable2 |
654 | + }); |
655 | + std::list<std::shared_ptr<mg::Renderable>> expected_renderable_list({ |
656 | + stub_renderable2 |
657 | + }); |
658 | + |
659 | + std::list<hwc_layer_1_t*> expected_prepare_list |
660 | + { |
661 | + &comp_layer, |
662 | + &comp_layer, |
663 | + &target_layer |
664 | + }; |
665 | + |
666 | + Sequence seq; |
667 | + EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_prepare_list))) |
668 | + .InSequence(seq) |
669 | + .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) |
670 | + { |
671 | + ASSERT_EQ(contents.numHwLayers, 3); |
672 | + contents.hwLayers[0].compositionType = HWC_OVERLAY; |
673 | + contents.hwLayers[1].compositionType = HWC_FRAMEBUFFER; |
674 | + contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; |
675 | + })); |
676 | + |
677 | + EXPECT_CALL(mock_compositor, render(MatchesRenderableList(expected_renderable_list),Ref(mock_context))) |
678 | + .InSequence(seq); |
679 | + |
680 | + mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); |
681 | + device.prepare_overlays(mock_context, updated_list, mock_compositor); |
682 | } |
683 | |
684 | TEST_F(HwcDevice, resets_layers_when_prepare_gl_called) |
685 | @@ -398,7 +338,7 @@ |
686 | stub_renderable2 |
687 | }); |
688 | |
689 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
690 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
691 | device.render_gl(stub_context); |
692 | } |
693 | |
694 | @@ -544,7 +484,7 @@ |
695 | EXPECT_CALL(*native_handle_3, update_fence(release_fence3)) |
696 | .InSequence(seq); |
697 | |
698 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
699 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
700 | device.post(mock_buffer); |
701 | } |
702 | |
703 | @@ -570,9 +510,9 @@ |
704 | EXPECT_CALL(*mock_hwc_device_wrapper, set(_)) |
705 | .Times(1); |
706 | |
707 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
708 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
709 | device.post(mock_buffer); |
710 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
711 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
712 | device.post(mock_buffer); |
713 | } |
714 | |
715 | @@ -598,9 +538,9 @@ |
716 | EXPECT_CALL(*mock_hwc_device_wrapper, set(_)) |
717 | .Times(2); |
718 | |
719 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
720 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
721 | device.post(mock_buffer); |
722 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
723 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
724 | device.post(mock_buffer); |
725 | } |
726 | |
727 | @@ -643,7 +583,7 @@ |
728 | EXPECT_EQ(HWC_FRAMEBUFFER, contents.hwLayers[0].compositionType); |
729 | })); |
730 | |
731 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
732 | - device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); |
733 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
734 | + device.prepare_overlays(stub_context, updated_list, stub_compositor); |
735 | device.post(mock_buffer); |
736 | } |
737 | |
738 | === modified file 'tests/unit-tests/graphics/android/test_hwc_display.cpp' |
739 | --- tests/unit-tests/graphics/android/test_hwc_display.cpp 2014-05-01 07:13:02 +0000 |
740 | +++ tests/unit-tests/graphics/android/test_hwc_display.cpp 2014-05-12 18:27:14 +0000 |
741 | @@ -133,7 +133,7 @@ |
742 | std::function<void(mg::Renderable const&)> render_fn; |
743 | |
744 | InSequence seq; |
745 | - EXPECT_CALL(*mock_display_device, render_gl_and_overlays(_, Ref(renderlist), Ref(render_fn))) |
746 | + EXPECT_CALL(*mock_display_device, prepare_overlays(_, Ref(renderlist), _)) |
747 | .Times(1); |
748 | EXPECT_CALL(*mock_fb_bundle, last_rendered_buffer()) |
749 | .Times(1) |
750 | |
751 | === modified file 'tests/unit-tests/graphics/android/test_hwc_fb_device.cpp' |
752 | --- tests/unit-tests/graphics/android/test_hwc_fb_device.cpp 2014-03-26 05:48:59 +0000 |
753 | +++ tests/unit-tests/graphics/android/test_hwc_fb_device.cpp 2014-05-12 18:27:14 +0000 |
754 | @@ -29,6 +29,8 @@ |
755 | #include "mir_test_doubles/stub_swapping_gl_context.h" |
756 | #include "mir_test_doubles/mock_egl.h" |
757 | #include "mir_test_doubles/mock_hwc_device_wrapper.h" |
758 | +#include "mir_test_doubles/mock_renderable_list_compositor.h" |
759 | +#include "src/platform/graphics/android/overlay_gl_compositor.h" |
760 | #include "hwc_struct_helpers.h" |
761 | #include <gtest/gtest.h> |
762 | #include <stdexcept> |
763 | @@ -111,6 +113,7 @@ |
764 | TEST_F(HwcFbDevice, hwc10_prepare_with_renderables) |
765 | { |
766 | using namespace testing; |
767 | + mtd::MockRenderableListCompositor mock_compositor; |
768 | std::list<hwc_layer_1_t*> expected_list{&skip_layer}; |
769 | auto renderable1 = std::make_shared<mtd::StubRenderable>(); |
770 | auto renderable2 = std::make_shared<mtd::StubRenderable>(); |
771 | @@ -120,14 +123,15 @@ |
772 | renderable2 |
773 | }; |
774 | |
775 | - mtd::MockRenderFunction mock_call_counter; |
776 | testing::Sequence seq; |
777 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) |
778 | .InSequence(seq); |
779 | - EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable1))) |
780 | - .InSequence(seq); |
781 | - EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable2))) |
782 | - .InSequence(seq); |
783 | + EXPECT_CALL(mock_compositor, render(Ref(renderlist),_)) |
784 | + .InSequence(seq) |
785 | + .WillOnce(Invoke([](mg::RenderableList const&, mga::SwappingGLContext const& cont) |
786 | + { |
787 | + cont.swap_buffers(); |
788 | + })); |
789 | EXPECT_CALL(mock_egl, eglGetCurrentDisplay()) |
790 | .InSequence(seq) |
791 | .WillOnce(Return(dpy)); |
792 | @@ -138,11 +142,7 @@ |
793 | .InSequence(seq); |
794 | |
795 | mga::HwcFbDevice device(mock_hwc_device, mock_hwc_device_wrapper, mock_fb_device, mock_vsync); |
796 | - |
797 | - device.render_gl_and_overlays(stub_context, renderlist, [&](mg::Renderable const& renderable) |
798 | - { |
799 | - mock_call_counter.called(renderable); |
800 | - }); |
801 | + device.prepare_overlays(stub_context, renderlist, mock_compositor); |
802 | } |
803 | |
804 | TEST_F(HwcFbDevice, hwc10_post) |
PASSED: Continuous integration, rev:1587 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- ci/1448/ jenkins. qa.ubuntu. com/job/ mir-android- trusty- i386-build/ 1773 jenkins. qa.ubuntu. com/job/ mir-clang- trusty- amd64-build/ 1771 jenkins. qa.ubuntu. com/job/ mir-mediumtests -trusty- touch/1341 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- amd64-ci/ 1180 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- amd64-ci/ 1180/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- armhf-ci/ 1185 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- trusty- armhf-ci/ 1185/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- trusty- armhf/1344 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- trusty- armhf/1344/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/1237 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 6581/console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- team-mir- development- branch- ci/1448/ rebuild
http://