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
=== modified file 'examples/demo_client.c'
--- examples/demo_client.c 2013-05-02 00:11:18 +0000
+++ examples/demo_client.c 2013-05-09 15:25:39 +0000
@@ -40,6 +40,8 @@
40/// \snippet demo_client.c surface_release_tag40/// \snippet demo_client.c surface_release_tag
41///\subsection connection_release We release our connection41///\subsection connection_release We release our connection
42/// \snippet demo_client.c connection_release_tag42/// \snippet demo_client.c connection_release_tag
43///\subsection get the raw, platform-specific buffer handle for the current buffer
44/// \snippet demo_client.c get_current_buffer_tag
43/// \example demo_client.c A simple mir client45/// \example demo_client.c A simple mir client
44///\section MirDemoState MirDemoState46///\section MirDemoState MirDemoState
45/// The handles needs to be accessible both to callbacks and to the control function.47/// The handles needs to be accessible both to callbacks and to the control function.
@@ -156,13 +158,18 @@
156 {158 {
157 // We can query the current graphics buffer attributes159 // We can query the current graphics buffer attributes
158 {160 {
159 MirBufferPackage buffer_package;161 ///\internal [get_current_buffer_tag]
160 buffer_package.data_items = -1;162 MirNativeBuffer* buffer_package = NULL;
161 buffer_package.fd_items = -1;
162 mir_surface_get_current_buffer(mcd.surface, &buffer_package);163 mir_surface_get_current_buffer(mcd.surface, &buffer_package);
163 assert(0 <= buffer_package.data_items);164 assert(buffer_package != NULL);
164 assert(0 <= buffer_package.fd_items);165 if (mir_platform_type_gbm == mir_surface_get_platform_type(mcd.surface))
165166 {
167 // Interpret buffer_package as MirBufferPackage
168 } else if (mir_platform_type_android == mir_surface_get_platform_type(mcd.surface))
169 {
170 // Interpret buffer_package as ANativeWindowBuffer
171 }
172 ///\internal [get_current_buffer_tag]
166 // In a real application we'd render into the current buffer173 // In a real application we'd render into the current buffer
167 }174 }
168175
169176
=== modified file 'include/client/mir_toolkit/mir_client_library.h'
--- include/client/mir_toolkit/mir_client_library.h 2013-05-02 00:11:18 +0000
+++ include/client/mir_toolkit/mir_client_library.h 2013-05-09 15:25:39 +0000
@@ -18,6 +18,7 @@
18#ifndef MIR_CLIENT_LIBRARY_H18#ifndef MIR_CLIENT_LIBRARY_H
19#define MIR_CLIENT_LIBRARY_H19#define MIR_CLIENT_LIBRARY_H
2020
21#include <mir_toolkit/mir_native_buffer.h>
21#include <mir_toolkit/client_types.h>22#include <mir_toolkit/client_types.h>
22#include <mir_toolkit/common.h>23#include <mir_toolkit/common.h>
2324
@@ -176,12 +177,21 @@
176void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters);177void mir_surface_get_parameters(MirSurface *surface, MirSurfaceParameters *parameters);
177178
178/**179/**
180 * Get the underlying platform type so the buffer obtained in "raw" representation
181 * in mir_surface_get_current_buffer() can be understood
182 * \pre The surface is valid
183 * \param [in] surface The surface
184 * \return One of mir_platform_type_android or mir_platform_type_gbm
185 */
186MirPlatformType mir_surface_get_platform_type(MirSurface *surface);
187
188/**
179 * Get a surface's buffer in "raw" representation.189 * Get a surface's buffer in "raw" representation.
180 * \pre The surface is valid190 * \pre The surface is valid
181 * \param [in] surface The surface191 * \param [in] surface The surface
182 * \param [out] buffer_package Structure to be populated192 * \param [out] buffer_package Structure to be populated
183 */193 */
184void mir_surface_get_current_buffer(MirSurface *surface, MirBufferPackage *buffer_package);194void mir_surface_get_current_buffer(MirSurface *surface, MirNativeBuffer **buffer_package);
185195
186/**196/**
187 * Get a surface's graphics_region, i.e., map the graphics buffer to main197 * Get a surface's graphics_region, i.e., map the graphics buffer to main
188198
=== modified file 'include/server/mir/compositor/buffer.h'
--- include/server/mir/compositor/buffer.h 2013-04-24 05:22:20 +0000
+++ include/server/mir/compositor/buffer.h 2013-05-09 15:25:39 +0000
@@ -20,6 +20,7 @@
20#define MIR_COMPOSITOR_BUFFER_H_20#define MIR_COMPOSITOR_BUFFER_H_
2121
22#include "mir/surfaces/graphic_region.h"22#include "mir/surfaces/graphic_region.h"
23#include "mir_toolkit/mir_native_buffer.h"
2324
24#include <memory>25#include <memory>
2526
@@ -36,6 +37,7 @@
36 virtual ~Buffer() {}37 virtual ~Buffer() {}
3738
38 virtual std::shared_ptr<BufferIPCPackage> get_ipc_package() const = 0;39 virtual std::shared_ptr<BufferIPCPackage> get_ipc_package() const = 0;
40 virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const = 0;
39 virtual BufferID id() const = 0;41 virtual BufferID id() const = 0;
4042
41protected:43protected:
4244
=== modified file 'include/shared/mir_toolkit/client_types.h'
--- include/shared/mir_toolkit/client_types.h 2013-05-02 00:11:18 +0000
+++ include/shared/mir_toolkit/client_types.h 2013-05-09 15:25:39 +0000
@@ -118,7 +118,15 @@
118118
119enum { mir_platform_package_max = 32 };119enum { mir_platform_package_max = 32 };
120120
121/** TODO */121/**
122 * The native buffer type for the system the client is connected on
123 */
124typedef enum MirPlatformType
125{
126 mir_platform_type_gbm,
127 mir_platform_type_android
128} MirPlatformType;
129
122typedef struct MirPlatformPackage130typedef struct MirPlatformPackage
123{131{
124 int data_items;132 int data_items;
@@ -128,22 +136,6 @@
128 int fd[mir_platform_package_max];136 int fd[mir_platform_package_max];
129} MirPlatformPackage;137} MirPlatformPackage;
130138
131enum { mir_buffer_package_max = 32 };
132
133/** TODO */
134typedef struct MirBufferPackage
135{
136 int data_items;
137 int fd_items;
138
139 int data[mir_buffer_package_max];
140 int fd[mir_buffer_package_max];
141
142 int stride;
143 int age; /**< Number of frames submitted by the client since the client has rendered to this buffer. */
144 /**< This has the same semantics as the EGL_EXT_buffer_age extension */
145 /**< \see http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt */
146} MirBufferPackage;
147139
148/**140/**
149 * Retrieved information about a MirSurface. This is most useful for learning141 * Retrieved information about a MirSurface. This is most useful for learning
150142
=== modified file 'include/shared/mir_toolkit/mesa/native_display.h'
--- include/shared/mir_toolkit/mesa/native_display.h 2013-05-02 00:11:18 +0000
+++ include/shared/mir_toolkit/mesa/native_display.h 2013-05-09 15:25:39 +0000
@@ -18,6 +18,7 @@
18#ifndef MIR_TOOLKIT_MESA_NATIVE_DISPLAY_H18#ifndef MIR_TOOLKIT_MESA_NATIVE_DISPLAY_H
19#define MIR_TOOLKIT_MESA_NATIVE_DISPLAY_H19#define MIR_TOOLKIT_MESA_NATIVE_DISPLAY_H
2020
21#include "mir_toolkit/mir_native_buffer.h"
21#include "mir_toolkit/client_types.h"22#include "mir_toolkit/client_types.h"
2223
23#ifdef __cplusplus24#ifdef __cplusplus
2425
=== added file 'include/shared/mir_toolkit/mir_native_buffer.h'
--- include/shared/mir_toolkit/mir_native_buffer.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir_toolkit/mir_native_buffer.h 2013-05-09 15:25:39 +0000
@@ -0,0 +1,44 @@
1/*
2 * Copyright © 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Kevin DuBois <kevin.dubois@canonical.com>
18 */
19
20#ifndef MIR_CLIENT_MIR_NATIVE_BUFFER_H_
21#define MIR_CLIENT_MIR_NATIVE_BUFFER_H_
22
23enum { mir_buffer_package_max = 32 };
24typedef struct MirBufferPackage
25{
26 int data_items;
27 int fd_items;
28
29 int data[mir_buffer_package_max];
30 int fd[mir_buffer_package_max];
31
32 int stride;
33 int age; /**< Number of frames submitted by the client since the client has rendered to this buffer. */
34 /**< This has the same semantics as the EGL_EXT_buffer_age extension */
35 /**< \see http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt */
36} MirBufferPackage;
37
38#ifdef ANDROID
39struct ANativeWindowBuffer;
40typedef struct ANativeWindowBuffer MirNativeBuffer;
41#else
42typedef struct MirBufferPackage MirNativeBuffer;
43#endif
44#endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */
045
=== modified file 'include/test/mir_test_doubles/mock_alloc_adaptor.h'
--- include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-04-24 05:22:20 +0000
+++ include/test/mir_test_doubles/mock_alloc_adaptor.h 2013-05-09 15:25:39 +0000
@@ -20,7 +20,6 @@
20#define MIR_TEST_DOUBLES_MOCK_ALLOC_ADAPTOR_H_20#define MIR_TEST_DOUBLES_MOCK_ALLOC_ADAPTOR_H_
2121
22#include "src/server/graphics/android/graphic_alloc_adaptor.h"22#include "src/server/graphics/android/graphic_alloc_adaptor.h"
23#include "src/server/graphics/android/android_buffer.h"
2423
25#include <system/window.h>24#include <system/window.h>
26#include <gmock/gmock.h>25#include <gmock/gmock.h>
2726
=== removed file 'include/test/mir_test_doubles/mock_android_buffer.h'
--- include/test/mir_test_doubles/mock_android_buffer.h 2013-04-24 05:22:20 +0000
+++ include/test/mir_test_doubles/mock_android_buffer.h 1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
1/*
2 * Copyright © 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voss <thomas.voss@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_MOCK_ANDROID_BUFFER_H_
20#define MIR_TEST_DOUBLES_MOCK_ANDROID_BUFFER_H_
21
22#include "src/server/graphics/android/android_buffer.h"
23#include <gmock/gmock.h>
24#include <gtest/gtest.h>
25
26namespace mir
27{
28namespace test
29{
30namespace doubles
31{
32
33struct MockAndroidBuffer : public mir::graphics::android::AndroidBuffer
34{
35 public:
36 MockAndroidBuffer()
37 {
38 using namespace testing;
39 ON_CALL(*this, native_buffer_handle())
40 .WillByDefault(Return(std::make_shared<ANativeWindowBuffer>()));
41 }
42
43 MOCK_CONST_METHOD0(size, geometry::Size());
44 MOCK_CONST_METHOD0(stride, geometry::Stride());
45 MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());
46 MOCK_CONST_METHOD0(get_ipc_package, std::shared_ptr<compositor::BufferIPCPackage>());
47
48 MOCK_METHOD0(bind_to_texture, void());
49 MOCK_CONST_METHOD0(id, compositor::BufferID());
50 MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<ANativeWindowBuffer>());
51};
52
53}
54}
55}
56
57#endif // MIR_TEST_DOUBLES_MOCK_ANDROID_BUFFER_H_
580
=== modified file 'include/test/mir_test_doubles/mock_buffer.h'
--- include/test/mir_test_doubles/mock_buffer.h 2013-04-24 05:22:20 +0000
+++ include/test/mir_test_doubles/mock_buffer.h 2013-05-09 15:25:39 +0000
@@ -59,12 +59,15 @@
59 .WillByDefault(Return(empty_package));59 .WillByDefault(Return(empty_package));
60 ON_CALL(*this, id())60 ON_CALL(*this, id())
61 .WillByDefault(Return(compositor::BufferID{4}));61 .WillByDefault(Return(compositor::BufferID{4}));
62 ON_CALL(*this, native_buffer_handle())
63 .WillByDefault(Return(std::shared_ptr<MirNativeBuffer>()));
62 }64 }
6365
64 MOCK_CONST_METHOD0(size, geometry::Size());66 MOCK_CONST_METHOD0(size, geometry::Size());
65 MOCK_CONST_METHOD0(stride, geometry::Stride());67 MOCK_CONST_METHOD0(stride, geometry::Stride());
66 MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());68 MOCK_CONST_METHOD0(pixel_format, geometry::PixelFormat());
67 MOCK_CONST_METHOD0(get_ipc_package, std::shared_ptr<compositor::BufferIPCPackage>());69 MOCK_CONST_METHOD0(get_ipc_package, std::shared_ptr<compositor::BufferIPCPackage>());
70 MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
6871
69 MOCK_METHOD0(bind_to_texture, void());72 MOCK_METHOD0(bind_to_texture, void());
70 MOCK_CONST_METHOD0(id, compositor::BufferID());73 MOCK_CONST_METHOD0(id, compositor::BufferID());
7174
=== modified file 'include/test/mir_test_doubles/mock_display_support_provider.h'
--- include/test/mir_test_doubles/mock_display_support_provider.h 2013-04-24 05:22:20 +0000
+++ include/test/mir_test_doubles/mock_display_support_provider.h 2013-05-09 15:25:39 +0000
@@ -35,7 +35,7 @@
35 MOCK_CONST_METHOD0(display_size, geometry::Size());35 MOCK_CONST_METHOD0(display_size, geometry::Size());
36 MOCK_CONST_METHOD0(display_format, geometry::PixelFormat());36 MOCK_CONST_METHOD0(display_format, geometry::PixelFormat());
37 MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int());37 MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int());
38 MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::graphics::android::AndroidBuffer> const&));38 MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::compositor::Buffer> const&));
39};39};
40}40}
41}41}
4242
=== modified file 'include/test/mir_test_doubles/mock_hwc_interface.h'
--- include/test/mir_test_doubles/mock_hwc_interface.h 2013-04-24 05:22:20 +0000
+++ include/test/mir_test_doubles/mock_hwc_interface.h 2013-05-09 15:25:39 +0000
@@ -39,7 +39,7 @@
39 MOCK_CONST_METHOD0(display_size, geometry::Size());39 MOCK_CONST_METHOD0(display_size, geometry::Size());
40 MOCK_CONST_METHOD0(display_format, geometry::PixelFormat());40 MOCK_CONST_METHOD0(display_format, geometry::PixelFormat());
41 MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int());41 MOCK_CONST_METHOD0(number_of_framebuffers_available, unsigned int());
42 MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::graphics::android::AndroidBuffer> const&));42 MOCK_METHOD1(set_next_frontbuffer, void(std::shared_ptr<mir::compositor::Buffer> const&));
43};43};
4444
45}45}
4646
=== modified file 'include/test/mir_test_doubles/mock_hwc_organizer.h'
--- include/test/mir_test_doubles/mock_hwc_organizer.h 2013-04-23 15:21:23 +0000
+++ include/test/mir_test_doubles/mock_hwc_organizer.h 2013-05-09 15:25:39 +0000
@@ -34,7 +34,7 @@
34{34{
35 ~MockHWCOrganizer() noexcept {}35 ~MockHWCOrganizer() noexcept {}
36 MOCK_CONST_METHOD0(native_list, graphics::android::LayerList const&());36 MOCK_CONST_METHOD0(native_list, graphics::android::LayerList const&());
37 MOCK_METHOD1(set_fb_target, void(std::shared_ptr<graphics::android::AndroidBuffer> const&));37 MOCK_METHOD1(set_fb_target, void(std::shared_ptr<compositor::Buffer> const&));
38};38};
3939
40}40}
4141
=== modified file 'include/test/mir_test_doubles/stub_buffer.h'
--- include/test/mir_test_doubles/stub_buffer.h 2013-04-24 05:22:20 +0000
+++ include/test/mir_test_doubles/stub_buffer.h 2013-05-09 15:25:39 +0000
@@ -53,8 +53,15 @@
5353
54 virtual geometry::PixelFormat pixel_format() const { return buf_pixel_format; }54 virtual geometry::PixelFormat pixel_format() const { return buf_pixel_format; }
5555
56 virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const { return std::make_shared<compositor::BufferIPCPackage>(); }56 virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const
57 {
58 return std::make_shared<compositor::BufferIPCPackage>();
59 }
5760
61 virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
62 {
63 return std::shared_ptr<MirNativeBuffer>();
64 }
58 virtual void bind_to_texture() {}65 virtual void bind_to_texture() {}
5966
60 geometry::Size const buf_size;67 geometry::Size const buf_size;
6168
=== modified file 'src/client/aging_buffer.h'
--- src/client/aging_buffer.h 2013-04-24 05:22:20 +0000
+++ src/client/aging_buffer.h 2013-05-09 15:25:39 +0000
@@ -30,6 +30,8 @@
30{30{
31public:31public:
32 AgingBuffer();32 AgingBuffer();
33 ~AgingBuffer() noexcept {};
34
33 virtual uint32_t age() const;35 virtual uint32_t age() const;
34 virtual void increment_age();36 virtual void increment_age();
35 virtual void mark_as_submitted();37 virtual void mark_as_submitted();
3638
=== modified file 'src/client/android/android_client_buffer.cpp'
--- src/client/android/android_client_buffer.cpp 2013-04-24 05:22:20 +0000
+++ src/client/android/android_client_buffer.cpp 2013-05-09 15:25:39 +0000
@@ -30,7 +30,8 @@
30 : creation_package(package),30 : creation_package(package),
31 buffer_registrar(registrar),31 buffer_registrar(registrar),
32 rect({{geom::X(0),geom::Y(0)}, size}),32 rect({{geom::X(0),geom::Y(0)}, size}),
33 buffer_pf(pf)33 buffer_pf(pf),
34 native_window_buffer(std::make_shared<ANativeWindowBuffer>())
34{35{
35 creation_package = std::move(package);36 creation_package = std::move(package);
36 native_handle = std::shared_ptr<const native_handle_t> (convert_to_native_handle(creation_package));37 native_handle = std::shared_ptr<const native_handle_t> (convert_to_native_handle(creation_package));
@@ -45,17 +46,17 @@
45}46}
46void mcla::AndroidClientBuffer::pack_native_window_buffer()47void mcla::AndroidClientBuffer::pack_native_window_buffer()
47{48{
48 native_window_buffer.height = static_cast<int32_t>(rect.size.height.as_uint32_t());49 native_window_buffer->height = static_cast<int32_t>(rect.size.height.as_uint32_t());
49 native_window_buffer.width = static_cast<int32_t>(rect.size.width.as_uint32_t());50 native_window_buffer->width = static_cast<int32_t>(rect.size.width.as_uint32_t());
50 native_window_buffer.stride = creation_package->stride;51 native_window_buffer->stride = creation_package->stride;
51 native_window_buffer.usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;52 native_window_buffer->usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;
5253
53 native_window_buffer.handle = native_handle.get();54 native_window_buffer->handle = native_handle.get();
54 native_window_buffer.common.incRef = &incRef;55 native_window_buffer->common.incRef = &incRef;
55 native_window_buffer.common.decRef = &incRef;56 native_window_buffer->common.decRef = &incRef;
56}57}
5758
58mcla::AndroidClientBuffer::~AndroidClientBuffer()59mcla::AndroidClientBuffer::~AndroidClientBuffer() noexcept
59{60{
60 buffer_registrar->unregister_buffer(native_handle.get());61 buffer_registrar->unregister_buffer(native_handle.get());
61}62}
@@ -112,12 +113,7 @@
112 return buffer_pf;113 return buffer_pf;
113}114}
114115
115MirNativeBuffer mcla::AndroidClientBuffer::get_native_handle()116std::shared_ptr<ANativeWindowBuffer> mcla::AndroidClientBuffer::native_buffer_handle() const
116{117{
117 return &native_window_buffer;118 return native_window_buffer;
118}
119
120std::shared_ptr<MirBufferPackage> mcla::AndroidClientBuffer::get_buffer_package() const
121{
122 return creation_package;
123}119}
124120
=== modified file 'src/client/android/android_client_buffer.h'
--- src/client/android/android_client_buffer.h 2013-04-24 05:22:20 +0000
+++ src/client/android/android_client_buffer.h 2013-05-09 15:25:39 +0000
@@ -40,14 +40,13 @@
40 AndroidClientBuffer(std::shared_ptr<AndroidRegistrar> const&,40 AndroidClientBuffer(std::shared_ptr<AndroidRegistrar> const&,
41 std::shared_ptr<MirBufferPackage> const&,41 std::shared_ptr<MirBufferPackage> const&,
42 geometry::Size size, geometry::PixelFormat pf);42 geometry::Size size, geometry::PixelFormat pf);
43 ~AndroidClientBuffer();43 ~AndroidClientBuffer() noexcept;
4444
45 std::shared_ptr<MemoryRegion> secure_for_cpu_write();45 std::shared_ptr<MemoryRegion> secure_for_cpu_write();
46 geometry::Size size() const;46 geometry::Size size() const;
47 geometry::Stride stride() const;47 geometry::Stride stride() const;
48 geometry::PixelFormat pixel_format() const;48 geometry::PixelFormat pixel_format() const;
49 MirNativeBuffer get_native_handle();49 std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const;
50 std::shared_ptr<MirBufferPackage> get_buffer_package() const;
5150
52 AndroidClientBuffer(const AndroidClientBuffer&) = delete;51 AndroidClientBuffer(const AndroidClientBuffer&) = delete;
53 AndroidClientBuffer& operator=(const AndroidClientBuffer&) = delete;52 AndroidClientBuffer& operator=(const AndroidClientBuffer&) = delete;
@@ -62,7 +61,7 @@
62 const geometry::Rectangle rect;61 const geometry::Rectangle rect;
63 const geometry::PixelFormat buffer_pf;62 const geometry::PixelFormat buffer_pf;
6463
65 ANativeWindowBuffer native_window_buffer;64 std::shared_ptr<ANativeWindowBuffer> native_window_buffer;
66};65};
6766
68}67}
6968
=== modified file 'src/client/android/android_client_platform.cpp'
--- src/client/android/android_client_platform.cpp 2013-04-24 05:22:20 +0000
+++ src/client/android/android_client_platform.cpp 2013-05-09 15:25:39 +0000
@@ -102,3 +102,8 @@
102 *native_display = EGL_DEFAULT_DISPLAY;102 *native_display = EGL_DEFAULT_DISPLAY;
103 return native_display;103 return native_display;
104}104}
105
106MirPlatformType mcla::AndroidClientPlatform::platform_type() const
107{
108 return mir_platform_type_android;
109}
105110
=== modified file 'src/client/android/android_client_platform.h'
--- src/client/android/android_client_platform.h 2013-04-24 05:22:20 +0000
+++ src/client/android/android_client_platform.h 2013-05-09 15:25:39 +0000
@@ -32,6 +32,7 @@
32class AndroidClientPlatform : public ClientPlatform32class AndroidClientPlatform : public ClientPlatform
33{33{
34public:34public:
35 MirPlatformType platform_type() const;
35 std::shared_ptr<ClientBufferFactory> create_buffer_factory();36 std::shared_ptr<ClientBufferFactory> create_buffer_factory();
36 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);37 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);
37 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();38 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
3839
=== modified file 'src/client/android/client_surface_interpreter.cpp'
--- src/client/android/client_surface_interpreter.cpp 2013-04-24 05:22:20 +0000
+++ src/client/android/client_surface_interpreter.cpp 2013-05-09 15:25:39 +0000
@@ -29,18 +29,18 @@
29{29{
30}30}
3131
32ANativeWindowBuffer* mcla::ClientSurfaceInterpreter::driver_requests_buffer()32MirNativeBuffer* mcla::ClientSurfaceInterpreter::driver_requests_buffer()
33{33{
34 auto buffer = surface.get_current_buffer();34 auto buffer = surface.get_current_buffer();
35 auto buffer_to_driver = buffer->get_native_handle();35 auto buffer_to_driver = buffer->native_buffer_handle();
36 buffer_to_driver->format = driver_pixel_format;36 buffer_to_driver->format = driver_pixel_format;
3737
38 return buffer_to_driver;38 return buffer_to_driver.get();
39}39}
4040
41static void empty(MirSurface * /*surface*/, void * /*client_context*/)41static void empty(MirSurface * /*surface*/, void * /*client_context*/)
42{}42{}
43void mcla::ClientSurfaceInterpreter::driver_returns_buffer(ANativeWindowBuffer*, std::shared_ptr<mga::SyncObject> const& sync_fence)43void mcla::ClientSurfaceInterpreter::driver_returns_buffer(MirNativeBuffer*, std::shared_ptr<mga::SyncObject> const& sync_fence)
44{44{
45 sync_fence->wait();45 sync_fence->wait();
46 mir_wait_for(surface.next_buffer(empty, NULL));46 mir_wait_for(surface.next_buffer(empty, NULL));
4747
=== modified file 'src/client/android/client_surface_interpreter.h'
--- src/client/android/client_surface_interpreter.h 2013-04-24 05:22:20 +0000
+++ src/client/android/client_surface_interpreter.h 2013-05-09 15:25:39 +0000
@@ -34,8 +34,8 @@
34public:34public:
35 explicit ClientSurfaceInterpreter(ClientSurface& surface);35 explicit ClientSurfaceInterpreter(ClientSurface& surface);
3636
37 ANativeWindowBuffer* driver_requests_buffer();37 MirNativeBuffer* driver_requests_buffer();
38 void driver_returns_buffer(ANativeWindowBuffer*, std::shared_ptr<graphics::android::SyncObject> const&);38 void driver_returns_buffer(MirNativeBuffer*, std::shared_ptr<graphics::android::SyncObject> const&);
39 void dispatch_driver_request_format(int format);39 void dispatch_driver_request_format(int format);
40 int driver_requests_info(int key) const;40 int driver_requests_info(int key) const;
41private:41private:
4242
=== modified file 'src/client/client_buffer.h'
--- src/client/client_buffer.h 2013-04-24 05:22:20 +0000
+++ src/client/client_buffer.h 2013-05-09 15:25:39 +0000
@@ -20,7 +20,8 @@
20#ifndef MIR_CLIENT_CLIENT_BUFFER_H_20#ifndef MIR_CLIENT_CLIENT_BUFFER_H_
21#define MIR_CLIENT_CLIENT_BUFFER_H_21#define MIR_CLIENT_CLIENT_BUFFER_H_
2222
23#include "mir_native_buffer.h"23#include "mir_toolkit/mir_native_buffer.h"
24#include "mir_toolkit/common.h"
24#include "mir/geometry/pixel_format.h"25#include "mir/geometry/pixel_format.h"
25#include "mir/geometry/size.h"26#include "mir/geometry/size.h"
2627
@@ -51,6 +52,7 @@
51class ClientBuffer52class ClientBuffer
52{53{
53public:54public:
55 virtual ~ClientBuffer() = default;
54 virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;56 virtual std::shared_ptr<MemoryRegion> secure_for_cpu_write() = 0;
55 virtual geometry::Size size() const = 0;57 virtual geometry::Size size() const = 0;
56 virtual geometry::Stride stride() const = 0;58 virtual geometry::Stride stride() const = 0;
@@ -58,9 +60,7 @@
58 virtual uint32_t age() const = 0;60 virtual uint32_t age() const = 0;
59 virtual void increment_age() = 0;61 virtual void increment_age() = 0;
60 virtual void mark_as_submitted() = 0;62 virtual void mark_as_submitted() = 0;
6163 virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const = 0;
62 virtual MirNativeBuffer get_native_handle() = 0;
63 virtual std::shared_ptr<MirBufferPackage> get_buffer_package() const = 0;
64};64};
6565
66}66}
6767
=== modified file 'src/client/client_platform.h'
--- src/client/client_platform.h 2013-04-24 05:22:20 +0000
+++ src/client/client_platform.h 2013-05-09 15:25:39 +0000
@@ -18,6 +18,8 @@
18#ifndef MIR_CLIENT_CLIENT_PLATFORM_H_18#ifndef MIR_CLIENT_CLIENT_PLATFORM_H_
19#define MIR_CLIENT_CLIENT_PLATFORM_H_19#define MIR_CLIENT_CLIENT_PLATFORM_H_
2020
21#include "mir_toolkit/client_types.h"
22
21#include <EGL/eglplatform.h>23#include <EGL/eglplatform.h>
22#include <memory>24#include <memory>
2325
@@ -36,6 +38,7 @@
36 ClientPlatform(const ClientPlatform& p) = delete;38 ClientPlatform(const ClientPlatform& p) = delete;
37 ClientPlatform& operator=(const ClientPlatform& p) = delete;39 ClientPlatform& operator=(const ClientPlatform& p) = delete;
3840
41 virtual MirPlatformType platform_type() const = 0;
39 virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0;42 virtual std::shared_ptr<ClientBufferFactory> create_buffer_factory() = 0;
40 virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0;43 virtual std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface) = 0;
41 virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0;44 virtual std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() = 0;
4245
=== modified file 'src/client/gbm/gbm_client_buffer.cpp'
--- src/client/gbm/gbm_client_buffer.cpp 2013-04-24 05:22:20 +0000
+++ src/client/gbm/gbm_client_buffer.cpp 2013-05-09 15:25:39 +0000
@@ -133,7 +133,7 @@
133{133{
134}134}
135135
136mclg::GBMClientBuffer::~GBMClientBuffer()136mclg::GBMClientBuffer::~GBMClientBuffer() noexcept
137{137{
138 // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does,138 // TODO (@raof): Error reporting? It should not be possible for this to fail; if it does,
139 // something's seriously wrong.139 // something's seriously wrong.
@@ -166,13 +166,8 @@
166 return buffer_pf;166 return buffer_pf;
167}167}
168168
169std::shared_ptr<MirBufferPackage> mclg::GBMClientBuffer::get_buffer_package() const169std::shared_ptr<MirNativeBuffer> mclg::GBMClientBuffer::native_buffer_handle() const
170{170{
171 creation_package->age = age();171 creation_package->age = age();
172 return creation_package;172 return creation_package;
173}173}
174
175MirNativeBuffer mclg::GBMClientBuffer::get_native_handle()
176{
177 return NULL;
178}
179174
=== modified file 'src/client/gbm/gbm_client_buffer.h'
--- src/client/gbm/gbm_client_buffer.h 2013-04-24 05:22:20 +0000
+++ src/client/gbm/gbm_client_buffer.h 2013-05-09 15:25:39 +0000
@@ -43,14 +43,13 @@
43 geometry::Size size,43 geometry::Size size,
44 geometry::PixelFormat pf);44 geometry::PixelFormat pf);
4545
46 virtual ~GBMClientBuffer();46 virtual ~GBMClientBuffer() noexcept;
4747
48 std::shared_ptr<MemoryRegion> secure_for_cpu_write();48 std::shared_ptr<MemoryRegion> secure_for_cpu_write();
49 geometry::Size size() const;49 geometry::Size size() const;
50 geometry::Stride stride() const;50 geometry::Stride stride() const;
51 geometry::PixelFormat pixel_format() const;51 geometry::PixelFormat pixel_format() const;
52 std::shared_ptr<MirBufferPackage> get_buffer_package() const;52 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
53 MirNativeBuffer get_native_handle();
5453
55 GBMClientBuffer(const GBMClientBuffer&) = delete;54 GBMClientBuffer(const GBMClientBuffer&) = delete;
56 GBMClientBuffer& operator=(const GBMClientBuffer&) = delete;55 GBMClientBuffer& operator=(const GBMClientBuffer&) = delete;
5756
=== modified file 'src/client/gbm/gbm_client_platform.cpp'
--- src/client/gbm/gbm_client_platform.cpp 2013-04-24 05:22:20 +0000
+++ src/client/gbm/gbm_client_platform.cpp 2013-05-09 15:25:39 +0000
@@ -144,3 +144,8 @@
144144
145 return std::shared_ptr<EGLNativeDisplayType>(egl_native_display, NativeDisplayDeleter(display_container));145 return std::shared_ptr<EGLNativeDisplayType>(egl_native_display, NativeDisplayDeleter(display_container));
146}146}
147
148MirPlatformType mclg::GBMClientPlatform::platform_type() const
149{
150 return mir_platform_type_gbm;
151}
147152
=== modified file 'src/client/gbm/gbm_client_platform.h'
--- src/client/gbm/gbm_client_platform.h 2013-04-24 05:22:20 +0000
+++ src/client/gbm/gbm_client_platform.h 2013-05-09 15:25:39 +0000
@@ -39,6 +39,7 @@
39 std::shared_ptr<DRMFDHandler> const& drm_fd_handler,39 std::shared_ptr<DRMFDHandler> const& drm_fd_handler,
40 EGLNativeDisplayContainer& display_container);40 EGLNativeDisplayContainer& display_container);
4141
42 MirPlatformType platform_type() const;
42 std::shared_ptr<ClientBufferFactory> create_buffer_factory();43 std::shared_ptr<ClientBufferFactory> create_buffer_factory();
43 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);44 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(ClientSurface *surface);
44 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();45 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display();
4546
=== modified file 'src/client/gbm/mesa_native_display_container.cpp'
--- src/client/gbm/mesa_native_display_container.cpp 2013-04-24 05:22:20 +0000
+++ src/client/gbm/mesa_native_display_container.cpp 2013-05-09 15:25:39 +0000
@@ -21,6 +21,7 @@
21#include "mir_toolkit/mesa/native_display.h"21#include "mir_toolkit/mesa/native_display.h"
22#include "mir_toolkit/mir_client_library.h"22#include "mir_toolkit/mir_client_library.h"
2323
24#include <cstring>
24#include <unordered_set>25#include <unordered_set>
25#include <mutex>26#include <mutex>
2627
@@ -45,7 +46,9 @@
45 MirBufferPackage* buffer_package)46 MirBufferPackage* buffer_package)
46{47{
47 MirSurface* ms = static_cast<MirSurface*>(surface);48 MirSurface* ms = static_cast<MirSurface*>(surface);
48 mir_surface_get_current_buffer(ms, buffer_package);49 MirBufferPackage * current_package;
50 mir_surface_get_current_buffer(ms, &current_package);
51 memcpy(buffer_package, current_package, sizeof(MirBufferPackage));
49}52}
5053
51static void buffer_advanced_callback(MirSurface* /* surface */,54static void buffer_advanced_callback(MirSurface* /* surface */,
5255
=== modified file 'src/client/mir_client_library.cpp'
--- src/client/mir_client_library.cpp 2013-05-02 00:11:18 +0000
+++ src/client/mir_client_library.cpp 2013-05-09 15:25:39 +0000
@@ -183,19 +183,15 @@
183 *parameters = surface->get_parameters();183 *parameters = surface->get_parameters();
184}184}
185185
186void mir_surface_get_current_buffer(MirSurface *surface, MirBufferPackage * buffer_package_out)186MirPlatformType mir_surface_get_platform_type(MirSurface * surface)
187{
188 return surface->platform_type();
189}
190
191void mir_surface_get_current_buffer(MirSurface * surface, MirNativeBuffer ** buffer_package_out)
187{192{
188 auto package = surface->get_current_buffer_package();193 auto package = surface->get_current_buffer_package();
189194 *buffer_package_out = package.get();
190 buffer_package_out->data_items = package->data_items;
191 buffer_package_out->fd_items = package->fd_items;
192 for(auto i=0; i<mir_buffer_package_max; i++)
193 {
194 buffer_package_out->data[i] = package->data[i];
195 buffer_package_out->fd[i] = package->fd[i];
196 }
197
198 buffer_package_out->stride = package->stride;
199}195}
200196
201void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package)197void mir_connection_get_platform(MirConnection *connection, MirPlatformPackage *platform_package)
202198
=== removed file 'src/client/mir_native_buffer.h'
--- src/client/mir_native_buffer.h 2013-04-24 05:22:20 +0000
+++ src/client/mir_native_buffer.h 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
1/*
2 * Copyright © 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Kevin DuBois <kevin.dubois@canonical.com>
18 */
19
20#ifndef MIR_CLIENT_MIR_NATIVE_BUFFER_H_
21#define MIR_CLIENT_MIR_NATIVE_BUFFER_H_
22
23#ifdef ANDROID
24struct ANativeWindowBuffer;
25typedef ANativeWindowBuffer* MirNativeBuffer;
26#else
27typedef void* MirNativeBuffer;
28#endif
29
30#endif /* MIR_CLIENT_MIR_NATIVE_BUFFER_H_ */
310
=== modified file 'src/client/mir_surface.cpp'
--- src/client/mir_surface.cpp 2013-05-01 23:30:06 +0000
+++ src/client/mir_surface.cpp 2013-05-09 15:25:39 +0000
@@ -195,10 +195,10 @@
195 return connection->release_surface(this, callback, context);195 return connection->release_surface(this, callback, context);
196}196}
197197
198std::shared_ptr<MirBufferPackage> MirSurface::get_current_buffer_package()198std::shared_ptr<MirNativeBuffer> MirSurface::get_current_buffer_package()
199{199{
200 auto buffer = buffer_depository->current_buffer();200 auto buffer = get_current_buffer();
201 return buffer->get_buffer_package();201 return buffer->native_buffer_handle();
202}202}
203203
204std::shared_ptr<mcl::ClientBuffer> MirSurface::get_current_buffer()204std::shared_ptr<mcl::ClientBuffer> MirSurface::get_current_buffer()
@@ -321,3 +321,9 @@
321 if (handle_event_callback)321 if (handle_event_callback)
322 handle_event_callback(&e);322 handle_event_callback(&e);
323}323}
324
325MirPlatformType MirSurface::platform_type()
326{
327 auto platform = connection->get_client_platform();
328 return platform->platform_type();
329}
324330
=== modified file 'src/client/mir_surface.h'
--- src/client/mir_surface.h 2013-04-24 05:22:20 +0000
+++ src/client/mir_surface.h 2013-05-09 15:25:39 +0000
@@ -24,6 +24,7 @@
24#include "mir/geometry/dimensions.h"24#include "mir/geometry/dimensions.h"
25#include "mir_toolkit/mir_client_library.h"25#include "mir_toolkit/mir_client_library.h"
26#include "mir_toolkit/common.h"26#include "mir_toolkit/common.h"
27#include "mir_toolkit/mir_native_buffer.h"
27#include "client_buffer_depository.h"28#include "client_buffer_depository.h"
28#include "mir_wait_handle.h"29#include "mir_wait_handle.h"
29#include "mir_client_surface.h"30#include "mir_client_surface.h"
@@ -75,7 +76,8 @@
75 MirWaitHandle* next_buffer(mir_surface_lifecycle_callback callback, void * context);76 MirWaitHandle* next_buffer(mir_surface_lifecycle_callback callback, void * context);
76 MirWaitHandle* get_create_wait_handle();77 MirWaitHandle* get_create_wait_handle();
7778
78 std::shared_ptr<MirBufferPackage> get_current_buffer_package();79 std::shared_ptr<MirNativeBuffer> get_current_buffer_package();
80 MirPlatformType platform_type();
79 std::shared_ptr<mir::client::ClientBuffer> get_current_buffer();81 std::shared_ptr<mir::client::ClientBuffer> get_current_buffer();
80 void get_cpu_region(MirGraphicsRegion& region);82 void get_cpu_region(MirGraphicsRegion& region);
81 void release_cpu_region();83 void release_cpu_region();
8284
=== modified file 'src/server/compositor/temporary_buffers.cpp'
--- src/server/compositor/temporary_buffers.cpp 2013-04-24 05:22:20 +0000
+++ src/server/compositor/temporary_buffers.cpp 2013-05-09 15:25:39 +0000
@@ -81,3 +81,7 @@
81 return buffer->get_ipc_package();81 return buffer->get_ipc_package();
82}82}
8383
84std::shared_ptr<MirNativeBuffer> mc::TemporaryBuffer::native_buffer_handle() const
85{
86 return buffer->native_buffer_handle();
87}
8488
=== modified file 'src/server/compositor/temporary_buffers.h'
--- src/server/compositor/temporary_buffers.h 2013-04-24 05:22:20 +0000
+++ src/server/compositor/temporary_buffers.h 2013-05-09 15:25:39 +0000
@@ -39,6 +39,7 @@
39 BufferID id() const;39 BufferID id() const;
40 void bind_to_texture();40 void bind_to_texture();
41 std::shared_ptr<BufferIPCPackage> get_ipc_package() const;41 std::shared_ptr<BufferIPCPackage> get_ipc_package() const;
42 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
4243
43protected:44protected:
44 explicit TemporaryBuffer(std::shared_ptr<Buffer> const& real_buffer);45 explicit TemporaryBuffer(std::shared_ptr<Buffer> const& real_buffer);
4546
=== removed file 'src/server/graphics/android/android_buffer.h'
--- src/server/graphics/android/android_buffer.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/android_buffer.h 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
1/*
2 * Copyright © 2012,2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Kevin DuBois <kevin.dubois@canonical.com>
18 */
19
20#ifndef MIR_GRAPHICS_ANDROID_ANDROID_BUFFER_H_
21#define MIR_GRAPHICS_ANDROID_ANDROID_BUFFER_H_
22
23#include "mir/compositor/buffer_basic.h"
24
25#include <system/window.h>
26#include <memory>
27
28namespace mir
29{
30namespace graphics
31{
32namespace android
33{
34
35class AndroidBuffer : public compositor::BufferBasic
36{
37public:
38 virtual ~AndroidBuffer() = default;
39 virtual std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const = 0;
40protected:
41 AndroidBuffer() = default;
42 AndroidBuffer(AndroidBuffer const&) = delete;
43 AndroidBuffer& operator=(AndroidBuffer const&) = delete;
44
45};
46
47}
48}
49}
50
51#endif /* MIR_GRAPHICS_ANDROID_ANDROID_BUFFER_H_ */
520
=== modified file 'src/server/graphics/android/android_buffer_allocator.cpp'
--- src/server/graphics/android/android_buffer_allocator.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/android_buffer_allocator.cpp 2013-05-09 15:25:39 +0000
@@ -75,7 +75,7 @@
75 return alloc_buffer_platform(buffer_properties.size, buffer_properties.format, usage);75 return alloc_buffer_platform(buffer_properties.size, buffer_properties.format, usage);
76}76}
7777
78std::shared_ptr<mga::AndroidBuffer> mga::AndroidGraphicBufferAllocator::alloc_buffer_platform(78std::shared_ptr<mga::Buffer> mga::AndroidGraphicBufferAllocator::alloc_buffer_platform(
79 geom::Size sz, geom::PixelFormat pf, mga::BufferUsage use)79 geom::Size sz, geom::PixelFormat pf, mga::BufferUsage use)
80{80{
81 auto buffer = std::make_shared<Buffer>(alloc_device, sz, pf, use);81 auto buffer = std::make_shared<Buffer>(alloc_device, sz, pf, use);
8282
=== modified file 'src/server/graphics/android/android_graphic_buffer_allocator.h'
--- src/server/graphics/android/android_graphic_buffer_allocator.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/android_graphic_buffer_allocator.h 2013-05-09 15:25:39 +0000
@@ -46,7 +46,7 @@
46 std::shared_ptr<compositor::Buffer> alloc_buffer(46 std::shared_ptr<compositor::Buffer> alloc_buffer(
47 compositor::BufferProperties const& buffer_properties);47 compositor::BufferProperties const& buffer_properties);
4848
49 std::shared_ptr<AndroidBuffer> alloc_buffer_platform(49 std::shared_ptr<Buffer> alloc_buffer_platform(
50 geometry::Size sz, geometry::PixelFormat pf, BufferUsage use);50 geometry::Size sz, geometry::PixelFormat pf, BufferUsage use);
5151
52 std::vector<geometry::PixelFormat> supported_pixel_formats();52 std::vector<geometry::PixelFormat> supported_pixel_formats();
5353
=== modified file 'src/server/graphics/android/buffer.h'
--- src/server/graphics/android/buffer.h 2013-04-16 20:55:50 +0000
+++ src/server/graphics/android/buffer.h 2013-05-09 15:25:39 +0000
@@ -20,7 +20,7 @@
20#ifndef MIR_GRAPHICS_ANDROID_BUFFER_H_20#ifndef MIR_GRAPHICS_ANDROID_BUFFER_H_
21#define MIR_GRAPHICS_ANDROID_BUFFER_H_21#define MIR_GRAPHICS_ANDROID_BUFFER_H_
2222
23#include "android_buffer.h"23#include "mir/compositor/buffer_basic.h"
24#include "android_buffer_handle.h"24#include "android_buffer_handle.h"
2525
26#include <map>26#include <map>
@@ -38,22 +38,20 @@
38{38{
3939
40class GraphicAllocAdaptor;40class GraphicAllocAdaptor;
41class Buffer: public AndroidBuffer 41class Buffer: public compositor::BufferBasic
42{42{
43public:43public:
44 Buffer(const std::shared_ptr<GraphicAllocAdaptor>& device,44 Buffer(const std::shared_ptr<GraphicAllocAdaptor>& device,
45 geometry::Size size, geometry::PixelFormat pf, BufferUsage use);45 geometry::Size size, geometry::PixelFormat pf, BufferUsage use);
46 ~Buffer();46 ~Buffer();
4747
48 /* from BufferBasic */
49 geometry::Size size() const;48 geometry::Size size() const;
50 geometry::Stride stride() const;49 geometry::Stride stride() const;
51 geometry::PixelFormat pixel_format() const;50 geometry::PixelFormat pixel_format() const;
51 void bind_to_texture();
52 std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const;52 std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const;
53 void bind_to_texture();
54
55 /* android-specific */
56 std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const;53 std::shared_ptr<ANativeWindowBuffer> native_buffer_handle() const;
54
57private:55private:
58 std::shared_ptr<GraphicAllocAdaptor> const alloc_device;56 std::shared_ptr<GraphicAllocAdaptor> const alloc_device;
5957
6058
=== modified file 'src/server/graphics/android/default_framebuffer_factory.cpp'
--- src/server/graphics/android/default_framebuffer_factory.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/default_framebuffer_factory.cpp 2013-05-09 15:25:39 +0000
@@ -18,11 +18,12 @@
18 */18 */
1919
20#include "mir/graphics/android/mir_native_window.h"20#include "mir/graphics/android/mir_native_window.h"
21#include "buffer.h"
21#include "default_framebuffer_factory.h"22#include "default_framebuffer_factory.h"
22#include "fb_device.h"23#include "fb_device.h"
24#include "fb_simple_swapper.h"
23#include "graphic_buffer_allocator.h"25#include "graphic_buffer_allocator.h"
24#include "server_render_window.h"26#include "server_render_window.h"
25#include "fb_simple_swapper.h"
2627
27#include <boost/throw_exception.hpp>28#include <boost/throw_exception.hpp>
28#include <stdexcept>29#include <stdexcept>
@@ -43,7 +44,7 @@
43 auto size = info_provider->display_size();44 auto size = info_provider->display_size();
44 auto pf = info_provider->display_format();45 auto pf = info_provider->display_format();
45 auto num_framebuffers = info_provider->number_of_framebuffers_available(); 46 auto num_framebuffers = info_provider->number_of_framebuffers_available();
46 std::vector<std::shared_ptr<mga::AndroidBuffer>> buffers; 47 std::vector<std::shared_ptr<mc::Buffer>> buffers;
47 for( auto i = 0u; i < num_framebuffers; ++i)48 for( auto i = 0u; i < num_framebuffers; ++i)
48 {49 {
49 buffers.push_back(buffer_allocator->alloc_buffer_platform(size, pf, mga::BufferUsage::use_framebuffer_gles));50 buffers.push_back(buffer_allocator->alloc_buffer_platform(size, pf, mga::BufferUsage::use_framebuffer_gles));
5051
=== modified file 'src/server/graphics/android/display_support_provider.h'
--- src/server/graphics/android/display_support_provider.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/display_support_provider.h 2013-05-09 15:25:39 +0000
@@ -25,12 +25,15 @@
2525
26namespace mir26namespace mir
27{27{
28namespace compositor
29{
30class Buffer;
31}
28namespace graphics32namespace graphics
29{33{
30namespace android34namespace android
31{35{
3236
33class AndroidBuffer;
34class DisplaySupportProvider37class DisplaySupportProvider
35{38{
36public:39public:
@@ -41,7 +44,7 @@
41 virtual unsigned int number_of_framebuffers_available() const = 0;44 virtual unsigned int number_of_framebuffers_available() const = 0;
42 //this function schedules the next frontbuffer to be "buffer" parameter. depending on implementation, it may45 //this function schedules the next frontbuffer to be "buffer" parameter. depending on implementation, it may
43 //post immediately, or be deferred.46 //post immediately, or be deferred.
44 virtual void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer) = 0;47 virtual void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer) = 0;
4548
46protected:49protected:
47 DisplaySupportProvider() = default;50 DisplaySupportProvider() = default;
4851
=== modified file 'src/server/graphics/android/fb_device.cpp'
--- src/server/graphics/android/fb_device.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/fb_device.cpp 2013-05-09 15:25:39 +0000
@@ -19,13 +19,14 @@
19#include "mir/compositor/buffer.h"19#include "mir/compositor/buffer.h"
2020
21#include "fb_device.h"21#include "fb_device.h"
22#include "android_buffer.h"22#include "buffer.h"
23#include "android_format_conversion-inl.h"23#include "android_format_conversion-inl.h"
2424
25#include <algorithm>25#include <algorithm>
26#include <boost/throw_exception.hpp>26#include <boost/throw_exception.hpp>
27#include <stdexcept>27#include <stdexcept>
2828
29namespace mc=mir::compositor;
29namespace mga=mir::graphics::android;30namespace mga=mir::graphics::android;
30namespace geom=mir::geometry;31namespace geom=mir::geometry;
31 32
@@ -34,7 +35,7 @@
34{35{
35}36}
3637
37void mga::FBDevice::set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer)38void mga::FBDevice::set_next_frontbuffer(std::shared_ptr<mc::Buffer> const& buffer)
38{39{
39 auto handle = buffer->native_buffer_handle();40 auto handle = buffer->native_buffer_handle();
40 if (fb_device->post(fb_device.get(), handle->handle) != 0)41 if (fb_device->post(fb_device.get(), handle->handle) != 0)
4142
=== modified file 'src/server/graphics/android/fb_device.h'
--- src/server/graphics/android/fb_device.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/fb_device.h 2013-05-09 15:25:39 +0000
@@ -39,7 +39,7 @@
39 geometry::PixelFormat display_format() const; 39 geometry::PixelFormat display_format() const;
40 unsigned int number_of_framebuffers_available() const;40 unsigned int number_of_framebuffers_available() const;
4141
42 void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer);42 void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer);
43private:43private:
44 std::shared_ptr<framebuffer_device_t> const fb_device;44 std::shared_ptr<framebuffer_device_t> const fb_device;
45};45};
4646
=== modified file 'src/server/graphics/android/fb_simple_swapper.cpp'
--- src/server/graphics/android/fb_simple_swapper.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/fb_simple_swapper.cpp 2013-05-09 15:25:39 +0000
@@ -22,9 +22,10 @@
22#include <boost/throw_exception.hpp>22#include <boost/throw_exception.hpp>
23#include <stdexcept>23#include <stdexcept>
2424
25namespace mc=mir::compositor;
25namespace mga=mir::graphics::android;26namespace mga=mir::graphics::android;
2627
27std::shared_ptr<mga::AndroidBuffer> mga::FBSimpleSwapper::compositor_acquire()28std::shared_ptr<mc::Buffer> mga::FBSimpleSwapper::compositor_acquire()
28{29{
29 std::unique_lock<std::mutex> lk(queue_lock);30 std::unique_lock<std::mutex> lk(queue_lock);
30 while (queue.empty())31 while (queue.empty())
@@ -37,7 +38,7 @@
37 return buffer;38 return buffer;
38}39}
3940
40void mga::FBSimpleSwapper::compositor_release(std::shared_ptr<mga::AndroidBuffer> const& released_buffer)41void mga::FBSimpleSwapper::compositor_release(std::shared_ptr<mc::Buffer> const& released_buffer)
41{42{
42 std::unique_lock<std::mutex> lk(queue_lock);43 std::unique_lock<std::mutex> lk(queue_lock);
4344
4445
=== modified file 'src/server/graphics/android/fb_simple_swapper.h'
--- src/server/graphics/android/fb_simple_swapper.h 2013-04-16 21:19:35 +0000
+++ src/server/graphics/android/fb_simple_swapper.h 2013-05-09 15:25:39 +0000
@@ -37,8 +37,8 @@
37class FBSimpleSwapper : public FBSwapper37class FBSimpleSwapper : public FBSwapper
38{38{
39public:39public:
40 template<typename AndroidBufferPtrContainer>40 template<typename BufferPtrContainer>
41 explicit FBSimpleSwapper(AndroidBufferPtrContainer const& buffer_list)41 explicit FBSimpleSwapper(BufferPtrContainer const& buffer_list)
42 {42 {
43 for (auto& buffer : buffer_list)43 for (auto& buffer : buffer_list)
44 {44 {
@@ -46,14 +46,14 @@
46 }46 }
47 }47 }
4848
49 std::shared_ptr<AndroidBuffer> compositor_acquire();49 std::shared_ptr<compositor::Buffer> compositor_acquire();
50 void compositor_release(std::shared_ptr<AndroidBuffer> const& released_buffer);50 void compositor_release(std::shared_ptr<compositor::Buffer> const& released_buffer);
5151
52private:52private:
53 std::mutex queue_lock;53 std::mutex queue_lock;
54 std::condition_variable cv;54 std::condition_variable cv;
5555
56 std::queue<std::shared_ptr<AndroidBuffer>> queue;56 std::queue<std::shared_ptr<compositor::Buffer>> queue;
57};57};
5858
59}59}
6060
=== modified file 'src/server/graphics/android/fb_swapper.h'
--- src/server/graphics/android/fb_swapper.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/fb_swapper.h 2013-05-09 15:25:39 +0000
@@ -24,20 +24,24 @@
2424
25namespace mir25namespace mir
26{26{
27namespace compositor
28{
29class Buffer;
30}
27namespace graphics31namespace graphics
28{32{
29namespace android33namespace android
30{34{
3135
32class AndroidBuffer;36class Buffer;
3337
34class FBSwapper // (todo: for composition bypass, inherit from mc::BufferSwapper)38//TODO: remove this interface. FBSimpleSwapper should inherit from mc::BufferSwapper
35{39class FBSwapper{
36public:40public:
37 virtual ~FBSwapper() = default;41 virtual ~FBSwapper() = default;
3842
39 virtual std::shared_ptr<AndroidBuffer> compositor_acquire() = 0;43 virtual std::shared_ptr<compositor::Buffer> compositor_acquire() = 0;
40 virtual void compositor_release(std::shared_ptr<AndroidBuffer> const& released_buffer) = 0;44 virtual void compositor_release(std::shared_ptr<compositor::Buffer> const& released_buffer) = 0;
41protected:45protected:
42 FBSwapper() = default;46 FBSwapper() = default;
43 FBSwapper(FBSwapper const&) = delete;47 FBSwapper(FBSwapper const&) = delete;
4448
=== modified file 'src/server/graphics/android/graphic_buffer_allocator.h'
--- src/server/graphics/android/graphic_buffer_allocator.h 2013-04-16 20:55:50 +0000
+++ src/server/graphics/android/graphic_buffer_allocator.h 2013-05-09 15:25:39 +0000
@@ -29,8 +29,8 @@
29{29{
30namespace android30namespace android
31{31{
32class Buffer;
3233
33class AndroidBuffer;
34class GraphicBufferAllocator: public compositor::GraphicBufferAllocator34class GraphicBufferAllocator: public compositor::GraphicBufferAllocator
35{35{
36public:36public:
@@ -39,7 +39,7 @@
3939
40 virtual std::shared_ptr<compositor::Buffer> alloc_buffer(40 virtual std::shared_ptr<compositor::Buffer> alloc_buffer(
41 compositor::BufferProperties const& buffer_properties) = 0;41 compositor::BufferProperties const& buffer_properties) = 0;
42 virtual std::shared_ptr<AndroidBuffer> alloc_buffer_platform(42 virtual std::shared_ptr<Buffer> alloc_buffer_platform(
43 geometry::Size sz, geometry::PixelFormat pf, BufferUsage use) = 0;43 geometry::Size sz, geometry::PixelFormat pf, BufferUsage use) = 0;
44 virtual std::vector<geometry::PixelFormat> supported_pixel_formats() = 0;44 virtual std::vector<geometry::PixelFormat> supported_pixel_formats() = 0;
4545
4646
=== modified file 'src/server/graphics/android/hwc10_device.cpp'
--- src/server/graphics/android/hwc10_device.cpp 2013-04-23 15:21:23 +0000
+++ src/server/graphics/android/hwc10_device.cpp 2013-05-09 15:25:39 +0000
@@ -22,6 +22,7 @@
22#include <boost/throw_exception.hpp>22#include <boost/throw_exception.hpp>
23#include <stdexcept>23#include <stdexcept>
2424
25namespace mc=mir::compositor;
25namespace mga=mir::graphics::android;26namespace mga=mir::graphics::android;
26namespace geom=mir::geometry;27namespace geom=mir::geometry;
2728
@@ -51,7 +52,7 @@
51 return fb_device->number_of_framebuffers_available();52 return fb_device->number_of_framebuffers_available();
52}53}
5354
54void mga::HWC10Device::set_next_frontbuffer(std::shared_ptr<mga::AndroidBuffer> const& buffer)55void mga::HWC10Device::set_next_frontbuffer(std::shared_ptr<mc::Buffer> const& buffer)
55{56{
56 fb_device->set_next_frontbuffer(buffer);57 fb_device->set_next_frontbuffer(buffer);
57}58}
5859
=== modified file 'src/server/graphics/android/hwc10_device.h'
--- src/server/graphics/android/hwc10_device.h 2013-04-23 15:21:23 +0000
+++ src/server/graphics/android/hwc10_device.h 2013-05-09 15:25:39 +0000
@@ -39,7 +39,7 @@
39 geometry::Size display_size() const; 39 geometry::Size display_size() const;
40 geometry::PixelFormat display_format() const;40 geometry::PixelFormat display_format() const;
41 unsigned int number_of_framebuffers_available() const;41 unsigned int number_of_framebuffers_available() const;
42 void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer);42 void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer);
43 43
44 void commit_frame(EGLDisplay dpy, EGLSurface sur);44 void commit_frame(EGLDisplay dpy, EGLSurface sur);
45private:45private:
4646
=== modified file 'src/server/graphics/android/hwc11_device.cpp'
--- src/server/graphics/android/hwc11_device.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/hwc11_device.cpp 2013-05-09 15:25:39 +0000
@@ -22,6 +22,7 @@
22#include <boost/throw_exception.hpp>22#include <boost/throw_exception.hpp>
23#include <stdexcept>23#include <stdexcept>
2424
25namespace mc=mir::compositor;
25namespace mga=mir::graphics::android;26namespace mga=mir::graphics::android;
26namespace geom=mir::geometry;27namespace geom=mir::geometry;
2728
@@ -71,7 +72,7 @@
71 return 2u;72 return 2u;
72}73}
73 74
74void mga::HWC11Device::set_next_frontbuffer(std::shared_ptr<mga::AndroidBuffer> const& buffer)75void mga::HWC11Device::set_next_frontbuffer(std::shared_ptr<mc::Buffer> const& buffer)
75{76{
76 layer_organizer->set_fb_target(buffer);77 layer_organizer->set_fb_target(buffer);
77 fb_device->set_next_frontbuffer(buffer);78 fb_device->set_next_frontbuffer(buffer);
7879
=== modified file 'src/server/graphics/android/hwc11_device.h'
--- src/server/graphics/android/hwc11_device.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/hwc11_device.h 2013-05-09 15:25:39 +0000
@@ -41,7 +41,7 @@
41 geometry::Size display_size() const; 41 geometry::Size display_size() const;
42 geometry::PixelFormat display_format() const;42 geometry::PixelFormat display_format() const;
43 unsigned int number_of_framebuffers_available() const;43 unsigned int number_of_framebuffers_available() const;
44 void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer);44 void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer);
45 45
46 void commit_frame(EGLDisplay dpy, EGLSurface sur);46 void commit_frame(EGLDisplay dpy, EGLSurface sur);
4747
4848
=== modified file 'src/server/graphics/android/hwc_common_device.h'
--- src/server/graphics/android/hwc_common_device.h 2013-04-23 15:21:23 +0000
+++ src/server/graphics/android/hwc_common_device.h 2013-05-09 15:25:39 +0000
@@ -49,7 +49,7 @@
49 void wait_for_vsync();49 void wait_for_vsync();
5050
51 virtual geometry::Size display_size() const = 0;51 virtual geometry::Size display_size() const = 0;
52 virtual void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer) = 0;52 virtual void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer) = 0;
53 virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;53 virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;
5454
55 void notify_vsync();55 void notify_vsync();
5656
=== modified file 'src/server/graphics/android/hwc_device.h'
--- src/server/graphics/android/hwc_device.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/hwc_device.h 2013-05-09 15:25:39 +0000
@@ -39,7 +39,7 @@
39 virtual geometry::Size display_size() const = 0; 39 virtual geometry::Size display_size() const = 0;
40 virtual geometry::PixelFormat display_format() const = 0; 40 virtual geometry::PixelFormat display_format() const = 0;
41 virtual unsigned int number_of_framebuffers_available() const = 0;41 virtual unsigned int number_of_framebuffers_available() const = 0;
42 virtual void set_next_frontbuffer(std::shared_ptr<AndroidBuffer> const& buffer) = 0;42 virtual void set_next_frontbuffer(std::shared_ptr<compositor::Buffer> const& buffer) = 0;
4343
44 virtual void wait_for_vsync() = 0;44 virtual void wait_for_vsync() = 0;
45 virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;45 virtual void commit_frame(EGLDisplay dpy, EGLSurface sur) = 0;
4646
=== modified file 'src/server/graphics/android/hwc_layerlist.cpp'
--- src/server/graphics/android/hwc_layerlist.cpp 2013-04-17 00:22:29 +0000
+++ src/server/graphics/android/hwc_layerlist.cpp 2013-05-09 15:25:39 +0000
@@ -17,10 +17,11 @@
17 */17 */
1818
19#include "hwc_layerlist.h"19#include "hwc_layerlist.h"
20#include "android_buffer.h"20#include "buffer.h"
2121
22#include <cstring>22#include <cstring>
2323
24namespace mc=mir::compositor;
24namespace mga=mir::graphics::android;25namespace mga=mir::graphics::android;
25namespace geom=mir::geometry;26namespace geom=mir::geometry;
2627
@@ -94,7 +95,7 @@
94 return layer_list;95 return layer_list;
95}96}
9697
97void mga::HWCLayerList::set_fb_target(std::shared_ptr<mga::AndroidBuffer> const& buffer)98void mga::HWCLayerList::set_fb_target(std::shared_ptr<mc::Buffer> const& buffer)
98{99{
99 auto handle = buffer->native_buffer_handle();100 auto handle = buffer->native_buffer_handle();
100101
101102
=== modified file 'src/server/graphics/android/hwc_layerlist.h'
--- src/server/graphics/android/hwc_layerlist.h 2013-04-17 00:22:29 +0000
+++ src/server/graphics/android/hwc_layerlist.h 2013-05-09 15:25:39 +0000
@@ -26,12 +26,15 @@
26#include <initializer_list>26#include <initializer_list>
27namespace mir27namespace mir
28{28{
29namespace compositor
30{
31class Buffer;
32}
29namespace graphics33namespace graphics
30{34{
31namespace android35namespace android
32{36{
3337
34class AndroidBuffer;
35class HWCDefaultLayer;38class HWCDefaultLayer;
36typedef struct std::vector<std::shared_ptr<HWCDefaultLayer>> LayerList;39typedef struct std::vector<std::shared_ptr<HWCDefaultLayer>> LayerList;
37 40
@@ -72,7 +75,7 @@
72public:75public:
73 virtual ~HWCLayerOrganizer() = default;76 virtual ~HWCLayerOrganizer() = default;
74 virtual const LayerList& native_list() const = 0;77 virtual const LayerList& native_list() const = 0;
75 virtual void set_fb_target(std::shared_ptr<AndroidBuffer> const&) = 0;78 virtual void set_fb_target(std::shared_ptr<compositor::Buffer> const&) = 0;
7679
77protected:80protected:
78 HWCLayerOrganizer() = default;81 HWCLayerOrganizer() = default;
@@ -87,7 +90,7 @@
87 HWCLayerList();90 HWCLayerList();
88 const LayerList& native_list() const;91 const LayerList& native_list() const;
8992
90 void set_fb_target(std::shared_ptr<AndroidBuffer> const&);93 void set_fb_target(std::shared_ptr<compositor::Buffer> const&);
9194
92private:95private:
93 LayerList layer_list;96 LayerList layer_list;
9497
=== modified file 'src/server/graphics/android/server_render_window.cpp'
--- src/server/graphics/android/server_render_window.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/server_render_window.cpp 2013-05-09 15:25:39 +0000
@@ -21,7 +21,7 @@
21#include "server_render_window.h"21#include "server_render_window.h"
22#include "display_support_provider.h"22#include "display_support_provider.h"
23#include "fb_swapper.h"23#include "fb_swapper.h"
24#include "android_buffer.h"24#include "buffer.h"
25#include "android_format_conversion-inl.h"25#include "android_format_conversion-inl.h"
2626
27#include <boost/throw_exception.hpp>27#include <boost/throw_exception.hpp>
2828
=== modified file 'src/server/graphics/android/server_render_window.h'
--- src/server/graphics/android/server_render_window.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/android/server_render_window.h 2013-05-09 15:25:39 +0000
@@ -31,6 +31,10 @@
3131
32namespace mir32namespace mir
33{33{
34namespace compositor
35{
36class Buffer;
37}
34namespace graphics38namespace graphics
35{39{
36namespace android40namespace android
@@ -38,7 +42,6 @@
3842
39class FBSwapper;43class FBSwapper;
40class DisplaySupportProvider;44class DisplaySupportProvider;
41class AndroidBuffer;
42class ServerRenderWindow : public AndroidDriverInterpreter 45class ServerRenderWindow : public AndroidDriverInterpreter
43{46{
44public:47public:
@@ -54,7 +57,7 @@
54 std::shared_ptr<FBSwapper> const swapper;57 std::shared_ptr<FBSwapper> const swapper;
55 std::shared_ptr<DisplaySupportProvider> const poster;58 std::shared_ptr<DisplaySupportProvider> const poster;
5659
57 std::unordered_map<ANativeWindowBuffer*, std::shared_ptr<AndroidBuffer>> buffers_in_driver;60 std::unordered_map<ANativeWindowBuffer*, std::shared_ptr<compositor::Buffer>> buffers_in_driver;
5861
59 int format;62 int format;
60}; 63};
6164
=== modified file 'src/server/graphics/gbm/gbm_buffer.cpp'
--- src/server/graphics/gbm/gbm_buffer.cpp 2013-04-24 05:22:20 +0000
+++ src/server/graphics/gbm/gbm_buffer.cpp 2013-05-09 15:25:39 +0000
@@ -127,3 +127,8 @@
127{127{
128 texture_binder->bind_to_texture();128 texture_binder->bind_to_texture();
129}129}
130
131std::shared_ptr<MirNativeBuffer> mgg::GBMBuffer::native_buffer_handle() const
132{
133 return std::make_shared<MirNativeBuffer>();
134}
130135
=== modified file 'src/server/graphics/gbm/gbm_buffer.h'
--- src/server/graphics/gbm/gbm_buffer.h 2013-04-24 05:22:20 +0000
+++ src/server/graphics/gbm/gbm_buffer.h 2013-05-09 15:25:39 +0000
@@ -54,6 +54,7 @@
54 virtual geometry::PixelFormat pixel_format() const;54 virtual geometry::PixelFormat pixel_format() const;
5555
56 virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const;56 virtual std::shared_ptr<compositor::BufferIPCPackage> get_ipc_package() const;
57 virtual std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
5758
58 virtual void bind_to_texture();59 virtual void bind_to_texture();
5960
6061
=== modified file 'tests/integration-tests/client/test_client_render.cpp'
--- tests/integration-tests/client/test_client_render.cpp 2013-04-24 05:22:20 +0000
+++ tests/integration-tests/client/test_client_render.cpp 2013-05-09 15:25:39 +0000
@@ -21,7 +21,6 @@
21#include "mir/compositor/buffer_ipc_package.h"21#include "mir/compositor/buffer_ipc_package.h"
22#include "mir/compositor/buffer_properties.h"22#include "mir/compositor/buffer_properties.h"
23#include "mir/graphics/buffer_initializer.h"23#include "mir/graphics/buffer_initializer.h"
24#include "src/server/graphics/android/android_buffer.h"
25#include "src/server/graphics/android/android_graphic_buffer_allocator.h"24#include "src/server/graphics/android/android_graphic_buffer_allocator.h"
2625
27#include "mir_test/draw/android_graphics.h"26#include "mir_test/draw/android_graphics.h"
2827
=== modified file 'tests/integration-tests/graphics/android/test_buffer_integration.cpp'
--- tests/integration-tests/graphics/android/test_buffer_integration.cpp 2013-04-24 05:22:20 +0000
+++ tests/integration-tests/graphics/android/test_buffer_integration.cpp 2013-05-09 15:25:39 +0000
@@ -16,7 +16,6 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#include "mir/graphics/platform.h"
20#include "src/server/graphics/android/android_graphic_buffer_allocator.h"19#include "src/server/graphics/android/android_graphic_buffer_allocator.h"
21#include "mir/graphics/buffer_initializer.h"20#include "mir/graphics/buffer_initializer.h"
22#include "mir/graphics/null_display_report.h"21#include "mir/graphics/null_display_report.h"
@@ -43,9 +42,6 @@
43protected:42protected:
44 virtual void SetUp()43 virtual void SetUp()
45 {44 {
46 platform = mg::create_platform(std::make_shared<mg::NullDisplayReport>());
47 ASSERT_TRUE(platform != NULL);
48
49 size = geom::Size{geom::Width{334},45 size = geom::Size{geom::Width{334},
50 geom::Height{122}};46 geom::Height{122}};
51 pf = geom::PixelFormat::abgr_8888;47 pf = geom::PixelFormat::abgr_8888;
@@ -58,8 +54,6 @@
58 geom::PixelFormat pf;54 geom::PixelFormat pf;
59 mc::BufferProperties buffer_properties;55 mc::BufferProperties buffer_properties;
60 mtd::TestGrallocMapper sw_renderer;56 mtd::TestGrallocMapper sw_renderer;
61
62 std::shared_ptr<mg::Platform> platform;
63};57};
6458
65}59}
@@ -98,7 +92,6 @@
98 auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);92 auto allocator = std::make_shared<mga::AndroidGraphicBufferAllocator>(null_buffer_initializer);
99 auto strategy = std::make_shared<mc::SwapperFactory>(allocator);93 auto strategy = std::make_shared<mc::SwapperFactory>(allocator);
100 mc::BufferProperties actual;94 mc::BufferProperties actual;
101 mc::BufferID id{34};
102 auto swapper = strategy->create_swapper(actual, buffer_properties);95 auto swapper = strategy->create_swapper(actual, buffer_properties);
103 auto returned_buffer = swapper->client_acquire();96 auto returned_buffer = swapper->client_acquire();
10497
10598
=== modified file 'tests/unit-tests/client/android/test_client_android_buffer.cpp'
--- tests/unit-tests/client/android/test_client_android_buffer.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/android/test_client_android_buffer.cpp 2013-05-09 15:25:39 +0000
@@ -286,7 +286,7 @@
286 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package),286 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package),
287 size, pf);287 size, pf);
288288
289 auto native_handle = buffer->get_native_handle();289 auto native_handle = buffer->native_buffer_handle();
290290
291 ASSERT_NE(nullptr, native_handle);291 ASSERT_NE(nullptr, native_handle);
292 EXPECT_EQ(buffer_handle, native_handle->handle);292 EXPECT_EQ(buffer_handle, native_handle->handle);
@@ -297,7 +297,7 @@
297 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package),297 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package),
298 size, pf);298 size, pf);
299299
300 auto native_handle = buffer->get_native_handle();300 auto native_handle = buffer->native_buffer_handle();
301301
302 ASSERT_NE(nullptr, native_handle);302 ASSERT_NE(nullptr, native_handle);
303 EXPECT_EQ(width.as_uint32_t(), static_cast<uint32_t>(native_handle->width));303 EXPECT_EQ(width.as_uint32_t(), static_cast<uint32_t>(native_handle->width));
@@ -308,7 +308,7 @@
308{308{
309 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);309 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
310310
311 auto native_handle = buffer->get_native_handle();311 auto native_handle = buffer->native_buffer_handle();
312 int correct_usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;312 int correct_usage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER;
313 ASSERT_NE(nullptr, native_handle);313 ASSERT_NE(nullptr, native_handle);
314 EXPECT_EQ(correct_usage, native_handle->usage);314 EXPECT_EQ(correct_usage, native_handle->usage);
@@ -318,7 +318,7 @@
318{318{
319 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);319 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
320320
321 auto native_handle = buffer->get_native_handle();321 auto native_handle = buffer->native_buffer_handle();
322 ASSERT_NE(nullptr, native_handle);322 ASSERT_NE(nullptr, native_handle);
323 EXPECT_EQ(static_cast<int32_t>(stride.as_uint32_t()), native_handle->stride);323 EXPECT_EQ(static_cast<int32_t>(stride.as_uint32_t()), native_handle->stride);
324}324}
@@ -327,7 +327,7 @@
327{327{
328 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);328 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
329329
330 auto native_handle = buffer->get_native_handle();330 auto native_handle = buffer->native_buffer_handle();
331331
332 ASSERT_NE(nullptr, native_handle);332 ASSERT_NE(nullptr, native_handle);
333 ASSERT_NE(nullptr, native_handle->common.incRef);333 ASSERT_NE(nullptr, native_handle->common.incRef);
@@ -336,19 +336,3 @@
336 native_handle->common.incRef(NULL);336 native_handle->common.incRef(NULL);
337 native_handle->common.decRef(NULL);337 native_handle->common.decRef(NULL);
338}338}
339
340TEST_F(ClientAndroidBufferTest, buffer_returns_creation_package)
341{
342 buffer = std::make_shared<mcla::AndroidClientBuffer>(mock_android_registrar, std::move(package), size, pf);
343
344 auto package_return = buffer->get_buffer_package();
345
346 EXPECT_EQ(package->data_items, package_return->data_items);
347 EXPECT_EQ(package->fd_items, package_return->fd_items);
348 EXPECT_EQ(package->stride, package_return->stride);
349 for(auto i=0; i<mir_buffer_package_max; i++)
350 EXPECT_EQ(package->data[i], package_return->data[i]);
351 for(auto i=0; i<mir_buffer_package_max; i++)
352 EXPECT_EQ(package->fd[i], package_return->fd[i]);
353}
354
355339
=== modified file 'tests/unit-tests/client/android/test_client_surface_interpreter.cpp'
--- tests/unit-tests/client/android/test_client_surface_interpreter.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/android/test_client_surface_interpreter.cpp 2013-05-09 15:25:39 +0000
@@ -40,9 +40,12 @@
40 MockClientBuffer()40 MockClientBuffer()
41 {41 {
42 using namespace testing;42 using namespace testing;
43 ON_CALL(*this, get_native_handle())43 buffer = std::make_shared<ANativeWindowBuffer>();
44 .WillByDefault(Return(&buffer));44 ON_CALL(*this, native_buffer_handle())
45 .WillByDefault(Return(buffer));
45 }46 }
47 ~MockClientBuffer() noexcept {}
48
46 MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());49 MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());
47 MOCK_CONST_METHOD0(size, geom::Size());50 MOCK_CONST_METHOD0(size, geom::Size());
48 MOCK_CONST_METHOD0(stride, geom::Stride());51 MOCK_CONST_METHOD0(stride, geom::Stride());
@@ -52,10 +55,9 @@
52 MOCK_METHOD0(mark_as_submitted, void());55 MOCK_METHOD0(mark_as_submitted, void());
53 MOCK_METHOD0(increment_age, void());56 MOCK_METHOD0(increment_age, void());
5457
55 MOCK_CONST_METHOD0(get_buffer_package, std::shared_ptr<MirBufferPackage>());58 MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
56 MOCK_METHOD0(get_native_handle, ANativeWindowBuffer*());
5759
58 ANativeWindowBuffer buffer;60 std::shared_ptr<ANativeWindowBuffer> buffer;
59 native_handle_t handle;61 native_handle_t handle;
60};62};
6163
@@ -116,21 +118,21 @@
116{118{
117 using namespace testing;119 using namespace testing;
118 native_handle_t handle;120 native_handle_t handle;
119 ANativeWindowBuffer buffer;121 auto buffer = std::make_shared<ANativeWindowBuffer>();
120 buffer.handle = &handle;122 buffer->handle = &handle;
121123
122 testing::NiceMock<MockMirSurface> mock_surface{surf_params};124 testing::NiceMock<MockMirSurface> mock_surface{surf_params};
123 mcla::ClientSurfaceInterpreter interpreter(mock_surface);125 mcla::ClientSurfaceInterpreter interpreter(mock_surface);
124126
125 EXPECT_CALL(*mock_client_buffer, get_native_handle())127 EXPECT_CALL(*mock_client_buffer, native_buffer_handle())
126 .Times(1)128 .Times(1)
127 .WillOnce(Return(&buffer));129 .WillOnce(Return(buffer));
128 EXPECT_CALL(mock_surface, get_current_buffer())130 EXPECT_CALL(mock_surface, get_current_buffer())
129 .Times(1)131 .Times(1)
130 .WillOnce(Return(mock_client_buffer));132 .WillOnce(Return(mock_client_buffer));
131133
132 auto returned_buffer = interpreter.driver_requests_buffer();134 auto returned_buffer = interpreter.driver_requests_buffer();
133 EXPECT_EQ(&buffer, returned_buffer);135 EXPECT_EQ(buffer.get(), returned_buffer);
134}136}
135137
136TEST_F(AndroidInterpreterTest, native_window_queue_advances_buffer)138TEST_F(AndroidInterpreterTest, native_window_queue_advances_buffer)
137139
=== modified file 'tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp'
--- tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/gbm/test_gbm_client_buffer.cpp 2013-05-09 15:25:39 +0000
@@ -82,7 +82,7 @@
8282
83 mclg::GBMClientBuffer buffer(drm_fd_handler, std::move(package), size, pf);83 mclg::GBMClientBuffer buffer(drm_fd_handler, std::move(package), size, pf);
8484
85 auto package_return = buffer.get_buffer_package();85 auto package_return = buffer.native_buffer_handle();
86 EXPECT_EQ(package_return->data_items, package_copy->data_items);86 EXPECT_EQ(package_return->data_items, package_copy->data_items);
87 EXPECT_EQ(package_return->fd_items, package_copy->fd_items);87 EXPECT_EQ(package_return->fd_items, package_copy->fd_items);
88 EXPECT_EQ(package_return->stride, package_copy->stride);88 EXPECT_EQ(package_return->stride, package_copy->stride);
8989
=== modified file 'tests/unit-tests/client/test_aging_buffer.cpp'
--- tests/unit-tests/client/test_aging_buffer.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/test_aging_buffer.cpp 2013-05-09 15:25:39 +0000
@@ -51,12 +51,7 @@
51 exit(1);51 exit(1);
52 }52 }
5353
54 std::shared_ptr<MirBufferPackage> get_buffer_package() const54 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
55 {
56 exit(1);
57 }
58
59 MirNativeBuffer get_native_handle()
60 {55 {
61 exit(1);56 exit(1);
62 }57 }
6358
=== modified file 'tests/unit-tests/client/test_client_buffer_depository.cpp'
--- tests/unit-tests/client/test_client_buffer_depository.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/test_client_buffer_depository.cpp 2013-05-09 15:25:39 +0000
@@ -42,7 +42,7 @@
42 }42 }
4343
44 MOCK_METHOD0(Destroy, void());44 MOCK_METHOD0(Destroy, void());
45 virtual ~MockBuffer()45 virtual ~MockBuffer() noexcept
46 {46 {
47 Destroy();47 Destroy();
48 }48 }
@@ -52,8 +52,7 @@
52 MOCK_CONST_METHOD0(size, geom::Size());52 MOCK_CONST_METHOD0(size, geom::Size());
53 MOCK_CONST_METHOD0(stride, geom::Stride());53 MOCK_CONST_METHOD0(stride, geom::Stride());
54 MOCK_CONST_METHOD0(pixel_format, geom::PixelFormat());54 MOCK_CONST_METHOD0(pixel_format, geom::PixelFormat());
55 MOCK_CONST_METHOD0(get_buffer_package, std::shared_ptr<MirBufferPackage>());55 MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
56 MOCK_METHOD0(get_native_handle, MirNativeBuffer());
57};56};
5857
59struct MockClientBufferFactory : public mcl::ClientBufferFactory58struct MockClientBufferFactory : public mcl::ClientBufferFactory
6059
=== modified file 'tests/unit-tests/client/test_client_mir_surface.cpp'
--- tests/unit-tests/client/test_client_mir_surface.cpp 2013-05-01 23:30:06 +0000
+++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-05-09 15:25:39 +0000
@@ -160,14 +160,11 @@
160160
161struct MockBuffer : public mcl::ClientBuffer161struct MockBuffer : public mcl::ClientBuffer
162{162{
163 explicit MockBuffer(std::shared_ptr<MirBufferPackage> const& contents)163 MockBuffer()
164 {164 {
165 using namespace testing;165 }
166166 ~MockBuffer() noexcept
167 auto buffer_package = std::make_shared<MirBufferPackage>();167 {
168 *buffer_package = *contents;
169 ON_CALL(*this, get_buffer_package())
170 .WillByDefault(Return(buffer_package));
171 }168 }
172169
173 MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());170 MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());
@@ -177,8 +174,7 @@
177 MOCK_CONST_METHOD0(age, uint32_t());174 MOCK_CONST_METHOD0(age, uint32_t());
178 MOCK_METHOD0(increment_age, void());175 MOCK_METHOD0(increment_age, void());
179 MOCK_METHOD0(mark_as_submitted, void());176 MOCK_METHOD0(mark_as_submitted, void());
180 MOCK_CONST_METHOD0(get_buffer_package, std::shared_ptr<MirBufferPackage>());177 MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<MirNativeBuffer>());
181 MOCK_METHOD0(get_native_handle, MirNativeBuffer());
182};178};
183179
184struct MockClientBufferFactory : public mcl::ClientBufferFactory180struct MockClientBufferFactory : public mcl::ClientBufferFactory
@@ -187,11 +183,11 @@
187 {183 {
188 using namespace testing;184 using namespace testing;
189185
190 emptybuffer=std::make_shared<NiceMock<MockBuffer>>(std::make_shared<MirBufferPackage>());186 emptybuffer=std::make_shared<NiceMock<MockBuffer>>();
191187
192 ON_CALL(*this, create_buffer(_,_,_))188 ON_CALL(*this, create_buffer(_,_,_))
193 .WillByDefault(DoAll(SaveArg<0>(&current_package),189 .WillByDefault(DoAll(SaveArg<0>(&current_package),
194 InvokeWithoutArgs([this] () {this->current_buffer = std::make_shared<NiceMock<MockBuffer>>(current_package);}),190 InvokeWithoutArgs([this] () {this->current_buffer = std::make_shared<NiceMock<MockBuffer>>();}),
195 ReturnPointee(&current_buffer)));191 ReturnPointee(&current_buffer)));
196 }192 }
197193
@@ -204,9 +200,12 @@
204 std::shared_ptr<mcl::ClientBuffer> emptybuffer;200 std::shared_ptr<mcl::ClientBuffer> emptybuffer;
205};201};
206202
207
208struct StubClientPlatform : public mcl::ClientPlatform203struct StubClientPlatform : public mcl::ClientPlatform
209{204{
205 MirPlatformType platform_type() const
206 {
207 return mir_platform_type_android;
208 }
210 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()209 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
211 {210 {
212 return std::shared_ptr<MockClientBufferFactory>();211 return std::shared_ptr<MockClientBufferFactory>();
@@ -510,15 +509,13 @@
510 nullptr);509 nullptr);
511 auto wait_handle = surface->get_create_wait_handle();510 auto wait_handle = surface->get_create_wait_handle();
512 wait_handle->wait_for_result();511 wait_handle->wait_for_result();
513512 Mock::VerifyAndClearExpectations(mock_buffer_factory.get());
514 EXPECT_THAT(*surface->get_current_buffer_package(), BufferPackageMatches(mock_server_tool->server_package));
515513
516 EXPECT_CALL(*mock_buffer_factory, create_buffer(_,_,_))514 EXPECT_CALL(*mock_buffer_factory, create_buffer(_,_,_))
517 .Times(1);515 .Times(1);
518 auto buffer_wait_handle = surface->next_buffer(&empty_surface_callback, nullptr);516 auto buffer_wait_handle = surface->next_buffer(&empty_surface_callback, nullptr);
519 buffer_wait_handle->wait_for_result();517 buffer_wait_handle->wait_for_result();
520518 Mock::VerifyAndClearExpectations(mock_buffer_factory.get());
521 EXPECT_THAT(*surface->get_current_buffer_package(), BufferPackageMatches(mock_server_tool->server_package));
522}519}
523520
524TEST_F(MirClientSurfaceTest, default_surface_type)521TEST_F(MirClientSurfaceTest, default_surface_type)
@@ -589,14 +586,9 @@
589 void increment_age() {}586 void increment_age() {}
590 void mark_as_submitted() {}587 void mark_as_submitted() {}
591588
592 std::shared_ptr<MirBufferPackage> get_buffer_package() const589 std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
593 {590 {
594 return std::shared_ptr<MirBufferPackage>();591 return std::shared_ptr<MirNativeBuffer>();
595 }
596
597 MirNativeBuffer get_native_handle()
598 {
599 return MirNativeBuffer();
600 }592 }
601593
602 geom::Size size_;594 geom::Size size_;
603595
=== modified file 'tests/unit-tests/client/test_client_platform.cpp'
--- tests/unit-tests/client/test_client_platform.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/test_client_platform.cpp 2013-05-09 15:25:39 +0000
@@ -40,6 +40,20 @@
40#endif40#endif
41};41};
4242
43TEST_F(ClientPlatformTest, platform_name)
44{
45 mtd::MockClientContext context;
46 mcl::NativeClientPlatformFactory factory;
47 auto platform = factory.create_client_platform(&context);
48
49#ifdef ANDROID
50 auto type = mir_platform_type_android;
51#else
52 auto type = mir_platform_type_gbm;
53#endif
54 EXPECT_EQ(type, platform->platform_type());
55}
56
43TEST_F(ClientPlatformTest, platform_creates)57TEST_F(ClientPlatformTest, platform_creates)
44{58{
45 mtd::MockClientContext context;59 mtd::MockClientContext context;
4660
=== modified file 'tests/unit-tests/client/test_mir_connection.cpp'
--- tests/unit-tests/client/test_mir_connection.cpp 2013-04-25 09:48:54 +0000
+++ tests/unit-tests/client/test_mir_connection.cpp 2013-05-09 15:25:39 +0000
@@ -80,6 +80,7 @@
80 .WillByDefault(Return(native_display));80 .WillByDefault(Return(native_display));
81 }81 }
8282
83 MOCK_CONST_METHOD0(platform_type, MirPlatformType());
83 MOCK_METHOD0(create_buffer_factory, std::shared_ptr<mcl::ClientBufferFactory>());84 MOCK_METHOD0(create_buffer_factory, std::shared_ptr<mcl::ClientBufferFactory>());
84 MOCK_METHOD1(create_egl_native_window, std::shared_ptr<EGLNativeWindowType>(mcl::ClientSurface*));85 MOCK_METHOD1(create_egl_native_window, std::shared_ptr<EGLNativeWindowType>(mcl::ClientSurface*));
85 MOCK_METHOD0(create_egl_native_display, std::shared_ptr<EGLNativeDisplayType>());86 MOCK_METHOD0(create_egl_native_display, std::shared_ptr<EGLNativeDisplayType>());
8687
=== modified file 'tests/unit-tests/compositor/test_temporary_buffers.cpp'
--- tests/unit-tests/compositor/test_temporary_buffers.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/compositor/test_temporary_buffers.cpp 2013-05-09 15:25:39 +0000
@@ -166,3 +166,12 @@
166166
167 proxy_buffer.id();167 proxy_buffer.id();
168}168}
169
170TEST_F(TemporaryBuffersTest, base_test_native_buffer_handle)
171{
172 TemporaryTestBuffer proxy_buffer(mock_buffer);
173 EXPECT_CALL(*mock_buffer, native_buffer_handle())
174 .Times(1);
175
176 proxy_buffer.native_buffer_handle();
177}
169178
=== modified file 'tests/unit-tests/graphics/android/test_fb_device.cpp'
--- tests/unit-tests/graphics/android/test_fb_device.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/graphics/android/test_fb_device.cpp 2013-05-09 15:25:39 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "mir_test_doubles/mock_fb_hal_device.h"19#include "mir_test_doubles/mock_fb_hal_device.h"
20#include "mir_test_doubles/mock_android_buffer.h"20#include "mir_test_doubles/mock_buffer.h"
21#include "src/server/graphics/android/fb_device.h"21#include "src/server/graphics/android/fb_device.h"
22#include "mir_test/hw_mock.h"22#include "mir_test/hw_mock.h"
2323
@@ -42,7 +42,7 @@
42 format = HAL_PIXEL_FORMAT_RGBA_8888;42 format = HAL_PIXEL_FORMAT_RGBA_8888;
4343
44 fb_hal_mock = std::make_shared<mtd::MockFBHalDevice>(width, height, format, fbnum); 44 fb_hal_mock = std::make_shared<mtd::MockFBHalDevice>(width, height, format, fbnum);
45 mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();45 mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>();
4646
47 dummy_buffer = std::make_shared<ANativeWindowBuffer>();47 dummy_buffer = std::make_shared<ANativeWindowBuffer>();
48 dummy_buffer->handle = (buffer_handle_t) 0x4893;48 dummy_buffer->handle = (buffer_handle_t) 0x4893;
@@ -52,7 +52,7 @@
5252
53 unsigned int width, height, format, fbnum;53 unsigned int width, height, format, fbnum;
54 std::shared_ptr<mtd::MockFBHalDevice> fb_hal_mock;54 std::shared_ptr<mtd::MockFBHalDevice> fb_hal_mock;
55 std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer;55 std::shared_ptr<mtd::MockBuffer> mock_buffer;
56 std::shared_ptr<ANativeWindowBuffer> dummy_buffer;56 std::shared_ptr<ANativeWindowBuffer> dummy_buffer;
57 mt::HardwareAccessMock hw_access_mock;57 mt::HardwareAccessMock hw_access_mock;
58};58};
5959
=== modified file 'tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp'
--- tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/graphics/android/test_fb_simple_swapper.cpp 2013-05-09 15:25:39 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "src/server/graphics/android/fb_simple_swapper.h"19#include "src/server/graphics/android/fb_simple_swapper.h"
20#include "mir_test_doubles/mock_android_buffer.h"20#include "mir_test_doubles/mock_buffer.h"
2121
22#include <future>22#include <future>
23#include <initializer_list>23#include <initializer_list>
@@ -34,19 +34,19 @@
34public:34public:
35 virtual void SetUp()35 virtual void SetUp()
36 {36 {
37 buffer1 = std::make_shared<mtd::MockAndroidBuffer>();37 buffer1 = std::make_shared<mtd::MockBuffer>();
38 buffer2 = std::make_shared<mtd::MockAndroidBuffer>();38 buffer2 = std::make_shared<mtd::MockBuffer>();
39 buffer3 = std::make_shared<mtd::MockAndroidBuffer>();39 buffer3 = std::make_shared<mtd::MockBuffer>();
40 }40 }
4141
42 std::shared_ptr<mga::AndroidBuffer> buffer1;42 std::shared_ptr<mc::Buffer> buffer1;
43 std::shared_ptr<mga::AndroidBuffer> buffer2;43 std::shared_ptr<mc::Buffer> buffer2;
44 std::shared_ptr<mga::AndroidBuffer> buffer3;44 std::shared_ptr<mc::Buffer> buffer3;
45};45};
4646
47TEST_F(FBSimpleSwapperTest, simple_swaps_returns_valid)47TEST_F(FBSimpleSwapperTest, simple_swaps_returns_valid)
48{48{
49 std::initializer_list<std::shared_ptr<mga::AndroidBuffer>> double_list{buffer1, buffer2};49 std::initializer_list<std::shared_ptr<mc::Buffer>> double_list{buffer1, buffer2};
50 mga::FBSimpleSwapper fb_swapper(double_list);50 mga::FBSimpleSwapper fb_swapper(double_list);
5151
52 auto test_buffer = fb_swapper.compositor_acquire();52 auto test_buffer = fb_swapper.compositor_acquire();
@@ -56,7 +56,7 @@
5656
57TEST_F(FBSimpleSwapperTest, simple_swaps_return_aba_pattern)57TEST_F(FBSimpleSwapperTest, simple_swaps_return_aba_pattern)
58{58{
59 std::initializer_list<std::shared_ptr<mga::AndroidBuffer>> double_list{buffer1, buffer2};59 std::initializer_list<std::shared_ptr<mc::Buffer>> double_list{buffer1, buffer2};
60 mga::FBSimpleSwapper fb_swapper(double_list);60 mga::FBSimpleSwapper fb_swapper(double_list);
6161
62 auto test_buffer_1 = fb_swapper.compositor_acquire();62 auto test_buffer_1 = fb_swapper.compositor_acquire();
@@ -74,7 +74,7 @@
7474
75TEST_F(FBSimpleSwapperTest, triple_swaps_return_abcab_pattern)75TEST_F(FBSimpleSwapperTest, triple_swaps_return_abcab_pattern)
76{76{
77 std::initializer_list<std::shared_ptr<mga::AndroidBuffer>> triple_list{buffer1, buffer2, buffer3};77 std::initializer_list<std::shared_ptr<mc::Buffer>> triple_list{buffer1, buffer2, buffer3};
78 mga::FBSimpleSwapper fb_swapper(triple_list);78 mga::FBSimpleSwapper fb_swapper(triple_list);
7979
80 auto test_buffer_1 = fb_swapper.compositor_acquire();80 auto test_buffer_1 = fb_swapper.compositor_acquire();
@@ -103,7 +103,7 @@
103103
104TEST_F(FBSimpleSwapperTest, synctest)104TEST_F(FBSimpleSwapperTest, synctest)
105{105{
106 std::vector<std::shared_ptr<mga::AndroidBuffer>> test_buffers{buffer1, buffer2};106 std::vector<std::shared_ptr<mc::Buffer>> test_buffers{buffer1, buffer2};
107 mga::FBSimpleSwapper fb_swapper(test_buffers);107 mga::FBSimpleSwapper fb_swapper(test_buffers);
108108
109 std::vector<std::shared_ptr<mc::Buffer>> blist;109 std::vector<std::shared_ptr<mc::Buffer>> blist;
110110
=== modified file 'tests/unit-tests/graphics/android/test_framebuffer_factory.cpp'
--- tests/unit-tests/graphics/android/test_framebuffer_factory.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/graphics/android/test_framebuffer_factory.cpp 2013-05-09 15:25:39 +0000
@@ -41,7 +41,7 @@
41{41{
42public:42public:
43 MOCK_METHOD1(alloc_buffer, std::shared_ptr<mc::Buffer>(mc::BufferProperties const&)); 43 MOCK_METHOD1(alloc_buffer, std::shared_ptr<mc::Buffer>(mc::BufferProperties const&));
44 MOCK_METHOD3(alloc_buffer_platform, std::shared_ptr<mga::AndroidBuffer>(geom::Size, geom::PixelFormat, mga::BufferUsage));44 MOCK_METHOD3(alloc_buffer_platform, std::shared_ptr<mga::Buffer>(geom::Size, geom::PixelFormat, mga::BufferUsage));
45 MOCK_METHOD0(supported_pixel_formats, std::vector<geom::PixelFormat>());45 MOCK_METHOD0(supported_pixel_formats, std::vector<geom::PixelFormat>());
46};46};
47}47}
@@ -62,7 +62,7 @@
62 ON_CALL(*mock_display_info_provider, number_of_framebuffers_available())62 ON_CALL(*mock_display_info_provider, number_of_framebuffers_available())
63 .WillByDefault(Return(fake_fb_num));63 .WillByDefault(Return(fake_fb_num));
64 ON_CALL(*mock_buffer_allocator, alloc_buffer_platform(_,_,_))64 ON_CALL(*mock_buffer_allocator, alloc_buffer_platform(_,_,_))
65 .WillByDefault(Return(std::shared_ptr<mga::AndroidBuffer>()));65 .WillByDefault(Return(std::shared_ptr<mga::Buffer>()));
66 }66 }
6767
68 std::shared_ptr<MockAndroidGraphicBufferAllocator> mock_buffer_allocator;68 std::shared_ptr<MockAndroidGraphicBufferAllocator> mock_buffer_allocator;
6969
=== modified file 'tests/unit-tests/graphics/android/test_hwc10_device.cpp'
--- tests/unit-tests/graphics/android/test_hwc10_device.cpp 2013-04-22 21:33:40 +0000
+++ tests/unit-tests/graphics/android/test_hwc10_device.cpp 2013-05-09 15:25:39 +0000
@@ -20,9 +20,10 @@
20#include "mir_test_doubles/mock_display_support_provider.h"20#include "mir_test_doubles/mock_display_support_provider.h"
21#include "mir_test_doubles/mock_hwc_composer_device_1.h"21#include "mir_test_doubles/mock_hwc_composer_device_1.h"
22#include "mir_test_doubles/mock_hwc_organizer.h"22#include "mir_test_doubles/mock_hwc_organizer.h"
23#include "mir_test_doubles/mock_android_buffer.h"23#include "mir_test_doubles/mock_buffer.h"
24#include <gtest/gtest.h>24#include <gtest/gtest.h>
2525
26namespace mc=mir::compositor;
26namespace mga=mir::graphics::android;27namespace mga=mir::graphics::android;
27namespace mtd=mir::test::doubles;28namespace mtd=mir::test::doubles;
28namespace geom=mir::geometry;29namespace geom=mir::geometry;
@@ -85,7 +86,7 @@
8586
86TEST_F(HWC10Device, hwc10_set_next_frontbuffer)87TEST_F(HWC10Device, hwc10_set_next_frontbuffer)
87{88{
88 std::shared_ptr<mga::AndroidBuffer> mock_buffer = std::make_shared<mtd::MockAndroidBuffer>();89 std::shared_ptr<mc::Buffer> mock_buffer = std::make_shared<mtd::MockBuffer>();
89 EXPECT_CALL(*mock_fbdev, set_next_frontbuffer(mock_buffer))90 EXPECT_CALL(*mock_fbdev, set_next_frontbuffer(mock_buffer))
90 .Times(1);91 .Times(1);
9192
9293
=== modified file 'tests/unit-tests/graphics/android/test_hwc11_device.cpp'
--- tests/unit-tests/graphics/android/test_hwc11_device.cpp 2013-04-20 00:08:22 +0000
+++ tests/unit-tests/graphics/android/test_hwc11_device.cpp 2013-05-09 15:25:39 +0000
@@ -21,10 +21,11 @@
21#include "mir_test_doubles/mock_display_support_provider.h"21#include "mir_test_doubles/mock_display_support_provider.h"
22#include "mir_test_doubles/mock_hwc_composer_device_1.h"22#include "mir_test_doubles/mock_hwc_composer_device_1.h"
23#include "mir_test_doubles/mock_hwc_organizer.h"23#include "mir_test_doubles/mock_hwc_organizer.h"
24#include "mir_test_doubles/mock_android_buffer.h"24#include "mir_test_doubles/mock_buffer.h"
25#include "mir_test/egl_mock.h"25#include "mir_test/egl_mock.h"
26#include <gtest/gtest.h>26#include <gtest/gtest.h>
2727
28namespace mc=mir::compositor;
28namespace mga=mir::graphics::android;29namespace mga=mir::graphics::android;
29namespace mtd=mir::test::doubles;30namespace mtd=mir::test::doubles;
3031
@@ -223,7 +224,7 @@
223224
224TEST_F(HWC11Device, hwc_device_set_next_frontbuffer_adds_to_layerlist)225TEST_F(HWC11Device, hwc_device_set_next_frontbuffer_adds_to_layerlist)
225{226{
226 std::shared_ptr<mga::AndroidBuffer> mock_buffer = std::make_shared<mtd::MockAndroidBuffer>();227 std::shared_ptr<mc::Buffer> mock_buffer = std::make_shared<mtd::MockBuffer>();
227 EXPECT_CALL(*this->mock_organizer, set_fb_target(mock_buffer))228 EXPECT_CALL(*this->mock_organizer, set_fb_target(mock_buffer))
228 .Times(1);229 .Times(1);
229 230
@@ -233,7 +234,7 @@
233234
234TEST_F(HWC11Device, hwc_device_set_next_frontbuffer_posts)235TEST_F(HWC11Device, hwc_device_set_next_frontbuffer_posts)
235{236{
236 std::shared_ptr<mga::AndroidBuffer> mock_buffer = std::make_shared<mtd::MockAndroidBuffer>();237 std::shared_ptr<mc::Buffer> mock_buffer = std::make_shared<mtd::MockBuffer>();
237 EXPECT_CALL(*this->mock_display_support_provider, set_next_frontbuffer(mock_buffer))238 EXPECT_CALL(*this->mock_display_support_provider, set_next_frontbuffer(mock_buffer))
238 .Times(1);239 .Times(1);
239240
240241
=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-05-09 15:25:39 +0000
@@ -21,7 +21,7 @@
21#include "src/server/graphics/android/hwc_layerlist.h"21#include "src/server/graphics/android/hwc_layerlist.h"
22#include "mir_test_doubles/mock_hwc_composer_device_1.h"22#include "mir_test_doubles/mock_hwc_composer_device_1.h"
23#include "mir_test_doubles/mock_hwc_organizer.h"23#include "mir_test_doubles/mock_hwc_organizer.h"
24#include "mir_test_doubles/mock_android_buffer.h"24#include "mir_test_doubles/mock_buffer.h"
25#include "mir_test_doubles/mock_display_support_provider.h"25#include "mir_test_doubles/mock_display_support_provider.h"
2626
27#include <thread>27#include <thread>
2828
=== modified file 'tests/unit-tests/graphics/android/test_hwc_layerlist.cpp'
--- tests/unit-tests/graphics/android/test_hwc_layerlist.cpp 2013-04-17 00:22:29 +0000
+++ tests/unit-tests/graphics/android/test_hwc_layerlist.cpp 2013-05-09 15:25:39 +0000
@@ -17,7 +17,7 @@
17 */17 */
1818
19#include "src/server/graphics/android/hwc_layerlist.h"19#include "src/server/graphics/android/hwc_layerlist.h"
20#include "mir_test_doubles/mock_android_buffer.h"20#include "mir_test_doubles/mock_buffer.h"
21#include "hwc_struct_helper-inl.h"21#include "hwc_struct_helper-inl.h"
22#include <gtest/gtest.h>22#include <gtest/gtest.h>
2323
@@ -41,7 +41,7 @@
41 stub_handle_1 = std::make_shared<ANativeWindowBuffer>();41 stub_handle_1 = std::make_shared<ANativeWindowBuffer>();
42 stub_handle_2 = std::make_shared<ANativeWindowBuffer>();42 stub_handle_2 = std::make_shared<ANativeWindowBuffer>();
4343
44 mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();44 mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>();
45 ON_CALL(*mock_buffer, native_buffer_handle())45 ON_CALL(*mock_buffer, native_buffer_handle())
46 .WillByDefault(Return(stub_handle_1));46 .WillByDefault(Return(stub_handle_1));
47 ON_CALL(*mock_buffer, size())47 ON_CALL(*mock_buffer, size())
@@ -55,7 +55,7 @@
5555
56 std::shared_ptr<ANativeWindowBuffer> stub_handle_1;56 std::shared_ptr<ANativeWindowBuffer> stub_handle_1;
57 std::shared_ptr<ANativeWindowBuffer> stub_handle_2;57 std::shared_ptr<ANativeWindowBuffer> stub_handle_2;
58 std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer;58 std::shared_ptr<mtd::MockBuffer> mock_buffer;
59};59};
6060
61TEST(HWCLayerDeepCopy, hwc_layer)61TEST(HWCLayerDeepCopy, hwc_layer)
6262
=== modified file 'tests/unit-tests/graphics/android/test_server_interpreter.cpp'
--- tests/unit-tests/graphics/android/test_server_interpreter.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/graphics/android/test_server_interpreter.cpp 2013-05-09 15:25:39 +0000
@@ -20,7 +20,7 @@
20#include "src/server/graphics/android/fb_swapper.h"20#include "src/server/graphics/android/fb_swapper.h"
2121
22#include "mir_test_doubles/mock_display_support_provider.h"22#include "mir_test_doubles/mock_display_support_provider.h"
23#include "mir_test_doubles/mock_android_buffer.h"23#include "mir_test_doubles/mock_buffer.h"
2424
25#include <gtest/gtest.h>25#include <gtest/gtest.h>
26#include <gmock/gmock.h>26#include <gmock/gmock.h>
@@ -43,17 +43,17 @@
43struct MockFBSwapper : public mga::FBSwapper43struct MockFBSwapper : public mga::FBSwapper
44{44{
45 ~MockFBSwapper() noexcept {}45 ~MockFBSwapper() noexcept {}
46 MOCK_METHOD0(compositor_acquire, std::shared_ptr<mga::AndroidBuffer>());46 MOCK_METHOD0(compositor_acquire, std::shared_ptr<mc::Buffer>());
47 MOCK_METHOD1(compositor_release, void(std::shared_ptr<mga::AndroidBuffer> const& released_buffer));47 MOCK_METHOD1(compositor_release, void(std::shared_ptr<mc::Buffer> const& released_buffer));
48}; 48};
49struct ServerRenderWindowTest : public ::testing::Test49struct ServerRenderWindowTest : public ::testing::Test
50{50{
51 virtual void SetUp()51 virtual void SetUp()
52 {52 {
53 using namespace testing;53 using namespace testing;
54 mock_buffer1 = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();54 mock_buffer1 = std::make_shared<NiceMock<mtd::MockBuffer>>();
55 mock_buffer2 = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();55 mock_buffer2 = std::make_shared<NiceMock<mtd::MockBuffer>>();
56 mock_buffer3 = std::make_shared<NiceMock<mtd::MockAndroidBuffer>>();56 mock_buffer3 = std::make_shared<NiceMock<mtd::MockBuffer>>();
57 mock_swapper = std::make_shared<NiceMock<MockFBSwapper>>();57 mock_swapper = std::make_shared<NiceMock<MockFBSwapper>>();
58 mock_display_poster = std::make_shared<NiceMock<mtd::MockDisplaySupportProvider>>();58 mock_display_poster = std::make_shared<NiceMock<mtd::MockDisplaySupportProvider>>();
59 ON_CALL(*mock_display_poster, display_format())59 ON_CALL(*mock_display_poster, display_format())
@@ -61,9 +61,9 @@
61 stub_sync = std::make_shared<StubFence>();61 stub_sync = std::make_shared<StubFence>();
62 }62 }
6363
64 std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer1;64 std::shared_ptr<mtd::MockBuffer> mock_buffer1;
65 std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer2;65 std::shared_ptr<mtd::MockBuffer> mock_buffer2;
66 std::shared_ptr<mtd::MockAndroidBuffer> mock_buffer3;66 std::shared_ptr<mtd::MockBuffer> mock_buffer3;
67 std::shared_ptr<MockFBSwapper> mock_swapper;67 std::shared_ptr<MockFBSwapper> mock_swapper;
68 std::shared_ptr<mtd::MockDisplaySupportProvider> mock_display_poster;68 std::shared_ptr<mtd::MockDisplaySupportProvider> mock_display_poster;
69 std::shared_ptr<StubFence> stub_sync;69 std::shared_ptr<StubFence> stub_sync;
@@ -106,7 +106,7 @@
106 render_window.driver_requests_buffer();106 render_window.driver_requests_buffer();
107 testing::Mock::VerifyAndClearExpectations(mock_swapper.get());107 testing::Mock::VerifyAndClearExpectations(mock_swapper.get());
108108
109 std::shared_ptr<mga::AndroidBuffer> buf1 = mock_buffer1;109 std::shared_ptr<mc::Buffer> buf1 = mock_buffer1;
110 EXPECT_CALL(*mock_swapper, compositor_release(buf1))110 EXPECT_CALL(*mock_swapper, compositor_release(buf1))
111 .Times(1);111 .Times(1);
112 EXPECT_CALL(*stub_sync, wait())112 EXPECT_CALL(*stub_sync, wait())
@@ -147,9 +147,9 @@
147 auto handle3 = render_window.driver_requests_buffer();147 auto handle3 = render_window.driver_requests_buffer();
148 testing::Mock::VerifyAndClearExpectations(mock_swapper.get());148 testing::Mock::VerifyAndClearExpectations(mock_swapper.get());
149149
150 std::shared_ptr<mga::AndroidBuffer> buf1 = mock_buffer1;150 std::shared_ptr<mc::Buffer> buf1 = mock_buffer1;
151 std::shared_ptr<mga::AndroidBuffer> buf2 = mock_buffer2;151 std::shared_ptr<mc::Buffer> buf2 = mock_buffer2;
152 std::shared_ptr<mga::AndroidBuffer> buf3 = mock_buffer3;152 std::shared_ptr<mc::Buffer> buf3 = mock_buffer3;
153 EXPECT_CALL(*mock_swapper, compositor_release(buf1))153 EXPECT_CALL(*mock_swapper, compositor_release(buf1))
154 .Times(1);154 .Times(1);
155 EXPECT_CALL(*mock_swapper, compositor_release(buf2))155 EXPECT_CALL(*mock_swapper, compositor_release(buf2))
@@ -183,13 +183,17 @@
183 using namespace testing;183 using namespace testing;
184 mga::ServerRenderWindow render_window(mock_swapper, mock_display_poster);184 mga::ServerRenderWindow render_window(mock_swapper, mock_display_poster);
185185
186 auto stub_anw = std::make_shared<ANativeWindowBuffer>();
186 mc::BufferID id{442}, returned_id;187 mc::BufferID id{442}, returned_id;
187 EXPECT_CALL(*mock_swapper, compositor_acquire())188 EXPECT_CALL(*mock_swapper, compositor_acquire())
188 .Times(1)189 .Times(1)
189 .WillOnce(Return(mock_buffer1));190 .WillOnce(Return(mock_buffer1));
190 EXPECT_CALL(*mock_swapper, compositor_release(_))191 EXPECT_CALL(*mock_swapper, compositor_release(_))
191 .Times(1);192 .Times(1);
192 std::shared_ptr<mga::AndroidBuffer> buf1 = mock_buffer1;193 std::shared_ptr<mc::Buffer> buf1 = mock_buffer1;
194 EXPECT_CALL(*mock_buffer1, native_buffer_handle())
195 .Times(1)
196 .WillOnce(Return(stub_anw));
193 EXPECT_CALL(*mock_display_poster, set_next_frontbuffer(buf1))197 EXPECT_CALL(*mock_display_poster, set_next_frontbuffer(buf1))
194 .Times(1);198 .Times(1);
195199

Subscribers

People subscribed via source and target branches