Merge lp:~alan-griffiths/mir/remove-guest-platforms into lp:mir
- remove-guest-platforms
- Merge into development-branch
Status: | Merged |
---|---|
Merge reported by: | Alberto Aguirre |
Merged at revision: | not available |
Proposed branch: | lp:~alan-griffiths/mir/remove-guest-platforms |
Merge into: | lp:mir |
Diff against target: |
748 lines (+0/-583) 17 files modified
include/platform/mir/graphics/platform.h (+0/-20) src/platforms/eglstream-kms/server/platform_symbols.cpp (+0/-7) src/platforms/mesa/server/kms/CMakeLists.txt (+0/-1) src/platforms/mesa/server/kms/guest_platform.cpp (+0/-118) src/platforms/mesa/server/kms/guest_platform.h (+0/-73) src/platforms/mesa/server/kms/platform.cpp (+0/-1) src/platforms/mesa/server/kms/platform_symbols.cpp (+0/-9) src/platforms/mesa/server/x11/graphics/CMakeLists.txt (+0/-1) src/platforms/mesa/server/x11/graphics/graphics.cpp (+0/-9) src/platforms/mesa/server/x11/graphics/guest_platform.cpp (+0/-79) src/platforms/mesa/server/x11/graphics/guest_platform.h (+0/-66) tests/mir_test_framework/platform_graphics_throw.cpp (+0/-7) tests/mir_test_framework/stubbed_graphics_platform.cpp (+0/-14) tests/unit-tests/platforms/mesa/kms/CMakeLists.txt (+0/-1) tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp (+0/-106) tests/unit-tests/platforms/mesa/x11/CMakeLists.txt (+0/-1) tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp (+0/-70) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/remove-guest-platforms |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Needs Fixing | |
Alberto Aguirre (community) | Approve | ||
Review via email: mp+325376@code.launchpad.net |
Commit message
Remove the (now unused) GuestPlatform code
Description of the change
Alan Griffiths (alan-griffiths) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4193
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alberto Aguirre (albaguirre) wrote : | # |
Needs ABI bump?
LGTM otherwise.
Alberto Aguirre (albaguirre) wrote : | # |
Nitpicks: seems like extra space on
317 + display.cpp
And similar lines in the diff.
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4194
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
SUCCESS: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Preview Diff
1 | === modified file 'include/platform/mir/graphics/platform.h' | |||
2 | --- include/platform/mir/graphics/platform.h 2017-05-08 03:04:26 +0000 | |||
3 | +++ include/platform/mir/graphics/platform.h 2017-06-09 16:24:41 +0000 | |||
4 | @@ -175,11 +175,6 @@ | |||
5 | 175 | std::shared_ptr<mir::graphics::DisplayReport> const& report, | 175 | std::shared_ptr<mir::graphics::DisplayReport> const& report, |
6 | 176 | std::shared_ptr<mir::logging::Logger> const& logger); | 176 | std::shared_ptr<mir::logging::Logger> const& logger); |
7 | 177 | 177 | ||
8 | 178 | typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateGuestPlatform)( | ||
9 | 179 | std::shared_ptr<mir::graphics::DisplayReport> const& report, | ||
10 | 180 | std::shared_ptr<mir::graphics::PlatformAuthentication> const& platform_authentication); | ||
11 | 181 | |||
12 | 182 | |||
13 | 183 | typedef void(*AddPlatformOptions)( | 178 | typedef void(*AddPlatformOptions)( |
14 | 184 | boost::program_options::options_description& config); | 179 | boost::program_options::options_description& config); |
15 | 185 | 180 | ||
16 | @@ -227,21 +222,6 @@ | |||
17 | 227 | std::shared_ptr<mir::logging::Logger> const& logger); | 222 | std::shared_ptr<mir::logging::Logger> const& logger); |
18 | 228 | 223 | ||
19 | 229 | /** | 224 | /** |
20 | 230 | * Function prototype used to return a new guest graphics platform. The guest graphics platform | ||
21 | 231 | * exists alongside the host platform and do not output or control the physical displays | ||
22 | 232 | * | ||
23 | 233 | * \param [in] platform_authentication the object that contains resources needed from the host platform | ||
24 | 234 | * \param [in] report the object to use to report interesting events from the display subsystem | ||
25 | 235 | * | ||
26 | 236 | * This factory function needs to be implemented by each platform. | ||
27 | 237 | * | ||
28 | 238 | * \ingroup platform_enablement | ||
29 | 239 | */ | ||
30 | 240 | mir::UniqueModulePtr<mir::graphics::Platform> create_guest_platform( | ||
31 | 241 | std::shared_ptr<mir::graphics::DisplayReport> const& report, | ||
32 | 242 | std::shared_ptr<mir::graphics::PlatformAuthentication> const& platform_authentication); | ||
33 | 243 | |||
34 | 244 | /** | ||
35 | 245 | * Function prototype used to add platform specific options to the platform-independent server options. | 225 | * Function prototype used to add platform specific options to the platform-independent server options. |
36 | 246 | * | 226 | * |
37 | 247 | * \param [in] config a boost::program_options that can be appended with new options | 227 | * \param [in] config a boost::program_options that can be appended with new options |
38 | 248 | 228 | ||
39 | === modified file 'src/platforms/eglstream-kms/server/platform_symbols.cpp' | |||
40 | --- src/platforms/eglstream-kms/server/platform_symbols.cpp 2017-05-25 06:15:15 +0000 | |||
41 | +++ src/platforms/eglstream-kms/server/platform_symbols.cpp 2017-06-09 16:24:41 +0000 | |||
42 | @@ -220,10 +220,3 @@ | |||
43 | 220 | return &description; | 220 | return &description; |
44 | 221 | } | 221 | } |
45 | 222 | 222 | ||
46 | 223 | mir::UniqueModulePtr<mg::Platform> create_guest_platform( | ||
47 | 224 | std::shared_ptr<mg::DisplayReport> const&, | ||
48 | 225 | std::shared_ptr<mg::PlatformAuthentication> const& /*platform_authentication*/) | ||
49 | 226 | { | ||
50 | 227 | mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform); | ||
51 | 228 | return nullptr; | ||
52 | 229 | } | ||
53 | 230 | 223 | ||
54 | === modified file 'src/platforms/mesa/server/kms/CMakeLists.txt' | |||
55 | --- src/platforms/mesa/server/kms/CMakeLists.txt 2017-05-17 04:48:46 +0000 | |||
56 | +++ src/platforms/mesa/server/kms/CMakeLists.txt 2017-06-09 16:24:41 +0000 | |||
57 | @@ -29,7 +29,6 @@ | |||
58 | 29 | cursor.cpp | 29 | cursor.cpp |
59 | 30 | display.cpp | 30 | display.cpp |
60 | 31 | display_buffer.cpp | 31 | display_buffer.cpp |
61 | 32 | guest_platform.cpp | ||
62 | 33 | page_flipper.h | 32 | page_flipper.h |
63 | 34 | kms_page_flipper.cpp | 33 | kms_page_flipper.cpp |
64 | 35 | linux_virtual_terminal.cpp | 34 | linux_virtual_terminal.cpp |
65 | 36 | 35 | ||
66 | === removed file 'src/platforms/mesa/server/kms/guest_platform.cpp' | |||
67 | --- src/platforms/mesa/server/kms/guest_platform.cpp 2017-05-31 17:56:19 +0000 | |||
68 | +++ src/platforms/mesa/server/kms/guest_platform.cpp 1970-01-01 00:00:00 +0000 | |||
69 | @@ -1,118 +0,0 @@ | |||
70 | 1 | /* | ||
71 | 2 | * Copyright © 2013 Canonical Ltd. | ||
72 | 3 | * | ||
73 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
74 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
75 | 6 | * as published by the Free Software Foundation. | ||
76 | 7 | * | ||
77 | 8 | * This program is distributed in the hope that it will be useful, | ||
78 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
79 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
80 | 11 | * GNU Lesser General Public License for more details. | ||
81 | 12 | * | ||
82 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
83 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
84 | 15 | * | ||
85 | 16 | * Authored by: | ||
86 | 17 | * Eleni Maria Stea <elenimaria.stea@canonical.com> | ||
87 | 18 | * Alan Griffiths <alan@octopull.co.uk> | ||
88 | 19 | */ | ||
89 | 20 | |||
90 | 21 | #include "guest_platform.h" | ||
91 | 22 | #include "nested_authentication.h" | ||
92 | 23 | #include "ipc_operations.h" | ||
93 | 24 | #include "buffer_allocator.h" | ||
94 | 25 | #include "mesa_extensions.h" | ||
95 | 26 | |||
96 | 27 | #include "mir/graphics/platform_authentication_wrapper.h" | ||
97 | 28 | #include "mir/graphics/platform_operation_message.h" | ||
98 | 29 | #include "mir_toolkit/mesa/platform_operation.h" | ||
99 | 30 | #include "mir_toolkit/extensions/set_gbm_device.h" | ||
100 | 31 | |||
101 | 32 | #include <boost/exception/errinfo_errno.hpp> | ||
102 | 33 | #include <boost/throw_exception.hpp> | ||
103 | 34 | |||
104 | 35 | #include <mutex> | ||
105 | 36 | #include <stdexcept> | ||
106 | 37 | #include <cstring> | ||
107 | 38 | |||
108 | 39 | namespace mg = mir::graphics; | ||
109 | 40 | namespace mgm = mg::mesa; | ||
110 | 41 | |||
111 | 42 | namespace | ||
112 | 43 | { | ||
113 | 44 | //TODO: construction for mclm::ClientPlatform is roundabout/2-step. | ||
114 | 45 | // Might be better for the extension to be a different way to allocate | ||
115 | 46 | // MirConnection, but beyond scope of work. | ||
116 | 47 | void set_guest_gbm_device(mg::PlatformAuthentication& platform_authentication, gbm_device* device) | ||
117 | 48 | { | ||
118 | 49 | std::string const msg{"Nested Mir failed to set the gbm device."}; | ||
119 | 50 | auto ext = platform_authentication.set_gbm_extension(); | ||
120 | 51 | if (ext.is_set()) | ||
121 | 52 | ext.value()->set_gbm_device(device); | ||
122 | 53 | else | ||
123 | 54 | BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir failed to set the gbm device.")); | ||
124 | 55 | } | ||
125 | 56 | } | ||
126 | 57 | |||
127 | 58 | mgm::GuestPlatform::NestedAuthFactory::NestedAuthFactory( | ||
128 | 59 | std::shared_ptr<mg::PlatformAuthentication> const& auth) : | ||
129 | 60 | auth(auth) | ||
130 | 61 | { | ||
131 | 62 | } | ||
132 | 63 | |||
133 | 64 | mir::UniqueModulePtr<mg::PlatformAuthentication> | ||
134 | 65 | mgm::GuestPlatform::NestedAuthFactory::create_platform_authentication() | ||
135 | 66 | { | ||
136 | 67 | return make_module_ptr<mg::AuthenticationWrapper>(auth); | ||
137 | 68 | } | ||
138 | 69 | |||
139 | 70 | mgm::GuestPlatform::GuestPlatform( | ||
140 | 71 | std::shared_ptr<mg::PlatformAuthentication> const& platform_authentication) : | ||
141 | 72 | platform_authentication{platform_authentication}, | ||
142 | 73 | auth_factory{platform_authentication} | ||
143 | 74 | { | ||
144 | 75 | auto ext = platform_authentication->auth_extension(); | ||
145 | 76 | if (!ext.is_set()) | ||
146 | 77 | BOOST_THROW_EXCEPTION(std::runtime_error("could not access drm auth fd")); | ||
147 | 78 | gbm.setup(ext.value()->auth_fd()); | ||
148 | 79 | set_guest_gbm_device(*platform_authentication, gbm.device); | ||
149 | 80 | } | ||
150 | 81 | |||
151 | 82 | mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgm::GuestPlatform::create_buffer_allocator() | ||
152 | 83 | { | ||
153 | 84 | return mir::make_module_ptr<mgm::BufferAllocator>(gbm.device, mgm::BypassOption::prohibited, mgm::BufferImportMethod::gbm_native_pixmap); | ||
154 | 85 | } | ||
155 | 86 | |||
156 | 87 | mir::UniqueModulePtr<mg::PlatformIpcOperations> mgm::GuestPlatform::make_ipc_operations() const | ||
157 | 88 | { | ||
158 | 89 | return mir::make_module_ptr<mgm::IpcOperations>( | ||
159 | 90 | std::make_shared<mgm::NestedAuthentication>(platform_authentication)); | ||
160 | 91 | } | ||
161 | 92 | |||
162 | 93 | mir::UniqueModulePtr<mg::Display> mgm::GuestPlatform::create_display( | ||
163 | 94 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, | ||
164 | 95 | std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) | ||
165 | 96 | { | ||
166 | 97 | BOOST_THROW_EXCEPTION(std::runtime_error("mgm::GuestPlatform cannot create display\n")); | ||
167 | 98 | } | ||
168 | 99 | |||
169 | 100 | mg::NativeDisplayPlatform* mgm::GuestPlatform::native_display_platform() | ||
170 | 101 | { | ||
171 | 102 | return &auth_factory; | ||
172 | 103 | } | ||
173 | 104 | |||
174 | 105 | mg::NativeRenderingPlatform* mgm::GuestPlatform::native_rendering_platform() | ||
175 | 106 | { | ||
176 | 107 | return this; | ||
177 | 108 | } | ||
178 | 109 | |||
179 | 110 | MirEGLNativeDisplayType mgm::GuestPlatform::egl_native_display() const | ||
180 | 111 | { | ||
181 | 112 | return gbm.device; | ||
182 | 113 | } | ||
183 | 114 | |||
184 | 115 | std::vector<mir::ExtensionDescription> mgm::GuestPlatform::extensions() const | ||
185 | 116 | { | ||
186 | 117 | return mgm::mesa_extensions(); | ||
187 | 118 | } | ||
188 | 119 | 0 | ||
189 | === removed file 'src/platforms/mesa/server/kms/guest_platform.h' | |||
190 | --- src/platforms/mesa/server/kms/guest_platform.h 2017-05-17 04:48:46 +0000 | |||
191 | +++ src/platforms/mesa/server/kms/guest_platform.h 1970-01-01 00:00:00 +0000 | |||
192 | @@ -1,73 +0,0 @@ | |||
193 | 1 | /* | ||
194 | 2 | * Copyright © 2013 Canonical Ltd. | ||
195 | 3 | * | ||
196 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
197 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
198 | 6 | * as published by the Free Software Foundation. | ||
199 | 7 | * | ||
200 | 8 | * This program is distributed in the hope that it will be useful, | ||
201 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
202 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
203 | 11 | * GNU Lesser General Public License for more details. | ||
204 | 12 | * | ||
205 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
206 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
207 | 15 | * | ||
208 | 16 | * Authored by: | ||
209 | 17 | * Eleni Maria Stea <elenimaria.stea@canonical.com> | ||
210 | 18 | * Alan Griffiths <alan@octopull.co.uk> | ||
211 | 19 | */ | ||
212 | 20 | |||
213 | 21 | #ifndef MIR_GRAPHICS_MESA_GUEST_PLATFORM_H_ | ||
214 | 22 | #define MIR_GRAPHICS_MESA_GUEST_PLATFORM_H_ | ||
215 | 23 | |||
216 | 24 | #include "mir/graphics/platform.h" | ||
217 | 25 | #include "mir/graphics/platform_authentication.h" | ||
218 | 26 | #include "mir/graphics/platform_ipc_package.h" | ||
219 | 27 | #include "mir/renderer/gl/egl_platform.h" | ||
220 | 28 | #include "display_helpers.h" | ||
221 | 29 | |||
222 | 30 | namespace mir | ||
223 | 31 | { | ||
224 | 32 | namespace graphics | ||
225 | 33 | { | ||
226 | 34 | namespace mesa | ||
227 | 35 | { | ||
228 | 36 | class PlatformAuthentication; | ||
229 | 37 | |||
230 | 38 | class GuestPlatform : public graphics::Platform, | ||
231 | 39 | public graphics::NativeRenderingPlatform, | ||
232 | 40 | public mir::renderer::gl::EGLPlatform | ||
233 | 41 | { | ||
234 | 42 | public: | ||
235 | 43 | GuestPlatform(std::shared_ptr<graphics::PlatformAuthentication> const& platform_authentication_arg); | ||
236 | 44 | |||
237 | 45 | UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override; | ||
238 | 46 | UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override; | ||
239 | 47 | |||
240 | 48 | UniqueModulePtr<Display> create_display( | ||
241 | 49 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, | ||
242 | 50 | std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) override; | ||
243 | 51 | NativeDisplayPlatform* native_display_platform() override; | ||
244 | 52 | std::vector<ExtensionDescription> extensions() const override; | ||
245 | 53 | |||
246 | 54 | NativeRenderingPlatform* native_rendering_platform() override; | ||
247 | 55 | MirServerEGLNativeDisplayType egl_native_display() const override; | ||
248 | 56 | |||
249 | 57 | private: | ||
250 | 58 | std::shared_ptr<graphics::PlatformAuthentication> const platform_authentication; | ||
251 | 59 | |||
252 | 60 | struct NestedAuthFactory : graphics::NativeDisplayPlatform, | ||
253 | 61 | graphics::PlatformAuthenticationFactory | ||
254 | 62 | { | ||
255 | 63 | NestedAuthFactory(std::shared_ptr<graphics::PlatformAuthentication> const&); | ||
256 | 64 | UniqueModulePtr<graphics::PlatformAuthentication> create_platform_authentication() override; | ||
257 | 65 | std::shared_ptr<graphics::PlatformAuthentication> const auth; | ||
258 | 66 | } auth_factory; | ||
259 | 67 | helpers::GBMHelper gbm; | ||
260 | 68 | }; | ||
261 | 69 | } | ||
262 | 70 | } | ||
263 | 71 | } | ||
264 | 72 | |||
265 | 73 | #endif // MIR_GRAPHICS_MESA_GUEST_PLATFORM_H_ | ||
266 | 74 | 0 | ||
267 | === modified file 'src/platforms/mesa/server/kms/platform.cpp' | |||
268 | --- src/platforms/mesa/server/kms/platform.cpp 2017-05-17 04:48:46 +0000 | |||
269 | +++ src/platforms/mesa/server/kms/platform.cpp 2017-06-09 16:24:41 +0000 | |||
270 | @@ -17,7 +17,6 @@ | |||
271 | 17 | */ | 17 | */ |
272 | 18 | 18 | ||
273 | 19 | #include "platform.h" | 19 | #include "platform.h" |
274 | 20 | #include "guest_platform.h" | ||
275 | 21 | #include "buffer_allocator.h" | 20 | #include "buffer_allocator.h" |
276 | 22 | #include "display.h" | 21 | #include "display.h" |
277 | 23 | #include "linux_virtual_terminal.h" | 22 | #include "linux_virtual_terminal.h" |
278 | 24 | 23 | ||
279 | === modified file 'src/platforms/mesa/server/kms/platform_symbols.cpp' | |||
280 | --- src/platforms/mesa/server/kms/platform_symbols.cpp 2017-05-17 04:48:46 +0000 | |||
281 | +++ src/platforms/mesa/server/kms/platform_symbols.cpp 2017-06-09 16:24:41 +0000 | |||
282 | @@ -18,7 +18,6 @@ | |||
283 | 18 | 18 | ||
284 | 19 | #include "platform.h" | 19 | #include "platform.h" |
285 | 20 | #include "gbm_platform.h" | 20 | #include "gbm_platform.h" |
286 | 21 | #include "guest_platform.h" | ||
287 | 22 | #include "linux_virtual_terminal.h" | 21 | #include "linux_virtual_terminal.h" |
288 | 23 | #include "mir/options/program_option.h" | 22 | #include "mir/options/program_option.h" |
289 | 24 | #include "mir/options/option.h" | 23 | #include "mir/options/option.h" |
290 | @@ -245,14 +244,6 @@ | |||
291 | 245 | return &description; | 244 | return &description; |
292 | 246 | } | 245 | } |
293 | 247 | 246 | ||
294 | 248 | mir::UniqueModulePtr<mg::Platform> create_guest_platform( | ||
295 | 249 | std::shared_ptr<mg::DisplayReport> const&, | ||
296 | 250 | std::shared_ptr<mg::PlatformAuthentication> const& platform_authentication) | ||
297 | 251 | { | ||
298 | 252 | mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform); | ||
299 | 253 | return mir::make_module_ptr<mgm::GuestPlatform>(platform_authentication); | ||
300 | 254 | } | ||
301 | 255 | |||
302 | 256 | mir::UniqueModulePtr<mir::graphics::DisplayPlatform> create_display_platform( | 247 | mir::UniqueModulePtr<mir::graphics::DisplayPlatform> create_display_platform( |
303 | 257 | std::shared_ptr<mo::Option> const& options, | 248 | std::shared_ptr<mo::Option> const& options, |
304 | 258 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry, | 249 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry, |
305 | 259 | 250 | ||
306 | === modified file 'src/platforms/mesa/server/x11/graphics/CMakeLists.txt' | |||
307 | --- src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2017-05-08 03:04:26 +0000 | |||
308 | +++ src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2017-06-09 16:24:41 +0000 | |||
309 | @@ -16,7 +16,6 @@ | |||
310 | 16 | mirplatformgraphicsmesax11objects OBJECT | 16 | mirplatformgraphicsmesax11objects OBJECT |
311 | 17 | 17 | ||
312 | 18 | platform.cpp | 18 | platform.cpp |
313 | 19 | guest_platform.cpp | ||
314 | 20 | display.cpp | 19 | display.cpp |
315 | 21 | display_configuration.cpp | 20 | display_configuration.cpp |
316 | 22 | display_buffer.cpp | 21 | display_buffer.cpp |
317 | 23 | 22 | ||
318 | === modified file 'src/platforms/mesa/server/x11/graphics/graphics.cpp' | |||
319 | --- src/platforms/mesa/server/x11/graphics/graphics.cpp 2017-05-17 04:48:46 +0000 | |||
320 | +++ src/platforms/mesa/server/x11/graphics/graphics.cpp 2017-06-09 16:24:41 +0000 | |||
321 | @@ -21,7 +21,6 @@ | |||
322 | 21 | #include "platform.h" | 21 | #include "platform.h" |
323 | 22 | #include "gbm_platform.h" | 22 | #include "gbm_platform.h" |
324 | 23 | #include "platform_common.h" | 23 | #include "platform_common.h" |
325 | 24 | #include "guest_platform.h" | ||
326 | 25 | #include "../X11_resources.h" | 24 | #include "../X11_resources.h" |
327 | 26 | #include "mir/module_deleter.h" | 25 | #include "mir/module_deleter.h" |
328 | 27 | #include "mir/assert_module_entry_point.h" | 26 | #include "mir/assert_module_entry_point.h" |
329 | @@ -67,14 +66,6 @@ | |||
330 | 67 | ); | 66 | ); |
331 | 68 | } | 67 | } |
332 | 69 | 68 | ||
333 | 70 | mir::UniqueModulePtr<mg::Platform> create_guest_platform( | ||
334 | 71 | std::shared_ptr<mg::DisplayReport> const&, | ||
335 | 72 | std::shared_ptr<mg::PlatformAuthentication> const&) | ||
336 | 73 | { | ||
337 | 74 | mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform); | ||
338 | 75 | return mir::make_module_ptr<mgx::GuestPlatform>(); | ||
339 | 76 | } | ||
340 | 77 | |||
341 | 78 | void add_graphics_platform_options(boost::program_options::options_description& config) | 69 | void add_graphics_platform_options(boost::program_options::options_description& config) |
342 | 79 | { | 70 | { |
343 | 80 | mir::assert_entry_point_signature<mg::AddPlatformOptions>(&add_graphics_platform_options); | 71 | mir::assert_entry_point_signature<mg::AddPlatformOptions>(&add_graphics_platform_options); |
344 | 81 | 72 | ||
345 | === removed file 'src/platforms/mesa/server/x11/graphics/guest_platform.cpp' | |||
346 | --- src/platforms/mesa/server/x11/graphics/guest_platform.cpp 2017-05-17 04:48:46 +0000 | |||
347 | +++ src/platforms/mesa/server/x11/graphics/guest_platform.cpp 1970-01-01 00:00:00 +0000 | |||
348 | @@ -1,79 +0,0 @@ | |||
349 | 1 | /* | ||
350 | 2 | * Copyright © 2015 Canonical Ltd. | ||
351 | 3 | * | ||
352 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
353 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
354 | 6 | * as published by the Free Software Foundation. | ||
355 | 7 | * | ||
356 | 8 | * This program is distributed in the hope that it will be useful, | ||
357 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
358 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
359 | 11 | * GNU Lesser General Public License for more details. | ||
360 | 12 | * | ||
361 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
362 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
363 | 15 | * | ||
364 | 16 | * Authored by: | ||
365 | 17 | * Cemil Azizoglu <cemil.azizoglu@canonical.com> | ||
366 | 18 | */ | ||
367 | 19 | |||
368 | 20 | #include "guest_platform.h" | ||
369 | 21 | #include "ipc_operations.h" | ||
370 | 22 | #include "buffer_allocator.h" | ||
371 | 23 | #include "mesa_extensions.h" | ||
372 | 24 | |||
373 | 25 | #include <boost/exception/errinfo_errno.hpp> | ||
374 | 26 | #include <boost/throw_exception.hpp> | ||
375 | 27 | |||
376 | 28 | namespace mg = mir::graphics; | ||
377 | 29 | namespace mgx = mg::X; | ||
378 | 30 | namespace mgm = mg::mesa; | ||
379 | 31 | |||
380 | 32 | mgx::GuestPlatform::GuestPlatform() | ||
381 | 33 | : udev{std::make_shared<mir::udev::Context>()}, | ||
382 | 34 | drm{std::make_shared<mesa::helpers::DRMHelper>(mesa::helpers::DRMNodeToUse::render)} | ||
383 | 35 | { | ||
384 | 36 | drm->setup(udev); | ||
385 | 37 | gbm.setup(*drm); | ||
386 | 38 | auth_factory = std::make_unique<mgm::DRMNativePlatformAuthFactory>(*drm); | ||
387 | 39 | } | ||
388 | 40 | |||
389 | 41 | mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgx::GuestPlatform::create_buffer_allocator() | ||
390 | 42 | { | ||
391 | 43 | return make_module_ptr<mgm::BufferAllocator>( | ||
392 | 44 | gbm.device, | ||
393 | 45 | mgm::BypassOption::prohibited, | ||
394 | 46 | mgm::BufferImportMethod::dma_buf); | ||
395 | 47 | } | ||
396 | 48 | |||
397 | 49 | mir::UniqueModulePtr<mg::PlatformIpcOperations> mgx::GuestPlatform::make_ipc_operations() const | ||
398 | 50 | { | ||
399 | 51 | return make_module_ptr<mg::mesa::IpcOperations>(drm); | ||
400 | 52 | } | ||
401 | 53 | |||
402 | 54 | mir::UniqueModulePtr<mg::Display> mgx::GuestPlatform::create_display( | ||
403 | 55 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, | ||
404 | 56 | std::shared_ptr<graphics::GLConfig> const&) | ||
405 | 57 | { | ||
406 | 58 | BOOST_THROW_EXCEPTION(std::runtime_error("Guest platform cannot create display\n")); | ||
407 | 59 | } | ||
408 | 60 | |||
409 | 61 | mg::NativeDisplayPlatform* mgx::GuestPlatform::native_display_platform() | ||
410 | 62 | { | ||
411 | 63 | return auth_factory.get(); | ||
412 | 64 | } | ||
413 | 65 | |||
414 | 66 | mg::NativeRenderingPlatform* mgx::GuestPlatform::native_rendering_platform() | ||
415 | 67 | { | ||
416 | 68 | return this; | ||
417 | 69 | } | ||
418 | 70 | |||
419 | 71 | MirServerEGLNativeDisplayType mgx::GuestPlatform::egl_native_display() const | ||
420 | 72 | { | ||
421 | 73 | return gbm.device; | ||
422 | 74 | } | ||
423 | 75 | |||
424 | 76 | std::vector<mir::ExtensionDescription> mgx::GuestPlatform::extensions() const | ||
425 | 77 | { | ||
426 | 78 | return mgm::mesa_extensions(); | ||
427 | 79 | } | ||
428 | 80 | 0 | ||
429 | === removed file 'src/platforms/mesa/server/x11/graphics/guest_platform.h' | |||
430 | --- src/platforms/mesa/server/x11/graphics/guest_platform.h 2017-05-17 04:48:46 +0000 | |||
431 | +++ src/platforms/mesa/server/x11/graphics/guest_platform.h 1970-01-01 00:00:00 +0000 | |||
432 | @@ -1,66 +0,0 @@ | |||
433 | 1 | /* | ||
434 | 2 | * Copyright © 2015 Canonical Ltd. | ||
435 | 3 | * | ||
436 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
437 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
438 | 6 | * as published by the Free Software Foundation. | ||
439 | 7 | * | ||
440 | 8 | * This program is distributed in the hope that it will be useful, | ||
441 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
442 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
443 | 11 | * GNU Lesser General Public License for more details. | ||
444 | 12 | * | ||
445 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
446 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
447 | 15 | * | ||
448 | 16 | * Authored by: | ||
449 | 17 | * Cemil Azizoglu <cemil.azizoglu@canonical.com> | ||
450 | 18 | */ | ||
451 | 19 | |||
452 | 20 | #ifndef MIR_GRAPHICS_X_GUEST_PLATFORM_H_ | ||
453 | 21 | #define MIR_GRAPHICS_X_GUEST_PLATFORM_H_ | ||
454 | 22 | |||
455 | 23 | #include "mir/graphics/platform.h" | ||
456 | 24 | #include "display_helpers.h" | ||
457 | 25 | #undef __GBM__ //display_helpers.h sets __GBM__ platform, here need X11 egl platform defs, and gbm utilities | ||
458 | 26 | #include "mir/renderer/gl/egl_platform.h" | ||
459 | 27 | #include "drm_native_platform.h" | ||
460 | 28 | |||
461 | 29 | namespace mir | ||
462 | 30 | { | ||
463 | 31 | namespace graphics | ||
464 | 32 | { | ||
465 | 33 | namespace X | ||
466 | 34 | { | ||
467 | 35 | |||
468 | 36 | class GuestPlatform : public graphics::Platform, | ||
469 | 37 | public graphics::NativeRenderingPlatform, | ||
470 | 38 | public mir::renderer::gl::EGLPlatform | ||
471 | 39 | { | ||
472 | 40 | public: | ||
473 | 41 | GuestPlatform(); | ||
474 | 42 | |||
475 | 43 | UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override; | ||
476 | 44 | UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override; | ||
477 | 45 | |||
478 | 46 | UniqueModulePtr<Display> create_display( | ||
479 | 47 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const&, | ||
480 | 48 | std::shared_ptr<graphics::GLConfig> const&) override; | ||
481 | 49 | NativeDisplayPlatform* native_display_platform() override; | ||
482 | 50 | std::vector<ExtensionDescription> extensions() const override; | ||
483 | 51 | |||
484 | 52 | NativeRenderingPlatform* native_rendering_platform() override; | ||
485 | 53 | MirServerEGLNativeDisplayType egl_native_display() const override; | ||
486 | 54 | |||
487 | 55 | private: | ||
488 | 56 | std::shared_ptr<mir::udev::Context> udev; | ||
489 | 57 | std::shared_ptr<graphics::mesa::helpers::DRMHelper> const drm; | ||
490 | 58 | graphics::mesa::helpers::GBMHelper gbm; | ||
491 | 59 | std::unique_ptr<mesa::DRMNativePlatformAuthFactory> auth_factory; | ||
492 | 60 | }; | ||
493 | 61 | |||
494 | 62 | } | ||
495 | 63 | } | ||
496 | 64 | } | ||
497 | 65 | |||
498 | 66 | #endif // MIR_GRAPHICS_X_GUEST_PLATFORM_H_ | ||
499 | 67 | 0 | ||
500 | === modified file 'tests/mir_test_framework/platform_graphics_throw.cpp' | |||
501 | --- tests/mir_test_framework/platform_graphics_throw.cpp 2017-05-08 03:04:26 +0000 | |||
502 | +++ tests/mir_test_framework/platform_graphics_throw.cpp 2017-06-09 16:24:41 +0000 | |||
503 | @@ -176,10 +176,3 @@ | |||
504 | 176 | return mir::make_module_ptr<ExceptionThrowingPlatform>(); | 176 | return mir::make_module_ptr<ExceptionThrowingPlatform>(); |
505 | 177 | } | 177 | } |
506 | 178 | 178 | ||
507 | 179 | mir::UniqueModulePtr<mg::Platform> create_guest_platform( | ||
508 | 180 | std::shared_ptr<mg::DisplayReport> const&, | ||
509 | 181 | std::shared_ptr<mg::PlatformAuthentication> const&) | ||
510 | 182 | { | ||
511 | 183 | mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform); | ||
512 | 184 | return mir::make_module_ptr<ExceptionThrowingPlatform>(); | ||
513 | 185 | } | ||
514 | 186 | 179 | ||
515 | === modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp' | |||
516 | --- tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-05-31 17:56:19 +0000 | |||
517 | +++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-06-09 16:24:41 +0000 | |||
518 | @@ -375,20 +375,6 @@ | |||
519 | 375 | return mir::make_module_ptr<GuestPlatformAdapter>(nullptr, result); | 375 | return mir::make_module_ptr<GuestPlatformAdapter>(nullptr, result); |
520 | 376 | } | 376 | } |
521 | 377 | 377 | ||
522 | 378 | mir::UniqueModulePtr<mg::Platform> create_guest_platform( | ||
523 | 379 | std::shared_ptr<mg::DisplayReport> const&, | ||
524 | 380 | std::shared_ptr<mg::PlatformAuthentication> const& context) | ||
525 | 381 | { | ||
526 | 382 | mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform); | ||
527 | 383 | auto graphics_platform = the_graphics_platform.lock(); | ||
528 | 384 | if (!graphics_platform) | ||
529 | 385 | { | ||
530 | 386 | static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}}; | ||
531 | 387 | the_graphics_platform = graphics_platform = create_stub_platform(default_display_rects); | ||
532 | 388 | } | ||
533 | 389 | return mir::make_module_ptr<GuestPlatformAdapter>(context, graphics_platform); | ||
534 | 390 | } | ||
535 | 391 | |||
536 | 392 | mir::UniqueModulePtr<mg::DisplayPlatform> create_display_platform( | 378 | mir::UniqueModulePtr<mg::DisplayPlatform> create_display_platform( |
537 | 393 | std::shared_ptr<mo::Option> const&, | 379 | std::shared_ptr<mo::Option> const&, |
538 | 394 | std::shared_ptr<mir::EmergencyCleanupRegistry> const&, | 380 | std::shared_ptr<mir::EmergencyCleanupRegistry> const&, |
539 | 395 | 381 | ||
540 | === modified file 'tests/unit-tests/platforms/mesa/kms/CMakeLists.txt' | |||
541 | --- tests/unit-tests/platforms/mesa/kms/CMakeLists.txt 2017-05-08 03:04:26 +0000 | |||
542 | +++ tests/unit-tests/platforms/mesa/kms/CMakeLists.txt 2017-06-09 16:24:41 +0000 | |||
543 | @@ -14,7 +14,6 @@ | |||
544 | 14 | ${CMAKE_CURRENT_SOURCE_DIR}/test_kms_page_flipper.cpp | 14 | ${CMAKE_CURRENT_SOURCE_DIR}/test_kms_page_flipper.cpp |
545 | 15 | ${CMAKE_CURRENT_SOURCE_DIR}/test_linux_virtual_terminal.cpp | 15 | ${CMAKE_CURRENT_SOURCE_DIR}/test_linux_virtual_terminal.cpp |
546 | 16 | ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor.cpp | 16 | ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor.cpp |
547 | 17 | ${CMAKE_CURRENT_SOURCE_DIR}/test_guest_platform.cpp | ||
548 | 18 | ${CMAKE_CURRENT_SOURCE_DIR}/test_bypass.cpp | 17 | ${CMAKE_CURRENT_SOURCE_DIR}/test_bypass.cpp |
549 | 19 | ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_authentication.cpp | 18 | ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_authentication.cpp |
550 | 20 | ${CMAKE_CURRENT_SOURCE_DIR}/test_drm_helper.cpp | 19 | ${CMAKE_CURRENT_SOURCE_DIR}/test_drm_helper.cpp |
551 | 21 | 20 | ||
552 | === removed file 'tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp' | |||
553 | --- tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp 2017-05-08 03:04:26 +0000 | |||
554 | +++ tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp 1970-01-01 00:00:00 +0000 | |||
555 | @@ -1,106 +0,0 @@ | |||
556 | 1 | /* | ||
557 | 2 | * Copyright © 2013 Canonical Ltd. | ||
558 | 3 | * | ||
559 | 4 | * This program is free software: you can redistribute it and/or modify | ||
560 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
561 | 6 | * published by the Free Software Foundation. | ||
562 | 7 | * | ||
563 | 8 | * This program is distributed in the hope that it will be useful, | ||
564 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
565 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
566 | 11 | * GNU General Public License for more details. | ||
567 | 12 | * | ||
568 | 13 | * You should have received a copy of the GNU General Public License | ||
569 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
570 | 15 | * | ||
571 | 16 | * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> | ||
572 | 17 | */ | ||
573 | 18 | |||
574 | 19 | #include "mir/graphics/platform_authentication.h" | ||
575 | 20 | #include "src/platforms/mesa/server/kms/guest_platform.h" | ||
576 | 21 | #include "mir/graphics/buffer_properties.h" | ||
577 | 22 | #include "mir/graphics/platform_ipc_operations.h" | ||
578 | 23 | #include "mir_toolkit/mesa/platform_operation.h" | ||
579 | 24 | #include "mir_toolkit/extensions/set_gbm_device.h" | ||
580 | 25 | |||
581 | 26 | #include "mir/test/fake_shared.h" | ||
582 | 27 | #include "mir/test/doubles/mock_drm.h" | ||
583 | 28 | #include "mir/test/doubles/mock_gbm.h" | ||
584 | 29 | #include "mir/test/doubles/stub_buffer.h" | ||
585 | 30 | #include "mir/test/doubles/mock_buffer_ipc_message.h" | ||
586 | 31 | #include "mir/test/doubles/fd_matcher.h" | ||
587 | 32 | #include "mir/test/doubles/mock_platform_authentication.h" | ||
588 | 33 | #include "mir/test/doubles/mock_mesa_auth_extensions.h" | ||
589 | 34 | |||
590 | 35 | #include <gtest/gtest.h> | ||
591 | 36 | #include <gmock/gmock.h> | ||
592 | 37 | |||
593 | 38 | #include <cstring> | ||
594 | 39 | #include <fcntl.h> | ||
595 | 40 | |||
596 | 41 | namespace mg = mir::graphics; | ||
597 | 42 | namespace mgm = mir::graphics::mesa; | ||
598 | 43 | namespace mt = mir::test; | ||
599 | 44 | namespace mtd = mir::test::doubles; | ||
600 | 45 | namespace geom = mir::geometry; | ||
601 | 46 | using namespace testing; | ||
602 | 47 | |||
603 | 48 | namespace | ||
604 | 49 | { | ||
605 | 50 | |||
606 | 51 | struct MockSetGbmExt : mg::SetGbmExtension | ||
607 | 52 | { | ||
608 | 53 | MOCK_METHOD1(set_gbm_device, void(gbm_device* dev)); | ||
609 | 54 | }; | ||
610 | 55 | |||
611 | 56 | class MesaGuestPlatformTest : public ::testing::Test | ||
612 | 57 | { | ||
613 | 58 | public: | ||
614 | 59 | MesaGuestPlatformTest() | ||
615 | 60 | : drm_fd{open(drm_device, 0, 0)} | ||
616 | 61 | { | ||
617 | 62 | int fake_fd = 4939; | ||
618 | 63 | ON_CALL(mock_platform_authentication, platform_fd_items()) | ||
619 | 64 | .WillByDefault(Return(std::vector<int>{drm_fd})); | ||
620 | 65 | ON_CALL(mock_platform_authentication, set_gbm_extension()) | ||
621 | 66 | .WillByDefault(Return(mir::optional_value<std::shared_ptr<mg::SetGbmExtension>>{mock_gbm_ext})); | ||
622 | 67 | ON_CALL(mock_platform_authentication, auth_extension()) | ||
623 | 68 | .WillByDefault(Return(mir::optional_value<std::shared_ptr<mg::MesaAuthExtension>>{mock_ext})); | ||
624 | 69 | ON_CALL(*mock_ext, auth_fd()) | ||
625 | 70 | .WillByDefault(Return(mir::Fd{mir::IntOwnedFd{fake_fd}})); | ||
626 | 71 | } | ||
627 | 72 | |||
628 | 73 | protected: | ||
629 | 74 | ::testing::NiceMock<mtd::MockDRM> mock_drm; | ||
630 | 75 | ::testing::NiceMock<mtd::MockGBM> mock_gbm; | ||
631 | 76 | ::testing::NiceMock<mtd::MockPlatformAuthentication> mock_platform_authentication; | ||
632 | 77 | std::shared_ptr<mtd::MockMesaExt> mock_ext = std::make_shared<mtd::MockMesaExt>(); | ||
633 | 78 | std::shared_ptr<MockSetGbmExt> mock_gbm_ext = std::make_shared<MockSetGbmExt>(); | ||
634 | 79 | char const* const drm_device = "/dev/dri/card0"; | ||
635 | 80 | int const drm_fd; | ||
636 | 81 | }; | ||
637 | 82 | |||
638 | 83 | } | ||
639 | 84 | |||
640 | 85 | TEST_F(MesaGuestPlatformTest, auth_fd_is_delegated_to_platform_authentication) | ||
641 | 86 | { | ||
642 | 87 | int const auth_fd{13}; | ||
643 | 88 | |||
644 | 89 | EXPECT_CALL(mock_platform_authentication, set_gbm_extension()); | ||
645 | 90 | EXPECT_CALL(mock_platform_authentication, auth_extension()) | ||
646 | 91 | .Times(2); | ||
647 | 92 | EXPECT_CALL(*mock_ext, auth_fd()) | ||
648 | 93 | .Times(2) | ||
649 | 94 | .WillRepeatedly(Return(mir::Fd{mir::IntOwnedFd{auth_fd}})); | ||
650 | 95 | |||
651 | 96 | mgm::GuestPlatform native(mt::fake_shared(mock_platform_authentication)); | ||
652 | 97 | auto ipc_ops = native.make_ipc_operations(); | ||
653 | 98 | ipc_ops->connection_ipc_package(); | ||
654 | 99 | } | ||
655 | 100 | |||
656 | 101 | TEST_F(MesaGuestPlatformTest, sets_gbm_device_during_initialization) | ||
657 | 102 | { | ||
658 | 103 | EXPECT_CALL(mock_platform_authentication, set_gbm_extension()); | ||
659 | 104 | EXPECT_CALL(*mock_gbm_ext, set_gbm_device(mock_gbm.fake_gbm.device)); | ||
660 | 105 | mgm::GuestPlatform native(mt::fake_shared(mock_platform_authentication)); | ||
661 | 106 | } | ||
662 | 107 | 0 | ||
663 | === modified file 'tests/unit-tests/platforms/mesa/x11/CMakeLists.txt' | |||
664 | --- tests/unit-tests/platforms/mesa/x11/CMakeLists.txt 2017-05-08 03:04:26 +0000 | |||
665 | +++ tests/unit-tests/platforms/mesa/x11/CMakeLists.txt 2017-06-09 16:24:41 +0000 | |||
666 | @@ -2,7 +2,6 @@ | |||
667 | 2 | mir_unit_tests_mesa-x11 | 2 | mir_unit_tests_mesa-x11 |
668 | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/test_platform.cpp | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/test_platform.cpp |
669 | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/test_graphics_platform.cpp | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/test_graphics_platform.cpp |
670 | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_guest_platform.cpp | ||
671 | 6 | ${CMAKE_CURRENT_SOURCE_DIR}/test_display.cpp | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_display.cpp |
672 | 7 | ${CMAKE_CURRENT_SOURCE_DIR}/test_display_generic.cpp | 6 | ${CMAKE_CURRENT_SOURCE_DIR}/test_display_generic.cpp |
673 | 8 | $<TARGET_OBJECTS:mirplatformservermesax11sharedresources> | 7 | $<TARGET_OBJECTS:mirplatformservermesax11sharedresources> |
674 | 9 | 8 | ||
675 | === removed file 'tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp' | |||
676 | --- tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp 2017-05-08 03:04:26 +0000 | |||
677 | +++ tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp 1970-01-01 00:00:00 +0000 | |||
678 | @@ -1,70 +0,0 @@ | |||
679 | 1 | /* | ||
680 | 2 | * Copyright © 2015 Canonical Ltd. | ||
681 | 3 | * | ||
682 | 4 | * This program is free software: you can redistribute it and/or modify | ||
683 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
684 | 6 | * published by the Free Software Foundation. | ||
685 | 7 | * | ||
686 | 8 | * This program is distributed in the hope that it will be useful, | ||
687 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
688 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
689 | 11 | * GNU General Public License for more details. | ||
690 | 12 | * | ||
691 | 13 | * You should have received a copy of the GNU General Public License | ||
692 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
693 | 15 | * | ||
694 | 16 | * Authored by: Cemil Azizoglu <cemil.azizoglu@canonical.com> | ||
695 | 17 | */ | ||
696 | 18 | |||
697 | 19 | #include "src/platforms/mesa/server/x11/graphics/guest_platform.h" | ||
698 | 20 | |||
699 | 21 | #include "mir/test/doubles/mock_drm.h" | ||
700 | 22 | #include "mir/test/doubles/mock_gbm.h" | ||
701 | 23 | |||
702 | 24 | #include <gtest/gtest.h> | ||
703 | 25 | #include <gmock/gmock.h> | ||
704 | 26 | |||
705 | 27 | namespace mgx = mir::graphics::X; | ||
706 | 28 | namespace mtd = mir::test::doubles; | ||
707 | 29 | |||
708 | 30 | namespace | ||
709 | 31 | { | ||
710 | 32 | |||
711 | 33 | class X11GuestPlatformTest : public ::testing::Test | ||
712 | 34 | { | ||
713 | 35 | public: | ||
714 | 36 | void SetUp() | ||
715 | 37 | { | ||
716 | 38 | ::testing::Mock::VerifyAndClearExpectations(&mock_drm); | ||
717 | 39 | ::testing::Mock::VerifyAndClearExpectations(&mock_gbm); | ||
718 | 40 | } | ||
719 | 41 | |||
720 | 42 | std::shared_ptr<mgx::GuestPlatform> create_guest_platform() | ||
721 | 43 | { | ||
722 | 44 | return std::make_shared<mgx::GuestPlatform>(); | ||
723 | 45 | } | ||
724 | 46 | |||
725 | 47 | ::testing::NiceMock<mtd::MockDRM> mock_drm; | ||
726 | 48 | ::testing::NiceMock<mtd::MockGBM> mock_gbm; | ||
727 | 49 | }; | ||
728 | 50 | } | ||
729 | 51 | |||
730 | 52 | TEST_F(X11GuestPlatformTest, failure_to_open_drm_results_in_an_error) | ||
731 | 53 | { | ||
732 | 54 | using namespace ::testing; | ||
733 | 55 | |||
734 | 56 | EXPECT_CALL(mock_drm, open(_,_,_)) | ||
735 | 57 | .WillRepeatedly(Return(-1)); | ||
736 | 58 | |||
737 | 59 | EXPECT_THROW({ create_guest_platform(); }, std::exception); | ||
738 | 60 | } | ||
739 | 61 | |||
740 | 62 | TEST_F(X11GuestPlatformTest, failure_to_create_gbm_device_results_in_an_error) | ||
741 | 63 | { | ||
742 | 64 | using namespace ::testing; | ||
743 | 65 | |||
744 | 66 | EXPECT_CALL(mock_gbm, gbm_create_device(_)) | ||
745 | 67 | .WillRepeatedly(Return(nullptr)); | ||
746 | 68 | |||
747 | 69 | EXPECT_THROW({ create_guest_platform(); }, std::exception); | ||
748 | 70 | } |
See also bug lp:1696974