Mir

Merge lp:~alan-griffiths/mir/remove-guest-platforms into lp:mir

Proposed by Alan Griffiths on 2017-06-09
Status: Merged
Merge reported by: Alberto Aguirre
Merged at revision: not available
Proposed branch: lp:~alan-griffiths/mir/remove-guest-platforms
Merge into: lp:mir
Diff against target: 748 lines (+0/-583)
17 files modified
include/platform/mir/graphics/platform.h (+0/-20)
src/platforms/eglstream-kms/server/platform_symbols.cpp (+0/-7)
src/platforms/mesa/server/kms/CMakeLists.txt (+0/-1)
src/platforms/mesa/server/kms/guest_platform.cpp (+0/-118)
src/platforms/mesa/server/kms/guest_platform.h (+0/-73)
src/platforms/mesa/server/kms/platform.cpp (+0/-1)
src/platforms/mesa/server/kms/platform_symbols.cpp (+0/-9)
src/platforms/mesa/server/x11/graphics/CMakeLists.txt (+0/-1)
src/platforms/mesa/server/x11/graphics/graphics.cpp (+0/-9)
src/platforms/mesa/server/x11/graphics/guest_platform.cpp (+0/-79)
src/platforms/mesa/server/x11/graphics/guest_platform.h (+0/-66)
tests/mir_test_framework/platform_graphics_throw.cpp (+0/-7)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+0/-14)
tests/unit-tests/platforms/mesa/kms/CMakeLists.txt (+0/-1)
tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp (+0/-106)
tests/unit-tests/platforms/mesa/x11/CMakeLists.txt (+0/-1)
tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp (+0/-70)
To merge this branch: bzr merge lp:~alan-griffiths/mir/remove-guest-platforms
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing on 2017-06-09
Alberto Aguirre (community) 2017-06-09 Approve on 2017-06-09
Review via email: mp+325376@code.launchpad.net

Commit message

Remove the (now unused) GuestPlatform code

To post a comment you must log in.
Alan Griffiths (alan-griffiths) wrote :

See also bug lp:1696974

Mir CI Bot (mir-ci-bot) wrote :

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

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

review: Approve (continuous-integration)
Alberto Aguirre (albaguirre) wrote :

Needs ABI bump?

LGTM otherwise.

review: Approve
Alberto Aguirre (albaguirre) wrote :

Nitpicks: seems like extra space on

317 + display.cpp

And similar lines in the diff.

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4194
https://mir-jenkins.ubuntu.com/job/mir-ci/3454/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4710
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4849
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4839
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4839
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4839
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4747/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4747/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4747/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4747/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4747/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4747/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/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4747/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4747
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4747/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/1337/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4714
    FAILURE: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1425/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/1426/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4854
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4844
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4844
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4844
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4751/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4751/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4751/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4751/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4751/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4751/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/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4751/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4751
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4751/artifact/output/*zip*/output.zip

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

Subscribers

People subscribed via source and target branches