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