Mir

Merge lp:~kdub/mir/split-nested into lp:mir

Proposed by Kevin DuBois
Status: Superseded
Proposed branch: lp:~kdub/mir/split-nested
Merge into: lp:mir
Prerequisite: lp:~kdub/mir/split-mesa
Diff against target: 589 lines (+273/-72)
15 files modified
src/include/platform/mir/graphics/platform_authentication_wrapper.h (+42/-0)
src/platforms/android/server/symbols.map.in (+2/-0)
src/platforms/common/server/CMakeLists.txt (+1/-0)
src/platforms/common/server/platform_authentication_wrapper.cpp (+48/-0)
src/platforms/eglstream-kms/server/symbols.map.in (+2/-0)
src/platforms/mesa/server/kms/guest_platform.cpp (+2/-30)
src/platforms/mesa/server/kms/symbols.map.in (+2/-0)
src/platforms/mesa/server/x11/symbols.map.in (+2/-0)
src/server/graphics/default_configuration.cpp (+5/-4)
src/server/graphics/nested/display.cpp (+1/-1)
src/server/graphics/nested/display.h (+3/-3)
src/server/graphics/nested/platform.cpp (+73/-20)
src/server/graphics/nested/platform.h (+55/-14)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+33/-0)
tests/mir_test_framework/symbols-server.map.in (+2/-0)
To merge this branch: bzr merge lp:~kdub/mir/split-nested
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Approve
Review via email: mp+321458@code.launchpad.net

This proposal has been superseded by a proposal from 2017-05-11.

Commit message

prepare the nested platform for providing separate display and rendering hooks. Now the nested platform loads the appropriate /rendering/ platform instead of the 'guest' platform.

Description of the change

prepare the nested platform for providing separate display and rendering hooks. Now the nested platform loads the appropriate /rendering/ platform instead of the 'guest' platform.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4098
https://mir-jenkins.ubuntu.com/job/mir-ci/3283/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4432
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4524
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4514
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4514
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4514
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4464
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4464/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4464
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4464/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4464
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4464/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4464
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4464/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4464
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4464/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4464
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4464/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3283/rebuild

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

OK

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4099
https://mir-jenkins.ubuntu.com/job/mir-ci/3299/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4461
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4576
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4566
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4566
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4566
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4566
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4493
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4493/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4493
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4493/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4493
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4493/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4493
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4493/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4493
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4493/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4493
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4493/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3299/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'src/include/platform/mir/graphics/platform_authentication_wrapper.h'
2--- src/include/platform/mir/graphics/platform_authentication_wrapper.h 1970-01-01 00:00:00 +0000
3+++ src/include/platform/mir/graphics/platform_authentication_wrapper.h 2017-04-04 13:57:35 +0000
4@@ -0,0 +1,42 @@
5+/*
6+ * Copyright © 2017 Canonical Ltd.
7+ *
8+ * This program is free software: you can redistribute it and/or modify it
9+ * under the terms of the GNU Lesser General Public License version 3,
10+ * as published by the Free Software Foundation.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU Lesser General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ *
20+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
21+ */
22+
23+#ifndef MIR_GRAPHICS_PLATFORM_AUTHENTICATION_WRAPPER_H_
24+#define MIR_GRAPHICS_PLATFORM_AUTHENTICATION_WRAPPER_H_
25+#include "mir/graphics/platform_authentication.h"
26+
27+namespace mir
28+{
29+namespace graphics
30+{
31+class AuthenticationWrapper : public PlatformAuthentication
32+{
33+public:
34+ AuthenticationWrapper(std::shared_ptr<PlatformAuthentication> const& auth);
35+ mir::optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() override;
36+ mir::optional_value<std::shared_ptr<SetGbmExtension>> set_gbm_extension() override;
37+ PlatformOperationMessage platform_operation(
38+ unsigned int op, PlatformOperationMessage const& msg) override;
39+ mir::optional_value<Fd> drm_fd() override;
40+private:
41+ std::shared_ptr<PlatformAuthentication> const auth;
42+};
43+}
44+}
45+
46+#endif /* MIR_GRAPHICS_PLATFORM_AUTHENTICATION_WRAPPER_H_ */
47
48=== modified file 'src/platforms/android/server/symbols.map.in'
49--- src/platforms/android/server/symbols.map.in 2016-01-29 08:18:22 +0000
50+++ src/platforms/android/server/symbols.map.in 2017-04-04 13:57:35 +0000
51@@ -5,6 +5,8 @@
52 create_guest_platform;
53 probe_graphics_platform;
54 describe_graphics_module;
55+ create_rendering_platform;
56+ create_display_platform;
57 local:
58 *;
59 };
60
61=== modified file 'src/platforms/common/server/CMakeLists.txt'
62--- src/platforms/common/server/CMakeLists.txt 2017-03-23 14:46:35 +0000
63+++ src/platforms/common/server/CMakeLists.txt 2017-04-04 13:57:35 +0000
64@@ -8,6 +8,7 @@
65 )
66
67 add_library(server_platform_common STATIC
68+ platform_authentication_wrapper.cpp
69 anonymous_shm_file.cpp
70 shm_buffer.cpp
71 shm_file.h
72
73=== added file 'src/platforms/common/server/platform_authentication_wrapper.cpp'
74--- src/platforms/common/server/platform_authentication_wrapper.cpp 1970-01-01 00:00:00 +0000
75+++ src/platforms/common/server/platform_authentication_wrapper.cpp 2017-04-04 13:57:35 +0000
76@@ -0,0 +1,48 @@
77+/*
78+ * Copyright © 2017 Canonical Ltd.
79+ *
80+ * This program is free software: you can redistribute it and/or modify it
81+ * under the terms of the GNU Lesser General Public License version 3,
82+ * as published by the Free Software Foundation.
83+ *
84+ * This program is distributed in the hope that it will be useful,
85+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
86+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87+ * GNU Lesser General Public License for more details.
88+ *
89+ * You should have received a copy of the GNU Lesser General Public License
90+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
91+ *
92+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
93+ */
94+
95+#include "mir/graphics/platform_authentication_wrapper.h"
96+#include "mir/graphics/platform_operation_message.h"
97+
98+namespace mg = mir::graphics;
99+
100+mg::AuthenticationWrapper::AuthenticationWrapper(std::shared_ptr<PlatformAuthentication> const& auth)
101+ : auth(auth)
102+{
103+}
104+
105+mir::optional_value<std::shared_ptr<mg::MesaAuthExtension>> mg::AuthenticationWrapper::auth_extension()
106+{
107+ return auth->auth_extension();
108+}
109+
110+mir::optional_value<std::shared_ptr<mg::SetGbmExtension>> mg::AuthenticationWrapper::set_gbm_extension()
111+{
112+ return auth->set_gbm_extension();
113+}
114+
115+mg::PlatformOperationMessage mg::AuthenticationWrapper::platform_operation(
116+ unsigned int op, mg::PlatformOperationMessage const& msg)
117+{
118+ return auth->platform_operation(op, msg);
119+}
120+
121+mir::optional_value<mir::Fd> mg::AuthenticationWrapper::drm_fd()
122+{
123+ return auth->drm_fd();
124+}
125
126=== modified file 'src/platforms/eglstream-kms/server/symbols.map.in'
127--- src/platforms/eglstream-kms/server/symbols.map.in 2016-05-31 01:21:42 +0000
128+++ src/platforms/eglstream-kms/server/symbols.map.in 2017-04-04 13:57:35 +0000
129@@ -5,6 +5,8 @@
130 create_guest_platform;
131 probe_graphics_platform;
132 describe_graphics_module;
133+ create_rendering_platform;
134+ create_display_platform;
135 local:
136 *;
137 };
138
139=== modified file 'src/platforms/mesa/server/kms/guest_platform.cpp'
140--- src/platforms/mesa/server/kms/guest_platform.cpp 2017-04-04 13:57:34 +0000
141+++ src/platforms/mesa/server/kms/guest_platform.cpp 2017-04-04 13:57:35 +0000
142@@ -23,7 +23,7 @@
143 #include "ipc_operations.h"
144 #include "buffer_allocator.h"
145
146-#include "mir/graphics/platform_authentication.h"
147+#include "mir/graphics/platform_authentication_wrapper.h"
148 #include "mir/graphics/platform_operation_message.h"
149 #include "mir_toolkit/mesa/platform_operation.h"
150 #include "mir_toolkit/extensions/set_gbm_device.h"
151@@ -63,35 +63,7 @@
152 mir::UniqueModulePtr<mg::PlatformAuthentication>
153 mgm::GuestPlatform::NestedAuthFactory::create_platform_authentication()
154 {
155- struct AuthenticationWrapper : mg::PlatformAuthentication
156- {
157- AuthenticationWrapper(std::shared_ptr<PlatformAuthentication> const& auth) :
158- auth(auth)
159- {
160- }
161-
162- mir::optional_value<std::shared_ptr<mg::MesaAuthExtension>> auth_extension() override
163- {
164- return auth->auth_extension();
165- }
166-
167- mir::optional_value<std::shared_ptr<mg::SetGbmExtension>> set_gbm_extension() override
168- {
169- return auth->set_gbm_extension();
170- }
171-
172- mg::PlatformOperationMessage platform_operation(
173- unsigned int op, mg::PlatformOperationMessage const& msg) override
174- {
175- return auth->platform_operation(op, msg);
176- }
177- mir::optional_value<mir::Fd> drm_fd() override
178- {
179- return auth->drm_fd();
180- }
181- std::shared_ptr<mg::PlatformAuthentication> const auth;
182- };
183- return make_module_ptr<AuthenticationWrapper>(auth);
184+ return make_module_ptr<mg::AuthenticationWrapper>(auth);
185 }
186
187 mgm::GuestPlatform::GuestPlatform(
188
189=== modified file 'src/platforms/mesa/server/kms/symbols.map.in'
190--- src/platforms/mesa/server/kms/symbols.map.in 2017-03-09 19:47:04 +0000
191+++ src/platforms/mesa/server/kms/symbols.map.in 2017-04-04 13:57:35 +0000
192@@ -5,6 +5,8 @@
193 create_guest_platform;
194 probe_graphics_platform;
195 describe_graphics_module;
196+ create_rendering_platform;
197+ create_display_platform;
198 local:
199 *;
200 };
201
202=== modified file 'src/platforms/mesa/server/x11/symbols.map.in'
203--- src/platforms/mesa/server/x11/symbols.map.in 2017-03-14 02:26:28 +0000
204+++ src/platforms/mesa/server/x11/symbols.map.in 2017-04-04 13:57:35 +0000
205@@ -5,6 +5,8 @@
206 create_host_platform;
207 create_guest_platform;
208 describe_graphics_module;
209+ create_rendering_platform;
210+ create_display_platform;
211 local: *;
212 };
213
214
215=== modified file 'src/server/graphics/default_configuration.cpp'
216--- src/server/graphics/default_configuration.cpp 2017-03-29 08:30:37 +0000
217+++ src/server/graphics/default_configuration.cpp 2017-04-04 13:57:35 +0000
218@@ -87,11 +87,12 @@
219 auto const host_connection = the_host_connection();
220
221 platform_library = std::make_shared<mir::SharedLibrary>(host_connection->graphics_platform_library());
222+ auto buffer_platform = std::make_shared<mgn::NestedBufferPlatform>(
223+ platform_library, host_connection, the_display_report(), the_options());
224 return std::make_shared<mgn::Platform>(
225- platform_library,
226- host_connection,
227- the_display_report(),
228- *the_options());
229+ buffer_platform,
230+ std::make_unique<mgn::NestedDisplayPlatform>(
231+ buffer_platform, host_connection, the_display_report(), *the_options()));
232 }
233
234 // fallback to standalone if host socket is unset
235
236=== modified file 'src/server/graphics/nested/display.cpp'
237--- src/server/graphics/nested/display.cpp 2017-03-16 07:37:11 +0000
238+++ src/server/graphics/nested/display.cpp 2017-04-04 13:57:35 +0000
239@@ -215,7 +215,7 @@
240 }
241
242 mgn::Display::Display(
243- std::shared_ptr<mg::Platform> const& platform,
244+ std::shared_ptr<mg::RenderingPlatform> const& platform,
245 std::shared_ptr<HostConnection> const& connection,
246 std::shared_ptr<mg::DisplayReport> const& display_report,
247 std::shared_ptr<mg::DisplayConfigurationPolicy> const& initial_conf_policy,
248
249=== modified file 'src/server/graphics/nested/display.h'
250--- src/server/graphics/nested/display.h 2017-02-15 07:38:33 +0000
251+++ src/server/graphics/nested/display.h 2017-04-04 13:57:35 +0000
252@@ -46,7 +46,7 @@
253 class DisplayBuffer;
254 class DisplayConfigurationPolicy;
255 class GLConfig;
256-class Platform;
257+class RenderingPlatform;
258
259 namespace nested
260 {
261@@ -118,7 +118,7 @@
262 {
263 public:
264 Display(
265- std::shared_ptr<graphics::Platform> const& platform,
266+ std::shared_ptr<graphics::RenderingPlatform> const& platform,
267 std::shared_ptr<HostConnection> const& connection,
268 std::shared_ptr<DisplayReport> const& display_report,
269 std::shared_ptr<DisplayConfigurationPolicy> const& conf_policy,
270@@ -155,7 +155,7 @@
271 Frame last_frame_on(unsigned output_id) const override;
272
273 private:
274- std::shared_ptr<graphics::Platform> const platform;
275+ std::shared_ptr<graphics::RenderingPlatform> const platform;
276 std::shared_ptr<HostConnection> const connection;
277 std::shared_ptr<DisplayReport> const display_report;
278 detail::EGLDisplayHandle egl_display;
279
280=== modified file 'src/server/graphics/nested/platform.cpp'
281--- src/server/graphics/nested/platform.cpp 2017-03-23 17:18:29 +0000
282+++ src/server/graphics/nested/platform.cpp 2017-04-04 13:57:35 +0000
283@@ -31,6 +31,7 @@
284 #include "mir/graphics/buffer_ipc_message.h"
285 #include "mir/graphics/platform_ipc_operations.h"
286 #include "mir/graphics/platform_operation_message.h"
287+#include "mir/graphics/platform_authentication_wrapper.h"
288 #include "mir/renderer/gl/egl_platform.h"
289
290 namespace mg = mir::graphics;
291@@ -47,17 +48,17 @@
292 }
293 }
294
295-mgn::Platform::Platform(
296+mgn::NestedBufferPlatform::NestedBufferPlatform(
297 std::shared_ptr<mir::SharedLibrary> const& library,
298 std::shared_ptr<mgn::HostConnection> const& connection,
299 std::shared_ptr<mg::DisplayReport> const& display_report,
300- mo::Option const& options) :
301+ std::shared_ptr<mo::Option> const& options) :
302 library(library),
303 connection(connection),
304 display_report(display_report),
305- guest_platform(library->load_function<mg::CreateGuestPlatform>(
306- "create_guest_platform", MIR_SERVER_GRAPHICS_PLATFORM_VERSION)(display_report, connection)),
307- passthrough_option(passthrough_from_options(options))
308+ rendering_platform(library->load_function<mg::CreateRenderingPlatform>(
309+ "create_rendering_platform", MIR_SERVER_GRAPHICS_PLATFORM_VERSION)(options, connection)),
310+ passthrough_option(passthrough_from_options(*options))
311 {
312 }
313
314@@ -112,25 +113,54 @@
315 };
316 }
317
318-mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgn::Platform::create_buffer_allocator()
319+mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgn::NestedBufferPlatform::create_buffer_allocator()
320 {
321 if (connection->supports_passthrough(mg::BufferUsage::software) ||
322 connection->supports_passthrough(mg::BufferUsage::hardware))
323 {
324- return mir::make_module_ptr<BufferAllocator>(connection, guest_platform->create_buffer_allocator());
325+ return mir::make_module_ptr<BufferAllocator>(connection, rendering_platform->create_buffer_allocator());
326 }
327 else
328 {
329- return guest_platform->create_buffer_allocator();
330+ return rendering_platform->create_buffer_allocator();
331 }
332 }
333
334-mir::UniqueModulePtr<mg::Display> mgn::Platform::create_display(
335+mir::UniqueModulePtr<mg::PlatformIpcOperations> mgn::NestedBufferPlatform::make_ipc_operations() const
336+{
337+ return mir::make_module_ptr<mgn::IpcOperations>(rendering_platform->make_ipc_operations());
338+}
339+
340+EGLNativeDisplayType mgn::NestedBufferPlatform::egl_native_display() const
341+{
342+ if (auto a = dynamic_cast<mir::renderer::gl::EGLPlatform*>(rendering_platform->native_rendering_platform()))
343+ return a->egl_native_display();
344+ return EGL_NO_DISPLAY;
345+}
346+
347+mg::NativeRenderingPlatform* mgn::NestedBufferPlatform::native_rendering_platform()
348+{
349+ return rendering_platform->native_rendering_platform();
350+}
351+
352+mgn::NestedDisplayPlatform::NestedDisplayPlatform(
353+ std::shared_ptr<graphics::RenderingPlatform> const& platform,
354+ std::shared_ptr<mgn::HostConnection> const& connection,
355+ std::shared_ptr<mg::DisplayReport> const& display_report,
356+ mo::Option const& options) :
357+ platform(platform),
358+ connection(connection),
359+ display_report(display_report),
360+ passthrough_option(passthrough_from_options(options))
361+{
362+}
363+
364+mir::UniqueModulePtr<mg::Display> mgn::NestedDisplayPlatform::create_display(
365 std::shared_ptr<mg::DisplayConfigurationPolicy> const& policy,
366 std::shared_ptr<mg::GLConfig> const& config)
367 {
368 return mir::make_module_ptr<mgn::Display>(
369- guest_platform,
370+ platform,
371 connection,
372 display_report,
373 policy,
374@@ -138,24 +168,47 @@
375 passthrough_option);
376 }
377
378+mg::NativeDisplayPlatform* mgn::NestedDisplayPlatform::native_display_platform()
379+{
380+ return this;
381+}
382+
383+mir::UniqueModulePtr<mg::PlatformAuthentication> mgn::NestedDisplayPlatform::create_platform_authentication()
384+{
385+ return make_module_ptr<mg::AuthenticationWrapper>(connection);
386+}
387+
388+mgn::Platform::Platform(
389+ std::shared_ptr<mgn::NestedBufferPlatform> buffer_platform,
390+ std::unique_ptr<mgn::NestedDisplayPlatform> display_platform) :
391+ buffer_platform{std::move(buffer_platform)},
392+ display_platform{std::move(display_platform)}
393+{
394+}
395+
396+mir::UniqueModulePtr<mg::Display> mgn::Platform::create_display(
397+ std::shared_ptr<mg::DisplayConfigurationPolicy> const& initial_conf_policy,
398+ std::shared_ptr<mg::GLConfig> const& gl_config)
399+{
400+ return display_platform->create_display(initial_conf_policy, gl_config);
401+}
402+
403+mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgn::Platform::create_buffer_allocator()
404+{
405+ return buffer_platform->create_buffer_allocator();
406+}
407+
408 mg::NativeDisplayPlatform* mgn::Platform::native_display_platform()
409 {
410- return connection.get();
411+ return display_platform->native_display_platform();
412 }
413
414 mir::UniqueModulePtr<mg::PlatformIpcOperations> mgn::Platform::make_ipc_operations() const
415 {
416- return mir::make_module_ptr<mgn::IpcOperations>(guest_platform->make_ipc_operations());
417-}
418-
419-EGLNativeDisplayType mgn::Platform::egl_native_display() const
420-{
421- if (auto a = dynamic_cast<mir::renderer::gl::EGLPlatform*>(guest_platform->native_rendering_platform()))
422- return a->egl_native_display();
423- return EGL_NO_DISPLAY;
424+ return buffer_platform->make_ipc_operations();
425 }
426
427 mg::NativeRenderingPlatform* mgn::Platform::native_rendering_platform()
428 {
429- return this;
430+ return buffer_platform->native_rendering_platform();
431 }
432
433=== modified file 'src/server/graphics/nested/platform.h'
434--- src/server/graphics/nested/platform.h 2017-03-23 17:18:29 +0000
435+++ src/server/graphics/nested/platform.h 2017-04-04 13:57:35 +0000
436@@ -20,6 +20,7 @@
437 #define MIR_GRAPHICS_NESTED_PLATFORM_H_
438
439 #include "mir/graphics/platform.h"
440+#include "mir/graphics/platform_authentication.h"
441 #include "mir/renderer/gl/egl_platform.h"
442 #include "passthrough_option.h"
443 #include <memory>
444@@ -36,22 +37,44 @@
445 namespace nested
446 {
447 class HostConnection;
448-class Platform : public graphics::Platform,
449- public graphics::NativeRenderingPlatform,
450- public mir::renderer::gl::EGLPlatform
451-{
452-public:
453- Platform(
454+
455+class NestedDisplayPlatform : public graphics::DisplayPlatform,
456+ public graphics::NativeDisplayPlatform,
457+ public graphics::PlatformAuthenticationFactory
458+{
459+public:
460+ NestedDisplayPlatform(
461+ std::shared_ptr<graphics::RenderingPlatform> const& platform,
462+ std::shared_ptr<HostConnection> const& connection,
463+ std::shared_ptr<DisplayReport> const& display_report,
464+ options::Option const& options);
465+
466+ UniqueModulePtr<graphics::Display> create_display(
467+ std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
468+ std::shared_ptr<GLConfig> const& gl_config) override;
469+ NativeDisplayPlatform* native_display_platform() override;
470+ UniqueModulePtr<PlatformAuthentication> create_platform_authentication() override;
471+
472+private:
473+ std::shared_ptr<graphics::RenderingPlatform> const platform;
474+ std::shared_ptr<HostConnection> const connection;
475+ std::shared_ptr<DisplayReport> const display_report;
476+
477+ PassthroughOption const passthrough_option;
478+};
479+
480+class NestedBufferPlatform : public graphics::RenderingPlatform,
481+ public graphics::NativeRenderingPlatform,
482+ public mir::renderer::gl::EGLPlatform
483+{
484+public:
485+ NestedBufferPlatform(
486 std::shared_ptr<mir::SharedLibrary> const& library,
487 std::shared_ptr<HostConnection> const& connection,
488 std::shared_ptr<DisplayReport> const& display_report,
489- options::Option const& options);
490+ std::shared_ptr<options::Option> const& options);
491
492 UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override;
493- UniqueModulePtr<graphics::Display> create_display(
494- std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
495- std::shared_ptr<GLConfig> const& gl_config) override;
496- NativeDisplayPlatform* native_display_platform() override;
497 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
498 NativeRenderingPlatform* native_rendering_platform() override;
499 EGLNativeDisplayType egl_native_display() const override;
500@@ -60,11 +83,29 @@
501 std::shared_ptr<HostConnection> const connection;
502 std::shared_ptr<DisplayReport> const display_report;
503
504- //the concept of guest platform is strange, it only exists to deny creating a
505- //host display in a nested context. It should go away soon.
506- std::shared_ptr<graphics::Platform> const guest_platform;
507+ std::shared_ptr<graphics::RenderingPlatform> const rendering_platform;
508 PassthroughOption const passthrough_option;
509 };
510+
511+class Platform : public graphics::Platform
512+{
513+public:
514+ Platform(
515+ std::shared_ptr<NestedBufferPlatform> buffer_platform,
516+ std::unique_ptr<NestedDisplayPlatform> display_platform);
517+ UniqueModulePtr<graphics::Display> create_display(
518+ std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
519+ std::shared_ptr<GLConfig> const& gl_config) override;
520+ NativeDisplayPlatform* native_display_platform() override;
521+
522+ UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override;
523+ UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
524+ NativeRenderingPlatform* native_rendering_platform() override;
525+private:
526+ std::shared_ptr<NestedBufferPlatform> const buffer_platform;
527+ std::unique_ptr<NestedDisplayPlatform> const display_platform;
528+};
529+
530 }
531 }
532 }
533
534=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
535--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-03-23 14:46:35 +0000
536+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-04-04 13:57:35 +0000
537@@ -372,6 +372,39 @@
538 return mir::make_module_ptr<GuestPlatformAdapter>(context, graphics_platform);
539 }
540
541+mir::UniqueModulePtr<mg::DisplayPlatform> create_display_platform(
542+ std::shared_ptr<mo::Option> const&,
543+ std::shared_ptr<mir::EmergencyCleanupRegistry> const&,
544+ std::shared_ptr<mg::DisplayReport> const&,
545+ std::shared_ptr<mir::logging::Logger> const&)
546+{
547+ mir::assert_entry_point_signature<mg::CreateDisplayPlatform>(&create_display_platform);
548+ std::shared_ptr<mg::Platform> result{};
549+
550+ if (auto const display_rects = std::move(chosen_display_rects))
551+ {
552+ result = create_stub_platform(*display_rects);
553+ }
554+ else
555+ {
556+ static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};
557+ result = create_stub_platform(default_display_rects);
558+ }
559+ the_graphics_platform = result;
560+ return mir::make_module_ptr<GuestPlatformAdapter>(nullptr, result);
561+}
562+
563+mir::UniqueModulePtr<mir::graphics::RenderingPlatform> create_rendering_platform(
564+ std::shared_ptr<mir::options::Option> const&,
565+ std::shared_ptr<mir::graphics::PlatformAuthentication> const&)
566+{
567+ mir::assert_entry_point_signature<mg::CreateRenderingPlatform>(&create_rendering_platform);
568+
569+ static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};
570+ auto result = create_stub_platform(default_display_rects);
571+ return mir::make_module_ptr<GuestPlatformAdapter>(nullptr, result);
572+}
573+
574 void add_graphics_platform_options(
575 boost::program_options::options_description& /*config*/)
576 {
577
578=== modified file 'tests/mir_test_framework/symbols-server.map.in'
579--- tests/mir_test_framework/symbols-server.map.in 2016-01-29 08:18:22 +0000
580+++ tests/mir_test_framework/symbols-server.map.in 2017-04-04 13:57:35 +0000
581@@ -3,6 +3,8 @@
582 add_graphics_platform_options;
583 create_host_platform;
584 create_guest_platform;
585+ create_display_platform;
586+ create_rendering_platform;
587 probe_graphics_platform;
588 describe_graphics_module;
589 };

Subscribers

People subscribed via source and target branches