Mir

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

Proposed by Alan Griffiths
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
Alberto Aguirre (community) Approve
Review via email: mp+325376@code.launchpad.net

Commit message

Remove the (now unused) GuestPlatform code

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

See also bug lp:1696974

Revision history for this message
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)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Needs ABI bump?

LGTM otherwise.

review: Approve
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Nitpicks: seems like extra space on

317 + display.cpp

And similar lines in the diff.

Revision history for this message
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)
Revision history for this message
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
=== modified file 'include/platform/mir/graphics/platform.h'
--- include/platform/mir/graphics/platform.h 2017-05-08 03:04:26 +0000
+++ include/platform/mir/graphics/platform.h 2017-06-09 16:24:41 +0000
@@ -175,11 +175,6 @@
175 std::shared_ptr<mir::graphics::DisplayReport> const& report,175 std::shared_ptr<mir::graphics::DisplayReport> const& report,
176 std::shared_ptr<mir::logging::Logger> const& logger);176 std::shared_ptr<mir::logging::Logger> const& logger);
177177
178typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateGuestPlatform)(
179 std::shared_ptr<mir::graphics::DisplayReport> const& report,
180 std::shared_ptr<mir::graphics::PlatformAuthentication> const& platform_authentication);
181
182
183typedef void(*AddPlatformOptions)(178typedef void(*AddPlatformOptions)(
184 boost::program_options::options_description& config);179 boost::program_options::options_description& config);
185180
@@ -227,21 +222,6 @@
227 std::shared_ptr<mir::logging::Logger> const& logger);222 std::shared_ptr<mir::logging::Logger> const& logger);
228223
229/**224/**
230 * Function prototype used to return a new guest graphics platform. The guest graphics platform
231 * exists alongside the host platform and do not output or control the physical displays
232 *
233 * \param [in] platform_authentication the object that contains resources needed from the host platform
234 * \param [in] report the object to use to report interesting events from the display subsystem
235 *
236 * This factory function needs to be implemented by each platform.
237 *
238 * \ingroup platform_enablement
239 */
240mir::UniqueModulePtr<mir::graphics::Platform> create_guest_platform(
241 std::shared_ptr<mir::graphics::DisplayReport> const& report,
242 std::shared_ptr<mir::graphics::PlatformAuthentication> const& platform_authentication);
243
244/**
245 * Function prototype used to add platform specific options to the platform-independent server options.225 * Function prototype used to add platform specific options to the platform-independent server options.
246 *226 *
247 * \param [in] config a boost::program_options that can be appended with new options227 * \param [in] config a boost::program_options that can be appended with new options
248228
=== modified file 'src/platforms/eglstream-kms/server/platform_symbols.cpp'
--- src/platforms/eglstream-kms/server/platform_symbols.cpp 2017-05-25 06:15:15 +0000
+++ src/platforms/eglstream-kms/server/platform_symbols.cpp 2017-06-09 16:24:41 +0000
@@ -220,10 +220,3 @@
220 return &description;220 return &description;
221}221}
222222
223mir::UniqueModulePtr<mg::Platform> create_guest_platform(
224 std::shared_ptr<mg::DisplayReport> const&,
225 std::shared_ptr<mg::PlatformAuthentication> const& /*platform_authentication*/)
226{
227 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
228 return nullptr;
229}
230223
=== modified file 'src/platforms/mesa/server/kms/CMakeLists.txt'
--- src/platforms/mesa/server/kms/CMakeLists.txt 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/kms/CMakeLists.txt 2017-06-09 16:24:41 +0000
@@ -29,7 +29,6 @@
29 cursor.cpp29 cursor.cpp
30 display.cpp30 display.cpp
31 display_buffer.cpp31 display_buffer.cpp
32 guest_platform.cpp
33 page_flipper.h32 page_flipper.h
34 kms_page_flipper.cpp33 kms_page_flipper.cpp
35 linux_virtual_terminal.cpp34 linux_virtual_terminal.cpp
3635
=== removed file 'src/platforms/mesa/server/kms/guest_platform.cpp'
--- src/platforms/mesa/server/kms/guest_platform.cpp 2017-05-31 17:56:19 +0000
+++ src/platforms/mesa/server/kms/guest_platform.cpp 1970-01-01 00:00:00 +0000
@@ -1,118 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Eleni Maria Stea <elenimaria.stea@canonical.com>
18 * Alan Griffiths <alan@octopull.co.uk>
19 */
20
21#include "guest_platform.h"
22#include "nested_authentication.h"
23#include "ipc_operations.h"
24#include "buffer_allocator.h"
25#include "mesa_extensions.h"
26
27#include "mir/graphics/platform_authentication_wrapper.h"
28#include "mir/graphics/platform_operation_message.h"
29#include "mir_toolkit/mesa/platform_operation.h"
30#include "mir_toolkit/extensions/set_gbm_device.h"
31
32#include <boost/exception/errinfo_errno.hpp>
33#include <boost/throw_exception.hpp>
34
35#include <mutex>
36#include <stdexcept>
37#include <cstring>
38
39namespace mg = mir::graphics;
40namespace mgm = mg::mesa;
41
42namespace
43{
44//TODO: construction for mclm::ClientPlatform is roundabout/2-step.
45// Might be better for the extension to be a different way to allocate
46// MirConnection, but beyond scope of work.
47void set_guest_gbm_device(mg::PlatformAuthentication& platform_authentication, gbm_device* device)
48{
49 std::string const msg{"Nested Mir failed to set the gbm device."};
50 auto ext = platform_authentication.set_gbm_extension();
51 if (ext.is_set())
52 ext.value()->set_gbm_device(device);
53 else
54 BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir failed to set the gbm device."));
55}
56}
57
58mgm::GuestPlatform::NestedAuthFactory::NestedAuthFactory(
59 std::shared_ptr<mg::PlatformAuthentication> const& auth) :
60 auth(auth)
61{
62}
63
64mir::UniqueModulePtr<mg::PlatformAuthentication>
65mgm::GuestPlatform::NestedAuthFactory::create_platform_authentication()
66{
67 return make_module_ptr<mg::AuthenticationWrapper>(auth);
68}
69
70mgm::GuestPlatform::GuestPlatform(
71 std::shared_ptr<mg::PlatformAuthentication> const& platform_authentication) :
72 platform_authentication{platform_authentication},
73 auth_factory{platform_authentication}
74{
75 auto ext = platform_authentication->auth_extension();
76 if (!ext.is_set())
77 BOOST_THROW_EXCEPTION(std::runtime_error("could not access drm auth fd"));
78 gbm.setup(ext.value()->auth_fd());
79 set_guest_gbm_device(*platform_authentication, gbm.device);
80}
81
82mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgm::GuestPlatform::create_buffer_allocator()
83{
84 return mir::make_module_ptr<mgm::BufferAllocator>(gbm.device, mgm::BypassOption::prohibited, mgm::BufferImportMethod::gbm_native_pixmap);
85}
86
87mir::UniqueModulePtr<mg::PlatformIpcOperations> mgm::GuestPlatform::make_ipc_operations() const
88{
89 return mir::make_module_ptr<mgm::IpcOperations>(
90 std::make_shared<mgm::NestedAuthentication>(platform_authentication));
91}
92
93mir::UniqueModulePtr<mg::Display> mgm::GuestPlatform::create_display(
94 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
95 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/)
96{
97 BOOST_THROW_EXCEPTION(std::runtime_error("mgm::GuestPlatform cannot create display\n"));
98}
99
100mg::NativeDisplayPlatform* mgm::GuestPlatform::native_display_platform()
101{
102 return &auth_factory;
103}
104
105mg::NativeRenderingPlatform* mgm::GuestPlatform::native_rendering_platform()
106{
107 return this;
108}
109
110MirEGLNativeDisplayType mgm::GuestPlatform::egl_native_display() const
111{
112 return gbm.device;
113}
114
115std::vector<mir::ExtensionDescription> mgm::GuestPlatform::extensions() const
116{
117 return mgm::mesa_extensions();
118}
1190
=== removed file 'src/platforms/mesa/server/kms/guest_platform.h'
--- src/platforms/mesa/server/kms/guest_platform.h 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/kms/guest_platform.h 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Eleni Maria Stea <elenimaria.stea@canonical.com>
18 * Alan Griffiths <alan@octopull.co.uk>
19 */
20
21#ifndef MIR_GRAPHICS_MESA_GUEST_PLATFORM_H_
22#define MIR_GRAPHICS_MESA_GUEST_PLATFORM_H_
23
24#include "mir/graphics/platform.h"
25#include "mir/graphics/platform_authentication.h"
26#include "mir/graphics/platform_ipc_package.h"
27#include "mir/renderer/gl/egl_platform.h"
28#include "display_helpers.h"
29
30namespace mir
31{
32namespace graphics
33{
34namespace mesa
35{
36class PlatformAuthentication;
37
38class GuestPlatform : public graphics::Platform,
39 public graphics::NativeRenderingPlatform,
40 public mir::renderer::gl::EGLPlatform
41{
42public:
43 GuestPlatform(std::shared_ptr<graphics::PlatformAuthentication> const& platform_authentication_arg);
44
45 UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override;
46 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
47
48 UniqueModulePtr<Display> create_display(
49 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
50 std::shared_ptr<graphics::GLConfig> const& /*gl_config*/) override;
51 NativeDisplayPlatform* native_display_platform() override;
52 std::vector<ExtensionDescription> extensions() const override;
53
54 NativeRenderingPlatform* native_rendering_platform() override;
55 MirServerEGLNativeDisplayType egl_native_display() const override;
56
57private:
58 std::shared_ptr<graphics::PlatformAuthentication> const platform_authentication;
59
60 struct NestedAuthFactory : graphics::NativeDisplayPlatform,
61 graphics::PlatformAuthenticationFactory
62 {
63 NestedAuthFactory(std::shared_ptr<graphics::PlatformAuthentication> const&);
64 UniqueModulePtr<graphics::PlatformAuthentication> create_platform_authentication() override;
65 std::shared_ptr<graphics::PlatformAuthentication> const auth;
66 } auth_factory;
67 helpers::GBMHelper gbm;
68};
69}
70}
71}
72
73#endif // MIR_GRAPHICS_MESA_GUEST_PLATFORM_H_
740
=== modified file 'src/platforms/mesa/server/kms/platform.cpp'
--- src/platforms/mesa/server/kms/platform.cpp 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/kms/platform.cpp 2017-06-09 16:24:41 +0000
@@ -17,7 +17,6 @@
17 */17 */
1818
19#include "platform.h"19#include "platform.h"
20#include "guest_platform.h"
21#include "buffer_allocator.h"20#include "buffer_allocator.h"
22#include "display.h"21#include "display.h"
23#include "linux_virtual_terminal.h"22#include "linux_virtual_terminal.h"
2423
=== modified file 'src/platforms/mesa/server/kms/platform_symbols.cpp'
--- src/platforms/mesa/server/kms/platform_symbols.cpp 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/kms/platform_symbols.cpp 2017-06-09 16:24:41 +0000
@@ -18,7 +18,6 @@
1818
19#include "platform.h"19#include "platform.h"
20#include "gbm_platform.h"20#include "gbm_platform.h"
21#include "guest_platform.h"
22#include "linux_virtual_terminal.h"21#include "linux_virtual_terminal.h"
23#include "mir/options/program_option.h"22#include "mir/options/program_option.h"
24#include "mir/options/option.h"23#include "mir/options/option.h"
@@ -245,14 +244,6 @@
245 return &description;244 return &description;
246}245}
247246
248mir::UniqueModulePtr<mg::Platform> create_guest_platform(
249 std::shared_ptr<mg::DisplayReport> const&,
250 std::shared_ptr<mg::PlatformAuthentication> const& platform_authentication)
251{
252 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
253 return mir::make_module_ptr<mgm::GuestPlatform>(platform_authentication);
254}
255
256mir::UniqueModulePtr<mir::graphics::DisplayPlatform> create_display_platform(247mir::UniqueModulePtr<mir::graphics::DisplayPlatform> create_display_platform(
257 std::shared_ptr<mo::Option> const& options,248 std::shared_ptr<mo::Option> const& options,
258 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,249 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
259250
=== modified file 'src/platforms/mesa/server/x11/graphics/CMakeLists.txt'
--- src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2017-05-08 03:04:26 +0000
+++ src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2017-06-09 16:24:41 +0000
@@ -16,7 +16,6 @@
16 mirplatformgraphicsmesax11objects OBJECT16 mirplatformgraphicsmesax11objects OBJECT
1717
18 platform.cpp18 platform.cpp
19 guest_platform.cpp
20 display.cpp19 display.cpp
21 display_configuration.cpp20 display_configuration.cpp
22 display_buffer.cpp21 display_buffer.cpp
2322
=== modified file 'src/platforms/mesa/server/x11/graphics/graphics.cpp'
--- src/platforms/mesa/server/x11/graphics/graphics.cpp 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/x11/graphics/graphics.cpp 2017-06-09 16:24:41 +0000
@@ -21,7 +21,6 @@
21#include "platform.h"21#include "platform.h"
22#include "gbm_platform.h"22#include "gbm_platform.h"
23#include "platform_common.h"23#include "platform_common.h"
24#include "guest_platform.h"
25#include "../X11_resources.h"24#include "../X11_resources.h"
26#include "mir/module_deleter.h"25#include "mir/module_deleter.h"
27#include "mir/assert_module_entry_point.h"26#include "mir/assert_module_entry_point.h"
@@ -67,14 +66,6 @@
67 );66 );
68}67}
6968
70mir::UniqueModulePtr<mg::Platform> create_guest_platform(
71 std::shared_ptr<mg::DisplayReport> const&,
72 std::shared_ptr<mg::PlatformAuthentication> const&)
73{
74 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
75 return mir::make_module_ptr<mgx::GuestPlatform>();
76}
77
78void add_graphics_platform_options(boost::program_options::options_description& config)69void add_graphics_platform_options(boost::program_options::options_description& config)
79{70{
80 mir::assert_entry_point_signature<mg::AddPlatformOptions>(&add_graphics_platform_options);71 mir::assert_entry_point_signature<mg::AddPlatformOptions>(&add_graphics_platform_options);
8172
=== removed file 'src/platforms/mesa/server/x11/graphics/guest_platform.cpp'
--- src/platforms/mesa/server/x11/graphics/guest_platform.cpp 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/x11/graphics/guest_platform.cpp 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Cemil Azizoglu <cemil.azizoglu@canonical.com>
18 */
19
20#include "guest_platform.h"
21#include "ipc_operations.h"
22#include "buffer_allocator.h"
23#include "mesa_extensions.h"
24
25#include <boost/exception/errinfo_errno.hpp>
26#include <boost/throw_exception.hpp>
27
28namespace mg = mir::graphics;
29namespace mgx = mg::X;
30namespace mgm = mg::mesa;
31
32mgx::GuestPlatform::GuestPlatform()
33 : udev{std::make_shared<mir::udev::Context>()},
34 drm{std::make_shared<mesa::helpers::DRMHelper>(mesa::helpers::DRMNodeToUse::render)}
35{
36 drm->setup(udev);
37 gbm.setup(*drm);
38 auth_factory = std::make_unique<mgm::DRMNativePlatformAuthFactory>(*drm);
39}
40
41mir::UniqueModulePtr<mg::GraphicBufferAllocator> mgx::GuestPlatform::create_buffer_allocator()
42{
43 return make_module_ptr<mgm::BufferAllocator>(
44 gbm.device,
45 mgm::BypassOption::prohibited,
46 mgm::BufferImportMethod::dma_buf);
47}
48
49mir::UniqueModulePtr<mg::PlatformIpcOperations> mgx::GuestPlatform::make_ipc_operations() const
50{
51 return make_module_ptr<mg::mesa::IpcOperations>(drm);
52}
53
54mir::UniqueModulePtr<mg::Display> mgx::GuestPlatform::create_display(
55 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
56 std::shared_ptr<graphics::GLConfig> const&)
57{
58 BOOST_THROW_EXCEPTION(std::runtime_error("Guest platform cannot create display\n"));
59}
60
61mg::NativeDisplayPlatform* mgx::GuestPlatform::native_display_platform()
62{
63 return auth_factory.get();
64}
65
66mg::NativeRenderingPlatform* mgx::GuestPlatform::native_rendering_platform()
67{
68 return this;
69}
70
71MirServerEGLNativeDisplayType mgx::GuestPlatform::egl_native_display() const
72{
73 return gbm.device;
74}
75
76std::vector<mir::ExtensionDescription> mgx::GuestPlatform::extensions() const
77{
78 return mgm::mesa_extensions();
79}
800
=== removed file 'src/platforms/mesa/server/x11/graphics/guest_platform.h'
--- src/platforms/mesa/server/x11/graphics/guest_platform.h 2017-05-17 04:48:46 +0000
+++ src/platforms/mesa/server/x11/graphics/guest_platform.h 1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by:
17 * Cemil Azizoglu <cemil.azizoglu@canonical.com>
18 */
19
20#ifndef MIR_GRAPHICS_X_GUEST_PLATFORM_H_
21#define MIR_GRAPHICS_X_GUEST_PLATFORM_H_
22
23#include "mir/graphics/platform.h"
24#include "display_helpers.h"
25#undef __GBM__ //display_helpers.h sets __GBM__ platform, here need X11 egl platform defs, and gbm utilities
26#include "mir/renderer/gl/egl_platform.h"
27#include "drm_native_platform.h"
28
29namespace mir
30{
31namespace graphics
32{
33namespace X
34{
35
36class GuestPlatform : public graphics::Platform,
37 public graphics::NativeRenderingPlatform,
38 public mir::renderer::gl::EGLPlatform
39{
40public:
41 GuestPlatform();
42
43 UniqueModulePtr<GraphicBufferAllocator> create_buffer_allocator() override;
44 UniqueModulePtr<PlatformIpcOperations> make_ipc_operations() const override;
45
46 UniqueModulePtr<Display> create_display(
47 std::shared_ptr<graphics::DisplayConfigurationPolicy> const&,
48 std::shared_ptr<graphics::GLConfig> const&) override;
49 NativeDisplayPlatform* native_display_platform() override;
50 std::vector<ExtensionDescription> extensions() const override;
51
52 NativeRenderingPlatform* native_rendering_platform() override;
53 MirServerEGLNativeDisplayType egl_native_display() const override;
54
55private:
56 std::shared_ptr<mir::udev::Context> udev;
57 std::shared_ptr<graphics::mesa::helpers::DRMHelper> const drm;
58 graphics::mesa::helpers::GBMHelper gbm;
59 std::unique_ptr<mesa::DRMNativePlatformAuthFactory> auth_factory;
60};
61
62}
63}
64}
65
66#endif // MIR_GRAPHICS_X_GUEST_PLATFORM_H_
670
=== modified file 'tests/mir_test_framework/platform_graphics_throw.cpp'
--- tests/mir_test_framework/platform_graphics_throw.cpp 2017-05-08 03:04:26 +0000
+++ tests/mir_test_framework/platform_graphics_throw.cpp 2017-06-09 16:24:41 +0000
@@ -176,10 +176,3 @@
176 return mir::make_module_ptr<ExceptionThrowingPlatform>();176 return mir::make_module_ptr<ExceptionThrowingPlatform>();
177}177}
178178
179mir::UniqueModulePtr<mg::Platform> create_guest_platform(
180 std::shared_ptr<mg::DisplayReport> const&,
181 std::shared_ptr<mg::PlatformAuthentication> const&)
182{
183 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
184 return mir::make_module_ptr<ExceptionThrowingPlatform>();
185}
186179
=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-05-31 17:56:19 +0000
+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2017-06-09 16:24:41 +0000
@@ -375,20 +375,6 @@
375 return mir::make_module_ptr<GuestPlatformAdapter>(nullptr, result);375 return mir::make_module_ptr<GuestPlatformAdapter>(nullptr, result);
376}376}
377377
378mir::UniqueModulePtr<mg::Platform> create_guest_platform(
379 std::shared_ptr<mg::DisplayReport> const&,
380 std::shared_ptr<mg::PlatformAuthentication> const& context)
381{
382 mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform);
383 auto graphics_platform = the_graphics_platform.lock();
384 if (!graphics_platform)
385 {
386 static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};
387 the_graphics_platform = graphics_platform = create_stub_platform(default_display_rects);
388 }
389 return mir::make_module_ptr<GuestPlatformAdapter>(context, graphics_platform);
390}
391
392mir::UniqueModulePtr<mg::DisplayPlatform> create_display_platform(378mir::UniqueModulePtr<mg::DisplayPlatform> create_display_platform(
393 std::shared_ptr<mo::Option> const&,379 std::shared_ptr<mo::Option> const&,
394 std::shared_ptr<mir::EmergencyCleanupRegistry> const&,380 std::shared_ptr<mir::EmergencyCleanupRegistry> const&,
395381
=== modified file 'tests/unit-tests/platforms/mesa/kms/CMakeLists.txt'
--- tests/unit-tests/platforms/mesa/kms/CMakeLists.txt 2017-05-08 03:04:26 +0000
+++ tests/unit-tests/platforms/mesa/kms/CMakeLists.txt 2017-06-09 16:24:41 +0000
@@ -14,7 +14,6 @@
14 ${CMAKE_CURRENT_SOURCE_DIR}/test_kms_page_flipper.cpp14 ${CMAKE_CURRENT_SOURCE_DIR}/test_kms_page_flipper.cpp
15 ${CMAKE_CURRENT_SOURCE_DIR}/test_linux_virtual_terminal.cpp15 ${CMAKE_CURRENT_SOURCE_DIR}/test_linux_virtual_terminal.cpp
16 ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor.cpp16 ${CMAKE_CURRENT_SOURCE_DIR}/test_cursor.cpp
17 ${CMAKE_CURRENT_SOURCE_DIR}/test_guest_platform.cpp
18 ${CMAKE_CURRENT_SOURCE_DIR}/test_bypass.cpp17 ${CMAKE_CURRENT_SOURCE_DIR}/test_bypass.cpp
19 ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_authentication.cpp18 ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_authentication.cpp
20 ${CMAKE_CURRENT_SOURCE_DIR}/test_drm_helper.cpp19 ${CMAKE_CURRENT_SOURCE_DIR}/test_drm_helper.cpp
2120
=== removed file 'tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp'
--- tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp 2017-05-08 03:04:26 +0000
+++ tests/unit-tests/platforms/mesa/kms/test_guest_platform.cpp 1970-01-01 00:00:00 +0000
@@ -1,106 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#include "mir/graphics/platform_authentication.h"
20#include "src/platforms/mesa/server/kms/guest_platform.h"
21#include "mir/graphics/buffer_properties.h"
22#include "mir/graphics/platform_ipc_operations.h"
23#include "mir_toolkit/mesa/platform_operation.h"
24#include "mir_toolkit/extensions/set_gbm_device.h"
25
26#include "mir/test/fake_shared.h"
27#include "mir/test/doubles/mock_drm.h"
28#include "mir/test/doubles/mock_gbm.h"
29#include "mir/test/doubles/stub_buffer.h"
30#include "mir/test/doubles/mock_buffer_ipc_message.h"
31#include "mir/test/doubles/fd_matcher.h"
32#include "mir/test/doubles/mock_platform_authentication.h"
33#include "mir/test/doubles/mock_mesa_auth_extensions.h"
34
35#include <gtest/gtest.h>
36#include <gmock/gmock.h>
37
38#include <cstring>
39#include <fcntl.h>
40
41namespace mg = mir::graphics;
42namespace mgm = mir::graphics::mesa;
43namespace mt = mir::test;
44namespace mtd = mir::test::doubles;
45namespace geom = mir::geometry;
46using namespace testing;
47
48namespace
49{
50
51struct MockSetGbmExt : mg::SetGbmExtension
52{
53 MOCK_METHOD1(set_gbm_device, void(gbm_device* dev));
54};
55
56class MesaGuestPlatformTest : public ::testing::Test
57{
58public:
59 MesaGuestPlatformTest()
60 : drm_fd{open(drm_device, 0, 0)}
61 {
62 int fake_fd = 4939;
63 ON_CALL(mock_platform_authentication, platform_fd_items())
64 .WillByDefault(Return(std::vector<int>{drm_fd}));
65 ON_CALL(mock_platform_authentication, set_gbm_extension())
66 .WillByDefault(Return(mir::optional_value<std::shared_ptr<mg::SetGbmExtension>>{mock_gbm_ext}));
67 ON_CALL(mock_platform_authentication, auth_extension())
68 .WillByDefault(Return(mir::optional_value<std::shared_ptr<mg::MesaAuthExtension>>{mock_ext}));
69 ON_CALL(*mock_ext, auth_fd())
70 .WillByDefault(Return(mir::Fd{mir::IntOwnedFd{fake_fd}}));
71 }
72
73protected:
74 ::testing::NiceMock<mtd::MockDRM> mock_drm;
75 ::testing::NiceMock<mtd::MockGBM> mock_gbm;
76 ::testing::NiceMock<mtd::MockPlatformAuthentication> mock_platform_authentication;
77 std::shared_ptr<mtd::MockMesaExt> mock_ext = std::make_shared<mtd::MockMesaExt>();
78 std::shared_ptr<MockSetGbmExt> mock_gbm_ext = std::make_shared<MockSetGbmExt>();
79 char const* const drm_device = "/dev/dri/card0";
80 int const drm_fd;
81};
82
83}
84
85TEST_F(MesaGuestPlatformTest, auth_fd_is_delegated_to_platform_authentication)
86{
87 int const auth_fd{13};
88
89 EXPECT_CALL(mock_platform_authentication, set_gbm_extension());
90 EXPECT_CALL(mock_platform_authentication, auth_extension())
91 .Times(2);
92 EXPECT_CALL(*mock_ext, auth_fd())
93 .Times(2)
94 .WillRepeatedly(Return(mir::Fd{mir::IntOwnedFd{auth_fd}}));
95
96 mgm::GuestPlatform native(mt::fake_shared(mock_platform_authentication));
97 auto ipc_ops = native.make_ipc_operations();
98 ipc_ops->connection_ipc_package();
99}
100
101TEST_F(MesaGuestPlatformTest, sets_gbm_device_during_initialization)
102{
103 EXPECT_CALL(mock_platform_authentication, set_gbm_extension());
104 EXPECT_CALL(*mock_gbm_ext, set_gbm_device(mock_gbm.fake_gbm.device));
105 mgm::GuestPlatform native(mt::fake_shared(mock_platform_authentication));
106}
1070
=== modified file 'tests/unit-tests/platforms/mesa/x11/CMakeLists.txt'
--- tests/unit-tests/platforms/mesa/x11/CMakeLists.txt 2017-05-08 03:04:26 +0000
+++ tests/unit-tests/platforms/mesa/x11/CMakeLists.txt 2017-06-09 16:24:41 +0000
@@ -2,7 +2,6 @@
2 mir_unit_tests_mesa-x112 mir_unit_tests_mesa-x11
3 ${CMAKE_CURRENT_SOURCE_DIR}/test_platform.cpp3 ${CMAKE_CURRENT_SOURCE_DIR}/test_platform.cpp
4 ${CMAKE_CURRENT_SOURCE_DIR}/test_graphics_platform.cpp4 ${CMAKE_CURRENT_SOURCE_DIR}/test_graphics_platform.cpp
5 ${CMAKE_CURRENT_SOURCE_DIR}/test_guest_platform.cpp
6 ${CMAKE_CURRENT_SOURCE_DIR}/test_display.cpp5 ${CMAKE_CURRENT_SOURCE_DIR}/test_display.cpp
7 ${CMAKE_CURRENT_SOURCE_DIR}/test_display_generic.cpp6 ${CMAKE_CURRENT_SOURCE_DIR}/test_display_generic.cpp
8 $<TARGET_OBJECTS:mirplatformservermesax11sharedresources>7 $<TARGET_OBJECTS:mirplatformservermesax11sharedresources>
98
=== removed file 'tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp'
--- tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp 2017-05-08 03:04:26 +0000
+++ tests/unit-tests/platforms/mesa/x11/test_guest_platform.cpp 1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Cemil Azizoglu <cemil.azizoglu@canonical.com>
17 */
18
19#include "src/platforms/mesa/server/x11/graphics/guest_platform.h"
20
21#include "mir/test/doubles/mock_drm.h"
22#include "mir/test/doubles/mock_gbm.h"
23
24#include <gtest/gtest.h>
25#include <gmock/gmock.h>
26
27namespace mgx = mir::graphics::X;
28namespace mtd = mir::test::doubles;
29
30namespace
31{
32
33class X11GuestPlatformTest : public ::testing::Test
34{
35public:
36 void SetUp()
37 {
38 ::testing::Mock::VerifyAndClearExpectations(&mock_drm);
39 ::testing::Mock::VerifyAndClearExpectations(&mock_gbm);
40 }
41
42 std::shared_ptr<mgx::GuestPlatform> create_guest_platform()
43 {
44 return std::make_shared<mgx::GuestPlatform>();
45 }
46
47 ::testing::NiceMock<mtd::MockDRM> mock_drm;
48 ::testing::NiceMock<mtd::MockGBM> mock_gbm;
49};
50}
51
52TEST_F(X11GuestPlatformTest, failure_to_open_drm_results_in_an_error)
53{
54 using namespace ::testing;
55
56 EXPECT_CALL(mock_drm, open(_,_,_))
57 .WillRepeatedly(Return(-1));
58
59 EXPECT_THROW({ create_guest_platform(); }, std::exception);
60}
61
62TEST_F(X11GuestPlatformTest, failure_to_create_gbm_device_results_in_an_error)
63{
64 using namespace ::testing;
65
66 EXPECT_CALL(mock_gbm, gbm_create_device(_))
67 .WillRepeatedly(Return(nullptr));
68
69 EXPECT_THROW({ create_guest_platform(); }, std::exception);
70}

Subscribers

People subscribed via source and target branches