Mir

Merge lp:~cemil-azizoglu/mir/add-create-module-context-fn into lp:mir

Proposed by Cemil Azizoglu
Status: Work in progress
Proposed branch: lp:~cemil-azizoglu/mir/add-create-module-context-fn
Merge into: lp:mir
Prerequisite: lp:~cemil-azizoglu/mir/mir-on-x-configure
Diff against target: 510 lines (+127/-39)
23 files modified
include/platform/mir/graphics/platform.h (+12/-4)
include/platform/mir/input/platform.h (+6/-2)
src/platforms/android/server/platform.cpp (+9/-2)
src/platforms/android/server/symbols.map (+5/-0)
src/platforms/mesa/server/kms/guest_platform.cpp (+2/-1)
src/platforms/mesa/server/kms/platform.cpp (+7/-1)
src/platforms/mesa/server/kms/symbols.map (+5/-0)
src/platforms/mesa/server/x11/CMakeLists.txt (+7/-0)
src/platforms/mesa/server/x11/X11_resources.cpp (+11/-0)
src/platforms/mesa/server/x11/graphics/CMakeLists.txt (+2/-9)
src/platforms/mesa/server/x11/graphics/graphics.cpp (+7/-6)
src/platforms/mesa/server/x11/input/CMakeLists.txt (+1/-1)
src/platforms/mesa/server/x11/input/input.cpp (+5/-4)
src/platforms/mesa/server/x11/symbols.map (+5/-0)
src/server/graphics/default_configuration.cpp (+7/-2)
src/server/input/default_configuration.cpp (+5/-1)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-1)
tests/mir_test_doubles/platform_factory.cpp (+2/-1)
tests/mir_test_framework/stub_input.cpp (+7/-1)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+9/-2)
tests/mir_test_framework/symbols-server.map (+5/-0)
tests/mir_test_framework/symbols-stub-input.map (+5/-0)
tests/unit-tests/graphics/android/test_platform.cpp (+1/-1)
To merge this branch: bzr merge lp:~cemil-azizoglu/mir/add-create-module-context-fn
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Alan Griffiths Needs Information
Alexandros Frantzis (community) Needs Fixing
Review via email: mp+269127@code.launchpad.net

Commit message

Add create_module_context() to platform implementations.

Description of the change

Add create_module_context() to platform implementations.

- Both graphics and input platforms would have this function.
- If both graphics and input platforms are compiled into the same so, there will be one implementation.
- The function is called before creating a graphics and/or input platform.
- The context created is opaque outside the platform layer.
- The context obtained will then be provided to APIs such as create_input_platform, create_host_platform, create_guest_platform.
- This facilitates the X11 related assets to be created once and be used for input as well as graphics.

To post a comment you must log in.
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Also platform ABI, graphics ABI and input ABI need to be bumped. Will bump separately.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
2837. By Cemil Azizoglu

Fix android build

2838. By Cemil Azizoglu

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> std::shared_ptr<void> module_context

std::shared_ptr<void> const&, for consistency with the rest of the code (the idea being not to pay the cost of copying the shared_ptr<> unless it's actually needed by the callee).

Looks good otherwise.

review: Needs Fixing
2839. By Cemil Azizoglu

merge prereq

2840. By Cemil Azizoglu

Move create_module_context function to the main dir of x platform

2841. By Cemil Azizoglu

merge prereq

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

I was about to suggest using mir::UniqueModulePtr<void> instead - it would keep the module alive at least as long as the context object from the platform is alive. But unique_ptr does not allow void.

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

> I was about to suggest using mir::UniqueModulePtr<void> instead - it would
> keep the module alive at least as long as the context object from the platform
> is alive. But unique_ptr does not allow void.

As with the branch Alexandros proposed yesterday there's an advantage to an "empty" type with a vtab - it can be used with RTTI to safely downcast at the receiving end.

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

*Needs Discussion*

I'm just pondering an alternative approach: adding a method to mg::Platform. Vis:

  auto create_input_platform(...) -> UniqueModulePtr<input::Platform>

It the user has specified an input platform this can be ignored, otherwise call this and if it returns non-nullptr then use the result. Otherwise Mir looks for a suitable module elsewhere as currently.

review: Needs Information
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

> *Needs Discussion*
>
> I'm just pondering an alternative approach: adding a method to mg::Platform.
> Vis:
>
> auto create_input_platform(...) -> UniqueModulePtr<input::Platform>
>
> It the user has specified an input platform this can be ignored, otherwise
> call this and if it returns non-nullptr then use the result. Otherwise Mir
> looks for a suitable module elsewhere as currently.

Some anomalies with this approach would be :

- Not sure how this would solve the problem of creating a common context for both graphics and input irrespective of load order.
- Strange to have an "input" related interface in mir::graphics::...
- A graphics only platform would still need to have a create_input_platform() entry point.. confusing IMO.
- Imposes an order in which graphics (first) and input (next) platforms need to be created

2842. By Cemil Azizoglu

create_module_context --> get_module_context
CreateModuleContext --> GetModuleContext

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Need to think about this more. Making it WIP for now.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

2842. By Cemil Azizoglu

create_module_context --> get_module_context
CreateModuleContext --> GetModuleContext

2841. By Cemil Azizoglu

merge prereq

2840. By Cemil Azizoglu

Move create_module_context function to the main dir of x platform

2839. By Cemil Azizoglu

merge prereq

2838. By Cemil Azizoglu

merge trunk

2837. By Cemil Azizoglu

Fix android build

2836. By Cemil Azizoglu

Add create_module_context() to platforms

2835. By Cemil Azizoglu

merge trunk

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 2015-08-14 16:11:47 +0000
+++ include/platform/mir/graphics/platform.h 2015-09-01 03:06:58 +0000
@@ -40,6 +40,8 @@
40class ProgramOption;40class ProgramOption;
41}41}
4242
43typedef std::shared_ptr<void>(*GetModuleContext)();
44
43/// Graphics subsystem. Mediates interaction between core system and45/// Graphics subsystem. Mediates interaction between core system and
44/// the graphics environment.46/// the graphics environment.
45namespace graphics47namespace graphics
@@ -119,11 +121,13 @@
119typedef std::shared_ptr<mir::graphics::Platform>(*CreateHostPlatform)(121typedef std::shared_ptr<mir::graphics::Platform>(*CreateHostPlatform)(
120 std::shared_ptr<mir::options::Option> const& options,122 std::shared_ptr<mir::options::Option> const& options,
121 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,123 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
122 std::shared_ptr<mir::graphics::DisplayReport> const& report);124 std::shared_ptr<mir::graphics::DisplayReport> const& report,
125 std::shared_ptr<void> module_context);
123126
124typedef std::shared_ptr<mir::graphics::Platform>(*CreateGuestPlatform)(127typedef std::shared_ptr<mir::graphics::Platform>(*CreateGuestPlatform)(
125 std::shared_ptr<mir::graphics::DisplayReport> const& report,128 std::shared_ptr<mir::graphics::DisplayReport> const& report,
126 std::shared_ptr<mir::graphics::NestedContext> const& nested_context);129 std::shared_ptr<mir::graphics::NestedContext> const& nested_context,
130 std::shared_ptr<void> module_context);
127131
128132
129typedef void(*AddPlatformOptions)(133typedef void(*AddPlatformOptions)(
@@ -153,7 +157,8 @@
153std::shared_ptr<mir::graphics::Platform> create_host_platform(157std::shared_ptr<mir::graphics::Platform> create_host_platform(
154 std::shared_ptr<mir::options::Option> const& options,158 std::shared_ptr<mir::options::Option> const& options,
155 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,159 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
156 std::shared_ptr<mir::graphics::DisplayReport> const& report);160 std::shared_ptr<mir::graphics::DisplayReport> const& report,
161 std::shared_ptr<void> module_context);
157162
158/**163/**
159 * Function prototype used to return a new guest graphics platform. The guest graphics platform164 * Function prototype used to return a new guest graphics platform. The guest graphics platform
@@ -168,7 +173,8 @@
168 */173 */
169std::shared_ptr<mir::graphics::Platform> create_guest_platform(174std::shared_ptr<mir::graphics::Platform> create_guest_platform(
170 std::shared_ptr<mir::graphics::DisplayReport> const& report,175 std::shared_ptr<mir::graphics::DisplayReport> const& report,
171 std::shared_ptr<mir::graphics::NestedContext> const& nested_context);176 std::shared_ptr<mir::graphics::NestedContext> const& nested_context,
177 std::shared_ptr<void> module_context);
172178
173/**179/**
174 * Function prototype used to add platform specific options to the platform-independent server options.180 * Function prototype used to add platform specific options to the platform-independent server options.
@@ -188,6 +194,8 @@
188mir::graphics::PlatformPriority probe_graphics_platform(mir::options::ProgramOption const& options);194mir::graphics::PlatformPriority probe_graphics_platform(mir::options::ProgramOption const& options);
189195
190mir::ModuleProperties const* describe_graphics_module();196mir::ModuleProperties const* describe_graphics_module();
197
198std::shared_ptr<void> get_module_context();
191}199}
192200
193#endif // MIR_GRAPHICS_PLATFORM_H_201#endif // MIR_GRAPHICS_PLATFORM_H_
194202
=== modified file 'include/platform/mir/input/platform.h'
--- include/platform/mir/input/platform.h 2015-07-23 02:39:20 +0000
+++ include/platform/mir/input/platform.h 2015-09-01 03:06:58 +0000
@@ -38,6 +38,8 @@
38class Dispatchable;38class Dispatchable;
39}39}
4040
41typedef std::shared_ptr<void>(*GetModuleContext)();
42
41namespace input43namespace input
42{44{
43class InputDevice;45class InputDevice;
@@ -94,7 +96,8 @@
94 std::shared_ptr<options::Option> const& options,96 std::shared_ptr<options::Option> const& options,
95 std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry,97 std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry,
96 std::shared_ptr<InputDeviceRegistry> const& input_device_registry,98 std::shared_ptr<InputDeviceRegistry> const& input_device_registry,
97 std::shared_ptr<InputReport> const& report);99 std::shared_ptr<InputReport> const& report,
100 std::shared_ptr<void> module_context);
98101
99typedef void(*AddPlatformOptions)(102typedef void(*AddPlatformOptions)(
100 boost::program_options::options_description& config);103 boost::program_options::options_description& config);
@@ -126,7 +129,8 @@
126 std::shared_ptr<mir::options::Option> const& options,129 std::shared_ptr<mir::options::Option> const& options,
127 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,130 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
128 std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry,131 std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry,
129 std::shared_ptr<mir::input::InputReport> const& report);132 std::shared_ptr<mir::input::InputReport> const& report,
133 std::shared_ptr<void> module_context);
130134
131/**135/**
132 * Function used to add additional configuration options136 * Function used to add additional configuration options
133137
=== modified file 'src/platforms/android/server/platform.cpp'
--- src/platforms/android/server/platform.cpp 2015-07-23 02:39:20 +0000
+++ src/platforms/android/server/platform.cpp 2015-09-01 03:06:58 +0000
@@ -138,7 +138,8 @@
138std::shared_ptr<mg::Platform> create_host_platform(138std::shared_ptr<mg::Platform> create_host_platform(
139 std::shared_ptr<mo::Option> const& options,139 std::shared_ptr<mo::Option> const& options,
140 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,140 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
141 std::shared_ptr<mir::graphics::DisplayReport> const& display_report)141 std::shared_ptr<mir::graphics::DisplayReport> const& display_report,
142 std::shared_ptr<void> /*module_context*/)
142{143{
143 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}, *options);144 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}, *options);
144 auto hwc_report = make_hwc_report(*options);145 auto hwc_report = make_hwc_report(*options);
@@ -153,7 +154,8 @@
153154
154std::shared_ptr<mg::Platform> create_guest_platform(155std::shared_ptr<mg::Platform> create_guest_platform(
155 std::shared_ptr<mg::DisplayReport> const& display_report,156 std::shared_ptr<mg::DisplayReport> const& display_report,
156 std::shared_ptr<mg::NestedContext> const&)157 std::shared_ptr<mg::NestedContext> const&,
158 std::shared_ptr<void> /*module_context*/)
157{159{
158 //TODO: actually allow disabling quirks for guest platform160 //TODO: actually allow disabling quirks for guest platform
159 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{});161 auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{});
@@ -196,3 +198,8 @@
196{198{
197 return &description;199 return &description;
198}200}
201
202std::shared_ptr<void> get_module_context()
203{
204 return {};
205}
199206
=== modified file 'src/platforms/android/server/symbols.map'
--- src/platforms/android/server/symbols.map 2015-07-22 02:54:31 +0000
+++ src/platforms/android/server/symbols.map 2015-09-01 03:06:58 +0000
@@ -1,3 +1,8 @@
1MIR_SERVER_PLATFORM {
2 global:
3 get_module_context;
4};
5
1MIR_GRAPHICS_PLATFORM_4 {6MIR_GRAPHICS_PLATFORM_4 {
2 global:7 global:
3 add_graphics_platform_options;8 add_graphics_platform_options;
49
=== modified file 'src/platforms/mesa/server/kms/guest_platform.cpp'
--- src/platforms/mesa/server/kms/guest_platform.cpp 2015-07-23 02:39:20 +0000
+++ src/platforms/mesa/server/kms/guest_platform.cpp 2015-09-01 03:06:58 +0000
@@ -90,7 +90,8 @@
9090
91std::shared_ptr<mg::Platform> create_guest_platform(91std::shared_ptr<mg::Platform> create_guest_platform(
92 std::shared_ptr<mg::DisplayReport> const&,92 std::shared_ptr<mg::DisplayReport> const&,
93 std::shared_ptr<mg::NestedContext> const& nested_context)93 std::shared_ptr<mg::NestedContext> const& nested_context,
94 std::shared_ptr<void> /*module_context*/)
94{95{
95 return std::make_shared<mgm::GuestPlatform>(nested_context);96 return std::make_shared<mgm::GuestPlatform>(nested_context);
96}97}
9798
=== modified file 'src/platforms/mesa/server/kms/platform.cpp'
--- src/platforms/mesa/server/kms/platform.cpp 2015-07-23 02:39:20 +0000
+++ src/platforms/mesa/server/kms/platform.cpp 2015-09-01 03:06:58 +0000
@@ -185,7 +185,8 @@
185std::shared_ptr<mg::Platform> create_host_platform(185std::shared_ptr<mg::Platform> create_host_platform(
186 std::shared_ptr<mo::Option> const& options,186 std::shared_ptr<mo::Option> const& options,
187 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,187 std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
188 std::shared_ptr<mg::DisplayReport> const& report)188 std::shared_ptr<mg::DisplayReport> const& report,
189 std::shared_ptr<void> /*module_context*/)
189{190{
190 auto real_fops = std::make_shared<RealVTFileOperations>();191 auto real_fops = std::make_shared<RealVTFileOperations>();
191 auto real_pops = std::unique_ptr<RealPosixProcessOperations>(new RealPosixProcessOperations{});192 auto real_pops = std::unique_ptr<RealPosixProcessOperations>(new RealPosixProcessOperations{});
@@ -258,3 +259,8 @@
258{259{
259 return &description;260 return &description;
260}261}
262
263std::shared_ptr<void> get_module_context()
264{
265 return {};
266}
261267
=== modified file 'src/platforms/mesa/server/kms/symbols.map'
--- src/platforms/mesa/server/kms/symbols.map 2015-07-23 02:39:20 +0000
+++ src/platforms/mesa/server/kms/symbols.map 2015-09-01 03:06:58 +0000
@@ -1,3 +1,8 @@
1MIR_SERVER_PLATFORM {
2 global:
3 get_module_context;
4};
5
1MIR_GRAPHICS_PLATFORM_4 {6MIR_GRAPHICS_PLATFORM_4 {
2 global:7 global:
3 add_graphics_platform_options;8 add_graphics_platform_options;
49
=== modified file 'src/platforms/mesa/server/x11/CMakeLists.txt'
--- src/platforms/mesa/server/x11/CMakeLists.txt 2015-08-27 16:57:05 +0000
+++ src/platforms/mesa/server/x11/CMakeLists.txt 2015-09-01 03:06:58 +0000
@@ -1,6 +1,13 @@
1add_subdirectory(graphics/)1add_subdirectory(graphics/)
2add_subdirectory(input/)2add_subdirectory(input/)
33
4include_directories(
5 ${server_common_include_dirs}
6 ${PROJECT_SOURCE_DIR}/src/platforms/mesa/server/common
7 ${PROJECT_SOURCE_DIR}/include/platform
8 ${DRM_INCLUDE_DIRS}
9)
10
4add_library(11add_library(
5 mirplatformservermesax11 MODULE12 mirplatformservermesax11 MODULE
613
714
=== modified file 'src/platforms/mesa/server/x11/X11_resources.cpp'
--- src/platforms/mesa/server/x11/X11_resources.cpp 2015-08-21 20:12:37 +0000
+++ src/platforms/mesa/server/x11/X11_resources.cpp 2015-09-01 03:06:58 +0000
@@ -19,6 +19,7 @@
19#define MIR_LOG_COMPONENT "x11-error"19#define MIR_LOG_COMPONENT "x11-error"
20#include "mir/log.h"20#include "mir/log.h"
2121
22#include "graphics/platform.h"
22#include "X11_resources.h"23#include "X11_resources.h"
2324
24namespace mx = mir::X;25namespace mx = mir::X;
@@ -26,6 +27,16 @@
26//Force synchronous Xlib operation - for debugging27//Force synchronous Xlib operation - for debugging
27//#define FORCE_SYNCHRONOUS28//#define FORCE_SYNCHRONOUS
2829
30std::shared_ptr<void> get_module_context()
31{
32 static std::shared_ptr<mx::X11Resources> anchor;
33
34 if (!anchor)
35 anchor = std::make_shared<mx::X11Resources>();
36
37 return anchor;
38}
39
29int mx::mir_x11_error_handler(Display* dpy, XErrorEvent* eev)40int mx::mir_x11_error_handler(Display* dpy, XErrorEvent* eev)
30{41{
31 char msg[80];42 char msg[80];
3243
=== modified file 'src/platforms/mesa/server/x11/graphics/CMakeLists.txt'
--- src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2015-09-01 02:26:10 +0000
+++ src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2015-09-01 03:06:58 +0000
@@ -1,16 +1,9 @@
1include_directories(1include_directories(
2 ${server_common_include_dirs}2 ${server_common_include_dirs}
3 ${PROJECT_SOURCE_DIR}/include/platform3 ${PROJECT_SOURCE_DIR}/include/platform
4 ${PROJECT_SOURCE_DIR}/include/client
5 ${PROJECT_SOURCE_DIR}/src/platforms/mesa/server/common4 ${PROJECT_SOURCE_DIR}/src/platforms/mesa/server/common
6)5 ${DRM_INCLUDE_DIRS}
76 ${EGL_INCLUDE_DIRS}
8include_directories(
9 ${DRM_INCLUDE_DIRS}
10 ${GBM_INCLUDE_DIRS}
11 ${EGL_INCLUDE_DIRS}
12 ${GLESv2_INCLUDE_DIRS}
13 ${UDEV_INCLUDE_DIRS}
14)7)
158
16add_library(9add_library(
1710
=== modified file 'src/platforms/mesa/server/x11/graphics/graphics.cpp'
--- src/platforms/mesa/server/x11/graphics/graphics.cpp 2015-08-21 20:12:37 +0000
+++ src/platforms/mesa/server/x11/graphics/graphics.cpp 2015-09-01 03:06:58 +0000
@@ -25,22 +25,23 @@
25namespace mx = mir::X;25namespace mx = mir::X;
26namespace mgx = mg::X;26namespace mgx = mg::X;
2727
28mx::X11Resources x11_resources;
29
30std::shared_ptr<mg::Platform> create_host_platform(28std::shared_ptr<mg::Platform> create_host_platform(
31 std::shared_ptr<mo::Option> const& /*options*/,29 std::shared_ptr<mo::Option> const& /*options*/,
32 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,30 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
33 std::shared_ptr<mg::DisplayReport> const& /*report*/)31 std::shared_ptr<mg::DisplayReport> const& /*report*/,
32 std::shared_ptr<void> module_context)
34{33{
35 if (!x11_resources.get_conn())34 auto context = std::static_pointer_cast<mx::X11Resources>(module_context);
35 if (!context->get_conn())
36 BOOST_THROW_EXCEPTION(std::runtime_error("Need valid x11 display"));36 BOOST_THROW_EXCEPTION(std::runtime_error("Need valid x11 display"));
3737
38 return std::make_shared<mgx::Platform>(x11_resources.get_conn());38 return std::make_shared<mgx::Platform>(context->get_conn());
39}39}
4040
41std::shared_ptr<mg::Platform> create_guest_platform(41std::shared_ptr<mg::Platform> create_guest_platform(
42 std::shared_ptr<mg::DisplayReport> const& /*report*/,42 std::shared_ptr<mg::DisplayReport> const& /*report*/,
43 std::shared_ptr<mg::NestedContext> const&)43 std::shared_ptr<mg::NestedContext> const&,
44 std::shared_ptr<void> /*module_context*/)
44{45{
45 BOOST_THROW_EXCEPTION(std::runtime_error("Guest platform isn't supported under X"));46 BOOST_THROW_EXCEPTION(std::runtime_error("Guest platform isn't supported under X"));
46 return nullptr;47 return nullptr;
4748
=== modified file 'src/platforms/mesa/server/x11/input/CMakeLists.txt'
--- src/platforms/mesa/server/x11/input/CMakeLists.txt 2015-08-21 22:20:42 +0000
+++ src/platforms/mesa/server/x11/input/CMakeLists.txt 2015-09-01 03:06:58 +0000
@@ -1,5 +1,5 @@
1include_directories(1include_directories(
2 ${server_common_include_dirs}2 ${PROJECT_SOURCE_DIR}/include/platform
3 ${PROJECT_SOURCE_DIR}/include/client3 ${PROJECT_SOURCE_DIR}/include/client
4)4)
55
66
=== modified file 'src/platforms/mesa/server/x11/input/input.cpp'
--- src/platforms/mesa/server/x11/input/input.cpp 2015-08-21 20:12:37 +0000
+++ src/platforms/mesa/server/x11/input/input.cpp 2015-09-01 03:06:58 +0000
@@ -25,15 +25,16 @@
25namespace mx = mir::X;25namespace mx = mir::X;
26namespace mix = mi::X;26namespace mix = mi::X;
2727
28extern mx::X11Resources x11_resources;
29
30mir::UniqueModulePtr<mi::Platform> create_input_platform(28mir::UniqueModulePtr<mi::Platform> create_input_platform(
31 std::shared_ptr<mo::Option> const& /*options*/,29 std::shared_ptr<mo::Option> const& /*options*/,
32 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,30 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
33 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,31 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,
34 std::shared_ptr<mi::InputReport> const& /*report*/)32 std::shared_ptr<mi::InputReport> const& /*report*/,
33 std::shared_ptr<void> module_context)
35{34{
36 return mir::make_module_ptr<mix::XInputPlatform>(input_device_registry, x11_resources.get_conn());35 auto context = std::static_pointer_cast<mx::X11Resources>(module_context);
36
37 return mir::make_module_ptr<mix::XInputPlatform>(input_device_registry, context->get_conn());
37}38}
3839
39void add_input_platform_options(40void add_input_platform_options(
4041
=== modified file 'src/platforms/mesa/server/x11/symbols.map'
--- src/platforms/mesa/server/x11/symbols.map 2015-09-01 02:26:10 +0000
+++ src/platforms/mesa/server/x11/symbols.map 2015-09-01 03:06:58 +0000
@@ -1,3 +1,8 @@
1MIR_SERVER_PLATFORM {
2 global:
3 get_module_context;
4};
5
1MIR_GRAPHICS_PLATFORM_4 {6MIR_GRAPHICS_PLATFORM_4 {
2 global: 7 global:
3 add_graphics_platform_options;8 add_graphics_platform_options;
49
=== modified file 'src/server/graphics/default_configuration.cpp'
--- src/server/graphics/default_configuration.cpp 2015-07-20 03:16:27 +0000
+++ src/server/graphics/default_configuration.cpp 2015-09-01 03:06:58 +0000
@@ -94,6 +94,10 @@
94 }94 }
95 platform_library = mir::graphics::module_for_device(platforms, dynamic_cast<mir::options::ProgramOption&>(*the_options()));95 platform_library = mir::graphics::module_for_device(platforms, dynamic_cast<mir::options::ProgramOption&>(*the_options()));
96 }96 }
97 auto get_module_context = platform_library->load_function<mir::GetModuleContext>(
98 "get_module_context",
99 "MIR_SERVER_PLATFORM");
100 auto context = get_module_context ? get_module_context() : nullptr;
97 auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>(101 auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>(
98 "create_host_platform",102 "create_host_platform",
99 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);103 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
@@ -111,11 +115,12 @@
111 description->micro_version);115 description->micro_version);
112116
113 if (!the_options()->is_set(options::host_socket_opt))117 if (!the_options()->is_set(options::host_socket_opt))
114 return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report());118 return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report(), context);
115 else119 else
116 return create_guest_platform(120 return create_guest_platform(
117 the_display_report(),121 the_display_report(),
118 the_host_connection());122 the_host_connection(),
123 context);
119124
120 });125 });
121}126}
122127
=== modified file 'src/server/input/default_configuration.cpp'
--- src/server/input/default_configuration.cpp 2015-08-20 12:33:43 +0000
+++ src/server/input/default_configuration.cpp 2015-09-01 03:06:58 +0000
@@ -318,10 +318,14 @@
318318
319 auto lib = std::make_shared<mir::SharedLibrary>(319 auto lib = std::make_shared<mir::SharedLibrary>(
320 options->get<std::string>(options::platform_input_lib));320 options->get<std::string>(options::platform_input_lib));
321 auto get_module_context = lib->load_function<mir::GetModuleContext>(
322 "get_module_context",
323 "MIR_SERVER_PLATFORM");
324 auto context = get_module_context ? get_module_context() : nullptr;
321 auto create = lib->load_function<mi::CreatePlatform>(325 auto create = lib->load_function<mi::CreatePlatform>(
322 "create_input_platform",326 "create_input_platform",
323 MIR_SERVER_INPUT_PLATFORM_VERSION);327 MIR_SERVER_INPUT_PLATFORM_VERSION);
324 return create(the_options(), the_emergency_cleanup(), the_input_device_registry(), the_input_report());328 return create(the_options(), the_emergency_cleanup(), the_input_device_registry(), the_input_report(), context);
325 });329 });
326}330}
327331
328332
=== modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp'
--- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2015-06-25 13:43:43 +0000
+++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2015-09-01 03:06:58 +0000
@@ -102,7 +102,8 @@
102 platform = create_host_platform(102 platform = create_host_platform(
103 options,103 options,
104 std::make_shared<mtd::NullEmergencyCleanup>(),104 std::make_shared<mtd::NullEmergencyCleanup>(),
105 mr::null_display_report());105 mr::null_display_report(),
106 get_module_context());
106 }107 }
107 else108 else
108 {109 {
109110
=== modified file 'tests/mir_test_doubles/platform_factory.cpp'
--- tests/mir_test_doubles/platform_factory.cpp 2015-08-21 20:35:15 +0000
+++ tests/mir_test_doubles/platform_factory.cpp 2015-09-01 03:06:58 +0000
@@ -40,7 +40,8 @@
40 return create_host_platform(40 return create_host_platform(
41 std::make_shared<options::ProgramOption>(),41 std::make_shared<options::ProgramOption>(),
42 std::make_shared<NullEmergencyCleanup>(),42 std::make_shared<NullEmergencyCleanup>(),
43 report::null_display_report());43 report::null_display_report(),
44 get_module_context());
44}45}
4546
46#elif MESA_KMS47#elif MESA_KMS
4748
=== modified file 'tests/mir_test_framework/stub_input.cpp'
--- tests/mir_test_framework/stub_input.cpp 2015-07-20 03:16:27 +0000
+++ tests/mir_test_framework/stub_input.cpp 2015-09-01 03:06:58 +0000
@@ -28,7 +28,8 @@
28 std::shared_ptr<mo::Option> const& /*options*/,28 std::shared_ptr<mo::Option> const& /*options*/,
29 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,29 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
30 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,30 std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry,
31 std::shared_ptr<mi::InputReport> const& /*report*/)31 std::shared_ptr<mi::InputReport> const& /*report*/,
32 std::shared_ptr<void> /*module_context*/)
32{33{
33 return mir::make_module_ptr<mtf::StubInputPlatform>(input_device_registry);34 return mir::make_module_ptr<mtf::StubInputPlatform>(input_device_registry);
34}35}
@@ -64,3 +65,8 @@
64{65{
65 return mir::make_module_ptr<mtf::FakeInputDeviceImpl>(info);66 return mir::make_module_ptr<mtf::FakeInputDeviceImpl>(info);
66}67}
68
69extern "C" std::shared_ptr<void> get_module_context()
70{
71 return {};
72}
6773
=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-07-23 02:39:20 +0000
+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-09-01 03:06:58 +0000
@@ -294,7 +294,8 @@
294std::shared_ptr<mg::Platform> create_host_platform(294std::shared_ptr<mg::Platform> create_host_platform(
295 std::shared_ptr<mo::Option> const& /*options*/,295 std::shared_ptr<mo::Option> const& /*options*/,
296 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,296 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
297 std::shared_ptr<mg::DisplayReport> const& /*report*/)297 std::shared_ptr<mg::DisplayReport> const& /*report*/,
298 std::shared_ptr<void> /*module_context*/)
298{299{
299 std::shared_ptr<mg::Platform> result{};300 std::shared_ptr<mg::Platform> result{};
300301
@@ -313,7 +314,8 @@
313314
314std::shared_ptr<mg::Platform> create_guest_platform(315std::shared_ptr<mg::Platform> create_guest_platform(
315 std::shared_ptr<mg::DisplayReport> const&,316 std::shared_ptr<mg::DisplayReport> const&,
316 std::shared_ptr<mg::NestedContext> const& context)317 std::shared_ptr<mg::NestedContext> const& context,
318 std::shared_ptr<void> /*module_context*/)
317{319{
318 auto graphics_platform = the_graphics_platform.lock();320 auto graphics_platform = the_graphics_platform.lock();
319 if (!graphics_platform)321 if (!graphics_platform)
@@ -339,3 +341,8 @@
339{341{
340 display_preset = display;342 display_preset = display;
341}343}
344
345extern "C" std::shared_ptr<void> get_module_context()
346{
347 return {};
348}
342349
=== modified file 'tests/mir_test_framework/symbols-server.map'
--- tests/mir_test_framework/symbols-server.map 2015-07-22 02:54:31 +0000
+++ tests/mir_test_framework/symbols-server.map 2015-09-01 03:06:58 +0000
@@ -1,3 +1,8 @@
1MIR_SERVER_PLATFORM {
2 global:
3 get_module_context;
4};
5
1MIR_GRAPHICS_PLATFORM_4 {6MIR_GRAPHICS_PLATFORM_4 {
2 global:7 global:
3 add_graphics_platform_options;8 add_graphics_platform_options;
49
=== modified file 'tests/mir_test_framework/symbols-stub-input.map'
--- tests/mir_test_framework/symbols-stub-input.map 2015-08-27 08:41:14 +0000
+++ tests/mir_test_framework/symbols-stub-input.map 2015-09-01 03:06:58 +0000
@@ -1,3 +1,8 @@
1MIR_SERVER_PLATFORM {
2 global:
3 get_module_context;
4};
5
1MIR_INPUT_PLATFORM_2 {6MIR_INPUT_PLATFORM_2 {
2 global:7 global:
3 add_input_platform_options;8 add_input_platform_options;
49
=== modified file 'tests/unit-tests/graphics/android/test_platform.cpp'
--- tests/unit-tests/graphics/android/test_platform.cpp 2015-07-20 03:16:27 +0000
+++ tests/unit-tests/graphics/android/test_platform.cpp 2015-09-01 03:06:58 +0000
@@ -271,5 +271,5 @@
271 EXPECT_CALL(hwaccess, hw_get_module(StrEq(GRALLOC_HARDWARE_MODULE_ID), _))271 EXPECT_CALL(hwaccess, hw_get_module(StrEq(GRALLOC_HARDWARE_MODULE_ID), _))
272 .Times(AtMost(1));272 .Times(AtMost(1));
273273
274 auto platform = create_guest_platform(mt::fake_shared(stub_report), nullptr);274 auto platform = create_guest_platform(mt::fake_shared(stub_report), nullptr, get_module_context());
275}275}

Subscribers

People subscribed via source and target branches