Mir

Merge lp:~alan-griffiths/mir/split-nested into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 4182
Proposed branch: lp:~alan-griffiths/mir/split-nested
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/split-mesa
Diff against target: 592 lines (+280/-75)
14 files modified
src/include/platform/mir/graphics/platform_authentication_wrapper.h (+42/-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 (+80/-22)
src/server/graphics/nested/platform.h (+57/-15)
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:~alan-griffiths/mir/split-nested
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Andreas Pokorny (community) Approve
Alan Griffiths Pending
Review via email: mp+323910@code.launchpad.net

This proposal supersedes a proposal from 2017-03-30.

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

OK

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

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)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4168
https://mir-jenkins.ubuntu.com/job/mir-ci/3394/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4612
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4741
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4730
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4730
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4644
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4644/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/4644
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4644/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4644
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4644/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4644
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4644/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/4644
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4644/artifact/output/*zip*/output.zip

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

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

PASSED: Continuous integration, rev:4169
https://mir-jenkins.ubuntu.com/job/mir-ci/3396/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4614
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4743
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4732
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4732
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4646
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4646/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/4646
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4646/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4646
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4646/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4646
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4646/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/4646
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4646/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

I still think that PlatformAuthentication could be changed into a single function interface that just resolves "extensions".. But the only use is for gbm/mesa for authentication - so we can keep it specific.

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

> I still think that PlatformAuthentication could be changed into a single
> function interface that just resolves "extensions".. But the only use is for
> gbm/mesa for authentication - so we can keep it specific.

Good point. But I was mostly wanting to land the WIP.

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

Subscribers

People subscribed via source and target branches