Mir

Merge lp:~kdub/mir/plumb-android-shader-creation into lp:mir

Proposed by Kevin DuBois
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: no longer in the source branch.
Merged at revision: 1575
Proposed branch: lp:~kdub/mir/plumb-android-shader-creation
Merge into: lp:mir
Prerequisite: lp:~kdub/mir/gl-program-creation-factory
Diff against target: 1198 lines (+360/-62)
39 files modified
examples/render_overlays.cpp (+1/-3)
include/platform/mir/graphics/gl_program.h (+3/-3)
include/platform/mir/graphics/platform.h (+2/-0)
include/test/mir_test_doubles/null_platform.h (+1/-0)
include/test/mir_test_doubles/stub_display_builder.h (+1/-0)
include/test/mir_test_doubles/stub_gl_program_factory.h (+43/-0)
src/platform/graphics/android/CMakeLists.txt (+1/-0)
src/platform/graphics/android/android_display.cpp (+2/-1)
src/platform/graphics/android/android_display.h (+2/-0)
src/platform/graphics/android/android_platform.cpp (+3/-2)
src/platform/graphics/android/android_platform.h (+1/-1)
src/platform/graphics/android/display_buffer.cpp (+3/-1)
src/platform/graphics/android/display_buffer.h (+5/-1)
src/platform/graphics/android/display_builder.h (+2/-1)
src/platform/graphics/android/output_builder.cpp (+2/-1)
src/platform/graphics/android/output_builder.h (+1/-0)
src/platform/graphics/android/overlay_gl_compositor.cpp (+49/-0)
src/platform/graphics/android/overlay_gl_compositor.h (+47/-0)
src/platform/graphics/mesa/platform.cpp (+1/-0)
src/platform/graphics/mesa/platform.h (+1/-0)
src/server/graphics/default_configuration.cpp (+1/-0)
src/server/graphics/nested/nested_platform.cpp (+1/-0)
src/server/graphics/nested/nested_platform.h (+1/-0)
tests/acceptance-tests/test_display_configuration.cpp (+1/-0)
tests/acceptance-tests/test_surfaces_with_output_id.cpp (+1/-0)
tests/integration-tests/graphics/android/test_display_integration.cpp (+3/-1)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-0)
tests/integration-tests/test_display_info.cpp (+1/-0)
tests/integration-tests/test_surfaceloop.cpp (+2/-0)
tests/mir_test_framework/stubbed_server_configuration.cpp (+1/-0)
tests/unit-tests/frontend/test_session_mediator.cpp (+3/-2)
tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_android_fb.cpp (+44/-9)
tests/unit-tests/graphics/android/test_hwc_display.cpp (+46/-31)
tests/unit-tests/graphics/android/test_output_builder.cpp (+7/-5)
tests/unit-tests/graphics/android/test_overlay_compositor.cpp (+67/-0)
tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+2/-0)
tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp (+3/-0)
tests/unit-tests/graphics/test_display.cpp (+2/-0)
To merge this branch: bzr merge lp:~kdub/mir/plumb-android-shader-creation
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Cemil Azizoglu (community) Approve
Chris Halse Rogers Approve
Review via email: mp+216779@code.launchpad.net

Commit message

android: plumb getting the gl program factory down to the android platform, and use it to make a simple placeholder shader program.

Description of the change

android: plumb getting the gl program factory down to the android platform, and use it to make a simple placeholder shader program.

The program will be expanded to provide the fallback rendering when the HWC rejects an overlay in a subsequent review.

To post a comment you must log in.
Revision history for this message
Chris Halse Rogers (raof) wrote :

Seems sensible to me.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

61 +++ include/test/mir_test_doubles/mock_gl_program_factory.h

Our current practice is to put stubs and mocks in different files. Breaking this convention here will make it harder to track down StubGLProgramFactory (and perhaps cause someone to rewrite the stub).

Otherwise looks good.

review: Needs Fixing
Revision history for this message
Kevin DuBois (kdub) wrote :

fixed!

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Looks good.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

OK.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/render_overlays.cpp'
2--- examples/render_overlays.cpp 2014-04-15 05:31:19 +0000
3+++ examples/render_overlays.cpp 2014-04-24 20:07:52 +0000
4@@ -173,9 +173,7 @@
5 mir::DefaultServerConfiguration conf{argc, argv};
6
7 auto platform = conf.the_graphics_platform();
8- auto display = platform->create_display(
9- conf.the_display_configuration_policy(),
10- conf.the_gl_config());
11+ auto display = conf.the_display();
12 auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());
13
14 mg::BufferProperties buffer_properties{
15
16=== renamed file 'include/server/mir/graphics/gl_program.h' => 'include/platform/mir/graphics/gl_program.h'
17--- include/server/mir/graphics/gl_program.h 2014-04-16 18:40:45 +0000
18+++ include/platform/mir/graphics/gl_program.h 2014-04-24 20:07:52 +0000
19@@ -2,15 +2,15 @@
20 * Copyright © 2013-2014 Canonical Ltd.
21 *
22 * This program is free software: you can redistribute it and/or modify it
23- * under the terms of the GNU General Public License version 3,
24+ * under the terms of the GNU Lesser General Public License version 3,
25 * as published by the Free Software Foundation.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30- * GNU General Public License for more details.
31+ * GNU Lesser General Public License for more details.
32 *
33- * You should have received a copy of the GNU General Public License
34+ * You should have received a copy of the GNU Lesser General Public License
35 * along with this program. If not, see <http://www.gnu.org/licenses/>.
36 *
37 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
38
39=== modified file 'include/platform/mir/graphics/platform.h'
40--- include/platform/mir/graphics/platform.h 2014-03-27 09:52:04 +0000
41+++ include/platform/mir/graphics/platform.h 2014-04-24 20:07:52 +0000
42@@ -50,6 +50,7 @@
43 class DisplayConfigurationPolicy;
44 class GraphicBufferAllocator;
45 class GLConfig;
46+class GLProgramFactory;
47
48 /**
49 * \defgroup platform_enablement Mir platform enablement
50@@ -84,6 +85,7 @@
51 */
52 virtual std::shared_ptr<Display> create_display(
53 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
54+ std::shared_ptr<GLProgramFactory> const& gl_program_factory,
55 std::shared_ptr<GLConfig> const& gl_config) = 0;
56
57 /**
58
59=== modified file 'include/test/mir_test_doubles/null_platform.h'
60--- include/test/mir_test_doubles/null_platform.h 2014-03-27 09:46:09 +0000
61+++ include/test/mir_test_doubles/null_platform.h 2014-04-24 20:07:52 +0000
62@@ -40,6 +40,7 @@
63
64 std::shared_ptr<graphics::Display> create_display(
65 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
66+ std::shared_ptr<graphics::GLProgramFactory> const&,
67 std::shared_ptr<graphics::GLConfig> const&)
68 {
69 return std::make_shared<NullDisplay>();
70
71=== modified file 'include/test/mir_test_doubles/stub_display_builder.h'
72--- include/test/mir_test_doubles/stub_display_builder.h 2014-03-26 05:48:59 +0000
73+++ include/test/mir_test_doubles/stub_display_builder.h 2014-04-24 20:07:52 +0000
74@@ -79,6 +79,7 @@
75 }
76
77 std::unique_ptr<graphics::android::ConfigurableDisplayBuffer> create_display_buffer(
78+ graphics::GLProgramFactory const&,
79 graphics::android::GLContext const&)
80 {
81 return std::unique_ptr<graphics::android::ConfigurableDisplayBuffer>(
82
83=== added file 'include/test/mir_test_doubles/stub_gl_program_factory.h'
84--- include/test/mir_test_doubles/stub_gl_program_factory.h 1970-01-01 00:00:00 +0000
85+++ include/test/mir_test_doubles/stub_gl_program_factory.h 2014-04-24 20:07:52 +0000
86@@ -0,0 +1,43 @@
87+/*
88+ * Copyright © 2014 Canonical Ltd.
89+ *
90+ * This program is free software: you can redistribute it and/or modify it
91+ * under the terms of the GNU General Public License version 3,
92+ * as published by the Free Software Foundation.
93+ *
94+ * This program is distributed in the hope that it will be useful,
95+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
96+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97+ * GNU General Public License for more details.
98+ *
99+ * You should have received a copy of the GNU General Public License
100+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
101+ *
102+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
103+ */
104+#ifndef MIR_TEST_DOUBLES_STUB_GL_PROGRAM_FACTORY_H_
105+#define MIR_TEST_DOUBLES_STUB_GL_PROGRAM_FACTORY_H_
106+
107+#include "mir/graphics/gl_program_factory.h"
108+
109+namespace mir
110+{
111+namespace test
112+{
113+namespace doubles
114+{
115+
116+class StubGLProgramFactory : public graphics::GLProgramFactory
117+{
118+public:
119+ std::unique_ptr<graphics::GLProgram> create_gl_program(std::string const&, std::string const&) const
120+ {
121+ return nullptr;
122+ }
123+};
124+
125+}
126+}
127+} // namespace mir
128+
129+#endif /* MIR_TEST_DOUBLES_STUB_GL_PROGRAM_FACTORY_H_ */
130
131=== modified file 'src/platform/graphics/android/CMakeLists.txt'
132--- src/platform/graphics/android/CMakeLists.txt 2014-04-15 05:31:19 +0000
133+++ src/platform/graphics/android/CMakeLists.txt 2014-04-24 20:07:52 +0000
134@@ -34,6 +34,7 @@
135 internal_client.cpp
136 gl_context.cpp
137 real_hwc_wrapper.cpp
138+ overlay_gl_compositor.cpp
139 )
140
141 set_target_properties(
142
143=== modified file 'src/platform/graphics/android/android_display.cpp'
144--- src/platform/graphics/android/android_display.cpp 2014-04-15 05:31:19 +0000
145+++ src/platform/graphics/android/android_display.cpp 2014-04-24 20:07:52 +0000
146@@ -33,11 +33,12 @@
147 namespace geom=mir::geometry;
148
149 mga::AndroidDisplay::AndroidDisplay(std::shared_ptr<mga::DisplayBuilder> const& display_builder,
150+ std::shared_ptr<mg::GLProgramFactory> const& gl_program_factory,
151 std::shared_ptr<GLConfig> const& gl_config,
152 std::shared_ptr<DisplayReport> const& display_report)
153 : display_builder{display_builder},
154 gl_context{display_builder->display_format(), *gl_config, *display_report},
155- display_buffer{display_builder->create_display_buffer(gl_context)}
156+ display_buffer{display_builder->create_display_buffer(*gl_program_factory, gl_context)}
157 {
158 display_report->report_successful_setup_of_native_resources();
159
160
161=== modified file 'src/platform/graphics/android/android_display.h'
162--- src/platform/graphics/android/android_display.h 2014-04-15 05:31:19 +0000
163+++ src/platform/graphics/android/android_display.h 2014-04-24 20:07:52 +0000
164@@ -32,6 +32,7 @@
165
166 class DisplayReport;
167 class GLConfig;
168+class GLProgramFactory;
169
170 namespace android
171 {
172@@ -43,6 +44,7 @@
173 {
174 public:
175 explicit AndroidDisplay(std::shared_ptr<DisplayBuilder> const& display_builder,
176+ std::shared_ptr<GLProgramFactory> const& gl_program_factory,
177 std::shared_ptr<GLConfig> const& gl_config,
178 std::shared_ptr<DisplayReport> const& display_report);
179
180
181=== modified file 'src/platform/graphics/android/android_platform.cpp'
182--- src/platform/graphics/android/android_platform.cpp 2014-03-27 13:38:00 +0000
183+++ src/platform/graphics/android/android_platform.cpp 2014-04-24 20:07:52 +0000
184@@ -83,11 +83,12 @@
185 }
186
187 std::shared_ptr<mg::Display> mga::AndroidPlatform::create_display(
188- std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
189+ std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
190+ std::shared_ptr<mg::GLProgramFactory> const& gl_program_factory,
191 std::shared_ptr<mg::GLConfig> const& gl_config)
192 {
193 return std::make_shared<mga::AndroidDisplay>(
194- display_builder, gl_config, display_report);
195+ display_builder, gl_program_factory, gl_config, display_report);
196 }
197
198 std::shared_ptr<mg::PlatformIPCPackage> mga::AndroidPlatform::get_ipc_package()
199
200=== modified file 'src/platform/graphics/android/android_platform.h'
201--- src/platform/graphics/android/android_platform.h 2014-03-27 09:46:09 +0000
202+++ src/platform/graphics/android/android_platform.h 2014-04-24 20:07:52 +0000
203@@ -45,6 +45,7 @@
204 std::shared_ptr<BufferInitializer> const& buffer_initializer);
205 std::shared_ptr<Display> create_display(
206 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
207+ std::shared_ptr<graphics::GLProgramFactory> const&,
208 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/);
209 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
210 std::shared_ptr<InternalClient> create_internal_client();
211@@ -56,7 +57,6 @@
212
213 void initialize(std::shared_ptr<NestedContext> const& nested_context) override;
214
215- // TODO a design that has this and create_buffer_allocator is missing simplicity
216 virtual std::shared_ptr<GraphicBufferAllocator> create_mga_buffer_allocator(
217 const std::shared_ptr<BufferInitializer>& buffer_initializer);
218
219
220=== modified file 'src/platform/graphics/android/display_buffer.cpp'
221--- src/platform/graphics/android/display_buffer.cpp 2014-04-15 05:31:19 +0000
222+++ src/platform/graphics/android/display_buffer.cpp 2014-04-24 20:07:52 +0000
223@@ -34,11 +34,13 @@
224 std::shared_ptr<FramebufferBundle> const& fb_bundle,
225 std::shared_ptr<DisplayDevice> const& display_device,
226 std::shared_ptr<ANativeWindow> const& native_window,
227- mga::GLContext const& shared_gl_context)
228+ mga::GLContext const& shared_gl_context,
229+ mg::GLProgramFactory const& program_factory)
230 : fb_bundle{fb_bundle},
231 display_device{display_device},
232 native_window{native_window},
233 gl_context{shared_gl_context, std::bind(mga::create_window_surface, std::placeholders::_1, std::placeholders::_2, native_window.get())},
234+ overlay_program{program_factory, gl_context},
235 current_configuration{
236 mg::DisplayConfigurationOutputId{1},
237 mg::DisplayConfigurationCardId{0},
238
239=== modified file 'src/platform/graphics/android/display_buffer.h'
240--- src/platform/graphics/android/display_buffer.h 2014-03-26 05:48:59 +0000
241+++ src/platform/graphics/android/display_buffer.h 2014-04-24 20:07:52 +0000
242@@ -21,8 +21,10 @@
243
244 #include "configurable_display_buffer.h"
245 #include "mir/graphics/egl_resources.h"
246+#include "mir/graphics/gl_program_factory.h"
247 #include "android_display_configuration.h"
248 #include "gl_context.h"
249+#include "overlay_gl_compositor.h"
250 #include <system/window.h>
251
252 namespace mir
253@@ -41,7 +43,8 @@
254 DisplayBuffer(std::shared_ptr<FramebufferBundle> const& fb_bundle,
255 std::shared_ptr<DisplayDevice> const& display_device,
256 std::shared_ptr<ANativeWindow> const& native_window,
257- GLContext const& shared_gl_context);
258+ GLContext const& shared_gl_context,
259+ GLProgramFactory const& program_factory);
260
261 geometry::Rectangle view_area() const;
262 void make_current();
263@@ -64,6 +67,7 @@
264 std::shared_ptr<DisplayDevice> const display_device;
265 std::shared_ptr<ANativeWindow> const native_window;
266 GLContext gl_context;
267+ OverlayGLProgram overlay_program;
268 bool prepared;
269 DisplayConfigurationOutput current_configuration;
270 MirOrientation rotation;
271
272=== modified file 'src/platform/graphics/android/display_builder.h'
273--- src/platform/graphics/android/display_builder.h 2014-03-06 06:05:17 +0000
274+++ src/platform/graphics/android/display_builder.h 2014-04-24 20:07:52 +0000
275@@ -27,6 +27,7 @@
276 {
277 namespace graphics
278 {
279+class GLProgramFactory;
280 namespace android
281 {
282 class GLContext;
283@@ -38,7 +39,7 @@
284
285 virtual MirPixelFormat display_format() = 0;
286 virtual std::unique_ptr<ConfigurableDisplayBuffer> create_display_buffer(
287- GLContext const& gl_context) = 0;
288+ GLProgramFactory const& gl_program_factory, GLContext const& gl_context) = 0;
289
290 protected:
291 DisplayBuilder() = default;
292
293=== modified file 'src/platform/graphics/android/output_builder.cpp'
294--- src/platform/graphics/android/output_builder.cpp 2014-03-06 06:05:17 +0000
295+++ src/platform/graphics/android/output_builder.cpp 2014-04-24 20:07:52 +0000
296@@ -64,6 +64,7 @@
297 }
298
299 std::unique_ptr<mga::ConfigurableDisplayBuffer> mga::OutputBuilder::create_display_buffer(
300+ GLProgramFactory const& gl_program_factory,
301 GLContext const& gl_context)
302 {
303 std::shared_ptr<mga::DisplayDevice> device;
304@@ -101,5 +102,5 @@
305
306 auto native_window = res_factory->create_native_window(framebuffers);
307 return std::unique_ptr<mga::DisplayBuffer>(
308- new DisplayBuffer(framebuffers, device, native_window, gl_context));
309+ new DisplayBuffer(framebuffers, device, native_window, gl_context, gl_program_factory));
310 }
311
312=== modified file 'src/platform/graphics/android/output_builder.h'
313--- src/platform/graphics/android/output_builder.h 2014-03-11 13:44:57 +0000
314+++ src/platform/graphics/android/output_builder.h 2014-04-24 20:07:52 +0000
315@@ -45,6 +45,7 @@
316
317 MirPixelFormat display_format();
318 std::unique_ptr<ConfigurableDisplayBuffer> create_display_buffer(
319+ GLProgramFactory const& gl_program_factory,
320 GLContext const& gl_context);
321
322 private:
323
324=== added file 'src/platform/graphics/android/overlay_gl_compositor.cpp'
325--- src/platform/graphics/android/overlay_gl_compositor.cpp 1970-01-01 00:00:00 +0000
326+++ src/platform/graphics/android/overlay_gl_compositor.cpp 2014-04-24 20:07:52 +0000
327@@ -0,0 +1,49 @@
328+/*
329+ * Copyright © 2014 Canonical Ltd.
330+ *
331+ * This program is free software: you can redistribute it and/or modify it
332+ * under the terms of the GNU Lesser General Public License version 3,
333+ * as published by the Free Software Foundation.
334+ *
335+ * This program is distributed in the hope that it will be useful,
336+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
337+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
338+ * GNU Lesser General Public License for more details.
339+ *
340+ * You should have received a copy of the GNU Lesser General Public License
341+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
342+ *
343+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
344+ */
345+
346+#include "mir/graphics/gl_program_factory.h"
347+#include "mir/graphics/gl_context.h"
348+#include "overlay_gl_compositor.h"
349+
350+namespace mg = mir::graphics;
351+namespace mga = mir::graphics::android;
352+namespace
353+{
354+std::string const vertex_shader
355+{
356+ "attribute vec4 position;\n"
357+ "void main() {\n"
358+ " gl_Position = position;\n"
359+ "}\n"
360+};
361+
362+std::string const fragment_shader
363+{
364+ "precision mediump float;\n"
365+ "void main() {\n"
366+ " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n"
367+ "}\n"
368+};
369+}
370+mga::OverlayGLProgram::OverlayGLProgram(
371+ GLProgramFactory const& factory, GLContext const& context)
372+{
373+ context.make_current();
374+ overlay_program = factory.create_gl_program(vertex_shader, fragment_shader);
375+ context.release_current();
376+}
377
378=== added file 'src/platform/graphics/android/overlay_gl_compositor.h'
379--- src/platform/graphics/android/overlay_gl_compositor.h 1970-01-01 00:00:00 +0000
380+++ src/platform/graphics/android/overlay_gl_compositor.h 2014-04-24 20:07:52 +0000
381@@ -0,0 +1,47 @@
382+/*
383+ * Copyright © 2014 Canonical Ltd.
384+ *
385+ * This program is free software: you can redistribute it and/or modify it
386+ * under the terms of the GNU Lesser General Public License version 3,
387+ * as published by the Free Software Foundation.
388+ *
389+ * This program is distributed in the hope that it will be useful,
390+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
391+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
392+ * GNU Lesser General Public License for more details.
393+ *
394+ * You should have received a copy of the GNU Lesser General Public License
395+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
396+ *
397+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
398+ */
399+
400+#ifndef MIR_GRAPHICS_ANDROID_OVERLAY_GL_PROGRAM_H_
401+#define MIR_GRAPHICS_ANDROID_OVERLAY_GL_PROGRAM_H_
402+
403+#include "mir/graphics/gl_program.h"
404+#include <memory>
405+
406+namespace mir
407+{
408+namespace graphics
409+{
410+class GLContext;
411+class GLProgramFactory;
412+
413+namespace android
414+{
415+
416+class OverlayGLProgram
417+{
418+public:
419+ OverlayGLProgram(GLProgramFactory const& program_factory, graphics::GLContext const& gl_context);
420+private:
421+ std::unique_ptr<graphics::GLProgram> overlay_program;
422+};
423+
424+}
425+}
426+}
427+
428+#endif /* MIR_GRAPHICS_ANDROID_OVERLAY_GL_PROGRAM_H_ */
429
430=== modified file 'src/platform/graphics/mesa/platform.cpp'
431--- src/platform/graphics/mesa/platform.cpp 2014-03-27 09:52:04 +0000
432+++ src/platform/graphics/mesa/platform.cpp 2014-04-24 20:07:52 +0000
433@@ -148,6 +148,7 @@
434
435 std::shared_ptr<mg::Display> mgm::Platform::create_display(
436 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
437+ std::shared_ptr<GLProgramFactory> const&,
438 std::shared_ptr<GLConfig> const& gl_config)
439 {
440 return std::make_shared<mgm::Display>(
441
442=== modified file 'src/platform/graphics/mesa/platform.h'
443--- src/platform/graphics/mesa/platform.h 2014-03-27 09:46:09 +0000
444+++ src/platform/graphics/mesa/platform.h 2014-04-24 20:07:52 +0000
445@@ -48,6 +48,7 @@
446 const std::shared_ptr<BufferInitializer>& buffer_initializer);
447 std::shared_ptr<graphics::Display> create_display(
448 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
449+ std::shared_ptr<GLProgramFactory> const& program_factory,
450 std::shared_ptr<GLConfig> const& gl_config);
451 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
452 std::shared_ptr<InternalClient> create_internal_client();
453
454=== modified file 'src/server/graphics/default_configuration.cpp'
455--- src/server/graphics/default_configuration.cpp 2014-04-23 15:24:13 +0000
456+++ src/server/graphics/default_configuration.cpp 2014-04-24 20:07:52 +0000
457@@ -110,6 +110,7 @@
458 {
459 return the_graphics_platform()->create_display(
460 the_display_configuration_policy(),
461+ the_gl_program_factory(),
462 the_gl_config());
463 }
464 });
465
466=== modified file 'src/server/graphics/nested/nested_platform.cpp'
467--- src/server/graphics/nested/nested_platform.cpp 2014-04-17 11:04:41 +0000
468+++ src/server/graphics/nested/nested_platform.cpp 2014-04-24 20:07:52 +0000
469@@ -82,6 +82,7 @@
470
471 std::shared_ptr<mg::Display> mgn::NestedPlatform::create_display(
472 std::shared_ptr<mg::DisplayConfigurationPolicy> const& conf_policy,
473+ std::shared_ptr<mg::GLProgramFactory> const&,
474 std::shared_ptr<mg::GLConfig> const& gl_config)
475 {
476 return std::make_shared<mgn::NestedDisplay>(
477
478=== modified file 'src/server/graphics/nested/nested_platform.h'
479--- src/server/graphics/nested/nested_platform.h 2014-03-27 09:46:09 +0000
480+++ src/server/graphics/nested/nested_platform.h 2014-04-24 20:07:52 +0000
481@@ -45,6 +45,7 @@
482 std::shared_ptr<BufferInitializer> const& buffer_initializer) override;
483 std::shared_ptr<Display> create_display(
484 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
485+ std::shared_ptr<GLProgramFactory> const& gl_program_factory,
486 std::shared_ptr<GLConfig> const& gl_config);
487 std::shared_ptr<PlatformIPCPackage> get_ipc_package() override;
488 std::shared_ptr<InternalClient> create_internal_client() override;
489
490=== modified file 'tests/acceptance-tests/test_display_configuration.cpp'
491--- tests/acceptance-tests/test_display_configuration.cpp 2014-03-27 09:52:04 +0000
492+++ tests/acceptance-tests/test_display_configuration.cpp 2014-04-24 20:07:52 +0000
493@@ -145,6 +145,7 @@
494
495 std::shared_ptr<mg::Display> create_display(
496 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
497+ std::shared_ptr<mg::GLProgramFactory> const&,
498 std::shared_ptr<mg::GLConfig> const&) override
499 {
500 return mt::fake_shared(mock_display);
501
502=== modified file 'tests/acceptance-tests/test_surfaces_with_output_id.cpp'
503--- tests/acceptance-tests/test_surfaces_with_output_id.cpp 2014-04-15 05:31:19 +0000
504+++ tests/acceptance-tests/test_surfaces_with_output_id.cpp 2014-04-24 20:07:52 +0000
505@@ -89,6 +89,7 @@
506
507 std::shared_ptr<mg::Display> create_display(
508 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
509+ std::shared_ptr<mg::GLProgramFactory> const&,
510 std::shared_ptr<mg::GLConfig> const&) override
511 {
512 return std::make_shared<StubDisplay>(display_rects());
513
514=== modified file 'tests/integration-tests/graphics/android/test_display_integration.cpp'
515--- tests/integration-tests/graphics/android/test_display_integration.cpp 2014-03-27 13:38:00 +0000
516+++ tests/integration-tests/graphics/android/test_display_integration.cpp 2014-04-24 20:07:52 +0000
517@@ -22,6 +22,7 @@
518 #include "src/platform/graphics/android/resource_factory.h"
519 #include "src/platform/graphics/android/android_graphic_buffer_allocator.h"
520 #include "src/platform/graphics/android/output_builder.h"
521+#include "src/server/graphics/program_factory.h"
522 #include "src/server/report/null_report_factory.h"
523
524 #include "examples/graphics.h"
525@@ -78,7 +79,8 @@
526 auto display_buffer_factory = std::make_shared<mga::OutputBuilder>(
527 fb_allocator, display_resource_factory, null_display_report);
528
529- mga::AndroidDisplay display{display_buffer_factory, stub_gl_config, null_display_report};
530+ auto program_factory = std::make_shared<mg::ProgramFactory>();
531+ mga::AndroidDisplay display{display_buffer_factory, program_factory, stub_gl_config, null_display_report};
532
533 display.for_each_display_buffer([this](mg::DisplayBuffer& buffer)
534 {
535
536=== modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp'
537--- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2014-03-27 09:46:09 +0000
538+++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2014-04-24 20:07:52 +0000
539@@ -26,6 +26,7 @@
540 #include "mir_test_doubles/stub_buffer_allocator.h"
541 #include "mir_test_doubles/null_platform.h"
542 #include "mir_test_doubles/stub_gl_config.h"
543+#include "mir_test_doubles/stub_gl_program_factory.h"
544 #include "src/server/graphics/default_display_configuration_policy.h"
545 #include "src/server/report/null_report_factory.h"
546
547@@ -105,6 +106,7 @@
548 auto conf_policy = std::make_shared<mg::DefaultDisplayConfigurationPolicy>();
549 display = platform->create_display(
550 conf_policy,
551+ std::make_shared<mtd::StubGLProgramFactory>(),
552 std::make_shared<mtd::StubGLConfig>());
553 auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
554 allocator = platform->create_buffer_allocator(buffer_initializer);
555
556=== modified file 'tests/integration-tests/test_display_info.cpp'
557--- tests/integration-tests/test_display_info.cpp 2014-03-27 09:46:09 +0000
558+++ tests/integration-tests/test_display_info.cpp 2014-04-24 20:07:52 +0000
559@@ -118,6 +118,7 @@
560
561 std::shared_ptr<mg::Display> create_display(
562 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
563+ std::shared_ptr<mg::GLProgramFactory> const&,
564 std::shared_ptr<mg::GLConfig> const&) override
565 {
566 if (!display)
567
568=== modified file 'tests/integration-tests/test_surfaceloop.cpp'
569--- tests/integration-tests/test_surfaceloop.cpp 2014-03-27 09:46:09 +0000
570+++ tests/integration-tests/test_surfaceloop.cpp 2014-04-24 20:07:52 +0000
571@@ -249,6 +249,7 @@
572
573 std::shared_ptr<mg::Display> create_display(
574 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
575+ std::shared_ptr<mg::GLProgramFactory> const&,
576 std::shared_ptr<mg::GLConfig> const&) override
577 {
578 return std::make_shared<StubDisplay>();
579@@ -365,6 +366,7 @@
580
581 std::shared_ptr<mg::Display> create_display(
582 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
583+ std::shared_ptr<mg::GLProgramFactory> const&,
584 std::shared_ptr<mg::GLConfig> const&) override
585 {
586 return std::make_shared<StubDisplay>();
587
588=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
589--- tests/mir_test_framework/stubbed_server_configuration.cpp 2014-03-27 09:46:09 +0000
590+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2014-04-24 20:07:52 +0000
591@@ -200,6 +200,7 @@
592
593 std::shared_ptr<mg::Display> create_display(
594 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
595+ std::shared_ptr<mg::GLProgramFactory> const&,
596 std::shared_ptr<mg::GLConfig> const&) override
597 {
598 return std::make_shared<StubDisplay>();
599
600=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
601--- tests/unit-tests/frontend/test_session_mediator.cpp 2014-04-15 05:31:19 +0000
602+++ tests/unit-tests/frontend/test_session_mediator.cpp 2014-04-24 20:07:52 +0000
603@@ -168,16 +168,17 @@
604 using namespace testing;
605 ON_CALL(*this, create_buffer_allocator(_))
606 .WillByDefault(Return(std::shared_ptr<mg::GraphicBufferAllocator>()));
607- ON_CALL(*this, create_display(_,_))
608+ ON_CALL(*this, create_display(_,_,_))
609 .WillByDefault(Return(std::make_shared<mtd::NullDisplay>()));
610 ON_CALL(*this, get_ipc_package())
611 .WillByDefault(Return(std::make_shared<mg::PlatformIPCPackage>()));
612 }
613
614 MOCK_METHOD1(create_buffer_allocator, std::shared_ptr<mg::GraphicBufferAllocator>(std::shared_ptr<mg::BufferInitializer> const&));
615- MOCK_METHOD2(create_display,
616+ MOCK_METHOD3(create_display,
617 std::shared_ptr<mg::Display>(
618 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
619+ std::shared_ptr<mg::GLProgramFactory> const&,
620 std::shared_ptr<mg::GLConfig> const&));
621 MOCK_METHOD0(get_ipc_package, std::shared_ptr<mg::PlatformIPCPackage>());
622 MOCK_METHOD0(create_internal_client, std::shared_ptr<mg::InternalClient>());
623
624=== modified file 'tests/unit-tests/graphics/android/CMakeLists.txt'
625--- tests/unit-tests/graphics/android/CMakeLists.txt 2014-03-26 05:48:59 +0000
626+++ tests/unit-tests/graphics/android/CMakeLists.txt 2014-04-24 20:07:52 +0000
627@@ -26,6 +26,7 @@
628 ${CMAKE_CURRENT_SOURCE_DIR}/test_external_refcount.cpp
629 ${CMAKE_CURRENT_SOURCE_DIR}/test_output_builder.cpp
630 ${CMAKE_CURRENT_SOURCE_DIR}/test_hwc_wrapper.cpp
631+ ${CMAKE_CURRENT_SOURCE_DIR}/test_overlay_compositor.cpp
632 )
633
634 set(UNIT_TEST_SOURCES ${UNIT_TEST_SOURCES} PARENT_SCOPE)
635
636=== modified file 'tests/unit-tests/graphics/android/test_android_fb.cpp'
637--- tests/unit-tests/graphics/android/test_android_fb.cpp 2014-03-27 13:38:00 +0000
638+++ tests/unit-tests/graphics/android/test_android_fb.cpp 2014-04-24 20:07:52 +0000
639@@ -28,6 +28,7 @@
640 #include "mir_test_doubles/stub_display_builder.h"
641 #include "mir_test_doubles/stub_gl_config.h"
642 #include "mir_test_doubles/mock_gl_config.h"
643+#include "mir_test_doubles/stub_gl_program_factory.h"
644 #include "mir/graphics/android/mir_native_window.h"
645 #include "mir_test_doubles/stub_driver_interpreter.h"
646
647@@ -51,7 +52,8 @@
648 dummy_config{mock_egl.fake_configs[0]},
649 null_display_report{mir::report::null_display_report()},
650 stub_db_factory{std::make_shared<mtd::StubDisplayBuilder>()},
651- stub_gl_config{std::make_shared<mtd::StubGLConfig>()}
652+ stub_gl_config{std::make_shared<mtd::StubGLConfig>()},
653+ stub_gl_program_factory{std::make_shared<mtd::StubGLProgramFactory>()}
654 {
655 }
656
657@@ -64,6 +66,7 @@
658 std::shared_ptr<mg::DisplayReport> const null_display_report;
659 std::shared_ptr<mtd::StubDisplayBuilder> const stub_db_factory;
660 std::shared_ptr<mtd::StubGLConfig> const stub_gl_config;
661+ std::shared_ptr<mtd::StubGLProgramFactory> const stub_gl_program_factory;
662 };
663
664 TEST_F(AndroidDisplay, creation_creates_egl_resources_properly)
665@@ -104,7 +107,11 @@
666 EXPECT_CALL(mock_egl, eglTerminate(dummy_display))
667 .Times(1);
668
669- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, null_display_report);
670+ mga::AndroidDisplay display(
671+ stub_db_factory,
672+ stub_gl_program_factory,
673+ stub_gl_config,
674+ null_display_report);
675 }
676
677 TEST_F(AndroidDisplay, selects_usable_configuration)
678@@ -148,7 +155,11 @@
679 .Times(1)
680 .WillOnce(Invoke(config_filler));
681
682- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, null_display_report);
683+ mga::AndroidDisplay display(
684+ stub_db_factory,
685+ stub_gl_program_factory,
686+ stub_gl_config,
687+ null_display_report);
688 EXPECT_EQ(correct_config, selected_config);
689 }
690
691@@ -172,7 +183,11 @@
692 mtd::EGLConfigContainsAttrib(EGL_STENCIL_SIZE, stencil_bits)),
693 _,_,_));
694
695- mga::AndroidDisplay display(stub_db_factory, mock_gl_config, null_display_report);
696+ mga::AndroidDisplay display(
697+ stub_db_factory,
698+ stub_gl_program_factory,
699+ mock_gl_config,
700+ null_display_report);
701 }
702
703 TEST_F(AndroidDisplay, logs_creation_events)
704@@ -190,7 +205,11 @@
705 EXPECT_CALL(*mock_display_report, report_successful_display_construction())
706 .Times(1);
707
708- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, mock_display_report);
709+ mga::AndroidDisplay display(
710+ stub_db_factory,
711+ stub_gl_program_factory,
712+ stub_gl_config,
713+ mock_display_report);
714 }
715
716 TEST_F(AndroidDisplay, throws_on_eglMakeCurrent_failure)
717@@ -210,7 +229,11 @@
718 .Times(0);
719
720 EXPECT_THROW({
721- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, mock_display_report);
722+ mga::AndroidDisplay display(
723+ stub_db_factory,
724+ stub_gl_program_factory,
725+ stub_gl_config,
726+ mock_display_report);
727 }, std::runtime_error);
728 }
729
730@@ -232,14 +255,22 @@
731 .WillOnce(Return(EGL_NO_SURFACE));
732
733 EXPECT_THROW({
734- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, mock_display_report);
735+ mga::AndroidDisplay display(
736+ stub_db_factory,
737+ stub_gl_program_factory,
738+ stub_gl_config,
739+ mock_display_report);
740 }, std::runtime_error);
741 }
742
743 TEST_F(AndroidDisplay, configures_display_buffer)
744 {
745 using namespace testing;
746- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, null_display_report);
747+ mga::AndroidDisplay display(
748+ stub_db_factory,
749+ stub_gl_program_factory,
750+ stub_gl_config,
751+ null_display_report);
752
753 auto configuration = display.configuration();
754 configuration->for_each_output([&](mg::UserDisplayConfigurationOutput& output)
755@@ -270,7 +301,11 @@
756 //we only have single display and single mode on android for the time being
757 TEST_F(AndroidDisplay, supports_one_output_configuration)
758 {
759- mga::AndroidDisplay display(stub_db_factory, stub_gl_config, null_display_report);
760+ mga::AndroidDisplay display(
761+ stub_db_factory,
762+ stub_gl_program_factory,
763+ stub_gl_config,
764+ null_display_report);
765 auto config = display.configuration();
766
767 size_t num_configs = 0;
768
769=== modified file 'tests/unit-tests/graphics/android/test_hwc_display.cpp'
770--- tests/unit-tests/graphics/android/test_hwc_display.cpp 2014-04-15 05:31:19 +0000
771+++ tests/unit-tests/graphics/android/test_hwc_display.cpp 2014-04-24 20:07:52 +0000
772@@ -30,6 +30,7 @@
773 #include "mir_test_doubles/stub_buffer.h"
774 #include "mir_test_doubles/stub_gl_config.h"
775 #include "mir_test_doubles/mock_framebuffer_bundle.h"
776+#include "mir_test_doubles/stub_gl_program_factory.h"
777 #include <memory>
778
779 namespace geom=mir::geometry;
780@@ -67,6 +68,7 @@
781 }
782
783 testing::NiceMock<mtd::MockEGL> mock_egl;
784+ mtd::StubGLProgramFactory stub_program_factory;
785
786 int visual_id;
787 EGLConfig dummy_config;
788@@ -96,7 +98,8 @@
789 .Times(1);
790
791 std::list<std::shared_ptr<mg::Renderable>> renderlist{};
792- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
793+ mga::DisplayBuffer db(
794+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
795 db.post_update();
796 }
797
798@@ -104,7 +107,8 @@
799 {
800 using namespace testing;
801
802- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
803+ mga::DisplayBuffer db(
804+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
805
806 InSequence seq;
807 EXPECT_CALL(*mock_display_device, render_gl(_))
808@@ -137,22 +141,23 @@
809 EXPECT_CALL(*mock_display_device, post(Ref(*stub_buffer)))
810 .Times(1);
811
812- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
813+ mga::DisplayBuffer db(
814+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
815 db.render_and_post_update(renderlist, render_fn);
816 }
817
818 TEST_F(AndroidDisplayBuffer, defaults_to_normal_orientation)
819 {
820- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window,
821- *gl_context);
822+ mga::DisplayBuffer db(
823+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
824
825 EXPECT_EQ(mir_orientation_normal, db.orientation());
826 }
827
828 TEST_F(AndroidDisplayBuffer, orientation_is_passed_through)
829 {
830- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window,
831- *gl_context);
832+ mga::DisplayBuffer db(
833+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
834
835 for (auto const& ori : {mir_orientation_normal,
836 mir_orientation_left,
837@@ -178,8 +183,8 @@
838 EXPECT_CALL(*mock_fb_bundle, fb_size())
839 .WillRepeatedly(Return(normal));
840
841- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window,
842- *gl_context);
843+ mga::DisplayBuffer db(
844+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
845
846 EXPECT_EQ(normal, db.view_area().size);
847
848@@ -202,7 +207,8 @@
849 {
850 using namespace testing;
851
852- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
853+ mga::DisplayBuffer db(
854+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
855
856 auto view_area = db.view_area();
857
858@@ -230,7 +236,8 @@
859 EXPECT_CALL(mock_egl, eglDestroyContext(dummy_display, mock_egl.fake_egl_context))
860 .Times(AtLeast(1));
861
862- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
863+ mga::DisplayBuffer db(
864+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
865 testing::Mock::VerifyAndClearExpectations(&mock_egl);
866 }
867
868@@ -247,12 +254,14 @@
869
870 EXPECT_THROW(
871 {
872- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
873+ mga::DisplayBuffer db(
874+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
875 }, std::runtime_error);
876
877 EXPECT_THROW(
878 {
879- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
880+ mga::DisplayBuffer db(
881+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
882 }, std::runtime_error);
883 }
884
885@@ -261,20 +270,19 @@
886 using namespace testing;
887 EGLContext fake_ctxt = reinterpret_cast<EGLContext>(0x4422);
888 EGLSurface fake_surf = reinterpret_cast<EGLSurface>(0x33984);
889-
890- EXPECT_CALL(mock_egl, eglCreateContext(_,_,_,_))
891- .Times(1)
892- .WillOnce(Return(fake_ctxt));
893- EXPECT_CALL(mock_egl, eglCreateWindowSurface(_,_,_,_))
894- .Times(1)
895- .WillOnce(Return(fake_surf));
896-
897+ ON_CALL(mock_egl, eglCreateContext(_,_,_,_))
898+ .WillByDefault(Return(fake_ctxt));
899+ ON_CALL(mock_egl, eglCreateWindowSurface(_,_,_,_))
900+ .WillByDefault(Return(fake_surf));
901+
902+ mga::DisplayBuffer db(
903+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
904+
905 EXPECT_CALL(mock_egl, eglMakeCurrent(dummy_display, fake_surf, fake_surf, fake_ctxt))
906 .Times(2)
907 .WillOnce(Return(EGL_TRUE))
908 .WillOnce(Return(EGL_FALSE));
909
910- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
911 db.make_current();
912 EXPECT_THROW(
913 {
914@@ -285,18 +293,19 @@
915 TEST_F(AndroidDisplayBuffer, release_current)
916 {
917 using namespace testing;
918+ mga::DisplayBuffer db(
919+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
920
921 EXPECT_CALL(mock_egl, eglMakeCurrent(dummy_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))
922 .Times(1);
923-
924- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
925 db.release_current();
926 }
927
928 TEST_F(AndroidDisplayBuffer, sets_display_power_mode_to_on_at_start)
929 {
930 using namespace testing;
931- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
932+ mga::DisplayBuffer db(
933+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
934 auto config = db.configuration();
935 EXPECT_EQ(mir_power_mode_on, config.power_mode);
936 }
937@@ -304,7 +313,8 @@
938 TEST_F(AndroidDisplayBuffer, changes_display_power_mode)
939 {
940 using namespace testing;
941- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
942+ mga::DisplayBuffer db(
943+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
944
945 Sequence seq;
946 EXPECT_CALL(*mock_display_device, mode(mir_power_mode_off))
947@@ -324,7 +334,8 @@
948 TEST_F(AndroidDisplayBuffer, disregards_double_display_power_mode_request)
949 {
950 using namespace testing;
951- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
952+ mga::DisplayBuffer db(
953+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
954
955 EXPECT_CALL(*mock_display_device, mode(mir_power_mode_off))
956 .Times(1);
957@@ -347,7 +358,8 @@
958 .Times(1)
959 .WillOnce(Return(true));
960
961- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
962+ mga::DisplayBuffer db(
963+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
964
965 auto config = db.configuration();
966 config.orientation = mir_orientation_left;
967@@ -364,7 +376,8 @@
968 .Times(1)
969 .WillOnce(Return(false));
970
971- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
972+ mga::DisplayBuffer db(
973+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
974
975 auto config = db.configuration();
976 config.orientation = mir_orientation_left;
977@@ -376,7 +389,8 @@
978
979 TEST_F(AndroidDisplayBuffer, incorrect_display_configure_throws)
980 {
981- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
982+ mga::DisplayBuffer db(
983+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
984 auto config = db.configuration();
985 //error
986 config.current_format = mir_pixel_format_invalid;
987@@ -387,7 +401,8 @@
988
989 TEST_F(AndroidDisplayBuffer, android_display_configuration_info)
990 {
991- mga::DisplayBuffer db(mock_fb_bundle, mock_display_device, native_window, *gl_context);
992+ mga::DisplayBuffer db(
993+ mock_fb_bundle, mock_display_device, native_window, *gl_context, stub_program_factory);
994 auto disp_conf = db.configuration();
995
996 ASSERT_EQ(1u, disp_conf.modes.size());
997
998=== modified file 'tests/unit-tests/graphics/android/test_output_builder.cpp'
999--- tests/unit-tests/graphics/android/test_output_builder.cpp 2014-03-27 13:38:00 +0000
1000+++ tests/unit-tests/graphics/android/test_output_builder.cpp 2014-04-24 20:07:52 +0000
1001@@ -30,6 +30,7 @@
1002 #include "mir_test_doubles/mock_egl.h"
1003 #include "mir_test_doubles/mock_android_native_buffer.h"
1004 #include "mir_test_doubles/stub_gl_config.h"
1005+#include "mir_test_doubles/stub_gl_program_factory.h"
1006 #include <system/window.h>
1007 #include <gtest/gtest.h>
1008
1009@@ -105,6 +106,7 @@
1010 mtd::StubGLConfig stub_gl_config;
1011 mga::GLContext gl_context{
1012 mga::to_mir_format(mock_egl.fake_visual_id), stub_gl_config, mock_display_report};
1013+ mtd::StubGLProgramFactory const stub_program_factory;
1014 };
1015 }
1016 TEST_F(OutputBuilder, hwc_version_10_success)
1017@@ -126,7 +128,7 @@
1018
1019 mga::OutputBuilder factory(
1020 mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mt::fake_shared(mock_display_report));
1021- factory.create_display_buffer(gl_context);
1022+ factory.create_display_buffer(stub_program_factory, gl_context);
1023 }
1024
1025 TEST_F(OutputBuilder, hwc_version_10_failure_uses_gpu)
1026@@ -149,7 +151,7 @@
1027
1028 mga::OutputBuilder factory(
1029 mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mt::fake_shared(mock_display_report));
1030- factory.create_display_buffer(gl_context);
1031+ factory.create_display_buffer(stub_program_factory, gl_context);
1032 }
1033
1034 TEST_F(OutputBuilder, hwc_version_11_success)
1035@@ -169,7 +171,7 @@
1036
1037 mga::OutputBuilder factory(
1038 mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mt::fake_shared(mock_display_report));
1039- factory.create_display_buffer(gl_context);
1040+ factory.create_display_buffer(stub_program_factory, gl_context);
1041 }
1042
1043 TEST_F(OutputBuilder, hwc_version_11_hwc_failure)
1044@@ -192,7 +194,7 @@
1045
1046 mga::OutputBuilder factory(
1047 mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mt::fake_shared(mock_display_report));
1048- factory.create_display_buffer(gl_context);
1049+ factory.create_display_buffer(stub_program_factory, gl_context);
1050 }
1051
1052 TEST_F(OutputBuilder, hwc_version_11_hwc_and_fb_failure_fatal)
1053@@ -229,5 +231,5 @@
1054
1055 mga::OutputBuilder factory(
1056 mt::fake_shared(mock_buffer_allocator),mock_resource_factory, mt::fake_shared(mock_display_report));
1057- factory.create_display_buffer(gl_context);
1058+ factory.create_display_buffer(stub_program_factory, gl_context);
1059 }
1060
1061=== added file 'tests/unit-tests/graphics/android/test_overlay_compositor.cpp'
1062--- tests/unit-tests/graphics/android/test_overlay_compositor.cpp 1970-01-01 00:00:00 +0000
1063+++ tests/unit-tests/graphics/android/test_overlay_compositor.cpp 2014-04-24 20:07:52 +0000
1064@@ -0,0 +1,67 @@
1065+/*
1066+ * Copyright © 2014 Canonical Ltd.
1067+ *
1068+ * This program is free software: you can redistribute it and/or modify
1069+ * it under the terms of the GNU General Public License version 3 as
1070+ * published by the Free Software Foundation.
1071+ *
1072+ * This program is distributed in the hope that it will be useful,
1073+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1074+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1075+ * GNU General Public License for more details.
1076+ *
1077+ * You should have received a copy of the GNU General Public License
1078+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1079+ *
1080+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1081+ */
1082+
1083+#include "src/platform/graphics/android/overlay_gl_compositor.h"
1084+#include "mir/graphics/gl_context.h"
1085+#include "mir/graphics/gl_program_factory.h"
1086+#include "mir_test_doubles/mock_gl.h"
1087+#include <gtest/gtest.h>
1088+#include <mir_test/gmock_fixes.h>
1089+
1090+namespace mg=mir::graphics;
1091+namespace mga=mir::graphics::android;
1092+namespace mt=mir::test;
1093+namespace mtd=mir::test::doubles;
1094+
1095+namespace
1096+{
1097+
1098+class MockGLProgramFactory : public mg::GLProgramFactory
1099+{
1100+public:
1101+ MOCK_CONST_METHOD2(create_gl_program,
1102+ std::unique_ptr<mg::GLProgram>(std::string const&, std::string const&));
1103+};
1104+
1105+class MockContext : public mg::GLContext
1106+{
1107+public:
1108+ MOCK_CONST_METHOD0(make_current, void());
1109+ MOCK_CONST_METHOD0(release_current, void());
1110+};
1111+
1112+class OverlayCompositor : public ::testing::Test
1113+{
1114+public:
1115+ testing::NiceMock<MockGLProgramFactory> mock_gl_program_factory;
1116+ testing::NiceMock<MockContext> mock_context;
1117+ testing::NiceMock<mtd::MockGL> mock_gl;
1118+};
1119+
1120+}
1121+
1122+TEST_F(OverlayCompositor, compiles_in_constructor)
1123+{
1124+ using namespace testing;
1125+ InSequence seq;
1126+ EXPECT_CALL(mock_context, make_current());
1127+ EXPECT_CALL(mock_gl_program_factory, create_gl_program(_,_));
1128+ EXPECT_CALL(mock_context, release_current());
1129+
1130+ mga::OverlayGLProgram glprogram(mock_gl_program_factory, mock_context);
1131+}
1132
1133=== modified file 'tests/unit-tests/graphics/mesa/test_display_configuration.cpp'
1134--- tests/unit-tests/graphics/mesa/test_display_configuration.cpp 2014-03-27 09:46:09 +0000
1135+++ tests/unit-tests/graphics/mesa/test_display_configuration.cpp 2014-04-24 20:07:52 +0000
1136@@ -28,6 +28,7 @@
1137 #include "src/server/report/null_report_factory.h"
1138 #include "mir_test_doubles/null_virtual_terminal.h"
1139 #include "mir_test_doubles/stub_gl_config.h"
1140+#include "mir_test_doubles/stub_gl_program_factory.h"
1141
1142 #include "mir_test_framework/udev_environment.h"
1143
1144@@ -102,6 +103,7 @@
1145 {
1146 return platform->create_display(
1147 std::make_shared<mg::DefaultDisplayConfigurationPolicy>(),
1148+ std::make_shared<mtd::StubGLProgramFactory>(),
1149 std::make_shared<mtd::StubGLConfig>());
1150 }
1151
1152
1153=== modified file 'tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp'
1154--- tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp 2014-03-27 09:52:04 +0000
1155+++ tests/unit-tests/graphics/mesa/test_display_multi_monitor.cpp 2014-04-24 20:07:52 +0000
1156@@ -27,6 +27,7 @@
1157 #include "mir/graphics/display_configuration_policy.h"
1158 #include "mir_test_doubles/null_virtual_terminal.h"
1159 #include "mir_test_doubles/stub_gl_config.h"
1160+#include "mir_test_doubles/stub_gl_program_factory.h"
1161
1162 #include "mir_test_framework/udev_environment.h"
1163
1164@@ -147,6 +148,7 @@
1165 {
1166 return platform->create_display(
1167 std::make_shared<ClonedDisplayConfigurationPolicy>(),
1168+ std::make_shared<mtd::StubGLProgramFactory>(),
1169 std::make_shared<mtd::StubGLConfig>());
1170 }
1171
1172@@ -155,6 +157,7 @@
1173 {
1174 return platform->create_display(
1175 std::make_shared<SideBySideDisplayConfigurationPolicy>(),
1176+ std::make_shared<mtd::StubGLProgramFactory>(),
1177 std::make_shared<mtd::StubGLConfig>());
1178 }
1179
1180
1181=== modified file 'tests/unit-tests/graphics/test_display.cpp'
1182--- tests/unit-tests/graphics/test_display.cpp 2014-04-15 05:31:19 +0000
1183+++ tests/unit-tests/graphics/test_display.cpp 2014-04-24 20:07:52 +0000
1184@@ -24,6 +24,7 @@
1185 #include "mir_test_doubles/mock_egl.h"
1186 #include "mir_test_doubles/mock_gl.h"
1187 #include "mir_test_doubles/stub_gl_config.h"
1188+#include "mir_test_doubles/stub_gl_program_factory.h"
1189 #include "src/server/graphics/default_display_configuration_policy.h"
1190 #ifndef ANDROID
1191 #include "mir_test_doubles/mock_drm.h"
1192@@ -87,6 +88,7 @@
1193 #endif
1194 return platform->create_display(
1195 std::make_shared<mg::DefaultDisplayConfigurationPolicy>(),
1196+ std::make_shared<mtd::StubGLProgramFactory>(),
1197 std::make_shared<mtd::StubGLConfig>());
1198 }
1199

Subscribers

People subscribed via source and target branches