Mir

Merge lp:~kdub/mir/drm-auth-from-display into lp:mir

Proposed by Kevin DuBois
Status: Superseded
Proposed branch: lp:~kdub/mir/drm-auth-from-display
Merge into: lp:mir
Prerequisite: lp:~kdub/mir/rename-nested-context
Diff against target: 992 lines (+328/-62)
32 files modified
include/platform/mir/graphics/platform.h (+20/-6)
include/platform/mir/graphics/platform_authentication.h (+2/-0)
include/test/mir/test/doubles/mock_platform_authentication.h (+2/-0)
include/test/mir/test/doubles/null_platform.h (+6/-1)
src/platforms/android/server/platform.cpp (+7/-2)
src/platforms/android/server/platform.h (+3/-2)
src/platforms/eglstream-kms/server/platform.cpp (+6/-1)
src/platforms/eglstream-kms/server/platform.h (+3/-2)
src/platforms/mesa/server/CMakeLists.txt (+1/-0)
src/platforms/mesa/server/drm_native_platform.cpp (+79/-0)
src/platforms/mesa/server/drm_native_platform.h (+52/-0)
src/platforms/mesa/server/kms/guest_platform.cpp (+39/-3)
src/platforms/mesa/server/kms/guest_platform.h (+7/-5)
src/platforms/mesa/server/kms/nested_authentication.h (+1/-1)
src/platforms/mesa/server/kms/platform.cpp (+9/-2)
src/platforms/mesa/server/kms/platform.h (+6/-3)
src/platforms/mesa/server/x11/graphics/graphics.cpp (+3/-3)
src/platforms/mesa/server/x11/graphics/guest_platform.cpp (+8/-5)
src/platforms/mesa/server/x11/graphics/guest_platform.h (+6/-3)
src/platforms/mesa/server/x11/graphics/platform.cpp (+7/-1)
src/platforms/mesa/server/x11/graphics/platform.h (+5/-2)
src/server/graphics/default_configuration.cpp (+1/-1)
src/server/graphics/nested/host_connection.h (+3/-1)
src/server/graphics/nested/mir_client_host_connection.cpp (+5/-0)
src/server/graphics/nested/mir_client_host_connection.h (+2/-0)
src/server/graphics/nested/platform.cpp (+7/-2)
src/server/graphics/nested/platform.h (+3/-2)
tests/include/mir/test/doubles/stub_host_connection.h (+4/-0)
tests/integration-tests/test_submit_buffer.cpp (+2/-1)
tests/mir_test_framework/platform_graphics_throw.cpp (+20/-9)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+8/-3)
tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp (+1/-1)
To merge this branch: bzr merge lp:~kdub/mir/drm-auth-from-display
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Kevin DuBois (community) Needs Resubmitting
Chris Halse Rogers Needs Fixing
Review via email: mp+320493@code.launchpad.net

This proposal has been superseded by a proposal from 2017-03-23.

Commit message

Give the authentication the BufferPlatform needs from the DisplayPlatform.

With android and nvidia, the DisplayPlatform and RenderingPlatform don't really have a dependency between each other.

Mesa needs a fd (sourced from /dev/dri/card* or /dev/dri/render*, as appropriate) to initialize the RenderingPlatform, specifically, it needs it to initialize the gbm device. The platform also gives out authenticated fds over IPC to clients via mir::frontend.

This fd is best owned by the DisplayPlatform (nested, kms, and x11 all do things a bit differently, but all need to provide fds so that gbm devices can be made), and given to the RenderingPlatform. This is already setup in the RenderingPlatform creation hook.

Description of the change

Give the authentication the BufferPlatform needs from the DisplayPlatform.

With android and nvidia, the DisplayPlatform and RenderingPlatform don't really have a dependency between each other.

Mesa needs a fd (sourced from /dev/dri/card* or /dev/dri/render*, as appropriate) to initialize the RenderingPlatform, specifically, it needs it to initialize the gbm device. The platform also gives out authenticated fds over IPC to clients via mir::frontend.

This fd is best owned by the DisplayPlatform (nested, kms, and x11 all do things a bit differently, but all need to provide fds so that gbm devices can be made), and given to the RenderingPlatform. This is already setup in the RenderingPlatform creation hook.

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

FAILED: Continuous integration, rev:4097
https://mir-jenkins.ubuntu.com/job/mir-ci/3205/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4309/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4396
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4386
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4386
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4386
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4341
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4341/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/4341
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4341/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4341
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4341/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4341/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4341/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4341
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4341/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
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/3206/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4310
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4397
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4387
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4387
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4387
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4342
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4342/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/4342
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4342/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4342
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4342/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/4342
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4342/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/4342
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4342/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/4342
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4342/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

Meta-review: Do we actually *need* an authenticated fd anywhere? I don't think that we do - the only thing the client needs to do is allocate buffers and create dma-buf FDs from them, both of which can definitely be done on a rendernode and I *think* be done on an unauthed regular node, too.

So, needs information: does this code need to exist at all?

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

In the 'mesa-kms' case, the gbm platform and the kms output seem to need to share the same fd for things to work. (hence the need for the drm_fd() function as a point of communication between the rendering/display platforms).

Maybe we don't need authenticated fds anymore in the 'perfect world' sense, it seems a lot better if non-root things merely use rendernodes. The current code supports extensions to provide the auth_fd and uses the auth_fd in a few different places, so in the practical sense, it probably has to remain for now. I'm just visiting this area to extrude the rendering/display components from the platform as a cleanup while I tinker with swrast rendering and offscreen options

So some sort of authenticated fd provision is needed from the Display. Getting rid of authenticated FD's will eliminate one of the fns from the PlatformAuthentication, and figuring out if things can be disentangled for mesa-kms further might be able to get rid of drm_fd(). I don't really want to add restructuring the render-device-access bits as an additional cleanup, the goal is to sort out our platform probing within the existing ways the platforms are working.

Revision history for this message
Chris Halse Rogers (raof) wrote :

Hm. The gbm platform and the kms output don't actually need to share the same fd, but a couple of calls will need to be changed to make that happen.

I can fix that bit.

OK. Empirical testing! Nothing breaks if you comment out all the drmAuth* calls in display_helper.cpp. Then authenticated_fd() returns a drm fd, but it's not authenticated.

We don't need authenticated fds *right now* (and, I suspect, we never actually did?).

Oh, right. DRI2 in XMir requires authMagic. Didn't test that :).

*********************************

So, I still think this is a needs-fixing: we're sticking a mesa-kms-only member into the generic DisplayPlatform interface. This seems like a job for the RenderPlatform dynamic_cast<mgm::DisplayPlatform>-ing.

Alternatively, implement mir_buffer_from_gbm_bo(), port XMir over to it (enabling DRI3 in the process), and then the RenderPlatform is independent of the DisplayPlatform again :).

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

I don't mind doing the casting pattern for this usage. I'll probably stick that in an MP that this one will sit on top of.

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

reworking, will resubmit on top of other MP.

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

PASSED: Continuous integration, rev:4101
https://mir-jenkins.ubuntu.com/job/mir-ci/3230/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4345
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4432
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4422
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4422
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4422
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4377
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4377/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/4377
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4377/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4377
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4377/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/4377
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4377/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/4377
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4377/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/4377
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4377/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/platform/mir/graphics/platform.h'
2--- include/platform/mir/graphics/platform.h 2017-03-22 05:31:00 +0000
3+++ include/platform/mir/graphics/platform.h 2017-03-23 17:31:31 +0000
4@@ -53,13 +53,13 @@
5 class GLConfig;
6 class PlatformIpcOperations;
7 class PlatformAuthentication;
8-class NativePlatform
9+class NativeRenderingPlatform
10 {
11 protected:
12- NativePlatform() = default;
13- virtual ~NativePlatform() = default;
14- NativePlatform(NativePlatform const&) = delete;
15- NativePlatform& operator=(NativePlatform const&) = delete;
16+ NativeRenderingPlatform() = default;
17+ virtual ~NativeRenderingPlatform() = default;
18+ NativeRenderingPlatform(NativeRenderingPlatform const&) = delete;
19+ NativeRenderingPlatform& operator=(NativeRenderingPlatform const&) = delete;
20 };
21
22 /**
23@@ -95,7 +95,16 @@
24 * Access the native resource[s] used to connect to the rendering backend
25 * for this platform
26 */
27- virtual NativePlatform* native_platform() = 0;
28+ virtual NativeRenderingPlatform* native_rendering_platform() = 0;
29+};
30+
31+class NativeDisplayPlatform
32+{
33+protected:
34+ NativeDisplayPlatform() = default;
35+ virtual ~NativeDisplayPlatform() = default;
36+ NativeDisplayPlatform(NativeDisplayPlatform const&) = delete;
37+ NativeDisplayPlatform& operator=(NativeDisplayPlatform const&) = delete;
38 };
39
40 class DisplayPlatform
41@@ -113,6 +122,11 @@
42 virtual UniqueModulePtr<Display> create_display(
43 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
44 std::shared_ptr<GLConfig> const& gl_config) = 0;
45+
46+ /**
47+ * Access the platform-specific resource[s] from the display.
48+ */
49+ virtual NativeDisplayPlatform* native_display_platform() = 0;
50 };
51
52 class Platform : public DisplayPlatform,
53
54=== modified file 'include/platform/mir/graphics/platform_authentication.h'
55--- include/platform/mir/graphics/platform_authentication.h 2017-03-16 12:08:38 +0000
56+++ include/platform/mir/graphics/platform_authentication.h 2017-03-23 17:31:31 +0000
57@@ -64,6 +64,8 @@
58 virtual mir::optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() = 0;
59 virtual mir::optional_value<std::shared_ptr<SetGbmExtension>> set_gbm_extension() = 0;
60
61+ virtual mir::optional_value<mir::Fd> drm_fd() = 0;
62+
63 virtual PlatformOperationMessage platform_operation(
64 unsigned int op, PlatformOperationMessage const& request) = 0;
65
66
67=== renamed file 'tests/include/mir/test/doubles/mock_platform_authentication.h' => 'include/test/mir/test/doubles/mock_platform_authentication.h'
68--- tests/include/mir/test/doubles/mock_platform_authentication.h 2017-03-16 12:08:38 +0000
69+++ include/test/mir/test/doubles/mock_platform_authentication.h 2017-03-23 17:31:31 +0000
70@@ -21,6 +21,7 @@
71
72 #include "mir/graphics/platform_authentication.h"
73 #include "mir/graphics/platform_operation_message.h"
74+#include <gmock/gmock.h>
75
76 namespace mir
77 {
78@@ -51,6 +52,7 @@
79 unsigned int, graphics::PlatformOperationMessage const&));
80 MOCK_METHOD0(auth_extension, optional_value<std::shared_ptr<graphics::MesaAuthExtension>>());
81 MOCK_METHOD0(set_gbm_extension, optional_value<std::shared_ptr<graphics::SetGbmExtension>>());
82+ MOCK_METHOD0(drm_fd, optional_value<mir::Fd>());
83 MOCK_METHOD2(request_interface, void*(char const*, int));
84 };
85
86
87=== modified file 'include/test/mir/test/doubles/null_platform.h'
88--- include/test/mir/test/doubles/null_platform.h 2017-03-16 07:37:11 +0000
89+++ include/test/mir/test/doubles/null_platform.h 2017-03-23 17:31:31 +0000
90@@ -46,12 +46,17 @@
91 return mir::make_module_ptr<NullDisplay>();
92 }
93
94+ graphics::NativeDisplayPlatform* native_display_platform() override
95+ {
96+ return nullptr;
97+ }
98+
99 mir::UniqueModulePtr<graphics::PlatformIpcOperations> make_ipc_operations() const override
100 {
101 return mir::make_module_ptr<NullPlatformIpcOperations>();
102 }
103
104- graphics::NativePlatform* native_platform() override
105+ graphics::NativeRenderingPlatform* native_rendering_platform() override
106 {
107 return nullptr;
108 }
109
110=== modified file 'src/platforms/android/server/platform.cpp'
111--- src/platforms/android/server/platform.cpp 2017-03-22 05:31:00 +0000
112+++ src/platforms/android/server/platform.cpp 2017-03-23 17:31:31 +0000
113@@ -157,12 +157,17 @@
114 display_buffer_builder, program_factory, gl_config, display_report, native_window_report, overlay_option);
115 }
116
117+mg::NativeDisplayPlatform* mga::Platform::native_display_platform()
118+{
119+ return nullptr;
120+}
121+
122 mir::UniqueModulePtr<mg::PlatformIpcOperations> mga::Platform::make_ipc_operations() const
123 {
124 return mir::make_module_ptr<mga::IpcOperations>();
125 }
126
127-mg::NativePlatform* mga::Platform::native_platform()
128+mg::NativeRenderingPlatform* mga::Platform::native_rendering_platform()
129 {
130 return this;
131 }
132@@ -210,7 +215,7 @@
133 sync_factory = std::make_shared<mga::NullCommandStreamSyncFactory>();
134
135 //TODO: remove nullptr parameter once platform classes are sorted.
136- // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder
137+ // mg::NativeRenderingPlatform cannot create a display anyways, so it doesnt need a display builder
138 auto const buffer_allocator = std::make_shared<mga::GraphicBufferAllocator>(sync_factory, quirks);
139 return mir::make_module_ptr<mga::Platform>(
140 buffer_allocator, nullptr, display_report,
141
142=== modified file 'src/platforms/android/server/platform.h'
143--- src/platforms/android/server/platform.h 2017-03-21 07:57:17 +0000
144+++ src/platforms/android/server/platform.h 2017-03-23 17:31:31 +0000
145@@ -39,7 +39,7 @@
146 class NativeWindowReport;
147
148 class Platform : public graphics::Platform,
149- public graphics::NativePlatform,
150+ public graphics::NativeRenderingPlatform,
151 public mir::renderer::gl::EGLPlatform
152 {
153 public:
154@@ -56,8 +56,9 @@
155 UniqueModulePtr<Display> create_display(
156 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
157 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) override;
158+ NativeDisplayPlatform* native_display_platform() override;
159 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
160- NativePlatform* native_platform() override;
161+ NativeRenderingPlatform* native_rendering_platform() override;
162 EGLNativeDisplayType egl_native_display() const override;
163
164 private:
165
166=== modified file 'src/platforms/eglstream-kms/server/platform.cpp'
167--- src/platforms/eglstream-kms/server/platform.cpp 2017-03-16 07:37:11 +0000
168+++ src/platforms/eglstream-kms/server/platform.cpp 2017-03-23 17:31:31 +0000
169@@ -113,6 +113,11 @@
170 return mir::make_module_ptr<mge::Display>(drm_node, display, configuration_policy, *gl_config);
171 }
172
173+mg::NativeDisplayPlatform* mge::Platform::native_display_platform()
174+{
175+ return nullptr;
176+}
177+
178 mir::UniqueModulePtr<mg::PlatformIpcOperations> mge::Platform::make_ipc_operations() const
179 {
180 class NoIPCOperations : public mg::PlatformIpcOperations
181@@ -161,7 +166,7 @@
182 return mir::make_module_ptr<NoIPCOperations>();
183 }
184
185-mg::NativePlatform* mge::Platform::native_platform()
186+mg::NativeRenderingPlatform* mge::Platform::native_rendering_platform()
187 {
188 return this;
189 }
190
191=== modified file 'src/platforms/eglstream-kms/server/platform.h'
192--- src/platforms/eglstream-kms/server/platform.h 2017-03-16 07:37:11 +0000
193+++ src/platforms/eglstream-kms/server/platform.h 2017-03-23 17:31:31 +0000
194@@ -37,7 +37,7 @@
195 namespace eglstream
196 {
197 class Platform : public graphics::Platform,
198- public graphics::NativePlatform,
199+ public graphics::NativeRenderingPlatform,
200 public mir::renderer::gl::EGLPlatform
201 {
202 public:
203@@ -52,10 +52,11 @@
204 UniqueModulePtr<Display> create_display(
205 std::shared_ptr<DisplayConfigurationPolicy> const& /*initial_conf_policy*/,
206 std::shared_ptr<GLConfig> const& /*gl_config*/) override;
207+ NativeDisplayPlatform* native_display_platform() override;
208
209 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
210
211- NativePlatform* native_platform() override;
212+ NativeRenderingPlatform* native_rendering_platform() override;
213 EGLNativeDisplayType egl_native_display() const override;
214
215 private:
216
217=== modified file 'src/platforms/mesa/server/CMakeLists.txt'
218--- src/platforms/mesa/server/CMakeLists.txt 2017-01-18 02:29:37 +0000
219+++ src/platforms/mesa/server/CMakeLists.txt 2017-03-23 17:31:31 +0000
220@@ -19,6 +19,7 @@
221 gbm_buffer.cpp
222 ipc_operations.cpp
223 software_buffer.cpp
224+ drm_native_platform.cpp
225 )
226
227 target_link_libraries(
228
229=== added file 'src/platforms/mesa/server/drm_native_platform.cpp'
230--- src/platforms/mesa/server/drm_native_platform.cpp 1970-01-01 00:00:00 +0000
231+++ src/platforms/mesa/server/drm_native_platform.cpp 2017-03-23 17:31:31 +0000
232@@ -0,0 +1,79 @@
233+/*
234+ * Copyright © 2017 Canonical Ltd.
235+ *
236+ * This program is free software: you can redistribute it and/or modify it
237+ * under the terms of the GNU Lesser General Public License version 3,
238+ * as published by the Free Software Foundation.
239+ *
240+ * This program is distributed in the hope that it will be useful,
241+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
242+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
243+ * GNU Lesser General Public License for more details.
244+ *
245+ * You should have received a copy of the GNU Lesser General Public License
246+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
247+ *
248+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
249+ */
250+
251+#include "drm_native_platform.h"
252+#include "display_helpers.h"
253+#include "mir/graphics/platform_operation_message.h"
254+#include <boost/throw_exception.hpp>
255+
256+namespace mg = mir::graphics;
257+namespace mgm = mg::mesa;
258+
259+mgm::DRMNativePlatform::DRMNativePlatform(mgm::helpers::DRMHelper& drm) :
260+ drm(drm)
261+{
262+}
263+
264+mir::optional_value<std::shared_ptr<mg::MesaAuthExtension>> mgm::DRMNativePlatform::auth_extension()
265+{
266+ class DRMAuth : public MesaAuthExtension
267+ {
268+ public:
269+ DRMAuth(mgm::helpers::DRMHelper& drm) :
270+ drm(drm)
271+ {
272+ }
273+
274+ mir::Fd auth_fd() override
275+ {
276+ return mir::Fd(drm.authenticated_fd());
277+ }
278+
279+ int auth_magic(unsigned int magic) override
280+ {
281+ try
282+ {
283+ drm.auth_magic(magic);
284+ return 0;
285+ }
286+ catch ( std::runtime_error& )
287+ {
288+ return -1;
289+ }
290+ }
291+ private:
292+ mgm::helpers::DRMHelper& drm;
293+ };
294+ return {std::make_shared<DRMAuth>(drm)};
295+}
296+
297+mir::optional_value<std::shared_ptr<mg::SetGbmExtension>> mgm::DRMNativePlatform::set_gbm_extension()
298+{
299+ return {};
300+}
301+
302+mg::PlatformOperationMessage mgm::DRMNativePlatform::platform_operation(
303+ unsigned int, mg::PlatformOperationMessage const&)
304+{
305+ BOOST_THROW_EXCEPTION(std::runtime_error("platform_operation deprecated"));
306+}
307+
308+mir::optional_value<mir::Fd> mgm::DRMNativePlatform::drm_fd()
309+{
310+ return {mir::Fd(IntOwnedFd{drm.fd})};
311+}
312
313=== added file 'src/platforms/mesa/server/drm_native_platform.h'
314--- src/platforms/mesa/server/drm_native_platform.h 1970-01-01 00:00:00 +0000
315+++ src/platforms/mesa/server/drm_native_platform.h 2017-03-23 17:31:31 +0000
316@@ -0,0 +1,52 @@
317+/*
318+ * Copyright © 2017 Canonical Ltd.
319+ *
320+ * This program is free software: you can redistribute it and/or modify it
321+ * under the terms of the GNU Lesser General Public License version 3,
322+ * as published by the Free Software Foundation.
323+ *
324+ * This program is distributed in the hope that it will be useful,
325+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
326+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
327+ * GNU Lesser General Public License for more details.
328+ *
329+ * You should have received a copy of the GNU Lesser General Public License
330+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
331+ *
332+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
333+ */
334+
335+#ifndef MIR_GRAPHICS_MESA_DRM_NATIVE_PLATFORM_H_
336+#define MIR_GRAPHICS_MESA_DRM_NATIVE_PLATFORM_H_
337+
338+#include "mir/graphics/platform.h"
339+#include "mir/graphics/platform_authentication.h"
340+
341+namespace mir
342+{
343+namespace graphics
344+{
345+namespace mesa
346+{
347+namespace helpers
348+{
349+class DRMHelper;
350+}
351+class DRMNativePlatform : public graphics::NativeDisplayPlatform,
352+ public graphics::PlatformAuthentication
353+{
354+public:
355+ DRMNativePlatform(helpers::DRMHelper&);
356+ mir::optional_value<std::shared_ptr<graphics::MesaAuthExtension>> auth_extension() override;
357+ mir::optional_value<std::shared_ptr<graphics::SetGbmExtension>> set_gbm_extension() override;
358+ PlatformOperationMessage platform_operation(
359+ unsigned int, PlatformOperationMessage const&) override;
360+ mir::optional_value<mir::Fd> drm_fd() override;
361+private:
362+ helpers::DRMHelper& drm;
363+};
364+}
365+}
366+}
367+
368+#endif /* MIR_GRAPHICS_MESA_DRM_NATIVE_PLATFORM_H_ */
369
370=== modified file 'src/platforms/mesa/server/kms/guest_platform.cpp'
371--- src/platforms/mesa/server/kms/guest_platform.cpp 2017-03-22 05:31:00 +0000
372+++ src/platforms/mesa/server/kms/guest_platform.cpp 2017-03-23 17:31:31 +0000
373@@ -52,11 +52,42 @@
374 else
375 BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir failed to set the gbm device."));
376 }
377+
378+struct AuthenticationWrapper : mg::NativeDisplayPlatform,
379+ mg::PlatformAuthentication
380+{
381+ AuthenticationWrapper(std::shared_ptr<PlatformAuthentication> const& auth) :
382+ auth(auth)
383+ {
384+ }
385+
386+ mir::optional_value<std::shared_ptr<mg::MesaAuthExtension>> auth_extension() override
387+ {
388+ return auth->auth_extension();
389+ }
390+
391+ mir::optional_value<std::shared_ptr<mg::SetGbmExtension>> set_gbm_extension() override
392+ {
393+ return auth->set_gbm_extension();
394+ }
395+
396+ mg::PlatformOperationMessage platform_operation(
397+ unsigned int op, mg::PlatformOperationMessage const& msg) override
398+ {
399+ return auth->platform_operation(op, msg);
400+ }
401+ mir::optional_value<mir::Fd> drm_fd() override
402+ {
403+ return auth->drm_fd();
404+ }
405+ std::shared_ptr<mg::PlatformAuthentication> const auth;
406+};
407 }
408
409 mgm::GuestPlatform::GuestPlatform(
410- std::shared_ptr<PlatformAuthentication> const& platform_authentication)
411- : platform_authentication{platform_authentication}
412+ std::shared_ptr<mg::PlatformAuthentication> const& platform_authentication) :
413+ platform_authentication{platform_authentication},
414+ auth(std::make_shared<AuthenticationWrapper>(platform_authentication))
415 {
416 auto ext = platform_authentication->auth_extension();
417 if (!ext.is_set())
418@@ -83,7 +114,12 @@
419 BOOST_THROW_EXCEPTION(std::runtime_error("mgm::GuestPlatform cannot create display\n"));
420 }
421
422-mg::NativePlatform* mgm::GuestPlatform::native_platform()
423+mg::NativeDisplayPlatform* mgm::GuestPlatform::native_display_platform()
424+{
425+ return auth.get();
426+}
427+
428+mg::NativeRenderingPlatform* mgm::GuestPlatform::native_rendering_platform()
429 {
430 return this;
431 }
432
433=== modified file 'src/platforms/mesa/server/kms/guest_platform.h'
434--- src/platforms/mesa/server/kms/guest_platform.h 2017-03-22 05:31:00 +0000
435+++ src/platforms/mesa/server/kms/guest_platform.h 2017-03-23 17:31:31 +0000
436@@ -32,14 +32,14 @@
437 {
438 namespace mesa
439 {
440-class InternalNativeDisplay;
441+class PlatformAuthentication;
442
443 class GuestPlatform : public graphics::Platform,
444- public graphics::NativePlatform,
445+ public graphics::NativeRenderingPlatform,
446 public mir::renderer::gl::EGLPlatform
447 {
448 public:
449- GuestPlatform(std::shared_ptr<PlatformAuthentication> const& platform_authentication_arg);
450+ GuestPlatform(std::shared_ptr<graphics::PlatformAuthentication> const& platform_authentication_arg);
451
452 UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override;
453 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
454@@ -47,12 +47,14 @@
455 UniqueModulePtr<Display> create_display(
456 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
457 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) override;
458+ NativeDisplayPlatform* native_display_platform() override;
459
460- NativePlatform* native_platform() override;
461+ NativeRenderingPlatform* native_rendering_platform() override;
462 EGLNativeDisplayType egl_native_display() const override;
463
464 private:
465- std::shared_ptr<PlatformAuthentication> const platform_authentication;
466+ std::shared_ptr<graphics::PlatformAuthentication> const platform_authentication;
467+ std::shared_ptr<graphics::NativeDisplayPlatform> auth;
468 helpers::GBMHelper gbm;
469 };
470 }
471
472=== modified file 'src/platforms/mesa/server/kms/nested_authentication.h'
473--- src/platforms/mesa/server/kms/nested_authentication.h 2017-03-20 19:06:00 +0000
474+++ src/platforms/mesa/server/kms/nested_authentication.h 2017-03-23 17:31:31 +0000
475@@ -32,7 +32,7 @@
476 class NestedAuthentication : public DRMAuthentication
477 {
478 public:
479- NestedAuthentication(std::shared_ptr<PlatformAuthentication> const& platform_authentication);
480+ NestedAuthentication(std::shared_ptr<graphics::PlatformAuthentication> const& platform_authentication);
481 void auth_magic(drm_magic_t magic) override;
482 mir::Fd authenticated_fd() override;
483 private:
484
485=== modified file 'src/platforms/mesa/server/kms/platform.cpp'
486--- src/platforms/mesa/server/kms/platform.cpp 2017-03-16 07:37:11 +0000
487+++ src/platforms/mesa/server/kms/platform.cpp 2017-03-23 17:31:31 +0000
488@@ -23,6 +23,8 @@
489 #include "linux_virtual_terminal.h"
490 #include "ipc_operations.h"
491 #include "mir/graphics/platform_ipc_operations.h"
492+#include "mir/graphics/platform_operation_message.h"
493+#include "mir/graphics/platform_authentication.h"
494 #include "mir/graphics/native_buffer.h"
495 #include "mir/emergency_cleanup_registry.h"
496 #include "mir/udev/wrapper.h"
497@@ -60,7 +62,7 @@
498 if (auto const drm = weak_drm.lock())
499 try { drm->drop_master(); } catch (...) {}
500 }));
501-
502+ native_platform = std::make_unique<mgm::DRMNativePlatform>(*drm);
503 }
504
505 mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgm::Platform::create_buffer_allocator()
506@@ -74,12 +76,17 @@
507 return make_module_ptr<mgm::Display>(drm, gbm, vt, bypass_option_, initial_conf_policy, gl_config, listener);
508 }
509
510+mg::NativeDisplayPlatform* mgm::Platform::native_display_platform()
511+{
512+ return native_platform.get();
513+}
514+
515 mir::UniqueModulePtr<mg::PlatformIpcOperations> mgm::Platform::make_ipc_operations() const
516 {
517 return make_module_ptr<mgm::IpcOperations>(drm);
518 }
519
520-mg::NativePlatform* mgm::Platform::native_platform()
521+mg::NativeRenderingPlatform* mgm::Platform::native_rendering_platform()
522 {
523 return this;
524 }
525
526=== modified file 'src/platforms/mesa/server/kms/platform.h'
527--- src/platforms/mesa/server/kms/platform.h 2017-03-16 07:37:11 +0000
528+++ src/platforms/mesa/server/kms/platform.h 2017-03-23 17:31:31 +0000
529@@ -20,6 +20,8 @@
530 #define MIR_GRAPHICS_MESA_PLATFORM_H_
531
532 #include "mir/graphics/platform.h"
533+#include "mir/graphics/platform_authentication.h"
534+#include "drm_native_platform.h"
535 #include "mir/renderer/gl/egl_platform.h"
536 #include "platform_common.h"
537 #include "display_helpers.h"
538@@ -33,9 +35,8 @@
539 {
540
541 class VirtualTerminal;
542-class InternalNativeDisplay;
543 class Platform : public graphics::Platform,
544- public graphics::NativePlatform,
545+ public graphics::NativeRenderingPlatform,
546 public mir::renderer::gl::EGLPlatform
547 {
548 public:
549@@ -49,10 +50,11 @@
550 UniqueModulePtr<graphics::Display> create_display(
551 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
552 std::shared_ptr<GLConfig> const& gl_config) override;
553+ NativeDisplayPlatform* native_display_platform() override;
554
555 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
556
557- NativePlatform* native_platform() override;
558+ NativeRenderingPlatform* native_rendering_platform() override;
559 EGLNativeDisplayType egl_native_display() const override;
560
561 std::shared_ptr<mir::udev::Context> udev;
562@@ -65,6 +67,7 @@
563 BypassOption bypass_option() const;
564 private:
565 BypassOption const bypass_option_;
566+ std::unique_ptr<DRMNativePlatform> native_platform;
567 };
568
569 }
570
571=== modified file 'src/platforms/mesa/server/x11/graphics/graphics.cpp'
572--- src/platforms/mesa/server/x11/graphics/graphics.cpp 2017-03-20 19:06:00 +0000
573+++ src/platforms/mesa/server/x11/graphics/graphics.cpp 2017-03-23 17:31:31 +0000
574@@ -64,11 +64,11 @@
575 }
576
577 mir::UniqueModulePtr<mg::Platform> create_guest_platform(
578- std::shared_ptr<mg::DisplayReport> const& /*report*/,
579- std::shared_ptr<mg::PlatformAuthentication> const& platform_authentication)
580+ std::shared_ptr<mg::DisplayReport> const&,
581+ std::shared_ptr<mg::PlatformAuthentication> const&)
582 {
583 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
584- return mir::make_module_ptr<mgx::GuestPlatform>(platform_authentication);
585+ return mir::make_module_ptr<mgx::GuestPlatform>();
586 }
587
588 void add_graphics_platform_options(boost::program_options::options_description& config)
589
590=== modified file 'src/platforms/mesa/server/x11/graphics/guest_platform.cpp'
591--- src/platforms/mesa/server/x11/graphics/guest_platform.cpp 2017-03-22 05:31:00 +0000
592+++ src/platforms/mesa/server/x11/graphics/guest_platform.cpp 2017-03-23 17:31:31 +0000
593@@ -21,8 +21,6 @@
594 #include "ipc_operations.h"
595 #include "buffer_allocator.h"
596
597-#include "mir/graphics/platform_authentication.h"
598-
599 #include <boost/exception/errinfo_errno.hpp>
600 #include <boost/throw_exception.hpp>
601
602@@ -30,13 +28,13 @@
603 namespace mgx = mg::X;
604 namespace mgm = mg::mesa;
605
606-mgx::GuestPlatform::GuestPlatform(
607- std::shared_ptr<PlatformAuthentication> const& /*platform_authentication*/)
608+mgx::GuestPlatform::GuestPlatform()
609 : udev{std::make_shared<mir::udev::Context>()},
610 drm{std::make_shared<mesa::helpers::DRMHelper>(mesa::helpers::DRMNodeToUse::render)}
611 {
612 drm->setup(udev);
613 gbm.setup(*drm);
614+ native_platform = std::make_unique<mgm::DRMNativePlatform>(*drm);
615 }
616
617 mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgx::GuestPlatform::create_buffer_allocator()
618@@ -59,7 +57,12 @@
619 BOOST_THROW_EXCEPTION(std::runtime_error("Guest platform cannot create display\n"));
620 }
621
622-mg::NativePlatform* mgx::GuestPlatform::native_platform()
623+mg::NativeDisplayPlatform* mgx::GuestPlatform::native_display_platform()
624+{
625+ return native_platform.get();
626+}
627+
628+mg::NativeRenderingPlatform* mgx::GuestPlatform::native_rendering_platform()
629 {
630 return this;
631 }
632
633=== modified file 'src/platforms/mesa/server/x11/graphics/guest_platform.h'
634--- src/platforms/mesa/server/x11/graphics/guest_platform.h 2017-03-22 05:31:00 +0000
635+++ src/platforms/mesa/server/x11/graphics/guest_platform.h 2017-03-23 17:31:31 +0000
636@@ -24,6 +24,7 @@
637 #include "display_helpers.h"
638 #undef __GBM__ //display_helpers.h sets __GBM__ platform, here need X11 egl platform defs, and gbm utilities
639 #include "mir/renderer/gl/egl_platform.h"
640+#include "drm_native_platform.h"
641
642 namespace mir
643 {
644@@ -33,11 +34,11 @@
645 {
646
647 class GuestPlatform : public graphics::Platform,
648- public graphics::NativePlatform,
649+ public graphics::NativeRenderingPlatform,
650 public mir::renderer::gl::EGLPlatform
651 {
652 public:
653- GuestPlatform(std::shared_ptr<PlatformAuthentication> const& /*platform_authentication*/);
654+ GuestPlatform();
655
656 UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override;
657 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
658@@ -45,14 +46,16 @@
659 UniqueModulePtr<Display> create_display(
660 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
661 std::shared_ptr<graphics::GLConfig> const&) override;
662+ NativeDisplayPlatform* native_display_platform() override;
663
664- NativePlatform* native_platform() override;
665+ NativeRenderingPlatform* native_rendering_platform() override;
666 EGLNativeDisplayType egl_native_display() const override;
667
668 private:
669 std::shared_ptr<mir::udev::Context> udev;
670 std::shared_ptr<graphics::mesa::helpers::DRMHelper> const drm;
671 graphics::mesa::helpers::GBMHelper gbm;
672+ std::unique_ptr<graphics::mesa::DRMNativePlatform> native_platform;
673 };
674
675 }
676
677=== modified file 'src/platforms/mesa/server/x11/graphics/platform.cpp'
678--- src/platforms/mesa/server/x11/graphics/platform.cpp 2017-03-16 07:37:11 +0000
679+++ src/platforms/mesa/server/x11/graphics/platform.cpp 2017-03-23 17:31:31 +0000
680@@ -40,6 +40,7 @@
681
682 drm->setup(udev);
683 gbm.setup(*drm);
684+ native_platform = std::make_unique<mgm::DRMNativePlatform>(*drm);
685 }
686
687 mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgx::Platform::create_buffer_allocator()
688@@ -55,12 +56,17 @@
689 report);
690 }
691
692+mg::NativeDisplayPlatform* mgx::Platform::native_display_platform()
693+{
694+ return native_platform.get();
695+}
696+
697 mir::UniqueModulePtr<mg::PlatformIpcOperations> mgx::Platform::make_ipc_operations() const
698 {
699 return make_module_ptr<mg::mesa::IpcOperations>(drm);
700 }
701
702-mg::NativePlatform* mgx::Platform::native_platform()
703+mg::NativeRenderingPlatform* mgx::Platform::native_rendering_platform()
704 {
705 return this;
706 }
707
708=== modified file 'src/platforms/mesa/server/x11/graphics/platform.h'
709--- src/platforms/mesa/server/x11/graphics/platform.h 2017-03-16 07:37:11 +0000
710+++ src/platforms/mesa/server/x11/graphics/platform.h 2017-03-23 17:31:31 +0000
711@@ -22,6 +22,7 @@
712 #include "mir/graphics/display_report.h"
713 #include "mir/graphics/platform.h"
714 #include "display_helpers.h"
715+#include "drm_native_platform.h"
716 #include "mir/geometry/size.h"
717 #include "mir/renderer/gl/egl_platform.h"
718
719@@ -36,7 +37,7 @@
720 {
721
722 class Platform : public graphics::Platform,
723- public graphics::NativePlatform,
724+ public graphics::NativeRenderingPlatform,
725 public mir::renderer::gl::EGLPlatform
726 {
727 public:
728@@ -51,10 +52,11 @@
729 UniqueModulePtr<graphics::Display> create_display(
730 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
731 std::shared_ptr<GLConfig> const& gl_config) override;
732+ NativeDisplayPlatform* native_display_platform() override;
733
734 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
735
736- NativePlatform* native_platform() override;
737+ NativeRenderingPlatform* native_rendering_platform() override;
738 EGLNativeDisplayType egl_native_display() const override;
739 private:
740 std::shared_ptr<::Display> const x11_connection;
741@@ -63,6 +65,7 @@
742 std::shared_ptr<DisplayReport> const report;
743 mesa::helpers::GBMHelper gbm;
744 mir::geometry::Size const size;
745+ std::unique_ptr<mesa::DRMNativePlatform> native_platform;
746 };
747
748 }
749
750=== modified file 'src/server/graphics/default_configuration.cpp'
751--- src/server/graphics/default_configuration.cpp 2017-03-16 07:37:11 +0000
752+++ src/server/graphics/default_configuration.cpp 2017-03-23 17:31:31 +0000
753@@ -154,7 +154,7 @@
754 if (the_options()->is_set(options::offscreen_opt))
755 {
756 if (auto egl_access = dynamic_cast<mir::renderer::gl::EGLPlatform*>(
757- the_graphics_platform()->native_platform()))
758+ the_graphics_platform()->native_rendering_platform()))
759 {
760 return std::make_shared<mg::offscreen::Display>(
761 egl_access->egl_native_display(),
762
763=== modified file 'src/server/graphics/nested/host_connection.h'
764--- src/server/graphics/nested/host_connection.h 2017-03-16 12:08:38 +0000
765+++ src/server/graphics/nested/host_connection.h 2017-03-23 17:31:31 +0000
766@@ -21,6 +21,7 @@
767
768 #include "mir_toolkit/client_types.h"
769 #include "mir_toolkit/mir_native_buffer.h"
770+#include "mir/graphics/platform.h"
771 #include "mir/graphics/platform_authentication.h"
772 #include "mir/graphics/buffer_properties.h"
773 #include "mir/geometry/rectangle.h"
774@@ -49,7 +50,8 @@
775 class HostChain;
776 class HostSurfaceSpec;
777 class NativeBuffer;
778-class HostConnection : public PlatformAuthentication
779+class HostConnection : public NativeDisplayPlatform,
780+ public PlatformAuthentication
781 {
782 public:
783 virtual ~HostConnection() = default;
784
785=== modified file 'src/server/graphics/nested/mir_client_host_connection.cpp'
786--- src/server/graphics/nested/mir_client_host_connection.cpp 2017-03-14 04:41:33 +0000
787+++ src/server/graphics/nested/mir_client_host_connection.cpp 2017-03-23 17:31:31 +0000
788@@ -743,6 +743,11 @@
789 }
790 }
791
792+mir::optional_value<mir::Fd> mgn::MirClientHostConnection::drm_fd()
793+{
794+ return {};
795+}
796+
797 mir::optional_value<std::shared_ptr<mir::graphics::MesaAuthExtension>>
798 mgn::MirClientHostConnection::auth_extension()
799 {
800
801=== modified file 'src/server/graphics/nested/mir_client_host_connection.h'
802--- src/server/graphics/nested/mir_client_host_connection.h 2017-03-10 19:47:57 +0000
803+++ src/server/graphics/nested/mir_client_host_connection.h 2017-03-23 17:31:31 +0000
804@@ -25,6 +25,7 @@
805 #include "mir/geometry/size.h"
806 #include "mir/geometry/displacement.h"
807 #include "mir/graphics/cursor_image.h"
808+#include "mir/graphics/platform.h"
809 #include "mir/recursive_read_write_mutex.h"
810
811 #include <string>
812@@ -92,6 +93,7 @@
813
814 optional_value<std::shared_ptr<MesaAuthExtension>> auth_extension() override;
815 optional_value<std::shared_ptr<SetGbmExtension>> set_gbm_extension() override;
816+ optional_value<mir::Fd> drm_fd() override;
817 private:
818 void update_input_config(UniqueInputConfig input_config);
819 std::mutex surfaces_mutex;
820
821=== modified file 'src/server/graphics/nested/platform.cpp'
822--- src/server/graphics/nested/platform.cpp 2017-03-16 07:37:11 +0000
823+++ src/server/graphics/nested/platform.cpp 2017-03-23 17:31:31 +0000
824@@ -138,6 +138,11 @@
825 passthrough_option);
826 }
827
828+mg::NativeDisplayPlatform* mgn::Platform::native_display_platform()
829+{
830+ return connection.get();
831+}
832+
833 mir::UniqueModulePtr<mg::PlatformIpcOperations> mgn::Platform::make_ipc_operations() const
834 {
835 return mir::make_module_ptr<mgn::IpcOperations>(guest_platform->make_ipc_operations());
836@@ -145,12 +150,12 @@
837
838 EGLNativeDisplayType mgn::Platform::egl_native_display() const
839 {
840- if (auto a = dynamic_cast<mir::renderer::gl::EGLPlatform*>(guest_platform->native_platform()))
841+ if (auto a = dynamic_cast<mir::renderer::gl::EGLPlatform*>(guest_platform->native_rendering_platform()))
842 return a->egl_native_display();
843 return EGL_NO_DISPLAY;
844 }
845
846-mg::NativePlatform* mgn::Platform::native_platform()
847+mg::NativeRenderingPlatform* mgn::Platform::native_rendering_platform()
848 {
849 return this;
850 }
851
852=== modified file 'src/server/graphics/nested/platform.h'
853--- src/server/graphics/nested/platform.h 2017-03-16 07:37:11 +0000
854+++ src/server/graphics/nested/platform.h 2017-03-23 17:31:31 +0000
855@@ -37,7 +37,7 @@
856 {
857 class HostConnection;
858 class Platform : public graphics::Platform,
859- public graphics::NativePlatform,
860+ public graphics::NativeRenderingPlatform,
861 public mir::renderer::gl::EGLPlatform
862 {
863 public:
864@@ -51,8 +51,9 @@
865 UniqueModulePtr<graphics::Display> create_display(
866 std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
867 std::shared_ptr<GLConfig> const& gl_config) override;
868+ NativeDisplayPlatform* native_display_platform() override;
869 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
870- NativePlatform* native_platform() override;
871+ NativeRenderingPlatform* native_rendering_platform() override;
872 EGLNativeDisplayType egl_native_display() const override;
873 private:
874 std::shared_ptr<mir::SharedLibrary> const library;
875
876=== modified file 'tests/include/mir/test/doubles/stub_host_connection.h'
877--- tests/include/mir/test/doubles/stub_host_connection.h 2017-03-10 19:47:57 +0000
878+++ tests/include/mir/test/doubles/stub_host_connection.h 2017-03-23 17:31:31 +0000
879@@ -192,6 +192,10 @@
880 {
881 return {};
882 }
883+ optional_value<mir::Fd> drm_fd()
884+ {
885+ return {};
886+ }
887 void* request_interface(char const*, int) { return nullptr; }
888 };
889
890
891=== modified file 'tests/integration-tests/test_submit_buffer.cpp'
892--- tests/integration-tests/test_submit_buffer.cpp 2017-03-16 07:37:11 +0000
893+++ tests/integration-tests/test_submit_buffer.cpp 2017-03-23 17:31:31 +0000
894@@ -233,7 +233,8 @@
895 return underlying_platform->create_display(policy, config);
896 }
897
898- mg::NativePlatform* native_platform() override { return nullptr; }
899+ mg::NativeRenderingPlatform* native_rendering_platform() override { return nullptr; }
900+ mg::NativeDisplayPlatform* native_display_platform() override { return nullptr; }
901
902 std::shared_ptr<mir::Fd> const last_fd;
903 std::shared_ptr<mg::Platform> const underlying_platform;
904
905=== modified file 'tests/mir_test_framework/platform_graphics_throw.cpp'
906--- tests/mir_test_framework/platform_graphics_throw.cpp 2017-03-22 05:31:00 +0000
907+++ tests/mir_test_framework/platform_graphics_throw.cpp 2017-03-23 17:31:31 +0000
908@@ -84,12 +84,20 @@
909 return stub_platform->make_ipc_operations();
910 }
911
912- mg::NativePlatform* native_platform() override
913- {
914- if (should_throw.at(ExceptionLocation::at_egl_native_display))
915- BOOST_THROW_EXCEPTION(std::runtime_error("Exception during egl_native_display"));
916-
917- return stub_platform->native_platform();
918+ mg::NativeRenderingPlatform* native_rendering_platform() override
919+ {
920+ if (should_throw.at(ExceptionLocation::at_native_rendering_platform))
921+ BOOST_THROW_EXCEPTION(std::runtime_error("Exception during egl_native_display"));
922+
923+ return stub_platform->native_rendering_platform();
924+ }
925+
926+ mg::NativeDisplayPlatform* native_display_platform() override
927+ {
928+ if (should_throw.at(ExceptionLocation::at_native_display_platform))
929+ BOOST_THROW_EXCEPTION(std::runtime_error("Exception during egl_native_display"));
930+
931+ return stub_platform->native_display_platform();
932 }
933
934 private:
935@@ -99,7 +107,8 @@
936 at_create_buffer_allocator,
937 at_create_display,
938 at_make_ipc_operations,
939- at_egl_native_display
940+ at_native_rendering_platform,
941+ at_native_display_platform,
942 };
943
944 static std::unordered_map<ExceptionLocation, bool, std::hash<uint32_t>> parse_exception_request(char const* request)
945@@ -113,8 +122,10 @@
946 static_cast<bool>(strstr(request, "create_display"));
947 requested_exceptions[ExceptionLocation::at_make_ipc_operations] =
948 static_cast<bool>(strstr(request, "make_ipc_operations"));
949- requested_exceptions[ExceptionLocation::at_egl_native_display] =
950- static_cast<bool>(strstr(request, "egl_native_display"));
951+ requested_exceptions[ExceptionLocation::at_native_rendering_platform] =
952+ static_cast<bool>(strstr(request, "native_rendering_platform"));
953+ requested_exceptions[ExceptionLocation::at_native_display_platform] =
954+ static_cast<bool>(strstr(request, "native_display_platform"));
955
956 return requested_exceptions;
957 };
958
959=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
960--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-03-22 05:31:00 +0000
961+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-03-23 17:31:31 +0000
962@@ -304,9 +304,14 @@
963 return adaptee->create_display(initial_conf_policy, gl_config);
964 }
965
966- mg::NativePlatform* native_platform() override
967- {
968- return adaptee->native_platform();
969+ mg::NativeRenderingPlatform* native_rendering_platform() override
970+ {
971+ return adaptee->native_rendering_platform();
972+ }
973+
974+ mg::NativeDisplayPlatform* native_display_platform() override
975+ {
976+ return adaptee->native_display_platform();
977 }
978
979 std::shared_ptr<mg::PlatformAuthentication> const context;
980
981=== modified file 'tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp'
982--- tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp 2015-09-03 17:01:03 +0000
983+++ tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp 2017-03-23 17:31:31 +0000
984@@ -41,7 +41,7 @@
985
986 std::shared_ptr<mgx::GuestPlatform> create_guest_platform()
987 {
988- return std::make_shared<mgx::GuestPlatform>(nullptr);
989+ return std::make_shared<mgx::GuestPlatform>();
990 }
991
992 ::testing::NiceMock<mtd::MockDRM> mock_drm;

Subscribers

People subscribed via source and target branches