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 | 22 | #include "mir/graphics/buffer.h" | 22 | #include "mir/graphics/buffer.h" |
6 | 23 | #include "src/platform/graphics/android/display_device.h" | 23 | #include "src/platform/graphics/android/display_device.h" |
7 | 24 | #include "src/platform/graphics/android/gl_context.h" | 24 | #include "src/platform/graphics/android/gl_context.h" |
8 | 25 | #include "src/platform/graphics/android/overlay_gl_compositor.h" | ||
9 | 25 | #include <gmock/gmock.h> | 26 | #include <gmock/gmock.h> |
10 | 26 | 27 | ||
11 | 27 | namespace mir | 28 | namespace mir |
12 | @@ -36,10 +37,10 @@ | |||
13 | 36 | ~MockDisplayDevice() noexcept {} | 37 | ~MockDisplayDevice() noexcept {} |
14 | 37 | MOCK_METHOD1(mode, void(MirPowerMode)); | 38 | MOCK_METHOD1(mode, void(MirPowerMode)); |
15 | 38 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); | 39 | MOCK_METHOD1(render_gl, void(graphics::android::SwappingGLContext const&)); |
17 | 39 | MOCK_METHOD3(render_gl_and_overlays, void( | 40 | MOCK_METHOD3(prepare_overlays, void( |
18 | 40 | graphics::android::SwappingGLContext const&, | 41 | graphics::android::SwappingGLContext const&, |
19 | 41 | graphics::RenderableList const&, | 42 | graphics::RenderableList const&, |
21 | 42 | std::function<void(graphics::Renderable const&)> const&)); | 43 | graphics::android::RenderableListCompositor const&)); |
22 | 43 | MOCK_METHOD1(post, void(graphics::Buffer const&)); | 44 | MOCK_METHOD1(post, void(graphics::Buffer const&)); |
23 | 44 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); | 45 | MOCK_CONST_METHOD1(apply_orientation, bool(MirOrientation)); |
24 | 45 | }; | 46 | }; |
25 | 46 | 47 | ||
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 | 1 | /* | ||
31 | 2 | * Copyright © 2014 Canonical Ltd. | ||
32 | 3 | * | ||
33 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
34 | 5 | * under the terms of the GNU General Public License version 3, | ||
35 | 6 | * as published by the Free Software Foundation. | ||
36 | 7 | * | ||
37 | 8 | * This program is distributed in the hope that it will be useful, | ||
38 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
40 | 11 | * GNU General Public License for more details. | ||
41 | 12 | * | ||
42 | 13 | * You should have received a copy of the GNU General Public License | ||
43 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
44 | 15 | * | ||
45 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
46 | 17 | */ | ||
47 | 18 | |||
48 | 19 | #ifndef MIR_TEST_DOUBLES_MOCK_RENDERABLE_LIST_COMPOSITOR_H_ | ||
49 | 20 | #define MIR_TEST_DOUBLES_MOCK_RENDERABLE_LIST_COMPOSITOR_H_ | ||
50 | 21 | |||
51 | 22 | #include "src/platform/graphics/android/overlay_gl_compositor.h" | ||
52 | 23 | #include <gmock/gmock.h> | ||
53 | 24 | |||
54 | 25 | namespace mir | ||
55 | 26 | { | ||
56 | 27 | namespace test | ||
57 | 28 | { | ||
58 | 29 | namespace doubles | ||
59 | 30 | { | ||
60 | 31 | |||
61 | 32 | struct MockRenderableListCompositor : public graphics::android::RenderableListCompositor | ||
62 | 33 | { | ||
63 | 34 | MOCK_CONST_METHOD2(render, | ||
64 | 35 | void(graphics::RenderableList const&, graphics::android::SwappingGLContext const&)); | ||
65 | 36 | }; | ||
66 | 37 | |||
67 | 38 | } | ||
68 | 39 | } | ||
69 | 40 | } | ||
70 | 41 | #endif // MIR_TEST_DOUBLES_MOCK_RENDERABLE_LIST_COMPOSITOR_H_ | ||
71 | 0 | 42 | ||
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 | 1 | /* | ||
77 | 2 | * Copyright © 2014 Canonical Ltd. | ||
78 | 3 | * | ||
79 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
80 | 5 | * under the terms of the GNU General Public License version 3, | ||
81 | 6 | * as published by the Free Software Foundation. | ||
82 | 7 | * | ||
83 | 8 | * This program is distributed in the hope that it will be useful, | ||
84 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
85 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
86 | 11 | * GNU General Public License for more details. | ||
87 | 12 | * | ||
88 | 13 | * You should have received a copy of the GNU General Public License | ||
89 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
90 | 15 | * | ||
91 | 16 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> | ||
92 | 17 | */ | ||
93 | 18 | |||
94 | 19 | #ifndef MIR_TEST_DOUBLES_STUB_RENDERABLE_LIST_COMPOSITOR_H_ | ||
95 | 20 | #define MIR_TEST_DOUBLES_STUB_RENDERABLE_LIST_COMPOSITOR_H_ | ||
96 | 21 | |||
97 | 22 | #include "src/platform/graphics/android/overlay_gl_compositor.h" | ||
98 | 23 | |||
99 | 24 | namespace mir | ||
100 | 25 | { | ||
101 | 26 | namespace test | ||
102 | 27 | { | ||
103 | 28 | namespace doubles | ||
104 | 29 | { | ||
105 | 30 | |||
106 | 31 | struct StubRenderableListCompositor : public graphics::android::RenderableListCompositor | ||
107 | 32 | { | ||
108 | 33 | void render(graphics::RenderableList const&, graphics::android::SwappingGLContext const&) const | ||
109 | 34 | { | ||
110 | 35 | } | ||
111 | 36 | }; | ||
112 | 37 | |||
113 | 38 | } | ||
114 | 39 | } | ||
115 | 40 | } | ||
116 | 41 | #endif // MIR_TEST_DOUBLES_STUB_RENDERABLE_LIST_COMPOSITOR_H_ | ||
117 | 0 | 42 | ||
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 | 88 | 88 | ||
123 | 89 | void mga::DisplayBuffer::render_and_post_update( | 89 | void mga::DisplayBuffer::render_and_post_update( |
124 | 90 | RenderableList const& renderlist, | 90 | RenderableList const& renderlist, |
126 | 91 | std::function<void(Renderable const&)> const& render_fn) | 91 | std::function<void(Renderable const&)> const&) |
127 | 92 | { | 92 | { |
128 | 93 | if (renderlist.empty()) | 93 | if (renderlist.empty()) |
129 | 94 | { | 94 | { |
130 | @@ -96,7 +96,7 @@ | |||
131 | 96 | } | 96 | } |
132 | 97 | else | 97 | else |
133 | 98 | { | 98 | { |
135 | 99 | display_device->render_gl_and_overlays(gl_context, renderlist, render_fn); | 99 | display_device->prepare_overlays(gl_context, renderlist, overlay_program); |
136 | 100 | } | 100 | } |
137 | 101 | 101 | ||
138 | 102 | post(); | 102 | post(); |
139 | 103 | 103 | ||
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 | 22 | #include "mir/graphics/renderable.h" | 22 | #include "mir/graphics/renderable.h" |
145 | 23 | #include "mir_toolkit/common.h" | 23 | #include "mir_toolkit/common.h" |
146 | 24 | #include <EGL/egl.h> | 24 | #include <EGL/egl.h> |
147 | 25 | #include <list> | ||
148 | 26 | 25 | ||
149 | 27 | namespace mir | 26 | namespace mir |
150 | 28 | { | 27 | { |
151 | @@ -33,6 +32,7 @@ | |||
152 | 33 | 32 | ||
153 | 34 | namespace android | 33 | namespace android |
154 | 35 | { | 34 | { |
155 | 35 | class RenderableListCompositor; | ||
156 | 36 | class SwappingGLContext; | 36 | class SwappingGLContext; |
157 | 37 | 37 | ||
158 | 38 | class DisplayDevice | 38 | class DisplayDevice |
159 | @@ -42,10 +42,10 @@ | |||
160 | 42 | 42 | ||
161 | 43 | virtual void mode(MirPowerMode mode) = 0; | 43 | virtual void mode(MirPowerMode mode) = 0; |
162 | 44 | virtual void render_gl(SwappingGLContext const& context) = 0; | 44 | virtual void render_gl(SwappingGLContext const& context) = 0; |
164 | 45 | virtual void render_gl_and_overlays( | 45 | virtual void prepare_overlays( |
165 | 46 | SwappingGLContext const& context, | 46 | SwappingGLContext const& context, |
166 | 47 | RenderableList const& list, | 47 | RenderableList const& list, |
168 | 48 | std::function<void(Renderable const&)> const& render_fn) = 0; | 48 | RenderableListCompositor const& list_compositor) = 0; |
169 | 49 | virtual void post(Buffer const& buffer) = 0; | 49 | virtual void post(Buffer const& buffer) = 0; |
170 | 50 | virtual bool apply_orientation(MirOrientation orientation) const = 0; | 50 | virtual bool apply_orientation(MirOrientation orientation) const = 0; |
171 | 51 | 51 | ||
172 | 52 | 52 | ||
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 | 24 | #include "fb_device.h" | 24 | #include "fb_device.h" |
178 | 25 | #include "framebuffer_bundle.h" | 25 | #include "framebuffer_bundle.h" |
179 | 26 | #include "buffer.h" | 26 | #include "buffer.h" |
180 | 27 | #include "overlay_gl_compositor.h" | ||
181 | 27 | 28 | ||
182 | 28 | #include <boost/throw_exception.hpp> | 29 | #include <boost/throw_exception.hpp> |
183 | 29 | #include <stdexcept> | 30 | #include <stdexcept> |
184 | @@ -49,15 +50,12 @@ | |||
185 | 49 | context.swap_buffers(); | 50 | context.swap_buffers(); |
186 | 50 | } | 51 | } |
187 | 51 | 52 | ||
189 | 52 | void mga::FBDevice::render_gl_and_overlays( | 53 | void mga::FBDevice::prepare_overlays( |
190 | 53 | SwappingGLContext const& context, | 54 | SwappingGLContext const& context, |
193 | 54 | RenderableList const& renderables, | 55 | RenderableList const& list, |
194 | 55 | std::function<void(Renderable const&)> const& render_fn) | 56 | RenderableListCompositor const& compositor) |
195 | 56 | { | 57 | { |
200 | 57 | for(auto const& renderable : renderables) | 58 | compositor.render(list, context); |
197 | 58 | render_fn(*renderable); | ||
198 | 59 | |||
199 | 60 | context.swap_buffers(); | ||
201 | 61 | } | 59 | } |
202 | 62 | 60 | ||
203 | 63 | void mga::FBDevice::post(mg::Buffer const& buffer) | 61 | void mga::FBDevice::post(mg::Buffer const& buffer) |
204 | 64 | 62 | ||
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 | 38 | bool apply_orientation(MirOrientation orientation) const; | 38 | bool apply_orientation(MirOrientation orientation) const; |
210 | 39 | void mode(MirPowerMode mode); | 39 | void mode(MirPowerMode mode); |
211 | 40 | virtual void render_gl(SwappingGLContext const& context); | 40 | virtual void render_gl(SwappingGLContext const& context); |
213 | 41 | virtual void render_gl_and_overlays( | 41 | virtual void prepare_overlays( |
214 | 42 | SwappingGLContext const& context, | 42 | SwappingGLContext const& context, |
215 | 43 | RenderableList const& list, | 43 | RenderableList const& list, |
217 | 44 | std::function<void(Renderable const&)> const& render_fn); | 44 | RenderableListCompositor const& list_compositor); |
218 | 45 | void post(Buffer const& buffer); | 45 | void post(Buffer const& buffer); |
219 | 46 | 46 | ||
220 | 47 | private: | 47 | private: |
221 | 48 | 48 | ||
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 | 24 | #include "hwc_wrapper.h" | 24 | #include "hwc_wrapper.h" |
227 | 25 | #include "framebuffer_bundle.h" | 25 | #include "framebuffer_bundle.h" |
228 | 26 | #include "buffer.h" | 26 | #include "buffer.h" |
230 | 27 | #include "mir/graphics/buffer.h" | 27 | #include "overlay_gl_compositor.h" |
231 | 28 | 28 | ||
232 | 29 | namespace mg = mir::graphics; | 29 | namespace mg = mir::graphics; |
233 | 30 | namespace mga=mir::graphics::android; | 30 | namespace mga=mir::graphics::android; |
234 | @@ -88,10 +88,10 @@ | |||
235 | 88 | context.swap_buffers(); | 88 | context.swap_buffers(); |
236 | 89 | } | 89 | } |
237 | 90 | 90 | ||
239 | 91 | void mga::HwcDevice::render_gl_and_overlays( | 91 | void mga::HwcDevice::prepare_overlays( |
240 | 92 | SwappingGLContext const& context, | 92 | SwappingGLContext const& context, |
241 | 93 | RenderableList const& renderables, | 93 | RenderableList const& renderables, |
243 | 94 | std::function<void(Renderable const&)> const& render_fn) | 94 | RenderableListCompositor const& list_compositor) |
244 | 95 | { | 95 | { |
245 | 96 | if (!(list_needs_commit = hwc_list.update_list_and_check_if_changed(renderables, fbtarget_size))) | 96 | if (!(list_needs_commit = hwc_list.update_list_and_check_if_changed(renderables, fbtarget_size))) |
246 | 97 | return; | 97 | return; |
247 | @@ -99,25 +99,18 @@ | |||
248 | 99 | 99 | ||
249 | 100 | hwc_wrapper->prepare(*hwc_list.native_list().lock()); | 100 | hwc_wrapper->prepare(*hwc_list.native_list().lock()); |
250 | 101 | 101 | ||
253 | 102 | //draw layers that the HWC did not accept for overlays here | 102 | mg::RenderableList rejected_renderables; |
254 | 103 | bool needs_swapbuffers = false; | 103 | |
255 | 104 | auto layers_it = hwc_list.begin(); | 104 | auto layers_it = hwc_list.begin(); |
256 | 105 | for(auto const& renderable : renderables) | 105 | for(auto const& renderable : renderables) |
257 | 106 | { | 106 | { |
258 | 107 | //prepare all layers for draw. | ||
259 | 108 | layers_it->prepare_for_draw(); | 107 | layers_it->prepare_for_draw(); |
260 | 109 | |||
261 | 110 | //trigger GL on the layers that are not overlays | ||
262 | 111 | if (layers_it->needs_gl_render()) | 108 | if (layers_it->needs_gl_render()) |
267 | 112 | { | 109 | rejected_renderables.push_back(renderable); |
264 | 113 | render_fn(*renderable); | ||
265 | 114 | needs_swapbuffers = true; | ||
266 | 115 | } | ||
268 | 116 | layers_it++; | 110 | layers_it++; |
269 | 117 | } | 111 | } |
270 | 118 | 112 | ||
273 | 119 | if (needs_swapbuffers) | 113 | list_compositor.render(rejected_renderables, context); |
272 | 120 | context.swap_buffers(); | ||
274 | 121 | } | 114 | } |
275 | 122 | 115 | ||
276 | 123 | void mga::HwcDevice::post(mg::Buffer const& buffer) | 116 | void mga::HwcDevice::post(mg::Buffer const& buffer) |
277 | 124 | 117 | ||
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 | 48 | std::shared_ptr<SyncFileOps> const& sync_ops); | 48 | std::shared_ptr<SyncFileOps> const& sync_ops); |
283 | 49 | 49 | ||
284 | 50 | virtual void render_gl(SwappingGLContext const& context); | 50 | virtual void render_gl(SwappingGLContext const& context); |
286 | 51 | virtual void render_gl_and_overlays( | 51 | virtual void prepare_overlays( |
287 | 52 | SwappingGLContext const& context, | 52 | SwappingGLContext const& context, |
288 | 53 | RenderableList const& list, | 53 | RenderableList const& list, |
290 | 54 | std::function<void(Renderable const&)> const& render_fn); | 54 | RenderableListCompositor const& list_compositor); |
291 | 55 | void post(Buffer const& buffer); | 55 | void post(Buffer const& buffer); |
292 | 56 | 56 | ||
293 | 57 | private: | 57 | private: |
294 | 58 | 58 | ||
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 | 22 | #include "framebuffer_bundle.h" | 22 | #include "framebuffer_bundle.h" |
300 | 23 | #include "android_format_conversion-inl.h" | 23 | #include "android_format_conversion-inl.h" |
301 | 24 | #include "hwc_wrapper.h" | 24 | #include "hwc_wrapper.h" |
302 | 25 | #include "overlay_gl_compositor.h" | ||
303 | 25 | #include "mir/graphics/buffer.h" | 26 | #include "mir/graphics/buffer.h" |
304 | 26 | #include "mir/graphics/android/native_buffer.h" | 27 | #include "mir/graphics/android/native_buffer.h" |
305 | 28 | #include "gl_context.h" | ||
306 | 27 | 29 | ||
307 | 28 | #include <boost/throw_exception.hpp> | 30 | #include <boost/throw_exception.hpp> |
308 | 29 | #include <sstream> | 31 | #include <sstream> |
309 | @@ -33,6 +35,24 @@ | |||
310 | 33 | namespace mga = mir::graphics::android; | 35 | namespace mga = mir::graphics::android; |
311 | 34 | namespace geom = mir::geometry; | 36 | namespace geom = mir::geometry; |
312 | 35 | 37 | ||
313 | 38 | namespace | ||
314 | 39 | { | ||
315 | 40 | class HWC10Context : public mga::SwappingGLContext | ||
316 | 41 | { | ||
317 | 42 | public: | ||
318 | 43 | HWC10Context(std::function<void()> const& swapping_fn) | ||
319 | 44 | : swapping_fn(std::move(swapping_fn)) | ||
320 | 45 | { | ||
321 | 46 | } | ||
322 | 47 | void swap_buffers() const override | ||
323 | 48 | { | ||
324 | 49 | swapping_fn(); | ||
325 | 50 | } | ||
326 | 51 | private: | ||
327 | 52 | std::function<void()> const swapping_fn; | ||
328 | 53 | }; | ||
329 | 54 | } | ||
330 | 55 | |||
331 | 36 | mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, | 56 | mga::HwcFbDevice::HwcFbDevice(std::shared_ptr<hwc_composer_device_1> const& hwc_device, |
332 | 37 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, | 57 | std::shared_ptr<HwcWrapper> const& hwc_wrapper, |
333 | 38 | std::shared_ptr<framebuffer_device_t> const& fb_device, | 58 | std::shared_ptr<framebuffer_device_t> const& fb_device, |
334 | @@ -84,16 +104,15 @@ | |||
335 | 84 | gpu_render(); | 104 | gpu_render(); |
336 | 85 | } | 105 | } |
337 | 86 | 106 | ||
339 | 87 | void mga::HwcFbDevice::render_gl_and_overlays( | 107 | void mga::HwcFbDevice::prepare_overlays( |
340 | 88 | SwappingGLContext const&, | 108 | SwappingGLContext const&, |
343 | 89 | RenderableList const& renderables, | 109 | RenderableList const& list, |
344 | 90 | std::function<void(Renderable const&)> const& render_fn) | 110 | RenderableListCompositor const& compositor) |
345 | 91 | { | 111 | { |
346 | 92 | prepare(); | 112 | prepare(); |
351 | 93 | //TODO: filter this list based on the results of the preparation | 113 | //hwc 1.0 is weird in that the driver gets to call eglSwapBuffers. |
352 | 94 | for(auto const& renderable : renderables) | 114 | HWC10Context context(std::bind(&HwcFbDevice::gpu_render, this)); |
353 | 95 | render_fn(*renderable); | 115 | compositor.render(list, context); |
350 | 96 | gpu_render(); | ||
354 | 97 | } | 116 | } |
355 | 98 | 117 | ||
356 | 99 | void mga::HwcFbDevice::post(mg::Buffer const& buffer) | 118 | void mga::HwcFbDevice::post(mg::Buffer const& buffer) |
357 | 100 | 119 | ||
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 | 41 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); | 41 | std::shared_ptr<HWCVsyncCoordinator> const& coordinator); |
363 | 42 | 42 | ||
364 | 43 | virtual void render_gl(SwappingGLContext const& context); | 43 | virtual void render_gl(SwappingGLContext const& context); |
366 | 44 | virtual void render_gl_and_overlays( | 44 | virtual void prepare_overlays( |
367 | 45 | SwappingGLContext const& context, | 45 | SwappingGLContext const& context, |
368 | 46 | RenderableList const& list, | 46 | RenderableList const& list, |
370 | 47 | std::function<void(Renderable const&)> const& render_fn); | 47 | RenderableListCompositor const& list_compositor); |
371 | 48 | void post(Buffer const& buffer); | 48 | void post(Buffer const& buffer); |
372 | 49 | 49 | ||
373 | 50 | private: | 50 | private: |
374 | 51 | 51 | ||
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 | 47 | overlay_program = factory.create_gl_program(vertex_shader, fragment_shader); | 47 | overlay_program = factory.create_gl_program(vertex_shader, fragment_shader); |
380 | 48 | context.release_current(); | 48 | context.release_current(); |
381 | 49 | } | 49 | } |
382 | 50 | |||
383 | 51 | void mga::OverlayGLProgram::render(RenderableList const&, SwappingGLContext const&) const | ||
384 | 52 | { | ||
385 | 53 | } | ||
386 | 50 | 54 | ||
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 | 20 | #define MIR_GRAPHICS_ANDROID_OVERLAY_GL_PROGRAM_H_ | 20 | #define MIR_GRAPHICS_ANDROID_OVERLAY_GL_PROGRAM_H_ |
392 | 21 | 21 | ||
393 | 22 | #include "mir/graphics/gl_program.h" | 22 | #include "mir/graphics/gl_program.h" |
394 | 23 | #include "mir/graphics/renderable.h" | ||
395 | 23 | #include <memory> | 24 | #include <memory> |
396 | 24 | 25 | ||
397 | 25 | namespace mir | 26 | namespace mir |
398 | @@ -31,11 +32,26 @@ | |||
399 | 31 | 32 | ||
400 | 32 | namespace android | 33 | namespace android |
401 | 33 | { | 34 | { |
404 | 34 | 35 | class SwappingGLContext; | |
405 | 35 | class OverlayGLProgram | 36 | |
406 | 37 | class RenderableListCompositor | ||
407 | 38 | { | ||
408 | 39 | public: | ||
409 | 40 | virtual ~RenderableListCompositor() = default; | ||
410 | 41 | virtual void render(RenderableList const&, SwappingGLContext const&) const = 0; | ||
411 | 42 | protected: | ||
412 | 43 | RenderableListCompositor() = default; | ||
413 | 44 | private: | ||
414 | 45 | RenderableListCompositor(RenderableListCompositor const&) = delete; | ||
415 | 46 | RenderableListCompositor& operator=(RenderableListCompositor const&) = delete; | ||
416 | 47 | }; | ||
417 | 48 | |||
418 | 49 | class OverlayGLProgram : public RenderableListCompositor | ||
419 | 36 | { | 50 | { |
420 | 37 | public: | 51 | public: |
421 | 38 | OverlayGLProgram(GLProgramFactory const& program_factory, graphics::GLContext const& gl_context); | 52 | OverlayGLProgram(GLProgramFactory const& program_factory, graphics::GLContext const& gl_context); |
422 | 53 | |||
423 | 54 | void render(RenderableList const&, SwappingGLContext const&) const; | ||
424 | 39 | private: | 55 | private: |
425 | 40 | std::unique_ptr<graphics::GLProgram> overlay_program; | 56 | std::unique_ptr<graphics::GLProgram> overlay_program; |
426 | 41 | }; | 57 | }; |
427 | 42 | 58 | ||
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 | 19 | #include "mir_test_doubles/mock_fb_hal_device.h" | 19 | #include "mir_test_doubles/mock_fb_hal_device.h" |
433 | 20 | #include "mir_test_doubles/mock_buffer.h" | 20 | #include "mir_test_doubles/mock_buffer.h" |
434 | 21 | #include "src/platform/graphics/android/fb_device.h" | 21 | #include "src/platform/graphics/android/fb_device.h" |
435 | 22 | #include "src/platform/graphics/android/overlay_gl_compositor.h" | ||
436 | 22 | #include "mir_test_doubles/mock_framebuffer_bundle.h" | 23 | #include "mir_test_doubles/mock_framebuffer_bundle.h" |
437 | 23 | #include "mir_test_doubles/mock_android_hw.h" | 24 | #include "mir_test_doubles/mock_android_hw.h" |
438 | 24 | #include "mir_test_doubles/mock_egl.h" | 25 | #include "mir_test_doubles/mock_egl.h" |
439 | @@ -27,6 +28,8 @@ | |||
440 | 27 | #include "mir_test_doubles/mock_android_native_buffer.h" | 28 | #include "mir_test_doubles/mock_android_native_buffer.h" |
441 | 28 | #include "mir_test_doubles/mock_render_function.h" | 29 | #include "mir_test_doubles/mock_render_function.h" |
442 | 29 | #include "mir_test_doubles/mock_swapping_gl_context.h" | 30 | #include "mir_test_doubles/mock_swapping_gl_context.h" |
443 | 31 | #include "mir_test_doubles/stub_renderable_list_compositor.h" | ||
444 | 32 | #include "mir_test_doubles/mock_renderable_list_compositor.h" | ||
445 | 30 | 33 | ||
446 | 31 | #include <gtest/gtest.h> | 34 | #include <gtest/gtest.h> |
447 | 32 | #include <stdexcept> | 35 | #include <stdexcept> |
448 | @@ -63,7 +66,7 @@ | |||
449 | 63 | mtd::MockSwappingGLContext mock_context; | 66 | mtd::MockSwappingGLContext mock_context; |
450 | 64 | }; | 67 | }; |
451 | 65 | 68 | ||
453 | 66 | TEST_F(FBDevice, render_overlays_via_gl) | 69 | TEST_F(FBDevice, prepares_overlays_by_rendering) |
454 | 67 | { | 70 | { |
455 | 68 | auto renderable1 = std::make_shared<mtd::StubRenderable>(); | 71 | auto renderable1 = std::make_shared<mtd::StubRenderable>(); |
456 | 69 | auto renderable2 = std::make_shared<mtd::StubRenderable>(); | 72 | auto renderable2 = std::make_shared<mtd::StubRenderable>(); |
457 | @@ -73,20 +76,11 @@ | |||
458 | 73 | renderable2 | 76 | renderable2 |
459 | 74 | }; | 77 | }; |
460 | 75 | 78 | ||
470 | 76 | mtd::MockRenderFunction mock_call_counter; | 79 | mtd::MockRenderableListCompositor mock_compositor; |
471 | 77 | testing::Sequence seq; | 80 | EXPECT_CALL(mock_compositor, render(testing::Ref(renderlist),testing::_)) |
472 | 78 | EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable1))) | 81 | .Times(1); |
464 | 79 | .InSequence(seq); | ||
465 | 80 | EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable2))) | ||
466 | 81 | .InSequence(seq); | ||
467 | 82 | EXPECT_CALL(mock_context, swap_buffers()) | ||
468 | 83 | .InSequence(seq); | ||
469 | 84 | |||
473 | 85 | mga::FBDevice fbdev(fb_hal_mock); | 82 | mga::FBDevice fbdev(fb_hal_mock); |
478 | 86 | fbdev.render_gl_and_overlays(mock_context, renderlist, [&](mg::Renderable const& renderable) | 83 | fbdev.prepare_overlays(mock_context, renderlist, mock_compositor); |
475 | 87 | { | ||
476 | 88 | mock_call_counter.called(renderable); | ||
477 | 89 | }); | ||
479 | 90 | } | 84 | } |
480 | 91 | 85 | ||
481 | 92 | TEST_F(FBDevice, commits_frame_via_post) | 86 | TEST_F(FBDevice, commits_frame_via_post) |
482 | 93 | 87 | ||
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 | 34 | #include "mir_test_doubles/mock_render_function.h" | 34 | #include "mir_test_doubles/mock_render_function.h" |
488 | 35 | #include "mir_test_doubles/mock_swapping_gl_context.h" | 35 | #include "mir_test_doubles/mock_swapping_gl_context.h" |
489 | 36 | #include "mir_test_doubles/stub_swapping_gl_context.h" | 36 | #include "mir_test_doubles/stub_swapping_gl_context.h" |
490 | 37 | #include "mir_test_doubles/stub_renderable_list_compositor.h" | ||
491 | 38 | #include "mir_test_doubles/mock_renderable_list_compositor.h" | ||
492 | 37 | #include <gmock/gmock.h> | 39 | #include <gmock/gmock.h> |
493 | 38 | #include <gtest/gtest.h> | 40 | #include <gtest/gtest.h> |
494 | 39 | #include <stdexcept> | 41 | #include <stdexcept> |
495 | @@ -230,6 +232,7 @@ | |||
496 | 230 | testing::NiceMock<mtd::MockBuffer> mock_buffer; | 232 | testing::NiceMock<mtd::MockBuffer> mock_buffer; |
497 | 231 | mtd::MockSwappingGLContext mock_context; | 233 | mtd::MockSwappingGLContext mock_context; |
498 | 232 | mtd::StubSwappingGLContext stub_context; | 234 | mtd::StubSwappingGLContext stub_context; |
499 | 235 | mtd::StubRenderableListCompositor stub_compositor; | ||
500 | 233 | }; | 236 | }; |
501 | 234 | 237 | ||
502 | 235 | 238 | ||
503 | @@ -249,125 +252,62 @@ | |||
504 | 249 | device.render_gl(stub_context); | 252 | device.render_gl(stub_context); |
505 | 250 | } | 253 | } |
506 | 251 | 254 | ||
626 | 252 | TEST_F(HwcDevice, calls_render_fn_and_swap_when_all_overlays_are_rejected) | 255 | namespace |
627 | 253 | { | 256 | { |
628 | 254 | using namespace testing; | 257 | MATCHER_P(MatchesRenderableList, value, std::string("")) |
629 | 255 | mtd::MockRenderFunction mock_render_fn; | 258 | { |
630 | 256 | auto render_fn = [&](mg::Renderable const& renderable) | 259 | if (value.size() != arg.size()) |
631 | 257 | { | 260 | return false; |
632 | 258 | mock_render_fn.called(renderable); | 261 | |
633 | 259 | }; | 262 | bool match{true}; |
634 | 260 | 263 | auto it = value.begin(); | |
635 | 261 | std::list<std::shared_ptr<mg::Renderable>> updated_list({ | 264 | for(auto const& a : arg) |
636 | 262 | stub_renderable1, | 265 | { |
637 | 263 | stub_renderable2 | 266 | if (a != *it) |
638 | 264 | }); | 267 | match = false; |
639 | 265 | 268 | it++; | |
640 | 266 | std::list<hwc_layer_1_t*> expected_list | 269 | } |
641 | 267 | { | 270 | return match; |
642 | 268 | &comp_layer, | 271 | } |
643 | 269 | &comp_layer, | 272 | |
644 | 270 | &target_layer | 273 | } |
645 | 271 | }; | 274 | |
646 | 272 | 275 | TEST_F(HwcDevice, calls_render_with_list_of_rejected_overlays) | |
647 | 273 | Sequence seq; | 276 | { |
648 | 274 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) | 277 | using namespace testing; |
649 | 275 | .InSequence(seq) | 278 | mtd::MockRenderableListCompositor mock_compositor; |
650 | 276 | .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) | 279 | |
651 | 277 | { | 280 | std::list<std::shared_ptr<mg::Renderable>> updated_list({ |
652 | 278 | ASSERT_EQ(contents.numHwLayers, 3); | 281 | stub_renderable1, |
653 | 279 | contents.hwLayers[0].compositionType = HWC_FRAMEBUFFER; | 282 | stub_renderable2 |
654 | 280 | contents.hwLayers[1].compositionType = HWC_FRAMEBUFFER; | 283 | }); |
655 | 281 | contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; | 284 | std::list<std::shared_ptr<mg::Renderable>> expected_renderable_list({ |
656 | 282 | })); | 285 | stub_renderable2 |
657 | 283 | EXPECT_CALL(mock_render_fn, called(Ref(*stub_renderable1))) | 286 | }); |
658 | 284 | .InSequence(seq); | 287 | |
659 | 285 | EXPECT_CALL(mock_render_fn, called(Ref(*stub_renderable2))) | 288 | std::list<hwc_layer_1_t*> expected_prepare_list |
660 | 286 | .InSequence(seq); | 289 | { |
661 | 287 | EXPECT_CALL(mock_context, swap_buffers()) | 290 | &comp_layer, |
662 | 288 | .InSequence(seq); | 291 | &comp_layer, |
663 | 289 | 292 | &target_layer | |
664 | 290 | mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); | 293 | }; |
665 | 291 | device.render_gl_and_overlays(mock_context, updated_list, render_fn); | 294 | |
666 | 292 | } | 295 | Sequence seq; |
667 | 293 | 296 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_prepare_list))) | |
668 | 294 | TEST_F(HwcDevice, calls_render_and_swap_when_some_overlays_are_rejected) | 297 | .InSequence(seq) |
669 | 295 | { | 298 | .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) |
670 | 296 | using namespace testing; | 299 | { |
671 | 297 | mtd::MockRenderFunction mock_render_fn; | 300 | ASSERT_EQ(contents.numHwLayers, 3); |
672 | 298 | auto render_fn = [&](mg::Renderable const& renderable) | 301 | contents.hwLayers[0].compositionType = HWC_OVERLAY; |
673 | 299 | { | 302 | contents.hwLayers[1].compositionType = HWC_FRAMEBUFFER; |
674 | 300 | mock_render_fn.called(renderable); | 303 | contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; |
675 | 301 | }; | 304 | })); |
676 | 302 | 305 | ||
677 | 303 | std::list<std::shared_ptr<mg::Renderable>> updated_list({ | 306 | EXPECT_CALL(mock_compositor, render(MatchesRenderableList(expected_renderable_list),Ref(mock_context))) |
678 | 304 | stub_renderable1, | 307 | .InSequence(seq); |
679 | 305 | stub_renderable2 | 308 | |
680 | 306 | }); | 309 | mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); |
681 | 307 | 310 | device.prepare_overlays(mock_context, updated_list, mock_compositor); | |
563 | 308 | std::list<hwc_layer_1_t*> expected_list | ||
564 | 309 | { | ||
565 | 310 | &comp_layer, | ||
566 | 311 | &comp_layer, | ||
567 | 312 | &target_layer | ||
568 | 313 | }; | ||
569 | 314 | |||
570 | 315 | Sequence seq; | ||
571 | 316 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) | ||
572 | 317 | .InSequence(seq) | ||
573 | 318 | .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) | ||
574 | 319 | { | ||
575 | 320 | ASSERT_EQ(contents.numHwLayers, 3); | ||
576 | 321 | contents.hwLayers[0].compositionType = HWC_OVERLAY; | ||
577 | 322 | contents.hwLayers[1].compositionType = HWC_FRAMEBUFFER; | ||
578 | 323 | contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; | ||
579 | 324 | })); | ||
580 | 325 | EXPECT_CALL(mock_render_fn, called(Ref(*stub_renderable2))) | ||
581 | 326 | .InSequence(seq); | ||
582 | 327 | EXPECT_CALL(mock_context, swap_buffers()) | ||
583 | 328 | .InSequence(seq); | ||
584 | 329 | |||
585 | 330 | mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); | ||
586 | 331 | device.render_gl_and_overlays(mock_context, updated_list, render_fn); | ||
587 | 332 | } | ||
588 | 333 | |||
589 | 334 | TEST_F(HwcDevice, does_not_call_render_or_swap_when_all_overlays_accepted) | ||
590 | 335 | { | ||
591 | 336 | using namespace testing; | ||
592 | 337 | mtd::MockRenderFunction mock_render_fn; | ||
593 | 338 | auto render_fn = [&](mg::Renderable const& renderable) | ||
594 | 339 | { | ||
595 | 340 | mock_render_fn.called(renderable); | ||
596 | 341 | }; | ||
597 | 342 | |||
598 | 343 | std::list<std::shared_ptr<mg::Renderable>> updated_list({ | ||
599 | 344 | stub_renderable1, | ||
600 | 345 | stub_renderable2 | ||
601 | 346 | }); | ||
602 | 347 | |||
603 | 348 | std::list<hwc_layer_1_t*> expected_list | ||
604 | 349 | { | ||
605 | 350 | &comp_layer, | ||
606 | 351 | &comp_layer, | ||
607 | 352 | &target_layer | ||
608 | 353 | }; | ||
609 | 354 | |||
610 | 355 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) | ||
611 | 356 | .Times(1) | ||
612 | 357 | .WillOnce(Invoke([&](hwc_display_contents_1_t& contents) | ||
613 | 358 | { | ||
614 | 359 | ASSERT_EQ(contents.numHwLayers, 3); | ||
615 | 360 | contents.hwLayers[0].compositionType = HWC_OVERLAY; | ||
616 | 361 | contents.hwLayers[1].compositionType = HWC_OVERLAY; | ||
617 | 362 | contents.hwLayers[2].compositionType = HWC_FRAMEBUFFER_TARGET; | ||
618 | 363 | })); | ||
619 | 364 | EXPECT_CALL(mock_render_fn, called(_)) | ||
620 | 365 | .Times(0); | ||
621 | 366 | EXPECT_CALL(mock_context, swap_buffers()) | ||
622 | 367 | .Times(0); | ||
623 | 368 | |||
624 | 369 | mga::HwcDevice device(mock_device, mock_hwc_device_wrapper, mock_vsync, mock_file_ops); | ||
625 | 370 | device.render_gl_and_overlays(mock_context, updated_list, render_fn); | ||
682 | 371 | } | 311 | } |
683 | 372 | 312 | ||
684 | 373 | TEST_F(HwcDevice, resets_layers_when_prepare_gl_called) | 313 | TEST_F(HwcDevice, resets_layers_when_prepare_gl_called) |
685 | @@ -398,7 +338,7 @@ | |||
686 | 398 | stub_renderable2 | 338 | stub_renderable2 |
687 | 399 | }); | 339 | }); |
688 | 400 | 340 | ||
690 | 401 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 341 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
691 | 402 | device.render_gl(stub_context); | 342 | device.render_gl(stub_context); |
692 | 403 | } | 343 | } |
693 | 404 | 344 | ||
694 | @@ -544,7 +484,7 @@ | |||
695 | 544 | EXPECT_CALL(*native_handle_3, update_fence(release_fence3)) | 484 | EXPECT_CALL(*native_handle_3, update_fence(release_fence3)) |
696 | 545 | .InSequence(seq); | 485 | .InSequence(seq); |
697 | 546 | 486 | ||
699 | 547 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 487 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
700 | 548 | device.post(mock_buffer); | 488 | device.post(mock_buffer); |
701 | 549 | } | 489 | } |
702 | 550 | 490 | ||
703 | @@ -570,9 +510,9 @@ | |||
704 | 570 | EXPECT_CALL(*mock_hwc_device_wrapper, set(_)) | 510 | EXPECT_CALL(*mock_hwc_device_wrapper, set(_)) |
705 | 571 | .Times(1); | 511 | .Times(1); |
706 | 572 | 512 | ||
708 | 573 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 513 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
709 | 574 | device.post(mock_buffer); | 514 | device.post(mock_buffer); |
711 | 575 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 515 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
712 | 576 | device.post(mock_buffer); | 516 | device.post(mock_buffer); |
713 | 577 | } | 517 | } |
714 | 578 | 518 | ||
715 | @@ -598,9 +538,9 @@ | |||
716 | 598 | EXPECT_CALL(*mock_hwc_device_wrapper, set(_)) | 538 | EXPECT_CALL(*mock_hwc_device_wrapper, set(_)) |
717 | 599 | .Times(2); | 539 | .Times(2); |
718 | 600 | 540 | ||
720 | 601 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 541 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
721 | 602 | device.post(mock_buffer); | 542 | device.post(mock_buffer); |
723 | 603 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 543 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
724 | 604 | device.post(mock_buffer); | 544 | device.post(mock_buffer); |
725 | 605 | } | 545 | } |
726 | 606 | 546 | ||
727 | @@ -643,7 +583,7 @@ | |||
728 | 643 | EXPECT_EQ(HWC_FRAMEBUFFER, contents.hwLayers[0].compositionType); | 583 | EXPECT_EQ(HWC_FRAMEBUFFER, contents.hwLayers[0].compositionType); |
729 | 644 | })); | 584 | })); |
730 | 645 | 585 | ||
733 | 646 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 586 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
734 | 647 | device.render_gl_and_overlays(stub_context, updated_list, [](mg::Renderable const&){}); | 587 | device.prepare_overlays(stub_context, updated_list, stub_compositor); |
735 | 648 | device.post(mock_buffer); | 588 | device.post(mock_buffer); |
736 | 649 | } | 589 | } |
737 | 650 | 590 | ||
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 | 133 | std::function<void(mg::Renderable const&)> render_fn; | 133 | std::function<void(mg::Renderable const&)> render_fn; |
743 | 134 | 134 | ||
744 | 135 | InSequence seq; | 135 | InSequence seq; |
746 | 136 | EXPECT_CALL(*mock_display_device, render_gl_and_overlays(_, Ref(renderlist), Ref(render_fn))) | 136 | EXPECT_CALL(*mock_display_device, prepare_overlays(_, Ref(renderlist), _)) |
747 | 137 | .Times(1); | 137 | .Times(1); |
748 | 138 | EXPECT_CALL(*mock_fb_bundle, last_rendered_buffer()) | 138 | EXPECT_CALL(*mock_fb_bundle, last_rendered_buffer()) |
749 | 139 | .Times(1) | 139 | .Times(1) |
750 | 140 | 140 | ||
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 | 29 | #include "mir_test_doubles/stub_swapping_gl_context.h" | 29 | #include "mir_test_doubles/stub_swapping_gl_context.h" |
756 | 30 | #include "mir_test_doubles/mock_egl.h" | 30 | #include "mir_test_doubles/mock_egl.h" |
757 | 31 | #include "mir_test_doubles/mock_hwc_device_wrapper.h" | 31 | #include "mir_test_doubles/mock_hwc_device_wrapper.h" |
758 | 32 | #include "mir_test_doubles/mock_renderable_list_compositor.h" | ||
759 | 33 | #include "src/platform/graphics/android/overlay_gl_compositor.h" | ||
760 | 32 | #include "hwc_struct_helpers.h" | 34 | #include "hwc_struct_helpers.h" |
761 | 33 | #include <gtest/gtest.h> | 35 | #include <gtest/gtest.h> |
762 | 34 | #include <stdexcept> | 36 | #include <stdexcept> |
763 | @@ -111,6 +113,7 @@ | |||
764 | 111 | TEST_F(HwcFbDevice, hwc10_prepare_with_renderables) | 113 | TEST_F(HwcFbDevice, hwc10_prepare_with_renderables) |
765 | 112 | { | 114 | { |
766 | 113 | using namespace testing; | 115 | using namespace testing; |
767 | 116 | mtd::MockRenderableListCompositor mock_compositor; | ||
768 | 114 | std::list<hwc_layer_1_t*> expected_list{&skip_layer}; | 117 | std::list<hwc_layer_1_t*> expected_list{&skip_layer}; |
769 | 115 | auto renderable1 = std::make_shared<mtd::StubRenderable>(); | 118 | auto renderable1 = std::make_shared<mtd::StubRenderable>(); |
770 | 116 | auto renderable2 = std::make_shared<mtd::StubRenderable>(); | 119 | auto renderable2 = std::make_shared<mtd::StubRenderable>(); |
771 | @@ -120,14 +123,15 @@ | |||
772 | 120 | renderable2 | 123 | renderable2 |
773 | 121 | }; | 124 | }; |
774 | 122 | 125 | ||
775 | 123 | mtd::MockRenderFunction mock_call_counter; | ||
776 | 124 | testing::Sequence seq; | 126 | testing::Sequence seq; |
777 | 125 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) | 127 | EXPECT_CALL(*mock_hwc_device_wrapper, prepare(MatchesList(expected_list))) |
778 | 126 | .InSequence(seq); | 128 | .InSequence(seq); |
783 | 127 | EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable1))) | 129 | EXPECT_CALL(mock_compositor, render(Ref(renderlist),_)) |
784 | 128 | .InSequence(seq); | 130 | .InSequence(seq) |
785 | 129 | EXPECT_CALL(mock_call_counter, called(testing::Ref(*renderable2))) | 131 | .WillOnce(Invoke([](mg::RenderableList const&, mga::SwappingGLContext const& cont) |
786 | 130 | .InSequence(seq); | 132 | { |
787 | 133 | cont.swap_buffers(); | ||
788 | 134 | })); | ||
789 | 131 | EXPECT_CALL(mock_egl, eglGetCurrentDisplay()) | 135 | EXPECT_CALL(mock_egl, eglGetCurrentDisplay()) |
790 | 132 | .InSequence(seq) | 136 | .InSequence(seq) |
791 | 133 | .WillOnce(Return(dpy)); | 137 | .WillOnce(Return(dpy)); |
792 | @@ -138,11 +142,7 @@ | |||
793 | 138 | .InSequence(seq); | 142 | .InSequence(seq); |
794 | 139 | 143 | ||
795 | 140 | mga::HwcFbDevice device(mock_hwc_device, mock_hwc_device_wrapper, mock_fb_device, mock_vsync); | 144 | mga::HwcFbDevice device(mock_hwc_device, mock_hwc_device_wrapper, mock_fb_device, mock_vsync); |
801 | 141 | 145 | device.prepare_overlays(stub_context, renderlist, mock_compositor); | |
797 | 142 | device.render_gl_and_overlays(stub_context, renderlist, [&](mg::Renderable const& renderable) | ||
798 | 143 | { | ||
799 | 144 | mock_call_counter.called(renderable); | ||
800 | 145 | }); | ||
802 | 146 | } | 146 | } |
803 | 147 | 147 | ||
804 | 148 | TEST_F(HwcFbDevice, hwc10_post) | 148 | 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://