Mir

Merge lp:~alan-griffiths/mir/remove-BufferInitializer into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 1987
Proposed branch: lp:~alan-griffiths/mir/remove-BufferInitializer
Merge into: lp:mir
Diff against target: 1233 lines (+75/-348)
41 files modified
examples/render_overlays.cpp (+1/-1)
include/platform/mir/graphics/native_platform.h (+1/-3)
include/platform/mir/graphics/platform.h (+1/-6)
include/server/mir/default_server_configuration.h (+0/-3)
platform-ABI-sha1sums (+2/-2)
playground/render_surfaces.cpp (+17/-46)
server-ABI-sha1sums (+3/-3)
src/include/platform/mir/graphics/buffer_initializer.h (+0/-54)
src/platform/graphics/android/android_buffer_allocator.cpp (+3/-6)
src/platform/graphics/android/android_graphic_buffer_allocator.h (+1/-4)
src/platform/graphics/android/platform.cpp (+6/-10)
src/platform/graphics/android/platform.h (+2/-4)
src/platform/graphics/mesa/buffer_allocator.cpp (+0/-8)
src/platform/graphics/mesa/buffer_allocator.h (+1/-5)
src/platform/graphics/mesa/native_platform.cpp (+2/-4)
src/platform/graphics/mesa/native_platform.h (+1/-2)
src/platform/graphics/mesa/platform.cpp (+2/-3)
src/platform/graphics/mesa/platform.h (+1/-2)
src/server/graphics/default_configuration.cpp (+1/-12)
src/server/graphics/nested/nested_platform.cpp (+2/-3)
src/server/graphics/nested/nested_platform.h (+1/-2)
tests/acceptance-tests/test_display_configuration.cpp (+1/-2)
tests/acceptance-tests/test_nested_mir.cpp (+2/-3)
tests/include/mir_test_doubles/mock_buffer_initializer.h (+0/-48)
tests/include/mir_test_doubles/null_platform.h (+1/-2)
tests/integration-tests/client/test_client_render.cpp (+1/-3)
tests/integration-tests/graphics/android/test_buffer_integration.cpp (+3/-6)
tests/integration-tests/graphics/android/test_display_integration.cpp (+1/-3)
tests/integration-tests/graphics/android/test_internal_client.cpp (+1/-3)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-5)
tests/integration-tests/test_display_info.cpp (+1/-2)
tests/integration-tests/test_drm_auth_magic.cpp (+1/-2)
tests/integration-tests/test_surfaceloop.cpp (+1/-2)
tests/mir_test_framework/stubbed_server_configuration.cpp (+1/-2)
tests/unit-tests/frontend/test_session_mediator.cpp (+2/-2)
tests/unit-tests/frontend/test_session_mediator_mesa.cpp (+1/-2)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+3/-39)
tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp (+1/-28)
tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp (+1/-4)
tests/unit-tests/graphics/nested/test_nested_platform.cpp (+1/-2)
tests/unit-tests/graphics/test_graphics_platform.cpp (+2/-5)
To merge this branch: bzr merge lp:~alan-griffiths/mir/remove-BufferInitializer
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Kevin DuBois (community) Approve
Review via email: mp+238549@code.launchpad.net

Commit message

graphics: remove BufferInitializer

Description of the change

graphics: remove BufferInitializer

This isn't a useful customization point - it was only ever used in render_surfaces and it wasn't needed there.

Although changing the signature of Platform::create_buffer_allocator() is an API change, that API isn't used in any downstream that I know of.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

Its one of the older classes in the code, and I agree that it hasn't gotten much useful customization and use, so I'm okay with its removal. This does break platform api, not sure what to do about that (sometimes we increment, sometimes we don't). I'd guess because this doesn't reach very far outside of the mir project we shouldn't increment. Apart from that issue though, approve.

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

Not related to this change: where did the green background for render_surfaces go?

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Its one of the older classes in the code, and I agree that it hasn't gotten
> much useful customization and use, so I'm okay with its removal. This does
> break platform api, not sure what to do about that (sometimes we increment,
> sometimes we don't). I'd guess because this doesn't reach very far outside of
> the mir project we shouldn't increment. Apart from that issue though, approve.

We do need to sort out the platform API (e.g. publish the headers needed to implement a driver platform). But I think that's for another MP.

1990. By Alan Griffiths

spike making render_surfaces an example once more

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

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-10-06 03:02:44 +0000
3+++ examples/render_overlays.cpp 2014-10-16 14:20:32 +0000
4@@ -169,7 +169,7 @@
5
6 auto platform = conf.the_graphics_platform();
7 auto display = conf.the_display();
8- auto buffer_allocator = platform->create_buffer_allocator(conf.the_buffer_initializer());
9+ auto buffer_allocator = platform->create_buffer_allocator();
10
11 mg::BufferProperties buffer_properties{
12 geom::Size{512, 512},
13
14=== modified file 'include/platform/mir/graphics/native_platform.h'
15--- include/platform/mir/graphics/native_platform.h 2014-10-06 03:02:44 +0000
16+++ include/platform/mir/graphics/native_platform.h 2014-10-16 14:20:32 +0000
17@@ -32,7 +32,6 @@
18 namespace graphics
19 {
20 class GraphicBufferAllocator;
21-class BufferInitializer;
22 class PlatformIPCPackage;
23 class InternalClient;
24 class BufferIpcMessage;
25@@ -48,8 +47,7 @@
26
27 virtual void initialize(std::shared_ptr<NestedContext> const& nested_context) = 0;
28
29- virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator(
30- std::shared_ptr<BufferInitializer> const& buffer_initializer) = 0;
31+ virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() = 0;
32
33 virtual std::shared_ptr<PlatformIPCPackage> connection_ipc_package() = 0;
34
35
36=== modified file 'include/platform/mir/graphics/platform.h'
37--- include/platform/mir/graphics/platform.h 2014-09-24 17:01:33 +0000
38+++ include/platform/mir/graphics/platform.h 2014-10-16 14:20:32 +0000
39@@ -44,7 +44,6 @@
40 {
41 class Buffer;
42 class Display;
43-class BufferInitializer;
44 class InternalClient;
45 class DisplayReport;
46 class DisplayConfigurationPolicy;
47@@ -75,12 +74,8 @@
48
49 /**
50 * Creates the buffer allocator subsystem.
51- *
52- * \param [in] buffer_initializer the object responsible for initializing the buffers
53 */
54-
55- virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator(
56- std::shared_ptr<BufferInitializer> const& buffer_initializer) = 0;
57+ virtual std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() = 0;
58
59 virtual std::shared_ptr<BufferWriter> make_buffer_writer() = 0;
60
61
62=== modified file 'include/server/mir/default_server_configuration.h'
63--- include/server/mir/default_server_configuration.h 2014-10-14 11:48:16 +0000
64+++ include/server/mir/default_server_configuration.h 2014-10-16 14:20:32 +0000
65@@ -107,7 +107,6 @@
66 class NativePlatform;
67 class Platform;
68 class Display;
69-class BufferInitializer;
70 class DisplayReport;
71 class GraphicBufferAllocator;
72 class BufferWriter;
73@@ -189,7 +188,6 @@
74 /** @name graphics configuration - customization
75 * configurable interfaces for modifying graphics
76 * @{ */
77- virtual std::shared_ptr<graphics::BufferInitializer> the_buffer_initializer();
78 virtual std::shared_ptr<compositor::RendererFactory> the_renderer_factory();
79 virtual std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy();
80 virtual std::shared_ptr<graphics::nested::HostConnection> the_host_connection();
81@@ -372,7 +370,6 @@
82 CachedPtr<input::TouchVisualizer> touch_visualizer;
83 CachedPtr<graphics::Platform> graphics_platform;
84 CachedPtr<graphics::NativePlatform> graphics_native_platform;
85- CachedPtr<graphics::BufferInitializer> buffer_initializer;
86 CachedPtr<graphics::GraphicBufferAllocator> buffer_allocator;
87 CachedPtr<graphics::BufferWriter> buffer_writer;
88 CachedPtr<graphics::Display> display;
89
90=== modified file 'platform-ABI-sha1sums'
91--- platform-ABI-sha1sums 2014-10-06 03:02:44 +0000
92+++ platform-ABI-sha1sums 2014-10-16 14:20:32 +0000
93@@ -35,8 +35,8 @@
94 979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
95 f90a35371e236a6cfec8e9a8474dbb3305c7621e include/platform/mir/graphics/internal_client.h
96 c9730cac4a3a101f9706ec6f444958abe047fd88 include/platform/mir/graphics/internal_surface.h
97-b4aaa941df9c0a6f9342629b26542700876f3aaa include/platform/mir/graphics/native_platform.h
98-f47dac961f060eb29a44ed3c8c18a49a3d353bb1 include/platform/mir/graphics/platform.h
99+d4ab0ef9544345fcc85740f6ed6d8118728a5c59 include/platform/mir/graphics/native_platform.h
100+109d2c82d245a512e7c1790a3b853c9c275ebd4d include/platform/mir/graphics/platform.h
101 1fbe488b4581486fd01e2f03e504f31b72c09040 include/platform/mir/graphics/platform_ipc_operations.h
102 9c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
103 84c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
104
105=== modified file 'playground/render_surfaces.cpp'
106--- playground/render_surfaces.cpp 2014-09-12 05:56:28 +0000
107+++ playground/render_surfaces.cpp 2014-10-16 14:20:32 +0000
108@@ -25,7 +25,6 @@
109 #include "mir/scene/surface_creation_parameters.h"
110 #include "mir/geometry/size.h"
111 #include "mir/geometry/rectangles.h"
112-#include "mir/graphics/buffer_initializer.h"
113 #include "mir/graphics/display.h"
114 #include "mir/graphics/display_buffer.h"
115 #include "mir/graphics/gl_context.h"
116@@ -72,9 +71,7 @@
117 ///\section RenderSurfacesServerConfiguration RenderSurfacesServerConfiguration
118 /// The configuration stubs out client connectivity and input.
119 /// \snippet render_surfaces.cpp RenderSurfacesServerConfiguration_stubs_tag
120-/// it also provides a bespoke buffer initializer
121-/// \snippet render_surfaces.cpp RenderResourcesBufferInitializer_tag
122-/// and a bespoke display buffer compositor
123+/// it also provides a bespoke display buffer compositor
124 /// \snippet render_surfaces.cpp RenderSurfacesDisplayBufferCompositor_tag
125 ///\section Utilities Utility classes
126 /// For smooth animation we need to track time and move surfaces accordingly
127@@ -248,41 +245,6 @@
128 }
129 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
130
131- ///\internal [RenderResourcesBufferInitializer_tag]
132- // Override for a bespoke buffer initializer
133- std::shared_ptr<mg::BufferInitializer> the_buffer_initializer() override
134- {
135- class RenderResourcesBufferInitializer : public mg::BufferInitializer
136- {
137- public:
138- RenderResourcesBufferInitializer(std::unique_ptr<mg::GLContext> gl_context)
139- : gl_context{std::move(gl_context)}
140- {
141- }
142-
143- void operator()(mg::Buffer& buffer)
144- {
145- auto using_gl_context = mir::raii::paired_calls(
146- [this] { gl_context->make_current(); },
147- [this] { gl_context->release_current(); });
148-
149- mt::ImageRenderer img_renderer{mir_image.pixel_data,
150- geom::Size{mir_image.width, mir_image.height},
151- mir_image.bytes_per_pixel};
152- mt::BufferRenderTarget brt{buffer};
153- brt.make_current();
154- img_renderer.render();
155- }
156-
157- private:
158- std::unique_ptr<mg::GLContext> const gl_context;
159-
160- };
161-
162- return std::make_shared<RenderResourcesBufferInitializer>(the_display()->create_gl_context());
163- }
164- ///\internal [RenderResourcesBufferInitializer_tag]
165-
166 // Unless the compositor starts before we create the surfaces it won't respond to
167 // the change notification that causes.
168 std::shared_ptr<mir::ServerStatusListener> the_server_status_listener()
169@@ -389,6 +351,8 @@
170
171 auto const display = the_display();
172 auto const surface_coordinator = the_surface_coordinator();
173+ auto const gl_context = the_display()->create_gl_context();
174+
175 /* TODO: Get proper configuration */
176 geom::Rectangles view_area;
177 display->for_each_display_buffer([&view_area](mg::DisplayBuffer const& db)
178@@ -413,16 +377,23 @@
179 .of_buffer_usage(mg::BufferUsage::hardware),
180 nullptr);
181
182- /*
183- * We call swap_buffers() twice so that the surface is
184- * considers the first buffer to be posted.
185- * (TODO There must be a better way!)
186- */
187 {
188 mg::Buffer* buffer{nullptr};
189 auto const complete = [&](mg::Buffer* new_buf){ buffer = new_buf; };
190- s->swap_buffers(buffer, complete);
191- s->swap_buffers(buffer, complete);
192+ s->swap_buffers(buffer, complete); // Fetch buffer for rendering
193+ {
194+ auto using_gl_context = mir::raii::paired_calls(
195+ [&gl_context] { gl_context->make_current(); },
196+ [&gl_context] { gl_context->release_current(); });
197+
198+ mt::ImageRenderer img_renderer{mir_image.pixel_data,
199+ geom::Size{mir_image.width, mir_image.height},
200+ mir_image.bytes_per_pixel};
201+ mt::BufferRenderTarget brt{*buffer};
202+ brt.make_current();
203+ img_renderer.render();
204+ }
205+ s->swap_buffers(buffer, complete); // Post rendered buffer
206 }
207
208 /*
209
210=== modified file 'server-ABI-sha1sums'
211--- server-ABI-sha1sums 2014-10-16 09:24:18 +0000
212+++ server-ABI-sha1sums 2014-10-16 14:20:32 +0000
213@@ -35,8 +35,8 @@
214 979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
215 f90a35371e236a6cfec8e9a8474dbb3305c7621e include/platform/mir/graphics/internal_client.h
216 c9730cac4a3a101f9706ec6f444958abe047fd88 include/platform/mir/graphics/internal_surface.h
217-b4aaa941df9c0a6f9342629b26542700876f3aaa include/platform/mir/graphics/native_platform.h
218-f47dac961f060eb29a44ed3c8c18a49a3d353bb1 include/platform/mir/graphics/platform.h
219+d4ab0ef9544345fcc85740f6ed6d8118728a5c59 include/platform/mir/graphics/native_platform.h
220+109d2c82d245a512e7c1790a3b853c9c275ebd4d include/platform/mir/graphics/platform.h
221 1fbe488b4581486fd01e2f03e504f31b72c09040 include/platform/mir/graphics/platform_ipc_operations.h
222 9c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
223 84c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
224@@ -48,7 +48,7 @@
225 a9f284ba4b05d58fd3eeb628d1f56fe4ac188526 include/server/mir/compositor/compositor_id.h
226 5205e30c5fdb5b5d8803064fc1abd102db59c4e7 include/server/mir/compositor/scene_element.h
227 4fcf34e424128b87ddc76733594e32e09ebbd486 include/server/mir/compositor/scene.h
228-afd4ec03c3aadc98b7dbee4e35d1d3bcb9a9334e include/server/mir/default_server_configuration.h
229+e1355c98730be9ba3d25480427f362d322631e88 include/server/mir/default_server_configuration.h
230 af1ff0714be973ac76d56006a2e5991f68cd1dec include/server/mir/display_server.h
231 a35c5495d8fd28fc0e375b17495fc5caab51b329 include/server/mir/emergency_cleanup.h
232 938de641cb0e01e1098b007b39b151a7dfe4adc1 include/server/mir/frontend/display_changer.h
233
234=== removed file 'src/include/platform/mir/graphics/buffer_initializer.h'
235--- src/include/platform/mir/graphics/buffer_initializer.h 2014-09-11 05:51:44 +0000
236+++ src/include/platform/mir/graphics/buffer_initializer.h 1970-01-01 00:00:00 +0000
237@@ -1,54 +0,0 @@
238-/*
239- * Copyright © 2012 Canonical Ltd.
240- *
241- * This program is free software: you can redistribute it and/or modify it
242- * under the terms of the GNU Lesser General Public License version 3,
243- * as published by the Free Software Foundation.
244- *
245- * This program is distributed in the hope that it will be useful,
246- * but WITHOUT ANY WARRANTY; without even the implied warranty of
247- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
248- * GNU Lesser General Public License for more details.
249- *
250- * You should have received a copy of the GNU Lesser General Public License
251- * along with this program. If not, see <http://www.gnu.org/licenses/>.
252- *
253- * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
254- */
255-
256-#ifndef MIR_GRAPHICS_BUFFER_INITIALIZER_H_
257-#define MIR_GRAPHICS_BUFFER_INITIALIZER_H_
258-
259-namespace mir
260-{
261-namespace graphics
262-{
263-class Buffer;
264-
265-/**
266- * Interface to buffer initialization.
267- */
268-class BufferInitializer
269-{
270-public:
271- virtual ~BufferInitializer() {}
272-
273- /** Operator to call to initialize a buffer. */
274- virtual void operator()(Buffer& buffer) = 0;
275-
276-protected:
277- BufferInitializer() = default;
278- BufferInitializer(const BufferInitializer&) = delete;
279- BufferInitializer& operator=(const BufferInitializer&) = delete;
280-};
281-
282-class NullBufferInitializer : public BufferInitializer
283-{
284-public:
285- void operator()(Buffer& /*buffer*/) {}
286-};
287-
288-}
289-}
290-
291-#endif /* MIR_GRAPHICS_BUFFER_INITIALIZER_H_ */
292
293=== modified file 'src/platform/graphics/android/android_buffer_allocator.cpp'
294--- src/platform/graphics/android/android_buffer_allocator.cpp 2014-09-19 03:08:20 +0000
295+++ src/platform/graphics/android/android_buffer_allocator.cpp 2014-10-16 14:20:32 +0000
296@@ -18,7 +18,6 @@
297 */
298
299 #include "mir/graphics/platform.h"
300-#include "mir/graphics/buffer_initializer.h"
301 #include "mir/graphics/egl_extensions.h"
302 #include "mir/graphics/buffer_properties.h"
303 #include "mir/graphics/android/sync_fence.h"
304@@ -46,10 +45,8 @@
305 };
306 }
307
308-mga::AndroidGraphicBufferAllocator::AndroidGraphicBufferAllocator(
309- std::shared_ptr<BufferInitializer> const& buffer_initializer)
310- : buffer_initializer(buffer_initializer),
311- egl_extensions(std::make_shared<mg::EGLExtensions>())
312+mga::AndroidGraphicBufferAllocator::AndroidGraphicBufferAllocator()
313+ : egl_extensions(std::make_shared<mg::EGLExtensions>())
314 {
315 int err;
316
317@@ -82,7 +79,7 @@
318 {
319 auto native_handle = alloc_device->alloc_buffer(sz, pf, use);
320 auto buffer = std::make_shared<Buffer>(native_handle, egl_extensions);
321- (*buffer_initializer)(*buffer);
322+
323 return buffer;
324 }
325
326
327=== modified file 'src/platform/graphics/android/android_graphic_buffer_allocator.h'
328--- src/platform/graphics/android/android_graphic_buffer_allocator.h 2014-03-06 06:05:17 +0000
329+++ src/platform/graphics/android/android_graphic_buffer_allocator.h 2014-10-16 14:20:32 +0000
330@@ -31,7 +31,6 @@
331 namespace graphics
332 {
333
334-class BufferInitializer;
335 class EGLExtensions;
336
337 namespace android
338@@ -42,8 +41,7 @@
339 class AndroidGraphicBufferAllocator: public GraphicBufferAllocator, public graphics::GraphicBufferAllocator
340 {
341 public:
342- AndroidGraphicBufferAllocator(
343- std::shared_ptr<BufferInitializer> const& buffer_initializer);
344+ AndroidGraphicBufferAllocator();
345
346 std::shared_ptr<graphics::Buffer> alloc_buffer(
347 graphics::BufferProperties const& buffer_properties);
348@@ -58,7 +56,6 @@
349 private:
350 const hw_module_t *hw_module;
351 std::shared_ptr<GraphicAllocAdaptor> alloc_device;
352- std::shared_ptr<BufferInitializer> const buffer_initializer;
353 std::shared_ptr<EGLExtensions> const egl_extensions;
354 };
355
356
357=== modified file 'src/platform/graphics/android/platform.cpp'
358--- src/platform/graphics/android/platform.cpp 2014-09-30 06:11:33 +0000
359+++ src/platform/graphics/android/platform.cpp 2014-10-16 14:20:32 +0000
360@@ -30,7 +30,6 @@
361 #include "mir/graphics/platform_ipc_package.h"
362 #include "mir/graphics/buffer_ipc_message.h"
363 #include "mir/graphics/android/native_buffer.h"
364-#include "mir/graphics/buffer_initializer.h"
365 #include "mir/graphics/buffer_id.h"
366 #include "mir/graphics/display_report.h"
367 #include "mir/options/option.h"
368@@ -90,12 +89,11 @@
369 {
370 }
371
372-std::shared_ptr<mg::GraphicBufferAllocator> mga::Platform::create_buffer_allocator(
373- std::shared_ptr<mg::BufferInitializer> const& buffer_initializer)
374+std::shared_ptr<mg::GraphicBufferAllocator> mga::Platform::create_buffer_allocator()
375 {
376 if (quirks.gralloc_reopenable_after_close())
377 {
378- return std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);
379+ return std::make_shared<mga::AndroidGraphicBufferAllocator>();
380 }
381 else
382 {
383@@ -104,15 +102,14 @@
384 std::unique_lock<std::mutex> lk(allocator_mutex);
385 static std::shared_ptr<mg::GraphicBufferAllocator> preserved_allocator;
386 if (!preserved_allocator)
387- preserved_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);
388+ preserved_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
389 return preserved_allocator;
390 }
391 }
392
393-std::shared_ptr<mga::GraphicBufferAllocator> mga::Platform::create_mga_buffer_allocator(
394- std::shared_ptr<mg::BufferInitializer> const& buffer_initializer)
395+std::shared_ptr<mga::GraphicBufferAllocator> mga::Platform::create_mga_buffer_allocator()
396 {
397- return std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);
398+ return std::make_shared<mga::AndroidGraphicBufferAllocator>();
399 }
400
401 std::shared_ptr<mg::PlatformIPCPackage> mga::Platform::connection_ipc_package()
402@@ -167,9 +164,8 @@
403 auto logger = make_logger(*options);
404 auto overlay_option = should_use_overlay_optimization(*options);
405 logger->log_overlay_optimization(overlay_option);
406- auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
407 auto display_resource_factory = std::make_shared<mga::ResourceFactory>();
408- auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);
409+ auto fb_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
410 auto display_builder = std::make_shared<mga::OutputBuilder>(
411 fb_allocator, display_resource_factory, display_report, overlay_option, logger);
412 return std::make_shared<mga::Platform>(display_builder, display_report);
413
414=== modified file 'src/platform/graphics/android/platform.h'
415--- src/platform/graphics/android/platform.h 2014-09-25 09:47:50 +0000
416+++ src/platform/graphics/android/platform.h 2014-10-16 14:20:32 +0000
417@@ -42,8 +42,7 @@
418 std::shared_ptr<DisplayReport> const& display_report);
419
420 /* From Platform */
421- std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(
422- std::shared_ptr<BufferInitializer> const& buffer_initializer);
423+ std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator();
424 std::shared_ptr<Display> create_display(
425 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
426 std::shared_ptr<graphics::GLProgramFactory> const&,
427@@ -62,8 +61,7 @@
428
429 void initialize(std::shared_ptr<NestedContext> const& nested_context) override;
430
431- std::shared_ptr<GraphicBufferAllocator> create_mga_buffer_allocator(
432- std::shared_ptr<BufferInitializer> const& buffer_initializer);
433+ std::shared_ptr<GraphicBufferAllocator> create_mga_buffer_allocator();
434
435 std::shared_ptr<DisplayBuilder> const display_builder;
436 std::shared_ptr<DisplayReport> const display_report;
437
438=== modified file 'src/platform/graphics/mesa/buffer_allocator.cpp'
439--- src/platform/graphics/mesa/buffer_allocator.cpp 2014-09-19 03:08:20 +0000
440+++ src/platform/graphics/mesa/buffer_allocator.cpp 2014-10-16 14:20:32 +0000
441@@ -23,7 +23,6 @@
442 #include "buffer_texture_binder.h"
443 #include "anonymous_shm_file.h"
444 #include "shm_buffer.h"
445-#include "mir/graphics/buffer_initializer.h"
446 #include "mir/graphics/egl_extensions.h"
447 #include "mir/graphics/buffer_properties.h"
448 #include <boost/throw_exception.hpp>
449@@ -110,15 +109,12 @@
450
451 mgm::BufferAllocator::BufferAllocator(
452 gbm_device* device,
453- const std::shared_ptr<BufferInitializer>& buffer_initializer,
454 BypassOption bypass_option)
455 : device(device),
456- buffer_initializer(buffer_initializer),
457 egl_extensions(std::make_shared<mg::EGLExtensions>()),
458 bypass_option(bypass_option)
459
460 {
461- assert(buffer_initializer.get() != 0);
462 }
463
464 std::shared_ptr<mg::Buffer> mgm::BufferAllocator::alloc_buffer(
465@@ -186,8 +182,6 @@
466 auto const buffer =
467 std::make_shared<GBMBuffer>(bo, bo_flags, std::move(texture_binder));
468
469- (*buffer_initializer)(*buffer);
470-
471 return buffer;
472 }
473
474@@ -213,8 +207,6 @@
475 std::make_shared<ShmBuffer>(shm_file, buffer_properties.size,
476 buffer_properties.format);
477
478- (*buffer_initializer)(*buffer);
479-
480 return buffer;
481 }
482
483
484=== modified file 'src/platform/graphics/mesa/buffer_allocator.h'
485--- src/platform/graphics/mesa/buffer_allocator.h 2014-09-11 05:51:44 +0000
486+++ src/platform/graphics/mesa/buffer_allocator.h 2014-10-16 14:20:32 +0000
487@@ -34,7 +34,6 @@
488 {
489 namespace graphics
490 {
491-class BufferInitializer;
492 struct EGLExtensions;
493
494 namespace mesa
495@@ -42,9 +41,7 @@
496 class BufferAllocator: public graphics::GraphicBufferAllocator
497 {
498 public:
499- BufferAllocator(gbm_device* device,
500- std::shared_ptr<BufferInitializer> const& buffer_initializer,
501- BypassOption bypass_option);
502+ BufferAllocator(gbm_device* device, BypassOption bypass_option);
503
504 virtual std::shared_ptr<Buffer> alloc_buffer(
505 graphics::BufferProperties const& buffer_properties);
506@@ -59,7 +56,6 @@
507 graphics::BufferProperties const& buffer_properties);
508
509 gbm_device* const device;
510- std::shared_ptr<graphics::BufferInitializer> buffer_initializer;
511 std::shared_ptr<EGLExtensions> const egl_extensions;
512
513 BypassOption const bypass_option;
514
515=== modified file 'src/platform/graphics/mesa/native_platform.cpp'
516--- src/platform/graphics/mesa/native_platform.cpp 2014-09-30 06:11:33 +0000
517+++ src/platform/graphics/mesa/native_platform.cpp 2014-10-16 14:20:32 +0000
518@@ -53,11 +53,9 @@
519 finish_internal_native_display();
520 }
521
522-std::shared_ptr<mg::GraphicBufferAllocator> mgm::NativePlatform::create_buffer_allocator(
523- std::shared_ptr<mg::BufferInitializer> const& buffer_initializer)
524+std::shared_ptr<mg::GraphicBufferAllocator> mgm::NativePlatform::create_buffer_allocator()
525 {
526- return std::make_shared<mgm::BufferAllocator>(
527- gbm.device, buffer_initializer, mgm::BypassOption::prohibited);
528+ return std::make_shared<mgm::BufferAllocator>(gbm.device, mgm::BypassOption::prohibited);
529 }
530
531 std::shared_ptr<mg::PlatformIPCPackage> mgm::NativePlatform::connection_ipc_package()
532
533=== modified file 'src/platform/graphics/mesa/native_platform.h'
534--- src/platform/graphics/mesa/native_platform.h 2014-09-24 17:01:33 +0000
535+++ src/platform/graphics/mesa/native_platform.h 2014-10-16 14:20:32 +0000
536@@ -38,8 +38,7 @@
537 virtual ~NativePlatform();
538
539 void initialize(std::shared_ptr<NestedContext> const& nested_context);
540- std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator(
541- std::shared_ptr<BufferInitializer> const& buffer_initializer) override;
542+ std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() override;
543 std::shared_ptr<PlatformIPCPackage> connection_ipc_package() override;
544 std::shared_ptr<InternalClient> create_internal_client() override;
545 void fill_buffer_package(
546
547=== modified file 'src/platform/graphics/mesa/platform.cpp'
548--- src/platform/graphics/mesa/platform.cpp 2014-09-30 06:11:33 +0000
549+++ src/platform/graphics/mesa/platform.cpp 2014-10-16 14:20:32 +0000
550@@ -145,10 +145,9 @@
551 }
552
553
554-std::shared_ptr<mg::GraphicBufferAllocator> mgm::Platform::create_buffer_allocator(
555- const std::shared_ptr<mg::BufferInitializer>& buffer_initializer)
556+std::shared_ptr<mg::GraphicBufferAllocator> mgm::Platform::create_buffer_allocator()
557 {
558- return std::make_shared<mgm::BufferAllocator>(gbm.device, buffer_initializer, bypass_option_);
559+ return std::make_shared<mgm::BufferAllocator>(gbm.device, bypass_option_);
560 }
561
562 std::shared_ptr<mg::Display> mgm::Platform::create_display(
563
564=== modified file 'src/platform/graphics/mesa/platform.h'
565--- src/platform/graphics/mesa/platform.h 2014-09-24 17:01:33 +0000
566+++ src/platform/graphics/mesa/platform.h 2014-10-16 14:20:32 +0000
567@@ -52,8 +52,7 @@
568 ~Platform();
569
570 /* From Platform */
571- std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(
572- const std::shared_ptr<BufferInitializer>& buffer_initializer);
573+ std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator();
574 std::shared_ptr<graphics::BufferWriter> make_buffer_writer();
575 std::shared_ptr<graphics::Display> create_display(
576 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
577
578=== modified file 'src/server/graphics/default_configuration.cpp'
579--- src/server/graphics/default_configuration.cpp 2014-09-19 03:08:20 +0000
580+++ src/server/graphics/default_configuration.cpp 2014-10-16 14:20:32 +0000
581@@ -25,7 +25,6 @@
582 #include "nested/nested_platform.h"
583 #include "offscreen/display.h"
584
585-#include "mir/graphics/buffer_initializer.h"
586 #include "mir/graphics/gl_config.h"
587 #include "mir/graphics/cursor.h"
588 #include "program_factory.h"
589@@ -43,16 +42,6 @@
590
591 namespace mg = mir::graphics;
592
593-std::shared_ptr<mg::BufferInitializer>
594-mir::DefaultServerConfiguration::the_buffer_initializer()
595-{
596- return buffer_initializer(
597- []()
598- {
599- return std::make_shared<mg::NullBufferInitializer>();
600- });
601-}
602-
603 std::shared_ptr<mg::DisplayConfigurationPolicy>
604 mir::DefaultServerConfiguration::the_display_configuration_policy()
605 {
606@@ -102,7 +91,7 @@
607 return buffer_allocator(
608 [&]()
609 {
610- return the_graphics_platform()->create_buffer_allocator(the_buffer_initializer());
611+ return the_graphics_platform()->create_buffer_allocator();
612 });
613 }
614
615
616=== modified file 'src/server/graphics/nested/nested_platform.cpp'
617--- src/server/graphics/nested/nested_platform.cpp 2014-09-26 05:50:46 +0000
618+++ src/server/graphics/nested/nested_platform.cpp 2014-10-16 14:20:32 +0000
619@@ -74,10 +74,9 @@
620 {
621 }
622
623-std::shared_ptr<mg::GraphicBufferAllocator> mgn::NestedPlatform::create_buffer_allocator(
624- std::shared_ptr<mg::BufferInitializer> const& buffer_initializer)
625+std::shared_ptr<mg::GraphicBufferAllocator> mgn::NestedPlatform::create_buffer_allocator()
626 {
627- return native_platform->create_buffer_allocator(buffer_initializer);
628+ return native_platform->create_buffer_allocator();
629 }
630
631 std::shared_ptr<mg::BufferWriter> mgn::NestedPlatform::make_buffer_writer()
632
633=== modified file 'src/server/graphics/nested/nested_platform.h'
634--- src/server/graphics/nested/nested_platform.h 2014-09-26 05:50:46 +0000
635+++ src/server/graphics/nested/nested_platform.h 2014-10-16 14:20:32 +0000
636@@ -42,8 +42,7 @@
637 std::shared_ptr<NativePlatform> const& native_platform);
638
639 ~NestedPlatform() noexcept;
640- std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator(
641- std::shared_ptr<BufferInitializer> const& buffer_initializer) override;
642+ std::shared_ptr<GraphicBufferAllocator> create_buffer_allocator() override;
643 std::shared_ptr<Display> create_display(
644 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
645 std::shared_ptr<GLProgramFactory> const& gl_program_factory,
646
647=== modified file 'tests/acceptance-tests/test_display_configuration.cpp'
648--- tests/acceptance-tests/test_display_configuration.cpp 2014-09-11 05:51:44 +0000
649+++ tests/acceptance-tests/test_display_configuration.cpp 2014-10-16 14:20:32 +0000
650@@ -140,8 +140,7 @@
651 class StubPlatform : public mtd::NullPlatform
652 {
653 public:
654- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
655- std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/) override
656+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
657 {
658 return std::make_shared<mtd::StubBufferAllocator>();
659 }
660
661=== modified file 'tests/acceptance-tests/test_nested_mir.cpp'
662--- tests/acceptance-tests/test_nested_mir.cpp 2014-09-30 06:11:33 +0000
663+++ tests/acceptance-tests/test_nested_mir.cpp 2014-10-16 14:20:32 +0000
664@@ -121,10 +121,9 @@
665
666 void initialize(std::shared_ptr<mg::NestedContext> const& /*nested_context*/) override {}
667
668- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
669- std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) override
670+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
671 {
672- return adaptee->create_buffer_allocator(buffer_initializer);
673+ return adaptee->create_buffer_allocator();
674 }
675
676 std::shared_ptr<mg::PlatformIPCPackage> connection_ipc_package() override
677
678=== removed file 'tests/include/mir_test_doubles/mock_buffer_initializer.h'
679--- tests/include/mir_test_doubles/mock_buffer_initializer.h 2013-08-28 03:41:48 +0000
680+++ tests/include/mir_test_doubles/mock_buffer_initializer.h 1970-01-01 00:00:00 +0000
681@@ -1,48 +0,0 @@
682-/*
683- * Copyright © 2012 Canonical Ltd.
684- *
685- * This program is free software: you can redistribute it and/or modify it
686- * under the terms of the GNU General Public License version 3,
687- * as published by the Free Software Foundation.
688- *
689- * This program is distributed in the hope that it will be useful,
690- * but WITHOUT ANY WARRANTY; without even the implied warranty of
691- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
692- * GNU General Public License for more details.
693- *
694- * You should have received a copy of the GNU General Public License
695- * along with this program. If not, see <http://www.gnu.org/licenses/>.
696- *
697- * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
698- */
699-
700-#ifndef MIR_TEST_DOUBLES_MOCK_BUFFER_INITIALIZER_H_
701-#define MIR_TEST_DOUBLES_MOCK_BUFFER_INITIALIZER_H_
702-
703-#include "mir/graphics/buffer_initializer.h"
704-
705-#include <gmock/gmock.h>
706-
707-namespace mir
708-{
709-namespace test
710-{
711-namespace doubles
712-{
713-
714-class MockBufferInitializer : public graphics::BufferInitializer
715-{
716-public:
717- MOCK_METHOD1(operator_call, void(graphics::Buffer& buffer));
718-
719- void operator()(graphics::Buffer& buffer)
720- {
721- operator_call(buffer);
722- }
723-};
724-
725-}
726-}
727-} // namespace mir
728-
729-#endif /* MIR_TEST_DOUBLES_MOCK_BUFFER_INITIALIZER_H_ */
730
731=== modified file 'tests/include/mir_test_doubles/null_platform.h'
732--- tests/include/mir_test_doubles/null_platform.h 2014-09-24 17:01:33 +0000
733+++ tests/include/mir_test_doubles/null_platform.h 2014-10-16 14:20:32 +0000
734@@ -33,8 +33,7 @@
735 class NullPlatform : public graphics::Platform
736 {
737 public:
738- std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator(
739- const std::shared_ptr<graphics::BufferInitializer>& /*buffer_initializer*/)
740+ std::shared_ptr<graphics::GraphicBufferAllocator> create_buffer_allocator()
741 {
742 return nullptr;
743 }
744
745=== modified file 'tests/integration-tests/client/test_client_render.cpp'
746--- tests/integration-tests/client/test_client_render.cpp 2014-10-14 17:16:30 +0000
747+++ tests/integration-tests/client/test_client_render.cpp 2014-10-16 14:20:32 +0000
748@@ -19,7 +19,6 @@
749 #include "mir_test_framework/process.h"
750
751 #include "mir/graphics/buffer_properties.h"
752-#include "mir/graphics/buffer_initializer.h"
753 #include "src/platform/graphics/android/buffer.h"
754 #include "mir/graphics/android/native_buffer.h"
755 #include "src/platform/graphics/android/android_graphic_buffer_allocator.h"
756@@ -192,8 +191,7 @@
757 {
758 StubServerGenerator()
759 {
760- auto initializer = std::make_shared<mg::NullBufferInitializer>();
761- allocator = std::make_shared<mga::AndroidGraphicBufferAllocator> (initializer);
762+ allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
763 auto size = geom::Size{test_width, test_height};
764 surface_pf = mir_pixel_format_abgr_8888;
765 last_posted = allocator->alloc_buffer_platform(size, surface_pf, mga::BufferUsage::use_hardware);
766
767=== modified file 'tests/integration-tests/graphics/android/test_buffer_integration.cpp'
768--- tests/integration-tests/graphics/android/test_buffer_integration.cpp 2014-10-06 03:02:44 +0000
769+++ tests/integration-tests/graphics/android/test_buffer_integration.cpp 2014-10-16 14:20:32 +0000
770@@ -18,7 +18,6 @@
771
772 #include "src/platform/graphics/android/android_graphic_buffer_allocator.h"
773 #include "src/server/compositor/buffer_queue.h"
774-#include "mir/graphics/buffer_initializer.h"
775 #include "src/server/report/null_report_factory.h"
776 #include "mir/graphics/android/native_buffer.h"
777 #include "mir/graphics/buffer_properties.h"
778@@ -47,11 +46,9 @@
779 size = geom::Size{334, 122};
780 pf = mir_pixel_format_abgr_8888;
781 buffer_properties = mg::BufferProperties{size, pf, mg::BufferUsage::software};
782- null_buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
783 graphics_region_factory = mtd::create_graphics_region_factory();
784 }
785
786- std::shared_ptr<mg::BufferInitializer> null_buffer_initializer;
787 geom::Size size;
788 MirPixelFormat pf;
789 mg::BufferProperties buffer_properties;
790@@ -89,7 +86,7 @@
791 {
792 using namespace testing;
793
794- auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);
795+ auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
796
797 mg::BufferProperties sw_properties{size, pf, mg::BufferUsage::software};
798 auto test_buffer = allocator->alloc_buffer(sw_properties);
799@@ -106,7 +103,7 @@
800 using namespace testing;
801
802 mg::BufferProperties hw_properties{size, pf, mg::BufferUsage::hardware};
803- auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);
804+ auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
805
806 //TODO: kdub it is a bit trickier to test that a gpu can render... just check creation for now
807 auto test_buffer = allocator->alloc_buffer(hw_properties);
808@@ -117,7 +114,7 @@
809 {
810 using namespace testing;
811
812- auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);
813+ auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
814
815 mc::BufferQueue swapper(2, allocator, buffer_properties, policy_factory);
816
817
818=== modified file 'tests/integration-tests/graphics/android/test_display_integration.cpp'
819--- tests/integration-tests/graphics/android/test_display_integration.cpp 2014-09-25 06:06:57 +0000
820+++ tests/integration-tests/graphics/android/test_display_integration.cpp 2014-10-16 14:20:32 +0000
821@@ -16,7 +16,6 @@
822 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
823 */
824
825-#include "mir/graphics/buffer_initializer.h"
826 #include "mir/graphics/display_buffer.h"
827 #include "src/platform/graphics/android/display.h"
828 #include "src/platform/graphics/android/hwc_loggers.h"
829@@ -55,8 +54,7 @@
830 the server can handle this, but we need the test to as well */
831 original_sigterm_handler = signal(SIGTERM, [](int){});
832
833- auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
834- buffer_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(buffer_initializer);
835+ buffer_allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
836
837 /* note about fb_device: OMAP4 drivers seem to only be able to open fb once
838 per process (repeated framebuffer_{open,close}() doesn't seem to work). once we
839
840=== modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp'
841--- tests/integration-tests/graphics/android/test_internal_client.cpp 2014-09-11 05:51:44 +0000
842+++ tests/integration-tests/graphics/android/test_internal_client.cpp 2014-10-16 14:20:32 +0000
843@@ -22,7 +22,6 @@
844 #include "src/platform/graphics/android/internal_client.h"
845 #include "src/server/compositor/buffer_stream_factory.h"
846 #include "src/server/report/null_report_factory.h"
847-#include "mir/graphics/buffer_initializer.h"
848 #include "src/server/report/null_report_factory.h"
849 #include "mir/graphics/android/mir_native_window.h"
850 #include "mir/graphics/platform.h"
851@@ -100,8 +99,7 @@
852
853 auto stub_input_factory = std::make_shared<StubInputFactory>();
854 auto stub_input_sender = std::make_shared<mtd::StubInputSender>();
855- auto null_buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
856- auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);
857+ auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>();
858 auto buffer_stream_factory = std::make_shared<mc::BufferStreamFactory>(allocator, std::make_shared<mtd::StubFrameDroppingPolicyFactory>());
859 auto scene_report = mr::null_scene_report();
860 auto const surface_configurator = std::make_shared<mtd::NullSurfaceConfigurator>();
861
862=== modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp'
863--- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2014-09-11 05:51:44 +0000
864+++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2014-10-16 14:20:32 +0000
865@@ -19,7 +19,6 @@
866 #include "mir/graphics/buffer_basic.h"
867 #include "mir/graphics/buffer_id.h"
868 #include "mir/graphics/buffer_properties.h"
869-#include "mir/graphics/buffer_initializer.h"
870 #include "mir/options/configuration.h"
871 #include "mir/options/option.h"
872 #include "mir_test_doubles/stub_buffer.h"
873@@ -85,8 +84,7 @@
874 class StubGraphicPlatform : public mtd::NullPlatform
875 {
876 public:
877- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
878- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
879+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
880 {
881 return std::make_shared<StubGraphicBufferAllocator>();
882 }
883@@ -116,8 +114,7 @@
884 conf_policy,
885 std::make_shared<mtd::StubGLProgramFactory>(),
886 std::make_shared<mtd::StubGLConfig>());
887- auto buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
888- allocator = platform->create_buffer_allocator(buffer_initializer);
889+ allocator = platform->create_buffer_allocator();
890 size = geom::Size{100, 100};
891 pf = mir_pixel_format_abgr_8888;
892 usage = mg::BufferUsage::hardware;
893
894=== modified file 'tests/integration-tests/test_display_info.cpp'
895--- tests/integration-tests/test_display_info.cpp 2014-09-11 05:51:44 +0000
896+++ tests/integration-tests/test_display_info.cpp 2014-10-16 14:20:32 +0000
897@@ -110,8 +110,7 @@
898 class StubPlatform : public mtd::NullPlatform
899 {
900 public:
901- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
902- std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/) override
903+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
904 {
905 return std::make_shared<StubGraphicBufferAllocator>();
906 }
907
908=== modified file 'tests/integration-tests/test_drm_auth_magic.cpp'
909--- tests/integration-tests/test_drm_auth_magic.cpp 2014-03-06 06:05:17 +0000
910+++ tests/integration-tests/test_drm_auth_magic.cpp 2014-10-16 14:20:32 +0000
911@@ -47,8 +47,7 @@
912 class MockAuthenticatingPlatform : public mtd::NullPlatform, public mg::DRMAuthenticator
913 {
914 public:
915- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
916- std::shared_ptr<mg::BufferInitializer> const& /*buffer_initializer*/) override
917+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
918 {
919 return std::make_shared<mtd::StubBufferAllocator>();
920 }
921
922=== modified file 'tests/integration-tests/test_surfaceloop.cpp'
923--- tests/integration-tests/test_surfaceloop.cpp 2014-09-11 05:51:44 +0000
924+++ tests/integration-tests/test_surfaceloop.cpp 2014-10-16 14:20:32 +0000
925@@ -181,8 +181,7 @@
926 class StubPlatform : public mtd::NullPlatform
927 {
928 public:
929- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
930- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
931+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
932 {
933 return std::make_shared<StubGraphicBufferAllocator>();
934 }
935
936=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
937--- tests/mir_test_framework/stubbed_server_configuration.cpp 2014-10-08 12:35:49 +0000
938+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2014-10-16 14:20:32 +0000
939@@ -184,8 +184,7 @@
940 {
941 }
942
943- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
944- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
945+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
946 {
947 return std::make_shared<StubGraphicBufferAllocator>();
948 }
949
950=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
951--- tests/unit-tests/frontend/test_session_mediator.cpp 2014-10-03 13:04:18 +0000
952+++ tests/unit-tests/frontend/test_session_mediator.cpp 2014-10-16 14:20:32 +0000
953@@ -209,7 +209,7 @@
954 MockPlatform(std::shared_ptr<mg::PlatformIpcOperations> const& ipc_ops)
955 {
956 using namespace testing;
957- ON_CALL(*this, create_buffer_allocator(_))
958+ ON_CALL(*this, create_buffer_allocator())
959 .WillByDefault(Return(std::shared_ptr<mg::GraphicBufferAllocator>()));
960 ON_CALL(*this, create_display(_,_,_))
961 .WillByDefault(Return(std::make_shared<mtd::NullDisplay>()));
962@@ -219,7 +219,7 @@
963 .WillByDefault(Return(ipc_ops));
964 }
965
966- MOCK_METHOD1(create_buffer_allocator, std::shared_ptr<mg::GraphicBufferAllocator>(std::shared_ptr<mg::BufferInitializer> const&));
967+ MOCK_METHOD0(create_buffer_allocator, std::shared_ptr<mg::GraphicBufferAllocator>());
968 MOCK_METHOD3(create_display,
969 std::shared_ptr<mg::Display>(
970 std::shared_ptr<mg::DisplayConfigurationPolicy> const&,
971
972=== modified file 'tests/unit-tests/frontend/test_session_mediator_mesa.cpp'
973--- tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-09-18 07:03:11 +0000
974+++ tests/unit-tests/frontend/test_session_mediator_mesa.cpp 2014-10-16 14:20:32 +0000
975@@ -54,8 +54,7 @@
976 class MockAuthenticatingPlatform : public mtd::NullPlatform, public mg::DRMAuthenticator
977 {
978 public:
979- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
980- const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
981+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
982 {
983 return std::shared_ptr<mg::GraphicBufferAllocator>();
984 }
985
986=== modified file 'tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp'
987--- tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp 2014-03-06 06:05:17 +0000
988+++ tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp 2014-10-16 14:20:32 +0000
989@@ -18,10 +18,8 @@
990
991 #include "src/platform/graphics/android/android_graphic_buffer_allocator.h"
992 #include "mir_test_doubles/mock_android_hw.h"
993-#include "mir/graphics/buffer_initializer.h"
994 #include "mir/graphics/buffer_properties.h"
995
996-#include "mir_test_doubles/mock_buffer_initializer.h"
997 #include "mir_test_doubles/mock_egl.h"
998
999 #include <hardware/gralloc.h>
1000@@ -36,11 +34,9 @@
1001 struct AndroidGraphicBufferAllocatorTest : public ::testing::Test
1002 {
1003 AndroidGraphicBufferAllocatorTest()
1004- : null_buffer_initializer{std::make_shared<mg::NullBufferInitializer>()}
1005 {
1006 }
1007
1008- std::shared_ptr<mg::BufferInitializer> const null_buffer_initializer;
1009 testing::NiceMock<mtd::HardwareAccessMock> hw_access_mock;
1010 testing::NiceMock<mtd::MockEGL> mock_egl;
1011 };
1012@@ -52,12 +48,12 @@
1013 EXPECT_CALL(hw_access_mock, hw_get_module(StrEq(GRALLOC_HARDWARE_MODULE_ID), _))
1014 .Times(1);
1015
1016- mga::AndroidGraphicBufferAllocator allocator(null_buffer_initializer);
1017+ mga::AndroidGraphicBufferAllocator allocator{};
1018 }
1019
1020 TEST_F(AndroidGraphicBufferAllocatorTest, supported_pixel_formats_contain_common_formats)
1021 {
1022- mga::AndroidGraphicBufferAllocator allocator{null_buffer_initializer};
1023+ mga::AndroidGraphicBufferAllocator allocator{};
1024 auto supported_pixel_formats = allocator.supported_pixel_formats();
1025
1026 auto abgr_8888_count = std::count(supported_pixel_formats.begin(),
1027@@ -79,45 +75,13 @@
1028
1029 TEST_F(AndroidGraphicBufferAllocatorTest, supported_pixel_formats_have_sane_default_in_first_position)
1030 {
1031- mga::AndroidGraphicBufferAllocator allocator{null_buffer_initializer};
1032+ mga::AndroidGraphicBufferAllocator allocator{};
1033 auto supported_pixel_formats = allocator.supported_pixel_formats();
1034
1035 ASSERT_FALSE(supported_pixel_formats.empty());
1036 EXPECT_EQ(mir_pixel_format_abgr_8888, supported_pixel_formats[0]);
1037 }
1038
1039-TEST_F(AndroidGraphicBufferAllocatorTest, alloc_buffer_calls_initializer)
1040-{
1041- using namespace testing;
1042-
1043- auto buffer_initializer = std::make_shared<mtd::MockBufferInitializer>();
1044-
1045- mg::BufferProperties properties{geom::Size{2, 2},
1046- mir_pixel_format_abgr_8888,
1047- mg::BufferUsage::hardware};
1048- mga::AndroidGraphicBufferAllocator allocator{buffer_initializer};
1049- EXPECT_CALL(*buffer_initializer, operator_call(_))
1050- .Times(1);
1051-
1052- allocator.alloc_buffer(properties);
1053-}
1054-
1055-TEST_F(AndroidGraphicBufferAllocatorTest, alloc_buffer_platform_calls_initializer)
1056-{
1057- using namespace testing;
1058-
1059- auto buffer_initializer = std::make_shared<mtd::MockBufferInitializer>();
1060-
1061- mga::AndroidGraphicBufferAllocator allocator{buffer_initializer};
1062- auto size = geom::Size{2, 2};
1063- auto pf = mir_pixel_format_abgr_8888;
1064-
1065- EXPECT_CALL(*buffer_initializer, operator_call(_))
1066- .Times(1);
1067-
1068- allocator.alloc_buffer_platform(size, pf, mga::BufferUsage::use_hardware);
1069-}
1070-
1071 TEST_F(AndroidGraphicBufferAllocatorTest, buffer_usage_converter)
1072 {
1073 EXPECT_EQ(mga::BufferUsage::use_hardware,
1074
1075=== modified file 'tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp'
1076--- tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp 2014-09-11 05:51:44 +0000
1077+++ tests/unit-tests/graphics/mesa/test_buffer_allocator.cpp 2014-10-16 14:20:32 +0000
1078@@ -25,7 +25,6 @@
1079 #include "mir_test_doubles/mock_gbm.h"
1080 #include "mir_test_doubles/mock_egl.h"
1081 #include "mir_test_doubles/mock_gl.h"
1082-#include "mir_test_doubles/mock_buffer_initializer.h"
1083 #include "mir_test_doubles/platform_factory.h"
1084 #include "mir_test_framework/udev_environment.h"
1085
1086@@ -62,9 +61,8 @@
1087 .WillByDefault(Return(mock_gbm.fake_gbm.bo_handle));
1088
1089 platform = mtd::create_mesa_platform_with_null_dependencies();
1090- mock_buffer_initializer = std::make_shared<testing::NiceMock<mtd::MockBufferInitializer>>();
1091 allocator.reset(new mgm::BufferAllocator(
1092- platform->gbm.device, mock_buffer_initializer, mgm::BypassOption::allowed));
1093+ platform->gbm.device, mgm::BypassOption::allowed));
1094 }
1095
1096 // Defaults
1097@@ -78,7 +76,6 @@
1098 ::testing::NiceMock<mtd::MockEGL> mock_egl;
1099 ::testing::NiceMock<mtd::MockGL> mock_gl;
1100 std::shared_ptr<mgm::Platform> platform;
1101- std::shared_ptr<testing::NiceMock<mtd::MockBufferInitializer>> mock_buffer_initializer;
1102 std::unique_ptr<mgm::BufferAllocator> allocator;
1103 mtf::UdevEnvironment fake_devices;
1104 };
1105@@ -147,7 +144,6 @@
1106
1107 mgm::BufferAllocator alloc(
1108 platform->gbm.device,
1109- mock_buffer_initializer,
1110 mgm::BypassOption::prohibited);
1111 auto buf = alloc.alloc_buffer(properties);
1112 ASSERT_TRUE(buf.get() != NULL);
1113@@ -236,29 +232,6 @@
1114 allocator->alloc_buffer(buffer_properties);
1115 }
1116
1117-TEST_F(MesaBufferAllocatorTest, buffer_initializer_is_called)
1118-{
1119- using namespace testing;
1120-
1121- EXPECT_CALL(*mock_buffer_initializer, operator_call(_))
1122- .Times(1);
1123-
1124- allocator->alloc_buffer(buffer_properties);
1125-}
1126-
1127-TEST_F(MesaBufferAllocatorTest, null_buffer_initializer_does_not_crash)
1128-{
1129- using namespace testing;
1130-
1131- auto null_buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
1132- allocator.reset(new mgm::BufferAllocator(
1133- platform->gbm.device, null_buffer_initializer, mgm::BypassOption::allowed));
1134-
1135- EXPECT_NO_THROW({
1136- allocator->alloc_buffer(buffer_properties);
1137- });
1138-}
1139-
1140 TEST_F(MesaBufferAllocatorTest, throws_on_buffer_creation_failure)
1141 {
1142 using namespace testing;
1143
1144=== modified file 'tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp'
1145--- tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp 2014-09-19 03:08:20 +0000
1146+++ tests/unit-tests/graphics/mesa/test_gbm_buffer.cpp 2014-10-16 14:20:32 +0000
1147@@ -25,7 +25,6 @@
1148
1149 #include "src/platform/graphics/mesa/gbm_buffer.h"
1150 #include "src/platform/graphics/mesa/buffer_allocator.h"
1151-#include "mir/graphics/buffer_initializer.h"
1152 #include "mir/graphics/buffer_properties.h"
1153 #include "mir_test_doubles/platform_factory.h"
1154
1155@@ -71,9 +70,8 @@
1156 .WillByDefault(Return(stride.as_uint32_t()));
1157
1158 platform = mtd::create_mesa_platform_with_null_dependencies();
1159- null_init = std::make_shared<mg::NullBufferInitializer>();
1160
1161- allocator.reset(new mgm::BufferAllocator(platform->gbm.device, null_init, mgm::BypassOption::allowed));
1162+ allocator.reset(new mgm::BufferAllocator(platform->gbm.device, mgm::BypassOption::allowed));
1163 }
1164
1165 ::testing::NiceMock<mtd::MockDRM> mock_drm;
1166@@ -81,7 +79,6 @@
1167 ::testing::NiceMock<mtd::MockEGL> mock_egl;
1168 ::testing::NiceMock<mtd::MockGL> mock_gl;
1169 std::shared_ptr<mgm::Platform> platform;
1170- std::shared_ptr<mg::NullBufferInitializer> null_init;
1171 std::unique_ptr<mgm::BufferAllocator> allocator;
1172
1173 // Defaults
1174
1175=== modified file 'tests/unit-tests/graphics/nested/test_nested_platform.cpp'
1176--- tests/unit-tests/graphics/nested/test_nested_platform.cpp 2014-09-24 17:01:33 +0000
1177+++ tests/unit-tests/graphics/nested/test_nested_platform.cpp 2014-10-16 14:20:32 +0000
1178@@ -49,8 +49,7 @@
1179 public:
1180 void initialize(std::shared_ptr<mg::NestedContext> const&) override {}
1181
1182- std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
1183- std::shared_ptr<mg::BufferInitializer> const&) override
1184+ std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator() override
1185 {
1186 return {};
1187 }
1188
1189=== modified file 'tests/unit-tests/graphics/test_graphics_platform.cpp'
1190--- tests/unit-tests/graphics/test_graphics_platform.cpp 2014-09-23 19:01:02 +0000
1191+++ tests/unit-tests/graphics/test_graphics_platform.cpp 2014-10-16 14:20:32 +0000
1192@@ -31,7 +31,6 @@
1193 #else
1194 #include "mir_test_doubles/mock_android_hw.h"
1195 #endif
1196-#include "mir/graphics/buffer_initializer.h"
1197 #include "mir/logging/dumb_console_logger.h"
1198
1199
1200@@ -52,7 +51,6 @@
1201 GraphicsPlatform() : logger(std::make_shared<ml::DumbConsoleLogger>())
1202 {
1203 using namespace testing;
1204- buffer_initializer = std::make_shared<mg::NullBufferInitializer>();
1205
1206 #ifndef ANDROID
1207 ON_CALL(mock_gbm, gbm_bo_get_width(_))
1208@@ -74,7 +72,6 @@
1209 }
1210
1211 std::shared_ptr<ml::Logger> logger;
1212- std::shared_ptr<mg::BufferInitializer> buffer_initializer;
1213
1214 ::testing::NiceMock<mtd::MockEGL> mock_egl;
1215 ::testing::NiceMock<mtd::MockGL> mock_gl;
1216@@ -93,7 +90,7 @@
1217
1218 EXPECT_NO_THROW (
1219 auto platform = create_platform();
1220- auto allocator = platform->create_buffer_allocator(buffer_initializer);
1221+ auto allocator = platform->create_buffer_allocator();
1222
1223 EXPECT_TRUE(allocator.get());
1224 );
1225@@ -103,7 +100,7 @@
1226 TEST_F(GraphicsPlatform, buffer_creation)
1227 {
1228 auto platform = create_platform();
1229- auto allocator = platform->create_buffer_allocator(buffer_initializer);
1230+ auto allocator = platform->create_buffer_allocator();
1231 auto supported_pixel_formats = allocator->supported_pixel_formats();
1232
1233 ASSERT_NE(0u, supported_pixel_formats.size());

Subscribers

People subscribed via source and target branches