Mir

Merge lp:~kdub/mir/native-buffer-type into lp:~mir-team/mir/trunk

Proposed by Kevin DuBois
Status: Merged
Approved by: Kevin DuBois
Approved revision: no longer in the source branch.
Merged at revision: 676
Proposed branch: lp:~kdub/mir/native-buffer-type
Merge into: lp:~mir-team/mir/trunk
Diff against target: 2070 lines (+342/-380)
76 files modified
examples/demo_client.c (+13/-6)
include/client/mir_toolkit/mir_client_library.h (+11/-1)
include/server/mir/compositor/buffer.h (+2/-0)
include/shared/mir_toolkit/client_types.h (+9/-17)
include/shared/mir_toolkit/mesa/native_display.h (+1/-0)
include/shared/mir_toolkit/mir_native_buffer.h (+44/-0)
include/test/mir_test_doubles/mock_alloc_adaptor.h (+0/-1)
include/test/mir_test_doubles/mock_android_buffer.h (+0/-57)
include/test/mir_test_doubles/mock_buffer.h (+3/-0)
include/test/mir_test_doubles/mock_display_support_provider.h (+1/-1)
include/test/mir_test_doubles/mock_hwc_interface.h (+1/-1)
include/test/mir_test_doubles/mock_hwc_organizer.h (+1/-1)
include/test/mir_test_doubles/stub_buffer.h (+8/-1)
src/client/aging_buffer.h (+2/-0)
src/client/android/android_client_buffer.cpp (+13/-17)
src/client/android/android_client_buffer.h (+3/-4)
src/client/android/android_client_platform.cpp (+5/-0)
src/client/android/android_client_platform.h (+1/-0)
src/client/android/client_surface_interpreter.cpp (+4/-4)
src/client/android/client_surface_interpreter.h (+2/-2)
src/client/client_buffer.h (+4/-4)
src/client/client_platform.h (+3/-0)
src/client/gbm/gbm_client_buffer.cpp (+2/-7)
src/client/gbm/gbm_client_buffer.h (+2/-3)
src/client/gbm/gbm_client_platform.cpp (+5/-0)
src/client/gbm/gbm_client_platform.h (+1/-0)
src/client/gbm/mesa_native_display_container.cpp (+4/-1)
src/client/mir_client_library.cpp (+7/-11)
src/client/mir_native_buffer.h (+0/-30)
src/client/mir_surface.cpp (+9/-3)
src/client/mir_surface.h (+3/-1)
src/server/compositor/temporary_buffers.cpp (+4/-0)
src/server/compositor/temporary_buffers.h (+1/-0)
src/server/graphics/android/android_buffer.h (+0/-51)
src/server/graphics/android/android_buffer_allocator.cpp (+1/-1)
src/server/graphics/android/android_graphic_buffer_allocator.h (+1/-1)
src/server/graphics/android/buffer.h (+4/-6)
src/server/graphics/android/default_framebuffer_factory.cpp (+3/-2)
src/server/graphics/android/display_support_provider.h (+5/-2)
src/server/graphics/android/fb_device.cpp (+3/-2)
src/server/graphics/android/fb_device.h (+1/-1)
src/server/graphics/android/fb_simple_swapper.cpp (+3/-2)
src/server/graphics/android/fb_simple_swapper.h (+5/-5)
src/server/graphics/android/fb_swapper.h (+9/-5)
src/server/graphics/android/graphic_buffer_allocator.h (+2/-2)
src/server/graphics/android/hwc10_device.cpp (+2/-1)
src/server/graphics/android/hwc10_device.h (+1/-1)
src/server/graphics/android/hwc11_device.cpp (+2/-1)
src/server/graphics/android/hwc11_device.h (+1/-1)
src/server/graphics/android/hwc_common_device.h (+1/-1)
src/server/graphics/android/hwc_device.h (+1/-1)
src/server/graphics/android/hwc_layerlist.cpp (+3/-2)
src/server/graphics/android/hwc_layerlist.h (+6/-3)
src/server/graphics/android/server_render_window.cpp (+1/-1)
src/server/graphics/android/server_render_window.h (+5/-2)
src/server/graphics/gbm/gbm_buffer.cpp (+5/-0)
src/server/graphics/gbm/gbm_buffer.h (+1/-0)
tests/integration-tests/client/test_client_render.cpp (+0/-1)
tests/integration-tests/graphics/android/test_buffer_integration.cpp (+0/-7)
tests/unit-tests/client/android/test_client_android_buffer.cpp (+5/-21)
tests/unit-tests/client/android/test_client_surface_interpreter.cpp (+12/-10)
tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp (+1/-1)
tests/unit-tests/client/test_aging_buffer.cpp (+1/-6)
tests/unit-tests/client/test_client_buffer_depository.cpp (+2/-3)
tests/unit-tests/client/test_client_mir_surface.cpp (+17/-25)
tests/unit-tests/client/test_client_platform.cpp (+14/-0)
tests/unit-tests/client/test_mir_connection.cpp (+1/-0)
tests/unit-tests/compositor/test_temporary_buffers.cpp (+9/-0)
tests/unit-tests/graphics/android/test_fb_device.cpp (+3/-3)
tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp (+11/-11)
tests/unit-tests/graphics/android/test_framebuffer_factory.cpp (+2/-2)
tests/unit-tests/graphics/android/test_hwc10_device.cpp (+3/-2)
tests/unit-tests/graphics/android/test_hwc11_device.cpp (+4/-3)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+1/-1)
tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+3/-3)
tests/unit-tests/graphics/android/test_server_interpreter.cpp (+18/-14)
To merge this branch: bzr merge lp:~kdub/mir/native-buffer-type
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+162635@code.launchpad.net

Commit message

use MirNativeBuffer as the platform independent type to represent the platform's native handle

Description of the change

improve handling of platform specific buffer handles accross the system by using a type, MirNativeBuffer to describe the platform-specific buffer type

This is a branch that I split off from my internal-client work for android.
MirBufferPackage is the native handle for the gbm/mesa platform. ANativeWindowBuffer is the native handle for android.
This branch addresses these problems
1) On the client side, we were using mcl::ClientBuffer::get_native_handle() for android, and mcl::ClientBuffer::get_buffer_package() for gbm. Both these functions did the same thing; that is, to get the native buffer handle for the driver. Consolidate these functions

2) On the server side, we had mc::Buffer::get_ipc_package(), which was always a bit strange that the concept of ipc was tied into our concept of a graphics buffer. I introduce a new function, mc::Buffer::native_buffer_handle() that returns the platform-specific buffer handle. This function will, in a subsequent MP, allow us to deprecate get_ipc_package() from mc::Buffer and put it elsewhere.

Currently, with lp:mir and mesa/gbm internal clients, we use get_ipc_package() to pack the ipc package, and then immediately unpack it to submit to driver. This is usually just 2 ints on gbm, but could be 40+ on android, so this avoids that work, and gives us a server-side representation of the buffer whenever we need it.

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

an interesting way that this branch manifested itself was that it showed that mir_surface_get_current_buffer() always returned the MirBufferPackage, which is the GBM platform's native type. This branch adds a new function to the client api, mir_surface_get_platform_type, which allows the user of mir_surface_get_current_buffer() to interpret the buffer they get from this function correctly.

This is really only used by xmir at the moment, so I'm working on updating xmir to support the api change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

1623 + //auto buffer_package = std::make_shared<MirBufferPackage>();
1624 + //ON_CALL(*this, native_buffer_handle())
1625 + // .WillByDefault(Return(buffer_package));

don't keep dead code in comments.

1673 +#if 0
1674 TEST_F(MirClientSurfaceTest, client_buffer_uses_ipc_message_from_server_on_create)
1675 {
1676 using namespace testing;
1677 @@ -391,6 +394,7 @@
1678 /* check for same contents */
1679 EXPECT_THAT(*submitted_package, BufferPackageMatches(mock_server_tool->server_package));
1680 }
1681 +#endif

don't keep dead code in conditionals.

1689 +#if 0
1690 TEST_F(MirClientSurfaceTest, get_buffer_returns_last_received_buffer_package)
1691 {
1692 using namespace testing;
1693 @@ -520,7 +525,7 @@
1694
1695 EXPECT_THAT(*surface->get_current_buffer_package(), BufferPackageMatches(mock_server_tool->server_package));
1696 }
1697 -
1698 +#endif

don't keep dead code in conditionals.

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

oops, sorry about the dead code... fixed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo_client.c'
2--- examples/demo_client.c 2013-05-02 00:11:18 +0000
3+++ examples/demo_client.c 2013-05-09 15:25:39 +0000
4@@ -40,6 +40,8 @@
5 /// \snippet demo_client.c surface_release_tag
6 ///\subsection connection_release We release our connection
7 /// \snippet demo_client.c connection_release_tag
8+///\subsection get the raw, platform-specific buffer handle for the current buffer
9+/// \snippet demo_client.c get_current_buffer_tag
10 /// \example demo_client.c A simple mir client
11 ///\section MirDemoState MirDemoState
12 /// The handles needs to be accessible both to callbacks and to the control function.
13@@ -156,13 +158,18 @@
14 {
15 // We can query the current graphics buffer attributes
16 {
17- MirBufferPackage buffer_package;
18- buffer_package.data_items = -1;
19- buffer_package.fd_items = -1;
20+ ///\internal [get_current_buffer_tag]
21+ MirNativeBuffer* buffer_package = NULL;
22 mir_surface_get_current_buffer(mcd.surface, &buffer_package);
23- assert(0 <= buffer_package.data_items);
24- assert(0 <= buffer_package.fd_items);
25-
26+ assert(buffer_package != NULL);
27+ if (mir_platform_type_gbm == mir_surface_get_platform_type(mcd.surface))
28+ {
29+ // Interpret buffer_package as MirBufferPackage
30+ } else if (mir_platform_type_android == mir_surface_get_platform_type(mcd.surface))
31+ {
32+ // Interpret buffer_package as ANativeWindowBuffer
33+ }
34+ ///\internal [get_current_buffer_tag]
35 // In a real application we'd render into the current buffer
36 }
37
38
39=== modified file 'include/client/mir_toolkit/mir_client_library.h'
40--- include/client/mir_toolkit/mir_client_library.h 2013-05-02 00:11:18 +0000
41+++ include/client/mir_toolkit/mir_client_library.h 2013-05-09 15:25:39 +0000
42@@ -18,6 +18,7 @@
43 #ifndef MIR_CLIENT_LIBRARY_H
44 #define MIR_CLIENT_LIBRARY_H
45
46+#include <mir_toolkit/mir_native_buffer.h>
47 #include <mir_toolkit/client_types.h>
48 #include <mir_toolkit/common.h>
49
50@@ -176,12 +177,21 @@
51 void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters);
52
53 /**
54+ * Get the underlying platform type so the buffer obtained in "raw" representation
55+ * in mir_surface_get_current_buffer() can be understood
56+ * \pre The surface is valid
57+ * \param [in] surface The surface
58+ * \return One of mir_platform_type_android or mir_platform_type_gbm
59+ */
60+MirPlatformType mir_surface_get_platform_type(MirSurface *surface);
61+
62+/**
63 * Get a surface's buffer in "raw" representation.
64 * \pre The surface is valid
65 * \param [in] surface The surface
66 * \param [out] buffer_package Structure to be populated
67 */
68-void mir_surface_get_current_buffer(MirSurface *surface, MirBufferPackage *buffer_package);
69+void mir_surface_get_current_buffer(MirSurface *surface, MirNativeBuffer **buffer_package);
70
71 /**
72 * Get a surface's graphics_region, i.e., map the graphics buffer to main
73
74=== modified file 'include/server/mir/compositor/buffer.h'
75--- include/server/mir/compositor/buffer.h 2013-04-24 05:22:20 +0000
76+++ include/server/mir/compositor/buffer.h 2013-05-09 15:25:39 +0000
77@@ -20,6 +20,7 @@
78 #define MIR_COMPOSITOR_BUFFER_H_
79
80 #include "mir/surfaces/graphic_region.h"
81+#include "mir_toolkit/mir_native_buffer.h"
82
83 #include <memory>
84
85@@ -36,6 +37,7 @@
86 virtual ~Buffer() {}
87
88 virtual std::shared_ptr<BufferIPCPackage> get_ipc_package() const = 0;
89+ virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const = 0;
90 virtual BufferID id() const = 0;
91
92 protected:
93
94=== modified file 'include/shared/mir_toolkit/client_types.h'
95--- include/shared/mir_toolkit/client_types.h 2013-05-02 00:11:18 +0000
96+++ include/shared/mir_toolkit/client_types.h 2013-05-09 15:25:39 +0000
97@@ -118,7 +118,15 @@
98
99 enum { mir_platform_package_max = 32 };
100
101-/** TODO */
102+/**
103+ * The native buffer type for the system the client is connected on
104+ */
105+typedef enum MirPlatformType
106+{
107+ mir_platform_type_gbm,
108+ mir_platform_type_android
109+} MirPlatformType;
110+
111 typedef struct MirPlatformPackage
112 {
113 int data_items;
114@@ -128,22 +136,6 @@
115 int fd[mir_platform_package_max];
116 } MirPlatformPackage;
117
118-enum { mir_buffer_package_max = 32 };
119-
120-/** TODO */
121-typedef struct MirBufferPackage
122-{
123- int data_items;
124- int fd_items;
125-
126- int data[mir_buffer_package_max];
127- int fd[mir_buffer_package_max];
128-
129- int stride;
130- int age; /**< Number of frames submitted by the client since the client has rendered to this buffer. */
131- /**< This has the same semantics as the EGL_EXT_buffer_age extension */
132- /**< \see http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt */
133-} MirBufferPackage;
134
135 /**
136 * Retrieved information about a MirSurface. This is most useful for learning
137
138=== modified file 'include/shared/mir_toolkit/mesa/native_display.h'
139--- include/shared/mir_toolkit/mesa/native_display.h 2013-05-02 00:11:18 +0000
140+++ include/shared/mir_toolkit/mesa/native_display.h 2013-05-09 15:25:39 +0000
141@@ -18,6 +18,7 @@
142 #ifndef MIR_TOOLKIT_MESA_NATIVE_DISPLAY_H
143 #define MIR_TOOLKIT_MESA_NATIVE_DISPLAY_H
144
145+#include "mir_toolkit/mir_native_buffer.h"
146 #include "mir_toolkit/client_types.h"
147
148 #ifdef __cplusplus
149
150=== added file 'include/shared/mir_toolkit/mir_native_buffer.h'
151--- include/shared/mir_toolkit/mir_native_buffer.h 1970-01-01 00:00:00 +0000
152+++ include/shared/mir_toolkit/mir_native_buffer.h 2013-05-09 15:25:39 +0000
153@@ -0,0 +1,44 @@
154+/*
155+ * Copyright © 2012 Canonical Ltd.
156+ *
157+ * This program is free software: you can redistribute it and/or modify it
158+ * under the terms of the GNU Lesser General Public License version 3,
159+ * as published by the Free Software Foundation.
160+ *
161+ * This program is distributed in the hope that it will be useful,
162+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
163+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
164+ * GNU Lesser General Public License for more details.
165+ *
166+ * You should have received a copy of the GNU Lesser General Public License
167+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
168+ *
169+ * Authored by:
170+ * Kevin DuBois <kevin.dubois@canonical.com>
171+ */
172+
173+#ifndef MIR_CLIENT_MIR_NATIVE_BUFFER_H_
174+#define MIR_CLIENT_MIR_NATIVE_BUFFER_H_
175+
176+enum { mir_buffer_package_max = 32 };
177+typedef struct MirBufferPackage
178+{
179+ int data_items;
180+ int fd_items;
181+
182+ int data[mir_buffer_package_max];
183+ int fd[mir_buffer_package_max];
184+
185+ int stride;
186+ int age; /**< Number of frames submitted by the client since the client has rendered to this buffer. */
187+ /**< This has the same semantics as the EGL_EXT_buffer_age extension */
188+ /**< \see http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt */
189+} MirBufferPackage;
190+
191+#ifdef ANDROID
192+struct ANativeWindowBuffer;
193+typedef struct ANativeWindowBuffer MirNativeBuffer;
194+#else
195+typedef struct MirBufferPackage MirNativeBuffer;
196+#endif
197+#endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */
198
199=== modified file 'include/test/mir_test_doubles/mock_alloc_adaptor.h'
200--- include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-04-24 05:22:20 +0000
201+++ include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-05-09 15:25:39 +0000
202@@ -20,7 +20,6 @@
203 #define MIR_TEST_DOUBLES_MOCK_ALLOC_ADAPTOR_H_
204
205 #include "src/server/graphics/android/graphic_alloc_adaptor.h"
206-#include "src/server/graphics/android/android_buffer.h"
207
208 #include <system/window.h>
209 #include <gmock/gmock.h>
210
211=== removed file 'include/test/mir_test_doubles/mock_android_buffer.h'
212--- include/test/mir_test_doubles/mock_android_buffer.h 2013-04-24 05:22:20 +0000
213+++ include/test/mir_test_doubles/mock_android_buffer.h 1970-01-01 00:00:00 +0000
214@@ -1,57 +0,0 @@
215-/*
216- * Copyright © 2012 Canonical Ltd.
217- *
218- * This program is free software: you can redistribute it and/or modify it
219- * under the terms of the GNU General Public License version 3,
220- * as published by the Free Software Foundation.
221- *
222- * This program is distributed in the hope that it will be useful,
223- * but WITHOUT ANY WARRANTY; without even the implied warranty of
224- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
225- * GNU General Public License for more details.
226- *
227- * You should have received a copy of the GNU General Public License
228- * along with this program. If not, see <http://www.gnu.org/licenses/>.
229- *
230- * Authored by: Thomas Voss <thomas.voss@canonical.com>
231- */
232-
233-#ifndef MIR_TEST_DOUBLES_MOCK_ANDROID_BUFFER_H_
234-#define MIR_TEST_DOUBLES_MOCK_ANDROID_BUFFER_H_
235-
236-#include "src/server/graphics/android/android_buffer.h"
237-#include <gmock/gmock.h>
238-#include <gtest/gtest.h>
239-
240-namespace mir
241-{
242-namespace test
243-{
244-namespace doubles
245-{
246-
247-struct MockAndroidBuffer : public mir::graphics::android::AndroidBuffer
248-{
249- public:
250- MockAndroidBuffer()
251- {
252- using namespace testing;
253- ON_CALL(*this, native_buffer_handle())
254- .WillByDefault(Return(std::make_shared<ANativeWindowBuffer>()));
255- }
256-
257- MOCK_CONST_METHOD0(size, geometry::Size());
258- MOCK_CONST_METHOD0(stride, geometry::Stride());
259- MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());
260- MOCK_CONST_METHOD0(get_ipc_package, std::shared_ptr<compositor::BufferIPCPackage>());
261-
262- MOCK_METHOD0(bind_to_texture, void());
263- MOCK_CONST_METHOD0(id, compositor::BufferID());
264- MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<ANativeWindowBuffer>());
265-};
266-
267-}
268-}
269-}
270-
271-#endif // MIR_TEST_DOUBLES_MOCK_ANDROID_BUFFER_H_
272
273=== modified file 'include/test/mir_test_doubles/mock_buffer.h'
274--- include/test/mir_test_doubles/mock_buffer.h 2013-04-24 05:22:20 +0000
275+++ include/test/mir_test_doubles/mock_buffer.h 2013-05-09 15:25:39 +0000
276@@ -59,12 +59,15 @@
277 .WillByDefault(Return(empty_package));
278 ON_CALL(*this, id())
279 .WillByDefault(Return(compositor::BufferID{4}));
280+ ON_CALL(*this, native_buffer_handle())
281+ .WillByDefault(Return(std::shared_ptr<MirNativeBuffer>()));
282 }
283
284 MOCK_CONST_METHOD0(size, geometry::Size());
285 MOCK_CONST_METHOD0(stride, geometry::Stride());
286 MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());
287 MOCK_CONST_METHOD0(get_ipc_package, std::shared_ptr<compositor::BufferIPCPackage>());
288+ MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
289
290 MOCK_METHOD0(bind_to_texture, void());
291 MOCK_CONST_METHOD0(id, compositor::BufferID());
292
293=== modified file 'include/test/mir_test_doubles/mock_display_support_provider.h'
294--- include/test/mir_test_doubles/mock_display_support_provider.h 2013-04-24 05:22:20 +0000
295+++ include/test/mir_test_doubles/mock_display_support_provider.h 2013-05-09 15:25:39 +0000
296@@ -35,7 +35,7 @@
297 MOCK_CONST_METHOD0(display_size, geometry::Size());
298 MOCK_CONST_METHOD0(display_format, geometry::PixelFormat());
299 MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int());
300- MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::graphics::android::AndroidBuffer> const&));
301+ MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::compositor::Buffer> const&));
302 };
303 }
304 }
305
306=== modified file 'include/test/mir_test_doubles/mock_hwc_interface.h'
307--- include/test/mir_test_doubles/mock_hwc_interface.h 2013-04-24 05:22:20 +0000
308+++ include/test/mir_test_doubles/mock_hwc_interface.h 2013-05-09 15:25:39 +0000
309@@ -39,7 +39,7 @@
310 MOCK_CONST_METHOD0(display_size, geometry::Size());
311 MOCK_CONST_METHOD0(display_format, geometry::PixelFormat());
312 MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int());
313- MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::graphics::android::AndroidBuffer> const&));
314+ MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::compositor::Buffer> const&));
315 };
316
317 }
318
319=== modified file 'include/test/mir_test_doubles/mock_hwc_organizer.h'
320--- include/test/mir_test_doubles/mock_hwc_organizer.h 2013-04-23 15:21:23 +0000
321+++ include/test/mir_test_doubles/mock_hwc_organizer.h 2013-05-09 15:25:39 +0000
322@@ -34,7 +34,7 @@
323 {
324 ~MockHWCOrganizer() noexcept {}
325 MOCK_CONST_METHOD0(native_list, graphics::android::LayerList const&());
326- MOCK_METHOD1(set_fb_target, void(std::shared_ptr<graphics::android::AndroidBuffer> const&));
327+ MOCK_METHOD1(set_fb_target, void(std::shared_ptr<compositor::Buffer> const&));
328 };
329
330 }
331
332=== modified file 'include/test/mir_test_doubles/stub_buffer.h'
333--- include/test/mir_test_doubles/stub_buffer.h 2013-04-24 05:22:20 +0000
334+++ include/test/mir_test_doubles/stub_buffer.h 2013-05-09 15:25:39 +0000
335@@ -53,8 +53,15 @@
336
337 virtual geometry::PixelFormat pixel_format() const { return buf_pixel_format; }
338
339- virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const { return std::make_shared<compositor::BufferIPCPackage>(); }
340+ virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const
341+ {
342+ return std::make_shared<compositor::BufferIPCPackage>();
343+ }
344
345+ virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
346+ {
347+ return std::shared_ptr<MirNativeBuffer>();
348+ }
349 virtual void bind_to_texture() {}
350
351 geometry::Size const buf_size;
352
353=== modified file 'src/client/aging_buffer.h'
354--- src/client/aging_buffer.h 2013-04-24 05:22:20 +0000
355+++ src/client/aging_buffer.h 2013-05-09 15:25:39 +0000
356@@ -30,6 +30,8 @@
357 {
358 public:
359 AgingBuffer();
360+ ~AgingBuffer() noexcept {};
361+
362 virtual uint32_t age() const;
363 virtual void increment_age();
364 virtual void mark_as_submitted();
365
366=== modified file 'src/client/android/android_client_buffer.cpp'
367--- src/client/android/android_client_buffer.cpp 2013-04-24 05:22:20 +0000
368+++ src/client/android/android_client_buffer.cpp 2013-05-09 15:25:39 +0000
369@@ -30,7 +30,8 @@
370 : creation_package(package),
371 buffer_registrar(registrar),
372 rect({{geom::X(0),geom::Y(0)}, size}),
373- buffer_pf(pf)
374+ buffer_pf(pf),
375+ native_window_buffer(std::make_shared<ANativeWindowBuffer>())
376 {
377 creation_package = std::move(package);
378 native_handle = std::shared_ptr<const native_handle_t> (convert_to_native_handle(creation_package));
379@@ -45,17 +46,17 @@
380 }
381 void mcla::AndroidClientBuffer::pack_native_window_buffer()
382 {
383- native_window_buffer.height = static_cast<int32_t>(rect.size.height.as_uint32_t());
384- native_window_buffer.width = static_cast<int32_t>(rect.size.width.as_uint32_t());
385- native_window_buffer.stride = creation_package->stride;
386- native_window_buffer.usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;
387+ native_window_buffer->height = static_cast<int32_t>(rect.size.height.as_uint32_t());
388+ native_window_buffer->width = static_cast<int32_t>(rect.size.width.as_uint32_t());
389+ native_window_buffer->stride = creation_package->stride;
390+ native_window_buffer->usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;
391
392- native_window_buffer.handle = native_handle.get();
393- native_window_buffer.common.incRef = &incRef;
394- native_window_buffer.common.decRef = &incRef;
395+ native_window_buffer->handle = native_handle.get();
396+ native_window_buffer->common.incRef = &incRef;
397+ native_window_buffer->common.decRef = &incRef;
398 }
399
400-mcla::AndroidClientBuffer::~AndroidClientBuffer()
401+mcla::AndroidClientBuffer::~AndroidClientBuffer() noexcept
402 {
403 buffer_registrar->unregister_buffer(native_handle.get());
404 }
405@@ -112,12 +113,7 @@
406 return buffer_pf;
407 }
408
409-MirNativeBuffer mcla::AndroidClientBuffer::get_native_handle()
410-{
411- return &native_window_buffer;
412-}
413-
414-std::shared_ptr<MirBufferPackage> mcla::AndroidClientBuffer::get_buffer_package() const
415-{
416- return creation_package;
417+std::shared_ptr<ANativeWindowBuffer> mcla::AndroidClientBuffer::native_buffer_handle() const
418+{
419+ return native_window_buffer;
420 }
421
422=== modified file 'src/client/android/android_client_buffer.h'
423--- src/client/android/android_client_buffer.h 2013-04-24 05:22:20 +0000
424+++ src/client/android/android_client_buffer.h 2013-05-09 15:25:39 +0000
425@@ -40,14 +40,13 @@
426 AndroidClientBuffer(std::shared_ptr<AndroidRegistrar> const&,
427 std::shared_ptr<MirBufferPackage> const&,
428 geometry::Size size, geometry::PixelFormat pf);
429- ~AndroidClientBuffer();
430+ ~AndroidClientBuffer() noexcept;
431
432 std::shared_ptr<MemoryRegion> secure_for_cpu_write();
433 geometry::Size size() const;
434 geometry::Stride stride() const;
435 geometry::PixelFormat pixel_format() const;
436- MirNativeBuffer get_native_handle();
437- std::shared_ptr<MirBufferPackage> get_buffer_package() const;
438+ std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const;
439
440 AndroidClientBuffer(const AndroidClientBuffer&) = delete;
441 AndroidClientBuffer& operator=(const AndroidClientBuffer&) = delete;
442@@ -62,7 +61,7 @@
443 const geometry::Rectangle rect;
444 const geometry::PixelFormat buffer_pf;
445
446- ANativeWindowBuffer native_window_buffer;
447+ std::shared_ptr<ANativeWindowBuffer> native_window_buffer;
448 };
449
450 }
451
452=== modified file 'src/client/android/android_client_platform.cpp'
453--- src/client/android/android_client_platform.cpp 2013-04-24 05:22:20 +0000
454+++ src/client/android/android_client_platform.cpp 2013-05-09 15:25:39 +0000
455@@ -102,3 +102,8 @@
456 *native_display = EGL_DEFAULT_DISPLAY;
457 return native_display;
458 }
459+
460+MirPlatformType mcla::AndroidClientPlatform::platform_type() const
461+{
462+ return mir_platform_type_android;
463+}
464
465=== modified file 'src/client/android/android_client_platform.h'
466--- src/client/android/android_client_platform.h 2013-04-24 05:22:20 +0000
467+++ src/client/android/android_client_platform.h 2013-05-09 15:25:39 +0000
468@@ -32,6 +32,7 @@
469 class AndroidClientPlatform : public ClientPlatform
470 {
471 public:
472+ MirPlatformType platform_type() const;
473 std::shared_ptr<ClientBufferFactory> create_buffer_factory();
474 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);
475 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
476
477=== modified file 'src/client/android/client_surface_interpreter.cpp'
478--- src/client/android/client_surface_interpreter.cpp 2013-04-24 05:22:20 +0000
479+++ src/client/android/client_surface_interpreter.cpp 2013-05-09 15:25:39 +0000
480@@ -29,18 +29,18 @@
481 {
482 }
483
484-ANativeWindowBuffer* mcla::ClientSurfaceInterpreter::driver_requests_buffer()
485+MirNativeBuffer* mcla::ClientSurfaceInterpreter::driver_requests_buffer()
486 {
487 auto buffer = surface.get_current_buffer();
488- auto buffer_to_driver = buffer->get_native_handle();
489+ auto buffer_to_driver = buffer->native_buffer_handle();
490 buffer_to_driver->format = driver_pixel_format;
491
492- return buffer_to_driver;
493+ return buffer_to_driver.get();
494 }
495
496 static void empty(MirSurface * /*surface*/, void * /*client_context*/)
497 {}
498-void mcla::ClientSurfaceInterpreter::driver_returns_buffer(ANativeWindowBuffer*, std::shared_ptr<mga::SyncObject> const& sync_fence)
499+void mcla::ClientSurfaceInterpreter::driver_returns_buffer(MirNativeBuffer*, std::shared_ptr<mga::SyncObject> const& sync_fence)
500 {
501 sync_fence->wait();
502 mir_wait_for(surface.next_buffer(empty, NULL));
503
504=== modified file 'src/client/android/client_surface_interpreter.h'
505--- src/client/android/client_surface_interpreter.h 2013-04-24 05:22:20 +0000
506+++ src/client/android/client_surface_interpreter.h 2013-05-09 15:25:39 +0000
507@@ -34,8 +34,8 @@
508 public:
509 explicit ClientSurfaceInterpreter(ClientSurface& surface);
510
511- ANativeWindowBuffer* driver_requests_buffer();
512- void driver_returns_buffer(ANativeWindowBuffer*, std::shared_ptr<graphics::android::SyncObject> const&);
513+ MirNativeBuffer* driver_requests_buffer();
514+ void driver_returns_buffer(MirNativeBuffer*, std::shared_ptr<graphics::android::SyncObject> const&);
515 void dispatch_driver_request_format(int format);
516 int driver_requests_info(int key) const;
517 private:
518
519=== modified file 'src/client/client_buffer.h'
520--- src/client/client_buffer.h 2013-04-24 05:22:20 +0000
521+++ src/client/client_buffer.h 2013-05-09 15:25:39 +0000
522@@ -20,7 +20,8 @@
523 #ifndef MIR_CLIENT_CLIENT_BUFFER_H_
524 #define MIR_CLIENT_CLIENT_BUFFER_H_
525
526-#include "mir_native_buffer.h"
527+#include "mir_toolkit/mir_native_buffer.h"
528+#include "mir_toolkit/common.h"
529 #include "mir/geometry/pixel_format.h"
530 #include "mir/geometry/size.h"
531
532@@ -51,6 +52,7 @@
533 class ClientBuffer
534 {
535 public:
536+ virtual ~ClientBuffer() = default;
537 virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;
538 virtual geometry::Size size() const = 0;
539 virtual geometry::Stride stride() const = 0;
540@@ -58,9 +60,7 @@
541 virtual uint32_t age() const = 0;
542 virtual void increment_age() = 0;
543 virtual void mark_as_submitted() = 0;
544-
545- virtual MirNativeBuffer get_native_handle() = 0;
546- virtual std::shared_ptr<MirBufferPackage> get_buffer_package() const = 0;
547+ virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const = 0;
548 };
549
550 }
551
552=== modified file 'src/client/client_platform.h'
553--- src/client/client_platform.h 2013-04-24 05:22:20 +0000
554+++ src/client/client_platform.h 2013-05-09 15:25:39 +0000
555@@ -18,6 +18,8 @@
556 #ifndef MIR_CLIENT_CLIENT_PLATFORM_H_
557 #define MIR_CLIENT_CLIENT_PLATFORM_H_
558
559+#include "mir_toolkit/client_types.h"
560+
561 #include <EGL/eglplatform.h>
562 #include <memory>
563
564@@ -36,6 +38,7 @@
565 ClientPlatform(const ClientPlatform& p) = delete;
566 ClientPlatform& operator=(const ClientPlatform& p) = delete;
567
568+ virtual MirPlatformType platform_type() const = 0;
569 virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0;
570 virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0;
571 virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0;
572
573=== modified file 'src/client/gbm/gbm_client_buffer.cpp'
574--- src/client/gbm/gbm_client_buffer.cpp 2013-04-24 05:22:20 +0000
575+++ src/client/gbm/gbm_client_buffer.cpp 2013-05-09 15:25:39 +0000
576@@ -133,7 +133,7 @@
577 {
578 }
579
580-mclg::GBMClientBuffer::~GBMClientBuffer()
581+mclg::GBMClientBuffer::~GBMClientBuffer() noexcept
582 {
583 // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does,
584 // something's seriously wrong.
585@@ -166,13 +166,8 @@
586 return buffer_pf;
587 }
588
589-std::shared_ptr<MirBufferPackage> mclg::GBMClientBuffer::get_buffer_package() const
590+std::shared_ptr<MirNativeBuffer> mclg::GBMClientBuffer::native_buffer_handle() const
591 {
592 creation_package->age = age();
593 return creation_package;
594 }
595-
596-MirNativeBuffer mclg::GBMClientBuffer::get_native_handle()
597-{
598- return NULL;
599-}
600
601=== modified file 'src/client/gbm/gbm_client_buffer.h'
602--- src/client/gbm/gbm_client_buffer.h 2013-04-24 05:22:20 +0000
603+++ src/client/gbm/gbm_client_buffer.h 2013-05-09 15:25:39 +0000
604@@ -43,14 +43,13 @@
605 geometry::Size size,
606 geometry::PixelFormat pf);
607
608- virtual ~GBMClientBuffer();
609+ virtual ~GBMClientBuffer() noexcept;
610
611 std::shared_ptr<MemoryRegion> secure_for_cpu_write();
612 geometry::Size size() const;
613 geometry::Stride stride() const;
614 geometry::PixelFormat pixel_format() const;
615- std::shared_ptr<MirBufferPackage> get_buffer_package() const;
616- MirNativeBuffer get_native_handle();
617+ std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
618
619 GBMClientBuffer(const GBMClientBuffer&) = delete;
620 GBMClientBuffer& operator=(const GBMClientBuffer&) = delete;
621
622=== modified file 'src/client/gbm/gbm_client_platform.cpp'
623--- src/client/gbm/gbm_client_platform.cpp 2013-04-24 05:22:20 +0000
624+++ src/client/gbm/gbm_client_platform.cpp 2013-05-09 15:25:39 +0000
625@@ -144,3 +144,8 @@
626
627 return std::shared_ptr<EGLNativeDisplayType>(egl_native_display, NativeDisplayDeleter(display_container));
628 }
629+
630+MirPlatformType mclg::GBMClientPlatform::platform_type() const
631+{
632+ return mir_platform_type_gbm;
633+}
634
635=== modified file 'src/client/gbm/gbm_client_platform.h'
636--- src/client/gbm/gbm_client_platform.h 2013-04-24 05:22:20 +0000
637+++ src/client/gbm/gbm_client_platform.h 2013-05-09 15:25:39 +0000
638@@ -39,6 +39,7 @@
639 std::shared_ptr<DRMFDHandler> const& drm_fd_handler,
640 EGLNativeDisplayContainer& display_container);
641
642+ MirPlatformType platform_type() const;
643 std::shared_ptr<ClientBufferFactory> create_buffer_factory();
644 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);
645 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
646
647=== modified file 'src/client/gbm/mesa_native_display_container.cpp'
648--- src/client/gbm/mesa_native_display_container.cpp 2013-04-24 05:22:20 +0000
649+++ src/client/gbm/mesa_native_display_container.cpp 2013-05-09 15:25:39 +0000
650@@ -21,6 +21,7 @@
651 #include "mir_toolkit/mesa/native_display.h"
652 #include "mir_toolkit/mir_client_library.h"
653
654+#include <cstring>
655 #include <unordered_set>
656 #include <mutex>
657
658@@ -45,7 +46,9 @@
659 MirBufferPackage* buffer_package)
660 {
661 MirSurface* ms = static_cast<MirSurface*>(surface);
662- mir_surface_get_current_buffer(ms, buffer_package);
663+ MirBufferPackage * current_package;
664+ mir_surface_get_current_buffer(ms, &current_package);
665+ memcpy(buffer_package, current_package, sizeof(MirBufferPackage));
666 }
667
668 static void buffer_advanced_callback(MirSurface* /* surface */,
669
670=== modified file 'src/client/mir_client_library.cpp'
671--- src/client/mir_client_library.cpp 2013-05-02 00:11:18 +0000
672+++ src/client/mir_client_library.cpp 2013-05-09 15:25:39 +0000
673@@ -183,19 +183,15 @@
674 *parameters = surface->get_parameters();
675 }
676
677-void mir_surface_get_current_buffer(MirSurface *surface, MirBufferPackage * buffer_package_out)
678+MirPlatformType mir_surface_get_platform_type(MirSurface * surface)
679+{
680+ return surface->platform_type();
681+}
682+
683+void mir_surface_get_current_buffer(MirSurface * surface, MirNativeBuffer ** buffer_package_out)
684 {
685 auto package = surface->get_current_buffer_package();
686-
687- buffer_package_out->data_items = package->data_items;
688- buffer_package_out->fd_items = package->fd_items;
689- for(auto i=0; i<mir_buffer_package_max; i++)
690- {
691- buffer_package_out->data[i] = package->data[i];
692- buffer_package_out->fd[i] = package->fd[i];
693- }
694-
695- buffer_package_out->stride = package->stride;
696+ *buffer_package_out = package.get();
697 }
698
699 void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package)
700
701=== removed file 'src/client/mir_native_buffer.h'
702--- src/client/mir_native_buffer.h 2013-04-24 05:22:20 +0000
703+++ src/client/mir_native_buffer.h 1970-01-01 00:00:00 +0000
704@@ -1,30 +0,0 @@
705-/*
706- * Copyright © 2012 Canonical Ltd.
707- *
708- * This program is free software: you can redistribute it and/or modify it
709- * under the terms of the GNU Lesser General Public License version 3,
710- * as published by the Free Software Foundation.
711- *
712- * This program is distributed in the hope that it will be useful,
713- * but WITHOUT ANY WARRANTY; without even the implied warranty of
714- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
715- * GNU Lesser General Public License for more details.
716- *
717- * You should have received a copy of the GNU Lesser General Public License
718- * along with this program. If not, see <http://www.gnu.org/licenses/>.
719- *
720- * Authored by:
721- * Kevin DuBois <kevin.dubois@canonical.com>
722- */
723-
724-#ifndef MIR_CLIENT_MIR_NATIVE_BUFFER_H_
725-#define MIR_CLIENT_MIR_NATIVE_BUFFER_H_
726-
727-#ifdef ANDROID
728-struct ANativeWindowBuffer;
729-typedef ANativeWindowBuffer* MirNativeBuffer;
730-#else
731-typedef void* MirNativeBuffer;
732-#endif
733-
734-#endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */
735
736=== modified file 'src/client/mir_surface.cpp'
737--- src/client/mir_surface.cpp 2013-05-01 23:30:06 +0000
738+++ src/client/mir_surface.cpp 2013-05-09 15:25:39 +0000
739@@ -195,10 +195,10 @@
740 return connection->release_surface(this, callback, context);
741 }
742
743-std::shared_ptr<MirBufferPackage> MirSurface::get_current_buffer_package()
744+std::shared_ptr<MirNativeBuffer> MirSurface::get_current_buffer_package()
745 {
746- auto buffer = buffer_depository->current_buffer();
747- return buffer->get_buffer_package();
748+ auto buffer = get_current_buffer();
749+ return buffer->native_buffer_handle();
750 }
751
752 std::shared_ptr<mcl::ClientBuffer> MirSurface::get_current_buffer()
753@@ -321,3 +321,9 @@
754 if (handle_event_callback)
755 handle_event_callback(&e);
756 }
757+
758+MirPlatformType MirSurface::platform_type()
759+{
760+ auto platform = connection->get_client_platform();
761+ return platform->platform_type();
762+}
763
764=== modified file 'src/client/mir_surface.h'
765--- src/client/mir_surface.h 2013-04-24 05:22:20 +0000
766+++ src/client/mir_surface.h 2013-05-09 15:25:39 +0000
767@@ -24,6 +24,7 @@
768 #include "mir/geometry/dimensions.h"
769 #include "mir_toolkit/mir_client_library.h"
770 #include "mir_toolkit/common.h"
771+#include "mir_toolkit/mir_native_buffer.h"
772 #include "client_buffer_depository.h"
773 #include "mir_wait_handle.h"
774 #include "mir_client_surface.h"
775@@ -75,7 +76,8 @@
776 MirWaitHandle* next_buffer(mir_surface_lifecycle_callback callback, void * context);
777 MirWaitHandle* get_create_wait_handle();
778
779- std::shared_ptr<MirBufferPackage> get_current_buffer_package();
780+ std::shared_ptr<MirNativeBuffer> get_current_buffer_package();
781+ MirPlatformType platform_type();
782 std::shared_ptr<mir::client::ClientBuffer> get_current_buffer();
783 void get_cpu_region(MirGraphicsRegion& region);
784 void release_cpu_region();
785
786=== modified file 'src/server/compositor/temporary_buffers.cpp'
787--- src/server/compositor/temporary_buffers.cpp 2013-04-24 05:22:20 +0000
788+++ src/server/compositor/temporary_buffers.cpp 2013-05-09 15:25:39 +0000
789@@ -81,3 +81,7 @@
790 return buffer->get_ipc_package();
791 }
792
793+std::shared_ptr<MirNativeBuffer> mc::TemporaryBuffer::native_buffer_handle() const
794+{
795+ return buffer->native_buffer_handle();
796+}
797
798=== modified file 'src/server/compositor/temporary_buffers.h'
799--- src/server/compositor/temporary_buffers.h 2013-04-24 05:22:20 +0000
800+++ src/server/compositor/temporary_buffers.h 2013-05-09 15:25:39 +0000
801@@ -39,6 +39,7 @@
802 BufferID id() const;
803 void bind_to_texture();
804 std::shared_ptr<BufferIPCPackage> get_ipc_package() const;
805+ std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
806
807 protected:
808 explicit TemporaryBuffer(std::shared_ptr<Buffer> const& real_buffer);
809
810=== removed file 'src/server/graphics/android/android_buffer.h'
811--- src/server/graphics/android/android_buffer.h 2013-04-24 05:22:20 +0000
812+++ src/server/graphics/android/android_buffer.h 1970-01-01 00:00:00 +0000
813@@ -1,51 +0,0 @@
814-/*
815- * Copyright © 2012,2013 Canonical Ltd.
816- *
817- * This program is free software: you can redistribute it and/or modify it
818- * under the terms of the GNU General Public License version 3,
819- * as published by the Free Software Foundation.
820- *
821- * This program is distributed in the hope that it will be useful,
822- * but WITHOUT ANY WARRANTY; without even the implied warranty of
823- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
824- * GNU General Public License for more details.
825- *
826- * You should have received a copy of the GNU General Public License
827- * along with this program. If not, see <http://www.gnu.org/licenses/>.
828- *
829- * Authored by:
830- * Kevin DuBois <kevin.dubois@canonical.com>
831- */
832-
833-#ifndef MIR_GRAPHICS_ANDROID_ANDROID_BUFFER_H_
834-#define MIR_GRAPHICS_ANDROID_ANDROID_BUFFER_H_
835-
836-#include "mir/compositor/buffer_basic.h"
837-
838-#include <system/window.h>
839-#include <memory>
840-
841-namespace mir
842-{
843-namespace graphics
844-{
845-namespace android
846-{
847-
848-class AndroidBuffer : public compositor::BufferBasic
849-{
850-public:
851- virtual ~AndroidBuffer() = default;
852- virtual std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const = 0;
853-protected:
854- AndroidBuffer() = default;
855- AndroidBuffer(AndroidBuffer const&) = delete;
856- AndroidBuffer& operator=(AndroidBuffer const&) = delete;
857-
858-};
859-
860-}
861-}
862-}
863-
864-#endif /* MIR_GRAPHICS_ANDROID_ANDROID_BUFFER_H_ */
865
866=== modified file 'src/server/graphics/android/android_buffer_allocator.cpp'
867--- src/server/graphics/android/android_buffer_allocator.cpp 2013-04-24 05:22:20 +0000
868+++ src/server/graphics/android/android_buffer_allocator.cpp 2013-05-09 15:25:39 +0000
869@@ -75,7 +75,7 @@
870 return alloc_buffer_platform(buffer_properties.size, buffer_properties.format, usage);
871 }
872
873-std::shared_ptr<mga::AndroidBuffer> mga::AndroidGraphicBufferAllocator::alloc_buffer_platform(
874+std::shared_ptr<mga::Buffer> mga::AndroidGraphicBufferAllocator::alloc_buffer_platform(
875 geom::Size sz, geom::PixelFormat pf, mga::BufferUsage use)
876 {
877 auto buffer = std::make_shared<Buffer>(alloc_device, sz, pf, use);
878
879=== modified file 'src/server/graphics/android/android_graphic_buffer_allocator.h'
880--- src/server/graphics/android/android_graphic_buffer_allocator.h 2013-04-24 05:22:20 +0000
881+++ src/server/graphics/android/android_graphic_buffer_allocator.h 2013-05-09 15:25:39 +0000
882@@ -46,7 +46,7 @@
883 std::shared_ptr<compositor::Buffer> alloc_buffer(
884 compositor::BufferProperties const& buffer_properties);
885
886- std::shared_ptr<AndroidBuffer> alloc_buffer_platform(
887+ std::shared_ptr<Buffer> alloc_buffer_platform(
888 geometry::Size sz, geometry::PixelFormat pf, BufferUsage use);
889
890 std::vector<geometry::PixelFormat> supported_pixel_formats();
891
892=== modified file 'src/server/graphics/android/buffer.h'
893--- src/server/graphics/android/buffer.h 2013-04-16 20:55:50 +0000
894+++ src/server/graphics/android/buffer.h 2013-05-09 15:25:39 +0000
895@@ -20,7 +20,7 @@
896 #ifndef MIR_GRAPHICS_ANDROID_BUFFER_H_
897 #define MIR_GRAPHICS_ANDROID_BUFFER_H_
898
899-#include "android_buffer.h"
900+#include "mir/compositor/buffer_basic.h"
901 #include "android_buffer_handle.h"
902
903 #include <map>
904@@ -38,22 +38,20 @@
905 {
906
907 class GraphicAllocAdaptor;
908-class Buffer: public AndroidBuffer
909+class Buffer: public compositor::BufferBasic
910 {
911 public:
912 Buffer(const std::shared_ptr<GraphicAllocAdaptor>& device,
913 geometry::Size size, geometry::PixelFormat pf, BufferUsage use);
914 ~Buffer();
915
916- /* from BufferBasic */
917 geometry::Size size() const;
918 geometry::Stride stride() const;
919 geometry::PixelFormat pixel_format() const;
920+ void bind_to_texture();
921 std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const;
922- void bind_to_texture();
923-
924- /* android-specific */
925 std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const;
926+
927 private:
928 std::shared_ptr<GraphicAllocAdaptor> const alloc_device;
929
930
931=== modified file 'src/server/graphics/android/default_framebuffer_factory.cpp'
932--- src/server/graphics/android/default_framebuffer_factory.cpp 2013-04-24 05:22:20 +0000
933+++ src/server/graphics/android/default_framebuffer_factory.cpp 2013-05-09 15:25:39 +0000
934@@ -18,11 +18,12 @@
935 */
936
937 #include "mir/graphics/android/mir_native_window.h"
938+#include "buffer.h"
939 #include "default_framebuffer_factory.h"
940 #include "fb_device.h"
941+#include "fb_simple_swapper.h"
942 #include "graphic_buffer_allocator.h"
943 #include "server_render_window.h"
944-#include "fb_simple_swapper.h"
945
946 #include <boost/throw_exception.hpp>
947 #include <stdexcept>
948@@ -43,7 +44,7 @@
949 auto size = info_provider->display_size();
950 auto pf = info_provider->display_format();
951 auto num_framebuffers = info_provider->number_of_framebuffers_available();
952- std::vector<std::shared_ptr<mga::AndroidBuffer>> buffers;
953+ std::vector<std::shared_ptr<mc::Buffer>> buffers;
954 for( auto i = 0u; i < num_framebuffers; ++i)
955 {
956 buffers.push_back(buffer_allocator->alloc_buffer_platform(size, pf, mga::BufferUsage::use_framebuffer_gles));
957
958=== modified file 'src/server/graphics/android/display_support_provider.h'
959--- src/server/graphics/android/display_support_provider.h 2013-04-24 05:22:20 +0000
960+++ src/server/graphics/android/display_support_provider.h 2013-05-09 15:25:39 +0000
961@@ -25,12 +25,15 @@
962
963 namespace mir
964 {
965+namespace compositor
966+{
967+class Buffer;
968+}
969 namespace graphics
970 {
971 namespace android
972 {
973
974-class AndroidBuffer;
975 class DisplaySupportProvider
976 {
977 public:
978@@ -41,7 +44,7 @@
979 virtual unsigned int number_of_framebuffers_available() const = 0;
980 //this function schedules the next frontbuffer to be "buffer" parameter. depending on implementation, it may
981 //post immediately, or be deferred.
982- virtual void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer) = 0;
983+ virtual void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer) = 0;
984
985 protected:
986 DisplaySupportProvider() = default;
987
988=== modified file 'src/server/graphics/android/fb_device.cpp'
989--- src/server/graphics/android/fb_device.cpp 2013-04-24 05:22:20 +0000
990+++ src/server/graphics/android/fb_device.cpp 2013-05-09 15:25:39 +0000
991@@ -19,13 +19,14 @@
992 #include "mir/compositor/buffer.h"
993
994 #include "fb_device.h"
995-#include "android_buffer.h"
996+#include "buffer.h"
997 #include "android_format_conversion-inl.h"
998
999 #include <algorithm>
1000 #include <boost/throw_exception.hpp>
1001 #include <stdexcept>
1002
1003+namespace mc=mir::compositor;
1004 namespace mga=mir::graphics::android;
1005 namespace geom=mir::geometry;
1006
1007@@ -34,7 +35,7 @@
1008 {
1009 }
1010
1011-void mga::FBDevice::set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer)
1012+void mga::FBDevice::set_next_frontbuffer(std::shared_ptr<mc::Buffer> const& buffer)
1013 {
1014 auto handle = buffer->native_buffer_handle();
1015 if (fb_device->post(fb_device.get(), handle->handle) != 0)
1016
1017=== modified file 'src/server/graphics/android/fb_device.h'
1018--- src/server/graphics/android/fb_device.h 2013-04-24 05:22:20 +0000
1019+++ src/server/graphics/android/fb_device.h 2013-05-09 15:25:39 +0000
1020@@ -39,7 +39,7 @@
1021 geometry::PixelFormat display_format() const;
1022 unsigned int number_of_framebuffers_available() const;
1023
1024- void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer);
1025+ void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer);
1026 private:
1027 std::shared_ptr<framebuffer_device_t> const fb_device;
1028 };
1029
1030=== modified file 'src/server/graphics/android/fb_simple_swapper.cpp'
1031--- src/server/graphics/android/fb_simple_swapper.cpp 2013-04-24 05:22:20 +0000
1032+++ src/server/graphics/android/fb_simple_swapper.cpp 2013-05-09 15:25:39 +0000
1033@@ -22,9 +22,10 @@
1034 #include <boost/throw_exception.hpp>
1035 #include <stdexcept>
1036
1037+namespace mc=mir::compositor;
1038 namespace mga=mir::graphics::android;
1039
1040-std::shared_ptr<mga::AndroidBuffer> mga::FBSimpleSwapper::compositor_acquire()
1041+std::shared_ptr<mc::Buffer> mga::FBSimpleSwapper::compositor_acquire()
1042 {
1043 std::unique_lock<std::mutex> lk(queue_lock);
1044 while (queue.empty())
1045@@ -37,7 +38,7 @@
1046 return buffer;
1047 }
1048
1049-void mga::FBSimpleSwapper::compositor_release(std::shared_ptr<mga::AndroidBuffer> const& released_buffer)
1050+void mga::FBSimpleSwapper::compositor_release(std::shared_ptr<mc::Buffer> const& released_buffer)
1051 {
1052 std::unique_lock<std::mutex> lk(queue_lock);
1053
1054
1055=== modified file 'src/server/graphics/android/fb_simple_swapper.h'
1056--- src/server/graphics/android/fb_simple_swapper.h 2013-04-16 21:19:35 +0000
1057+++ src/server/graphics/android/fb_simple_swapper.h 2013-05-09 15:25:39 +0000
1058@@ -37,8 +37,8 @@
1059 class FBSimpleSwapper : public FBSwapper
1060 {
1061 public:
1062- template<typename AndroidBufferPtrContainer>
1063- explicit FBSimpleSwapper(AndroidBufferPtrContainer const& buffer_list)
1064+ template<typename BufferPtrContainer>
1065+ explicit FBSimpleSwapper(BufferPtrContainer const& buffer_list)
1066 {
1067 for (auto& buffer : buffer_list)
1068 {
1069@@ -46,14 +46,14 @@
1070 }
1071 }
1072
1073- std::shared_ptr<AndroidBuffer> compositor_acquire();
1074- void compositor_release(std::shared_ptr<AndroidBuffer> const& released_buffer);
1075+ std::shared_ptr<compositor::Buffer> compositor_acquire();
1076+ void compositor_release(std::shared_ptr<compositor::Buffer> const& released_buffer);
1077
1078 private:
1079 std::mutex queue_lock;
1080 std::condition_variable cv;
1081
1082- std::queue<std::shared_ptr<AndroidBuffer>> queue;
1083+ std::queue<std::shared_ptr<compositor::Buffer>> queue;
1084 };
1085
1086 }
1087
1088=== modified file 'src/server/graphics/android/fb_swapper.h'
1089--- src/server/graphics/android/fb_swapper.h 2013-04-24 05:22:20 +0000
1090+++ src/server/graphics/android/fb_swapper.h 2013-05-09 15:25:39 +0000
1091@@ -24,20 +24,24 @@
1092
1093 namespace mir
1094 {
1095+namespace compositor
1096+{
1097+class Buffer;
1098+}
1099 namespace graphics
1100 {
1101 namespace android
1102 {
1103
1104-class AndroidBuffer;
1105+class Buffer;
1106
1107-class FBSwapper // (todo: for composition bypass, inherit from mc::BufferSwapper)
1108-{
1109+//TODO: remove this interface. FBSimpleSwapper should inherit from mc::BufferSwapper
1110+class FBSwapper{
1111 public:
1112 virtual ~FBSwapper() = default;
1113
1114- virtual std::shared_ptr<AndroidBuffer> compositor_acquire() = 0;
1115- virtual void compositor_release(std::shared_ptr<AndroidBuffer> const& released_buffer) = 0;
1116+ virtual std::shared_ptr<compositor::Buffer> compositor_acquire() = 0;
1117+ virtual void compositor_release(std::shared_ptr<compositor::Buffer> const& released_buffer) = 0;
1118 protected:
1119 FBSwapper() = default;
1120 FBSwapper(FBSwapper const&) = delete;
1121
1122=== modified file 'src/server/graphics/android/graphic_buffer_allocator.h'
1123--- src/server/graphics/android/graphic_buffer_allocator.h 2013-04-16 20:55:50 +0000
1124+++ src/server/graphics/android/graphic_buffer_allocator.h 2013-05-09 15:25:39 +0000
1125@@ -29,8 +29,8 @@
1126 {
1127 namespace android
1128 {
1129+class Buffer;
1130
1131-class AndroidBuffer;
1132 class GraphicBufferAllocator: public compositor::GraphicBufferAllocator
1133 {
1134 public:
1135@@ -39,7 +39,7 @@
1136
1137 virtual std::shared_ptr<compositor::Buffer> alloc_buffer(
1138 compositor::BufferProperties const& buffer_properties) = 0;
1139- virtual std::shared_ptr<AndroidBuffer> alloc_buffer_platform(
1140+ virtual std::shared_ptr<Buffer> alloc_buffer_platform(
1141 geometry::Size sz, geometry::PixelFormat pf, BufferUsage use) = 0;
1142 virtual std::vector<geometry::PixelFormat> supported_pixel_formats() = 0;
1143
1144
1145=== modified file 'src/server/graphics/android/hwc10_device.cpp'
1146--- src/server/graphics/android/hwc10_device.cpp 2013-04-23 15:21:23 +0000
1147+++ src/server/graphics/android/hwc10_device.cpp 2013-05-09 15:25:39 +0000
1148@@ -22,6 +22,7 @@
1149 #include <boost/throw_exception.hpp>
1150 #include <stdexcept>
1151
1152+namespace mc=mir::compositor;
1153 namespace mga=mir::graphics::android;
1154 namespace geom=mir::geometry;
1155
1156@@ -51,7 +52,7 @@
1157 return fb_device->number_of_framebuffers_available();
1158 }
1159
1160-void mga::HWC10Device::set_next_frontbuffer(std::shared_ptr<mga::AndroidBuffer> const& buffer)
1161+void mga::HWC10Device::set_next_frontbuffer(std::shared_ptr<mc::Buffer> const& buffer)
1162 {
1163 fb_device->set_next_frontbuffer(buffer);
1164 }
1165
1166=== modified file 'src/server/graphics/android/hwc10_device.h'
1167--- src/server/graphics/android/hwc10_device.h 2013-04-23 15:21:23 +0000
1168+++ src/server/graphics/android/hwc10_device.h 2013-05-09 15:25:39 +0000
1169@@ -39,7 +39,7 @@
1170 geometry::Size display_size() const;
1171 geometry::PixelFormat display_format() const;
1172 unsigned int number_of_framebuffers_available() const;
1173- void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer);
1174+ void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer);
1175
1176 void commit_frame(EGLDisplay dpy, EGLSurface sur);
1177 private:
1178
1179=== modified file 'src/server/graphics/android/hwc11_device.cpp'
1180--- src/server/graphics/android/hwc11_device.cpp 2013-04-24 05:22:20 +0000
1181+++ src/server/graphics/android/hwc11_device.cpp 2013-05-09 15:25:39 +0000
1182@@ -22,6 +22,7 @@
1183 #include <boost/throw_exception.hpp>
1184 #include <stdexcept>
1185
1186+namespace mc=mir::compositor;
1187 namespace mga=mir::graphics::android;
1188 namespace geom=mir::geometry;
1189
1190@@ -71,7 +72,7 @@
1191 return 2u;
1192 }
1193
1194-void mga::HWC11Device::set_next_frontbuffer(std::shared_ptr<mga::AndroidBuffer> const& buffer)
1195+void mga::HWC11Device::set_next_frontbuffer(std::shared_ptr<mc::Buffer> const& buffer)
1196 {
1197 layer_organizer->set_fb_target(buffer);
1198 fb_device->set_next_frontbuffer(buffer);
1199
1200=== modified file 'src/server/graphics/android/hwc11_device.h'
1201--- src/server/graphics/android/hwc11_device.h 2013-04-24 05:22:20 +0000
1202+++ src/server/graphics/android/hwc11_device.h 2013-05-09 15:25:39 +0000
1203@@ -41,7 +41,7 @@
1204 geometry::Size display_size() const;
1205 geometry::PixelFormat display_format() const;
1206 unsigned int number_of_framebuffers_available() const;
1207- void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer);
1208+ void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer);
1209
1210 void commit_frame(EGLDisplay dpy, EGLSurface sur);
1211
1212
1213=== modified file 'src/server/graphics/android/hwc_common_device.h'
1214--- src/server/graphics/android/hwc_common_device.h 2013-04-23 15:21:23 +0000
1215+++ src/server/graphics/android/hwc_common_device.h 2013-05-09 15:25:39 +0000
1216@@ -49,7 +49,7 @@
1217 void wait_for_vsync();
1218
1219 virtual geometry::Size display_size() const = 0;
1220- virtual void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer) = 0;
1221+ virtual void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer) = 0;
1222 virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;
1223
1224 void notify_vsync();
1225
1226=== modified file 'src/server/graphics/android/hwc_device.h'
1227--- src/server/graphics/android/hwc_device.h 2013-04-24 05:22:20 +0000
1228+++ src/server/graphics/android/hwc_device.h 2013-05-09 15:25:39 +0000
1229@@ -39,7 +39,7 @@
1230 virtual geometry::Size display_size() const = 0;
1231 virtual geometry::PixelFormat display_format() const = 0;
1232 virtual unsigned int number_of_framebuffers_available() const = 0;
1233- virtual void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer) = 0;
1234+ virtual void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer) = 0;
1235
1236 virtual void wait_for_vsync() = 0;
1237 virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;
1238
1239=== modified file 'src/server/graphics/android/hwc_layerlist.cpp'
1240--- src/server/graphics/android/hwc_layerlist.cpp 2013-04-17 00:22:29 +0000
1241+++ src/server/graphics/android/hwc_layerlist.cpp 2013-05-09 15:25:39 +0000
1242@@ -17,10 +17,11 @@
1243 */
1244
1245 #include "hwc_layerlist.h"
1246-#include "android_buffer.h"
1247+#include "buffer.h"
1248
1249 #include <cstring>
1250
1251+namespace mc=mir::compositor;
1252 namespace mga=mir::graphics::android;
1253 namespace geom=mir::geometry;
1254
1255@@ -94,7 +95,7 @@
1256 return layer_list;
1257 }
1258
1259-void mga::HWCLayerList::set_fb_target(std::shared_ptr<mga::AndroidBuffer> const& buffer)
1260+void mga::HWCLayerList::set_fb_target(std::shared_ptr<mc::Buffer> const& buffer)
1261 {
1262 auto handle = buffer->native_buffer_handle();
1263
1264
1265=== modified file 'src/server/graphics/android/hwc_layerlist.h'
1266--- src/server/graphics/android/hwc_layerlist.h 2013-04-17 00:22:29 +0000
1267+++ src/server/graphics/android/hwc_layerlist.h 2013-05-09 15:25:39 +0000
1268@@ -26,12 +26,15 @@
1269 #include <initializer_list>
1270 namespace mir
1271 {
1272+namespace compositor
1273+{
1274+class Buffer;
1275+}
1276 namespace graphics
1277 {
1278 namespace android
1279 {
1280
1281-class AndroidBuffer;
1282 class HWCDefaultLayer;
1283 typedef struct std::vector<std::shared_ptr<HWCDefaultLayer>> LayerList;
1284
1285@@ -72,7 +75,7 @@
1286 public:
1287 virtual ~HWCLayerOrganizer() = default;
1288 virtual const LayerList& native_list() const = 0;
1289- virtual void set_fb_target(std::shared_ptr<AndroidBuffer> const&) = 0;
1290+ virtual void set_fb_target(std::shared_ptr<compositor::Buffer> const&) = 0;
1291
1292 protected:
1293 HWCLayerOrganizer() = default;
1294@@ -87,7 +90,7 @@
1295 HWCLayerList();
1296 const LayerList& native_list() const;
1297
1298- void set_fb_target(std::shared_ptr<AndroidBuffer> const&);
1299+ void set_fb_target(std::shared_ptr<compositor::Buffer> const&);
1300
1301 private:
1302 LayerList layer_list;
1303
1304=== modified file 'src/server/graphics/android/server_render_window.cpp'
1305--- src/server/graphics/android/server_render_window.cpp 2013-04-24 05:22:20 +0000
1306+++ src/server/graphics/android/server_render_window.cpp 2013-05-09 15:25:39 +0000
1307@@ -21,7 +21,7 @@
1308 #include "server_render_window.h"
1309 #include "display_support_provider.h"
1310 #include "fb_swapper.h"
1311-#include "android_buffer.h"
1312+#include "buffer.h"
1313 #include "android_format_conversion-inl.h"
1314
1315 #include <boost/throw_exception.hpp>
1316
1317=== modified file 'src/server/graphics/android/server_render_window.h'
1318--- src/server/graphics/android/server_render_window.h 2013-04-24 05:22:20 +0000
1319+++ src/server/graphics/android/server_render_window.h 2013-05-09 15:25:39 +0000
1320@@ -31,6 +31,10 @@
1321
1322 namespace mir
1323 {
1324+namespace compositor
1325+{
1326+class Buffer;
1327+}
1328 namespace graphics
1329 {
1330 namespace android
1331@@ -38,7 +42,6 @@
1332
1333 class FBSwapper;
1334 class DisplaySupportProvider;
1335-class AndroidBuffer;
1336 class ServerRenderWindow : public AndroidDriverInterpreter
1337 {
1338 public:
1339@@ -54,7 +57,7 @@
1340 std::shared_ptr<FBSwapper> const swapper;
1341 std::shared_ptr<DisplaySupportProvider> const poster;
1342
1343- std::unordered_map<ANativeWindowBuffer*, std::shared_ptr<AndroidBuffer>> buffers_in_driver;
1344+ std::unordered_map<ANativeWindowBuffer*, std::shared_ptr<compositor::Buffer>> buffers_in_driver;
1345
1346 int format;
1347 };
1348
1349=== modified file 'src/server/graphics/gbm/gbm_buffer.cpp'
1350--- src/server/graphics/gbm/gbm_buffer.cpp 2013-04-24 05:22:20 +0000
1351+++ src/server/graphics/gbm/gbm_buffer.cpp 2013-05-09 15:25:39 +0000
1352@@ -127,3 +127,8 @@
1353 {
1354 texture_binder->bind_to_texture();
1355 }
1356+
1357+std::shared_ptr<MirNativeBuffer> mgg::GBMBuffer::native_buffer_handle() const
1358+{
1359+ return std::make_shared<MirNativeBuffer>();
1360+}
1361
1362=== modified file 'src/server/graphics/gbm/gbm_buffer.h'
1363--- src/server/graphics/gbm/gbm_buffer.h 2013-04-24 05:22:20 +0000
1364+++ src/server/graphics/gbm/gbm_buffer.h 2013-05-09 15:25:39 +0000
1365@@ -54,6 +54,7 @@
1366 virtual geometry::PixelFormat pixel_format() const;
1367
1368 virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const;
1369+ virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
1370
1371 virtual void bind_to_texture();
1372
1373
1374=== modified file 'tests/integration-tests/client/test_client_render.cpp'
1375--- tests/integration-tests/client/test_client_render.cpp 2013-04-24 05:22:20 +0000
1376+++ tests/integration-tests/client/test_client_render.cpp 2013-05-09 15:25:39 +0000
1377@@ -21,7 +21,6 @@
1378 #include "mir/compositor/buffer_ipc_package.h"
1379 #include "mir/compositor/buffer_properties.h"
1380 #include "mir/graphics/buffer_initializer.h"
1381-#include "src/server/graphics/android/android_buffer.h"
1382 #include "src/server/graphics/android/android_graphic_buffer_allocator.h"
1383
1384 #include "mir_test/draw/android_graphics.h"
1385
1386=== modified file 'tests/integration-tests/graphics/android/test_buffer_integration.cpp'
1387--- tests/integration-tests/graphics/android/test_buffer_integration.cpp 2013-04-24 05:22:20 +0000
1388+++ tests/integration-tests/graphics/android/test_buffer_integration.cpp 2013-05-09 15:25:39 +0000
1389@@ -16,7 +16,6 @@
1390 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1391 */
1392
1393-#include "mir/graphics/platform.h"
1394 #include "src/server/graphics/android/android_graphic_buffer_allocator.h"
1395 #include "mir/graphics/buffer_initializer.h"
1396 #include "mir/graphics/null_display_report.h"
1397@@ -43,9 +42,6 @@
1398 protected:
1399 virtual void SetUp()
1400 {
1401- platform = mg::create_platform(std::make_shared<mg::NullDisplayReport>());
1402- ASSERT_TRUE(platform != NULL);
1403-
1404 size = geom::Size{geom::Width{334},
1405 geom::Height{122}};
1406 pf = geom::PixelFormat::abgr_8888;
1407@@ -58,8 +54,6 @@
1408 geom::PixelFormat pf;
1409 mc::BufferProperties buffer_properties;
1410 mtd::TestGrallocMapper sw_renderer;
1411-
1412- std::shared_ptr<mg::Platform> platform;
1413 };
1414
1415 }
1416@@ -98,7 +92,6 @@
1417 auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);
1418 auto strategy = std::make_shared<mc::SwapperFactory>(allocator);
1419 mc::BufferProperties actual;
1420- mc::BufferID id{34};
1421 auto swapper = strategy->create_swapper(actual, buffer_properties);
1422 auto returned_buffer = swapper->client_acquire();
1423
1424
1425=== modified file 'tests/unit-tests/client/android/test_client_android_buffer.cpp'
1426--- tests/unit-tests/client/android/test_client_android_buffer.cpp 2013-04-24 05:22:20 +0000
1427+++ tests/unit-tests/client/android/test_client_android_buffer.cpp 2013-05-09 15:25:39 +0000
1428@@ -286,7 +286,7 @@
1429 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package),
1430 size, pf);
1431
1432- auto native_handle = buffer->get_native_handle();
1433+ auto native_handle = buffer->native_buffer_handle();
1434
1435 ASSERT_NE(nullptr, native_handle);
1436 EXPECT_EQ(buffer_handle, native_handle->handle);
1437@@ -297,7 +297,7 @@
1438 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package),
1439 size, pf);
1440
1441- auto native_handle = buffer->get_native_handle();
1442+ auto native_handle = buffer->native_buffer_handle();
1443
1444 ASSERT_NE(nullptr, native_handle);
1445 EXPECT_EQ(width.as_uint32_t(), static_cast<uint32_t>(native_handle->width));
1446@@ -308,7 +308,7 @@
1447 {
1448 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
1449
1450- auto native_handle = buffer->get_native_handle();
1451+ auto native_handle = buffer->native_buffer_handle();
1452 int correct_usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;
1453 ASSERT_NE(nullptr, native_handle);
1454 EXPECT_EQ(correct_usage, native_handle->usage);
1455@@ -318,7 +318,7 @@
1456 {
1457 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
1458
1459- auto native_handle = buffer->get_native_handle();
1460+ auto native_handle = buffer->native_buffer_handle();
1461 ASSERT_NE(nullptr, native_handle);
1462 EXPECT_EQ(static_cast<int32_t>(stride.as_uint32_t()), native_handle->stride);
1463 }
1464@@ -327,7 +327,7 @@
1465 {
1466 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
1467
1468- auto native_handle = buffer->get_native_handle();
1469+ auto native_handle = buffer->native_buffer_handle();
1470
1471 ASSERT_NE(nullptr, native_handle);
1472 ASSERT_NE(nullptr, native_handle->common.incRef);
1473@@ -336,19 +336,3 @@
1474 native_handle->common.incRef(NULL);
1475 native_handle->common.decRef(NULL);
1476 }
1477-
1478-TEST_F(ClientAndroidBufferTest, buffer_returns_creation_package)
1479-{
1480- buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
1481-
1482- auto package_return = buffer->get_buffer_package();
1483-
1484- EXPECT_EQ(package->data_items, package_return->data_items);
1485- EXPECT_EQ(package->fd_items, package_return->fd_items);
1486- EXPECT_EQ(package->stride, package_return->stride);
1487- for(auto i=0; i<mir_buffer_package_max; i++)
1488- EXPECT_EQ(package->data[i], package_return->data[i]);
1489- for(auto i=0; i<mir_buffer_package_max; i++)
1490- EXPECT_EQ(package->fd[i], package_return->fd[i]);
1491-}
1492-
1493
1494=== modified file 'tests/unit-tests/client/android/test_client_surface_interpreter.cpp'
1495--- tests/unit-tests/client/android/test_client_surface_interpreter.cpp 2013-04-24 05:22:20 +0000
1496+++ tests/unit-tests/client/android/test_client_surface_interpreter.cpp 2013-05-09 15:25:39 +0000
1497@@ -40,9 +40,12 @@
1498 MockClientBuffer()
1499 {
1500 using namespace testing;
1501- ON_CALL(*this, get_native_handle())
1502- .WillByDefault(Return(&buffer));
1503+ buffer = std::make_shared<ANativeWindowBuffer>();
1504+ ON_CALL(*this, native_buffer_handle())
1505+ .WillByDefault(Return(buffer));
1506 }
1507+ ~MockClientBuffer() noexcept {}
1508+
1509 MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());
1510 MOCK_CONST_METHOD0(size, geom::Size());
1511 MOCK_CONST_METHOD0(stride, geom::Stride());
1512@@ -52,10 +55,9 @@
1513 MOCK_METHOD0(mark_as_submitted, void());
1514 MOCK_METHOD0(increment_age, void());
1515
1516- MOCK_CONST_METHOD0(get_buffer_package, std::shared_ptr<MirBufferPackage>());
1517- MOCK_METHOD0(get_native_handle, ANativeWindowBuffer*());
1518+ MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
1519
1520- ANativeWindowBuffer buffer;
1521+ std::shared_ptr<ANativeWindowBuffer> buffer;
1522 native_handle_t handle;
1523 };
1524
1525@@ -116,21 +118,21 @@
1526 {
1527 using namespace testing;
1528 native_handle_t handle;
1529- ANativeWindowBuffer buffer;
1530- buffer.handle = &handle;
1531+ auto buffer = std::make_shared<ANativeWindowBuffer>();
1532+ buffer->handle = &handle;
1533
1534 testing::NiceMock<MockMirSurface> mock_surface{surf_params};
1535 mcla::ClientSurfaceInterpreter interpreter(mock_surface);
1536
1537- EXPECT_CALL(*mock_client_buffer, get_native_handle())
1538+ EXPECT_CALL(*mock_client_buffer, native_buffer_handle())
1539 .Times(1)
1540- .WillOnce(Return(&buffer));
1541+ .WillOnce(Return(buffer));
1542 EXPECT_CALL(mock_surface, get_current_buffer())
1543 .Times(1)
1544 .WillOnce(Return(mock_client_buffer));
1545
1546 auto returned_buffer = interpreter.driver_requests_buffer();
1547- EXPECT_EQ(&buffer, returned_buffer);
1548+ EXPECT_EQ(buffer.get(), returned_buffer);
1549 }
1550
1551 TEST_F(AndroidInterpreterTest, native_window_queue_advances_buffer)
1552
1553=== modified file 'tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp'
1554--- tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp 2013-04-24 05:22:20 +0000
1555+++ tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp 2013-05-09 15:25:39 +0000
1556@@ -82,7 +82,7 @@
1557
1558 mclg::GBMClientBuffer buffer(drm_fd_handler, std::move(package), size, pf);
1559
1560- auto package_return = buffer.get_buffer_package();
1561+ auto package_return = buffer.native_buffer_handle();
1562 EXPECT_EQ(package_return->data_items, package_copy->data_items);
1563 EXPECT_EQ(package_return->fd_items, package_copy->fd_items);
1564 EXPECT_EQ(package_return->stride, package_copy->stride);
1565
1566=== modified file 'tests/unit-tests/client/test_aging_buffer.cpp'
1567--- tests/unit-tests/client/test_aging_buffer.cpp 2013-04-24 05:22:20 +0000
1568+++ tests/unit-tests/client/test_aging_buffer.cpp 2013-05-09 15:25:39 +0000
1569@@ -51,12 +51,7 @@
1570 exit(1);
1571 }
1572
1573- std::shared_ptr<MirBufferPackage> get_buffer_package() const
1574- {
1575- exit(1);
1576- }
1577-
1578- MirNativeBuffer get_native_handle()
1579+ std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
1580 {
1581 exit(1);
1582 }
1583
1584=== modified file 'tests/unit-tests/client/test_client_buffer_depository.cpp'
1585--- tests/unit-tests/client/test_client_buffer_depository.cpp 2013-04-24 05:22:20 +0000
1586+++ tests/unit-tests/client/test_client_buffer_depository.cpp 2013-05-09 15:25:39 +0000
1587@@ -42,7 +42,7 @@
1588 }
1589
1590 MOCK_METHOD0(Destroy, void());
1591- virtual ~MockBuffer()
1592+ virtual ~MockBuffer() noexcept
1593 {
1594 Destroy();
1595 }
1596@@ -52,8 +52,7 @@
1597 MOCK_CONST_METHOD0(size, geom::Size());
1598 MOCK_CONST_METHOD0(stride, geom::Stride());
1599 MOCK_CONST_METHOD0(pixel_format, geom::PixelFormat());
1600- MOCK_CONST_METHOD0(get_buffer_package, std::shared_ptr<MirBufferPackage>());
1601- MOCK_METHOD0(get_native_handle, MirNativeBuffer());
1602+ MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
1603 };
1604
1605 struct MockClientBufferFactory : public mcl::ClientBufferFactory
1606
1607=== modified file 'tests/unit-tests/client/test_client_mir_surface.cpp'
1608--- tests/unit-tests/client/test_client_mir_surface.cpp 2013-05-01 23:30:06 +0000
1609+++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-05-09 15:25:39 +0000
1610@@ -160,14 +160,11 @@
1611
1612 struct MockBuffer : public mcl::ClientBuffer
1613 {
1614- explicit MockBuffer(std::shared_ptr<MirBufferPackage> const& contents)
1615- {
1616- using namespace testing;
1617-
1618- auto buffer_package = std::make_shared<MirBufferPackage>();
1619- *buffer_package = *contents;
1620- ON_CALL(*this, get_buffer_package())
1621- .WillByDefault(Return(buffer_package));
1622+ MockBuffer()
1623+ {
1624+ }
1625+ ~MockBuffer() noexcept
1626+ {
1627 }
1628
1629 MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());
1630@@ -177,8 +174,7 @@
1631 MOCK_CONST_METHOD0(age, uint32_t());
1632 MOCK_METHOD0(increment_age, void());
1633 MOCK_METHOD0(mark_as_submitted, void());
1634- MOCK_CONST_METHOD0(get_buffer_package, std::shared_ptr<MirBufferPackage>());
1635- MOCK_METHOD0(get_native_handle, MirNativeBuffer());
1636+ MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
1637 };
1638
1639 struct MockClientBufferFactory : public mcl::ClientBufferFactory
1640@@ -187,11 +183,11 @@
1641 {
1642 using namespace testing;
1643
1644- emptybuffer=std::make_shared<NiceMock<MockBuffer>>(std::make_shared<MirBufferPackage>());
1645+ emptybuffer=std::make_shared<NiceMock<MockBuffer>>();
1646
1647 ON_CALL(*this, create_buffer(_,_,_))
1648 .WillByDefault(DoAll(SaveArg<0>(&current_package),
1649- InvokeWithoutArgs([this] () {this->current_buffer = std::make_shared<NiceMock<MockBuffer>>(current_package);}),
1650+ InvokeWithoutArgs([this] () {this->current_buffer = std::make_shared<NiceMock<MockBuffer>>();}),
1651 ReturnPointee(&current_buffer)));
1652 }
1653
1654@@ -204,9 +200,12 @@
1655 std::shared_ptr<mcl::ClientBuffer> emptybuffer;
1656 };
1657
1658-
1659 struct StubClientPlatform : public mcl::ClientPlatform
1660 {
1661+ MirPlatformType platform_type() const
1662+ {
1663+ return mir_platform_type_android;
1664+ }
1665 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
1666 {
1667 return std::shared_ptr<MockClientBufferFactory>();
1668@@ -510,15 +509,13 @@
1669 nullptr);
1670 auto wait_handle = surface->get_create_wait_handle();
1671 wait_handle->wait_for_result();
1672-
1673- EXPECT_THAT(*surface->get_current_buffer_package(), BufferPackageMatches(mock_server_tool->server_package));
1674+ Mock::VerifyAndClearExpectations(mock_buffer_factory.get());
1675
1676 EXPECT_CALL(*mock_buffer_factory, create_buffer(_,_,_))
1677 .Times(1);
1678 auto buffer_wait_handle = surface->next_buffer(&empty_surface_callback, nullptr);
1679 buffer_wait_handle->wait_for_result();
1680-
1681- EXPECT_THAT(*surface->get_current_buffer_package(), BufferPackageMatches(mock_server_tool->server_package));
1682+ Mock::VerifyAndClearExpectations(mock_buffer_factory.get());
1683 }
1684
1685 TEST_F(MirClientSurfaceTest, default_surface_type)
1686@@ -589,14 +586,9 @@
1687 void increment_age() {}
1688 void mark_as_submitted() {}
1689
1690- std::shared_ptr<MirBufferPackage> get_buffer_package() const
1691- {
1692- return std::shared_ptr<MirBufferPackage>();
1693- }
1694-
1695- MirNativeBuffer get_native_handle()
1696- {
1697- return MirNativeBuffer();
1698+ std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
1699+ {
1700+ return std::shared_ptr<MirNativeBuffer>();
1701 }
1702
1703 geom::Size size_;
1704
1705=== modified file 'tests/unit-tests/client/test_client_platform.cpp'
1706--- tests/unit-tests/client/test_client_platform.cpp 2013-04-24 05:22:20 +0000
1707+++ tests/unit-tests/client/test_client_platform.cpp 2013-05-09 15:25:39 +0000
1708@@ -40,6 +40,20 @@
1709 #endif
1710 };
1711
1712+TEST_F(ClientPlatformTest, platform_name)
1713+{
1714+ mtd::MockClientContext context;
1715+ mcl::NativeClientPlatformFactory factory;
1716+ auto platform = factory.create_client_platform(&context);
1717+
1718+#ifdef ANDROID
1719+ auto type = mir_platform_type_android;
1720+#else
1721+ auto type = mir_platform_type_gbm;
1722+#endif
1723+ EXPECT_EQ(type, platform->platform_type());
1724+}
1725+
1726 TEST_F(ClientPlatformTest, platform_creates)
1727 {
1728 mtd::MockClientContext context;
1729
1730=== modified file 'tests/unit-tests/client/test_mir_connection.cpp'
1731--- tests/unit-tests/client/test_mir_connection.cpp 2013-04-25 09:48:54 +0000
1732+++ tests/unit-tests/client/test_mir_connection.cpp 2013-05-09 15:25:39 +0000
1733@@ -80,6 +80,7 @@
1734 .WillByDefault(Return(native_display));
1735 }
1736
1737+ MOCK_CONST_METHOD0(platform_type, MirPlatformType());
1738 MOCK_METHOD0(create_buffer_factory, std::shared_ptr<mcl::ClientBufferFactory>());
1739 MOCK_METHOD1(create_egl_native_window, std::shared_ptr<EGLNativeWindowType>(mcl::ClientSurface*));
1740 MOCK_METHOD0(create_egl_native_display, std::shared_ptr<EGLNativeDisplayType>());
1741
1742=== modified file 'tests/unit-tests/compositor/test_temporary_buffers.cpp'
1743--- tests/unit-tests/compositor/test_temporary_buffers.cpp 2013-04-24 05:22:20 +0000
1744+++ tests/unit-tests/compositor/test_temporary_buffers.cpp 2013-05-09 15:25:39 +0000
1745@@ -166,3 +166,12 @@
1746
1747 proxy_buffer.id();
1748 }
1749+
1750+TEST_F(TemporaryBuffersTest, base_test_native_buffer_handle)
1751+{
1752+ TemporaryTestBuffer proxy_buffer(mock_buffer);
1753+ EXPECT_CALL(*mock_buffer, native_buffer_handle())
1754+ .Times(1);
1755+
1756+ proxy_buffer.native_buffer_handle();
1757+}
1758
1759=== modified file 'tests/unit-tests/graphics/android/test_fb_device.cpp'
1760--- tests/unit-tests/graphics/android/test_fb_device.cpp 2013-04-24 05:22:20 +0000
1761+++ tests/unit-tests/graphics/android/test_fb_device.cpp 2013-05-09 15:25:39 +0000
1762@@ -17,7 +17,7 @@
1763 */
1764
1765 #include "mir_test_doubles/mock_fb_hal_device.h"
1766-#include "mir_test_doubles/mock_android_buffer.h"
1767+#include "mir_test_doubles/mock_buffer.h"
1768 #include "src/server/graphics/android/fb_device.h"
1769 #include "mir_test/hw_mock.h"
1770
1771@@ -42,7 +42,7 @@
1772 format = HAL_PIXEL_FORMAT_RGBA_8888;
1773
1774 fb_hal_mock = std::make_shared<mtd::MockFBHalDevice>(width, height, format, fbnum);
1775- mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();
1776+ mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>();
1777
1778 dummy_buffer = std::make_shared<ANativeWindowBuffer>();
1779 dummy_buffer->handle = (buffer_handle_t) 0x4893;
1780@@ -52,7 +52,7 @@
1781
1782 unsigned int width, height, format, fbnum;
1783 std::shared_ptr<mtd::MockFBHalDevice> fb_hal_mock;
1784- std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer;
1785+ std::shared_ptr<mtd::MockBuffer> mock_buffer;
1786 std::shared_ptr<ANativeWindowBuffer> dummy_buffer;
1787 mt::HardwareAccessMock hw_access_mock;
1788 };
1789
1790=== modified file 'tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp'
1791--- tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp 2013-04-24 05:22:20 +0000
1792+++ tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp 2013-05-09 15:25:39 +0000
1793@@ -17,7 +17,7 @@
1794 */
1795
1796 #include "src/server/graphics/android/fb_simple_swapper.h"
1797-#include "mir_test_doubles/mock_android_buffer.h"
1798+#include "mir_test_doubles/mock_buffer.h"
1799
1800 #include <future>
1801 #include <initializer_list>
1802@@ -34,19 +34,19 @@
1803 public:
1804 virtual void SetUp()
1805 {
1806- buffer1 = std::make_shared<mtd::MockAndroidBuffer>();
1807- buffer2 = std::make_shared<mtd::MockAndroidBuffer>();
1808- buffer3 = std::make_shared<mtd::MockAndroidBuffer>();
1809+ buffer1 = std::make_shared<mtd::MockBuffer>();
1810+ buffer2 = std::make_shared<mtd::MockBuffer>();
1811+ buffer3 = std::make_shared<mtd::MockBuffer>();
1812 }
1813
1814- std::shared_ptr<mga::AndroidBuffer> buffer1;
1815- std::shared_ptr<mga::AndroidBuffer> buffer2;
1816- std::shared_ptr<mga::AndroidBuffer> buffer3;
1817+ std::shared_ptr<mc::Buffer> buffer1;
1818+ std::shared_ptr<mc::Buffer> buffer2;
1819+ std::shared_ptr<mc::Buffer> buffer3;
1820 };
1821
1822 TEST_F(FBSimpleSwapperTest, simple_swaps_returns_valid)
1823 {
1824- std::initializer_list<std::shared_ptr<mga::AndroidBuffer>> double_list{buffer1, buffer2};
1825+ std::initializer_list<std::shared_ptr<mc::Buffer>> double_list{buffer1, buffer2};
1826 mga::FBSimpleSwapper fb_swapper(double_list);
1827
1828 auto test_buffer = fb_swapper.compositor_acquire();
1829@@ -56,7 +56,7 @@
1830
1831 TEST_F(FBSimpleSwapperTest, simple_swaps_return_aba_pattern)
1832 {
1833- std::initializer_list<std::shared_ptr<mga::AndroidBuffer>> double_list{buffer1, buffer2};
1834+ std::initializer_list<std::shared_ptr<mc::Buffer>> double_list{buffer1, buffer2};
1835 mga::FBSimpleSwapper fb_swapper(double_list);
1836
1837 auto test_buffer_1 = fb_swapper.compositor_acquire();
1838@@ -74,7 +74,7 @@
1839
1840 TEST_F(FBSimpleSwapperTest, triple_swaps_return_abcab_pattern)
1841 {
1842- std::initializer_list<std::shared_ptr<mga::AndroidBuffer>> triple_list{buffer1, buffer2, buffer3};
1843+ std::initializer_list<std::shared_ptr<mc::Buffer>> triple_list{buffer1, buffer2, buffer3};
1844 mga::FBSimpleSwapper fb_swapper(triple_list);
1845
1846 auto test_buffer_1 = fb_swapper.compositor_acquire();
1847@@ -103,7 +103,7 @@
1848
1849 TEST_F(FBSimpleSwapperTest, synctest)
1850 {
1851- std::vector<std::shared_ptr<mga::AndroidBuffer>> test_buffers{buffer1, buffer2};
1852+ std::vector<std::shared_ptr<mc::Buffer>> test_buffers{buffer1, buffer2};
1853 mga::FBSimpleSwapper fb_swapper(test_buffers);
1854
1855 std::vector<std::shared_ptr<mc::Buffer>> blist;
1856
1857=== modified file 'tests/unit-tests/graphics/android/test_framebuffer_factory.cpp'
1858--- tests/unit-tests/graphics/android/test_framebuffer_factory.cpp 2013-04-24 05:22:20 +0000
1859+++ tests/unit-tests/graphics/android/test_framebuffer_factory.cpp 2013-05-09 15:25:39 +0000
1860@@ -41,7 +41,7 @@
1861 {
1862 public:
1863 MOCK_METHOD1(alloc_buffer, std::shared_ptr<mc::Buffer>(mc::BufferProperties const&));
1864- MOCK_METHOD3(alloc_buffer_platform, std::shared_ptr<mga::AndroidBuffer>(geom::Size, geom::PixelFormat, mga::BufferUsage));
1865+ MOCK_METHOD3(alloc_buffer_platform, std::shared_ptr<mga::Buffer>(geom::Size, geom::PixelFormat, mga::BufferUsage));
1866 MOCK_METHOD0(supported_pixel_formats, std::vector<geom::PixelFormat>());
1867 };
1868 }
1869@@ -62,7 +62,7 @@
1870 ON_CALL(*mock_display_info_provider, number_of_framebuffers_available())
1871 .WillByDefault(Return(fake_fb_num));
1872 ON_CALL(*mock_buffer_allocator, alloc_buffer_platform(_,_,_))
1873- .WillByDefault(Return(std::shared_ptr<mga::AndroidBuffer>()));
1874+ .WillByDefault(Return(std::shared_ptr<mga::Buffer>()));
1875 }
1876
1877 std::shared_ptr<MockAndroidGraphicBufferAllocator> mock_buffer_allocator;
1878
1879=== modified file 'tests/unit-tests/graphics/android/test_hwc10_device.cpp'
1880--- tests/unit-tests/graphics/android/test_hwc10_device.cpp 2013-04-22 21:33:40 +0000
1881+++ tests/unit-tests/graphics/android/test_hwc10_device.cpp 2013-05-09 15:25:39 +0000
1882@@ -20,9 +20,10 @@
1883 #include "mir_test_doubles/mock_display_support_provider.h"
1884 #include "mir_test_doubles/mock_hwc_composer_device_1.h"
1885 #include "mir_test_doubles/mock_hwc_organizer.h"
1886-#include "mir_test_doubles/mock_android_buffer.h"
1887+#include "mir_test_doubles/mock_buffer.h"
1888 #include <gtest/gtest.h>
1889
1890+namespace mc=mir::compositor;
1891 namespace mga=mir::graphics::android;
1892 namespace mtd=mir::test::doubles;
1893 namespace geom=mir::geometry;
1894@@ -85,7 +86,7 @@
1895
1896 TEST_F(HWC10Device, hwc10_set_next_frontbuffer)
1897 {
1898- std::shared_ptr<mga::AndroidBuffer> mock_buffer = std::make_shared<mtd::MockAndroidBuffer>();
1899+ std::shared_ptr<mc::Buffer> mock_buffer = std::make_shared<mtd::MockBuffer>();
1900 EXPECT_CALL(*mock_fbdev, set_next_frontbuffer(mock_buffer))
1901 .Times(1);
1902
1903
1904=== modified file 'tests/unit-tests/graphics/android/test_hwc11_device.cpp'
1905--- tests/unit-tests/graphics/android/test_hwc11_device.cpp 2013-04-20 00:08:22 +0000
1906+++ tests/unit-tests/graphics/android/test_hwc11_device.cpp 2013-05-09 15:25:39 +0000
1907@@ -21,10 +21,11 @@
1908 #include "mir_test_doubles/mock_display_support_provider.h"
1909 #include "mir_test_doubles/mock_hwc_composer_device_1.h"
1910 #include "mir_test_doubles/mock_hwc_organizer.h"
1911-#include "mir_test_doubles/mock_android_buffer.h"
1912+#include "mir_test_doubles/mock_buffer.h"
1913 #include "mir_test/egl_mock.h"
1914 #include <gtest/gtest.h>
1915
1916+namespace mc=mir::compositor;
1917 namespace mga=mir::graphics::android;
1918 namespace mtd=mir::test::doubles;
1919
1920@@ -223,7 +224,7 @@
1921
1922 TEST_F(HWC11Device, hwc_device_set_next_frontbuffer_adds_to_layerlist)
1923 {
1924- std::shared_ptr<mga::AndroidBuffer> mock_buffer = std::make_shared<mtd::MockAndroidBuffer>();
1925+ std::shared_ptr<mc::Buffer> mock_buffer = std::make_shared<mtd::MockBuffer>();
1926 EXPECT_CALL(*this->mock_organizer, set_fb_target(mock_buffer))
1927 .Times(1);
1928
1929@@ -233,7 +234,7 @@
1930
1931 TEST_F(HWC11Device, hwc_device_set_next_frontbuffer_posts)
1932 {
1933- std::shared_ptr<mga::AndroidBuffer> mock_buffer = std::make_shared<mtd::MockAndroidBuffer>();
1934+ std::shared_ptr<mc::Buffer> mock_buffer = std::make_shared<mtd::MockBuffer>();
1935 EXPECT_CALL(*this->mock_display_support_provider, set_next_frontbuffer(mock_buffer))
1936 .Times(1);
1937
1938
1939=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
1940--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-04-24 05:22:20 +0000
1941+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-05-09 15:25:39 +0000
1942@@ -21,7 +21,7 @@
1943 #include "src/server/graphics/android/hwc_layerlist.h"
1944 #include "mir_test_doubles/mock_hwc_composer_device_1.h"
1945 #include "mir_test_doubles/mock_hwc_organizer.h"
1946-#include "mir_test_doubles/mock_android_buffer.h"
1947+#include "mir_test_doubles/mock_buffer.h"
1948 #include "mir_test_doubles/mock_display_support_provider.h"
1949
1950 #include <thread>
1951
1952=== modified file 'tests/unit-tests/graphics/android/test_hwc_layerlist.cpp'
1953--- tests/unit-tests/graphics/android/test_hwc_layerlist.cpp 2013-04-17 00:22:29 +0000
1954+++ tests/unit-tests/graphics/android/test_hwc_layerlist.cpp 2013-05-09 15:25:39 +0000
1955@@ -17,7 +17,7 @@
1956 */
1957
1958 #include "src/server/graphics/android/hwc_layerlist.h"
1959-#include "mir_test_doubles/mock_android_buffer.h"
1960+#include "mir_test_doubles/mock_buffer.h"
1961 #include "hwc_struct_helper-inl.h"
1962 #include <gtest/gtest.h>
1963
1964@@ -41,7 +41,7 @@
1965 stub_handle_1 = std::make_shared<ANativeWindowBuffer>();
1966 stub_handle_2 = std::make_shared<ANativeWindowBuffer>();
1967
1968- mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();
1969+ mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>();
1970 ON_CALL(*mock_buffer, native_buffer_handle())
1971 .WillByDefault(Return(stub_handle_1));
1972 ON_CALL(*mock_buffer, size())
1973@@ -55,7 +55,7 @@
1974
1975 std::shared_ptr<ANativeWindowBuffer> stub_handle_1;
1976 std::shared_ptr<ANativeWindowBuffer> stub_handle_2;
1977- std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer;
1978+ std::shared_ptr<mtd::MockBuffer> mock_buffer;
1979 };
1980
1981 TEST(HWCLayerDeepCopy, hwc_layer)
1982
1983=== modified file 'tests/unit-tests/graphics/android/test_server_interpreter.cpp'
1984--- tests/unit-tests/graphics/android/test_server_interpreter.cpp 2013-04-24 05:22:20 +0000
1985+++ tests/unit-tests/graphics/android/test_server_interpreter.cpp 2013-05-09 15:25:39 +0000
1986@@ -20,7 +20,7 @@
1987 #include "src/server/graphics/android/fb_swapper.h"
1988
1989 #include "mir_test_doubles/mock_display_support_provider.h"
1990-#include "mir_test_doubles/mock_android_buffer.h"
1991+#include "mir_test_doubles/mock_buffer.h"
1992
1993 #include <gtest/gtest.h>
1994 #include <gmock/gmock.h>
1995@@ -43,17 +43,17 @@
1996 struct MockFBSwapper : public mga::FBSwapper
1997 {
1998 ~MockFBSwapper() noexcept {}
1999- MOCK_METHOD0(compositor_acquire, std::shared_ptr<mga::AndroidBuffer>());
2000- MOCK_METHOD1(compositor_release, void(std::shared_ptr<mga::AndroidBuffer> const& released_buffer));
2001+ MOCK_METHOD0(compositor_acquire, std::shared_ptr<mc::Buffer>());
2002+ MOCK_METHOD1(compositor_release, void(std::shared_ptr<mc::Buffer> const& released_buffer));
2003 };
2004 struct ServerRenderWindowTest : public ::testing::Test
2005 {
2006 virtual void SetUp()
2007 {
2008 using namespace testing;
2009- mock_buffer1 = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();
2010- mock_buffer2 = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();
2011- mock_buffer3 = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();
2012+ mock_buffer1 = std::make_shared<NiceMock<mtd::MockBuffer>>();
2013+ mock_buffer2 = std::make_shared<NiceMock<mtd::MockBuffer>>();
2014+ mock_buffer3 = std::make_shared<NiceMock<mtd::MockBuffer>>();
2015 mock_swapper = std::make_shared<NiceMock<MockFBSwapper>>();
2016 mock_display_poster = std::make_shared<NiceMock<mtd::MockDisplaySupportProvider>>();
2017 ON_CALL(*mock_display_poster, display_format())
2018@@ -61,9 +61,9 @@
2019 stub_sync = std::make_shared<StubFence>();
2020 }
2021
2022- std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer1;
2023- std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer2;
2024- std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer3;
2025+ std::shared_ptr<mtd::MockBuffer> mock_buffer1;
2026+ std::shared_ptr<mtd::MockBuffer> mock_buffer2;
2027+ std::shared_ptr<mtd::MockBuffer> mock_buffer3;
2028 std::shared_ptr<MockFBSwapper> mock_swapper;
2029 std::shared_ptr<mtd::MockDisplaySupportProvider> mock_display_poster;
2030 std::shared_ptr<StubFence> stub_sync;
2031@@ -106,7 +106,7 @@
2032 render_window.driver_requests_buffer();
2033 testing::Mock::VerifyAndClearExpectations(mock_swapper.get());
2034
2035- std::shared_ptr<mga::AndroidBuffer> buf1 = mock_buffer1;
2036+ std::shared_ptr<mc::Buffer> buf1 = mock_buffer1;
2037 EXPECT_CALL(*mock_swapper, compositor_release(buf1))
2038 .Times(1);
2039 EXPECT_CALL(*stub_sync, wait())
2040@@ -147,9 +147,9 @@
2041 auto handle3 = render_window.driver_requests_buffer();
2042 testing::Mock::VerifyAndClearExpectations(mock_swapper.get());
2043
2044- std::shared_ptr<mga::AndroidBuffer> buf1 = mock_buffer1;
2045- std::shared_ptr<mga::AndroidBuffer> buf2 = mock_buffer2;
2046- std::shared_ptr<mga::AndroidBuffer> buf3 = mock_buffer3;
2047+ std::shared_ptr<mc::Buffer> buf1 = mock_buffer1;
2048+ std::shared_ptr<mc::Buffer> buf2 = mock_buffer2;
2049+ std::shared_ptr<mc::Buffer> buf3 = mock_buffer3;
2050 EXPECT_CALL(*mock_swapper, compositor_release(buf1))
2051 .Times(1);
2052 EXPECT_CALL(*mock_swapper, compositor_release(buf2))
2053@@ -183,13 +183,17 @@
2054 using namespace testing;
2055 mga::ServerRenderWindow render_window(mock_swapper, mock_display_poster);
2056
2057+ auto stub_anw = std::make_shared<ANativeWindowBuffer>();
2058 mc::BufferID id{442}, returned_id;
2059 EXPECT_CALL(*mock_swapper, compositor_acquire())
2060 .Times(1)
2061 .WillOnce(Return(mock_buffer1));
2062 EXPECT_CALL(*mock_swapper, compositor_release(_))
2063 .Times(1);
2064- std::shared_ptr<mga::AndroidBuffer> buf1 = mock_buffer1;
2065+ std::shared_ptr<mc::Buffer> buf1 = mock_buffer1;
2066+ EXPECT_CALL(*mock_buffer1, native_buffer_handle())
2067+ .Times(1)
2068+ .WillOnce(Return(stub_anw));
2069 EXPECT_CALL(*mock_display_poster, set_next_frontbuffer(buf1))
2070 .Times(1);
2071

Subscribers

People subscribed via source and target branches