Merge lp:~cemil-azizoglu/mir/add-create-module-context-fn into lp:mir
- add-create-module-context-fn
- Merge into development-branch
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 |
Related bugs: |
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_
Description of the change
Add create_
- 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_
- This facilitates the X11 related assets to be created once and be used for input as well as graphics.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2836
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 2837. By Cemil Azizoglu
-
Fix android build
- 2838. By Cemil Azizoglu
-
merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2837
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2838
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
> std::shared_
std::shared_
Looks good otherwise.
- 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
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2841
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2841
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Andreas Pokorny (andreas-pokorny) wrote : | # |
I was about to suggest using mir::UniqueModu
Alan Griffiths (alan-griffiths) wrote : | # |
> I was about to suggest using mir::UniqueModu
> 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.
Alan Griffiths (alan-griffiths) wrote : | # |
*Needs Discussion*
I'm just pondering an alternative approach: adding a method to mg::Platform. Vis:
auto create_
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.
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
> *Needs Discussion*
>
> I'm just pondering an alternative approach: adding a method to mg::Platform.
> Vis:
>
> auto create_
>
> 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_
- 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
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
Need to think about this more. Making it WIP for now.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2842
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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
1 | === modified file 'include/platform/mir/graphics/platform.h' |
2 | --- include/platform/mir/graphics/platform.h 2015-08-14 16:11:47 +0000 |
3 | +++ include/platform/mir/graphics/platform.h 2015-09-01 03:06:58 +0000 |
4 | @@ -40,6 +40,8 @@ |
5 | class ProgramOption; |
6 | } |
7 | |
8 | +typedef std::shared_ptr<void>(*GetModuleContext)(); |
9 | + |
10 | /// Graphics subsystem. Mediates interaction between core system and |
11 | /// the graphics environment. |
12 | namespace graphics |
13 | @@ -119,11 +121,13 @@ |
14 | typedef std::shared_ptr<mir::graphics::Platform>(*CreateHostPlatform)( |
15 | std::shared_ptr<mir::options::Option> const& options, |
16 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry, |
17 | - std::shared_ptr<mir::graphics::DisplayReport> const& report); |
18 | + std::shared_ptr<mir::graphics::DisplayReport> const& report, |
19 | + std::shared_ptr<void> module_context); |
20 | |
21 | typedef std::shared_ptr<mir::graphics::Platform>(*CreateGuestPlatform)( |
22 | std::shared_ptr<mir::graphics::DisplayReport> const& report, |
23 | - std::shared_ptr<mir::graphics::NestedContext> const& nested_context); |
24 | + std::shared_ptr<mir::graphics::NestedContext> const& nested_context, |
25 | + std::shared_ptr<void> module_context); |
26 | |
27 | |
28 | typedef void(*AddPlatformOptions)( |
29 | @@ -153,7 +157,8 @@ |
30 | std::shared_ptr<mir::graphics::Platform> create_host_platform( |
31 | std::shared_ptr<mir::options::Option> const& options, |
32 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry, |
33 | - std::shared_ptr<mir::graphics::DisplayReport> const& report); |
34 | + std::shared_ptr<mir::graphics::DisplayReport> const& report, |
35 | + std::shared_ptr<void> module_context); |
36 | |
37 | /** |
38 | * Function prototype used to return a new guest graphics platform. The guest graphics platform |
39 | @@ -168,7 +173,8 @@ |
40 | */ |
41 | std::shared_ptr<mir::graphics::Platform> create_guest_platform( |
42 | std::shared_ptr<mir::graphics::DisplayReport> const& report, |
43 | - std::shared_ptr<mir::graphics::NestedContext> const& nested_context); |
44 | + std::shared_ptr<mir::graphics::NestedContext> const& nested_context, |
45 | + std::shared_ptr<void> module_context); |
46 | |
47 | /** |
48 | * Function prototype used to add platform specific options to the platform-independent server options. |
49 | @@ -188,6 +194,8 @@ |
50 | mir::graphics::PlatformPriority probe_graphics_platform(mir::options::ProgramOption const& options); |
51 | |
52 | mir::ModuleProperties const* describe_graphics_module(); |
53 | + |
54 | +std::shared_ptr<void> get_module_context(); |
55 | } |
56 | |
57 | #endif // MIR_GRAPHICS_PLATFORM_H_ |
58 | |
59 | === modified file 'include/platform/mir/input/platform.h' |
60 | --- include/platform/mir/input/platform.h 2015-07-23 02:39:20 +0000 |
61 | +++ include/platform/mir/input/platform.h 2015-09-01 03:06:58 +0000 |
62 | @@ -38,6 +38,8 @@ |
63 | class Dispatchable; |
64 | } |
65 | |
66 | +typedef std::shared_ptr<void>(*GetModuleContext)(); |
67 | + |
68 | namespace input |
69 | { |
70 | class InputDevice; |
71 | @@ -94,7 +96,8 @@ |
72 | std::shared_ptr<options::Option> const& options, |
73 | std::shared_ptr<EmergencyCleanupRegistry> const& emergency_cleanup_registry, |
74 | std::shared_ptr<InputDeviceRegistry> const& input_device_registry, |
75 | - std::shared_ptr<InputReport> const& report); |
76 | + std::shared_ptr<InputReport> const& report, |
77 | + std::shared_ptr<void> module_context); |
78 | |
79 | typedef void(*AddPlatformOptions)( |
80 | boost::program_options::options_description& config); |
81 | @@ -126,7 +129,8 @@ |
82 | std::shared_ptr<mir::options::Option> const& options, |
83 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry, |
84 | std::shared_ptr<mir::input::InputDeviceRegistry> const& input_device_registry, |
85 | - std::shared_ptr<mir::input::InputReport> const& report); |
86 | + std::shared_ptr<mir::input::InputReport> const& report, |
87 | + std::shared_ptr<void> module_context); |
88 | |
89 | /** |
90 | * Function used to add additional configuration options |
91 | |
92 | === modified file 'src/platforms/android/server/platform.cpp' |
93 | --- src/platforms/android/server/platform.cpp 2015-07-23 02:39:20 +0000 |
94 | +++ src/platforms/android/server/platform.cpp 2015-09-01 03:06:58 +0000 |
95 | @@ -138,7 +138,8 @@ |
96 | std::shared_ptr<mg::Platform> create_host_platform( |
97 | std::shared_ptr<mo::Option> const& options, |
98 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/, |
99 | - std::shared_ptr<mir::graphics::DisplayReport> const& display_report) |
100 | + std::shared_ptr<mir::graphics::DisplayReport> const& display_report, |
101 | + std::shared_ptr<void> /*module_context*/) |
102 | { |
103 | auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}, *options); |
104 | auto hwc_report = make_hwc_report(*options); |
105 | @@ -153,7 +154,8 @@ |
106 | |
107 | std::shared_ptr<mg::Platform> create_guest_platform( |
108 | std::shared_ptr<mg::DisplayReport> const& display_report, |
109 | - std::shared_ptr<mg::NestedContext> const&) |
110 | + std::shared_ptr<mg::NestedContext> const&, |
111 | + std::shared_ptr<void> /*module_context*/) |
112 | { |
113 | //TODO: actually allow disabling quirks for guest platform |
114 | auto quirks = std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}); |
115 | @@ -196,3 +198,8 @@ |
116 | { |
117 | return &description; |
118 | } |
119 | + |
120 | +std::shared_ptr<void> get_module_context() |
121 | +{ |
122 | + return {}; |
123 | +} |
124 | |
125 | === modified file 'src/platforms/android/server/symbols.map' |
126 | --- src/platforms/android/server/symbols.map 2015-07-22 02:54:31 +0000 |
127 | +++ src/platforms/android/server/symbols.map 2015-09-01 03:06:58 +0000 |
128 | @@ -1,3 +1,8 @@ |
129 | +MIR_SERVER_PLATFORM { |
130 | + global: |
131 | + get_module_context; |
132 | +}; |
133 | + |
134 | MIR_GRAPHICS_PLATFORM_4 { |
135 | global: |
136 | add_graphics_platform_options; |
137 | |
138 | === modified file 'src/platforms/mesa/server/kms/guest_platform.cpp' |
139 | --- src/platforms/mesa/server/kms/guest_platform.cpp 2015-07-23 02:39:20 +0000 |
140 | +++ src/platforms/mesa/server/kms/guest_platform.cpp 2015-09-01 03:06:58 +0000 |
141 | @@ -90,7 +90,8 @@ |
142 | |
143 | std::shared_ptr<mg::Platform> create_guest_platform( |
144 | std::shared_ptr<mg::DisplayReport> const&, |
145 | - std::shared_ptr<mg::NestedContext> const& nested_context) |
146 | + std::shared_ptr<mg::NestedContext> const& nested_context, |
147 | + std::shared_ptr<void> /*module_context*/) |
148 | { |
149 | return std::make_shared<mgm::GuestPlatform>(nested_context); |
150 | } |
151 | |
152 | === modified file 'src/platforms/mesa/server/kms/platform.cpp' |
153 | --- src/platforms/mesa/server/kms/platform.cpp 2015-07-23 02:39:20 +0000 |
154 | +++ src/platforms/mesa/server/kms/platform.cpp 2015-09-01 03:06:58 +0000 |
155 | @@ -185,7 +185,8 @@ |
156 | std::shared_ptr<mg::Platform> create_host_platform( |
157 | std::shared_ptr<mo::Option> const& options, |
158 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry, |
159 | - std::shared_ptr<mg::DisplayReport> const& report) |
160 | + std::shared_ptr<mg::DisplayReport> const& report, |
161 | + std::shared_ptr<void> /*module_context*/) |
162 | { |
163 | auto real_fops = std::make_shared<RealVTFileOperations>(); |
164 | auto real_pops = std::unique_ptr<RealPosixProcessOperations>(new RealPosixProcessOperations{}); |
165 | @@ -258,3 +259,8 @@ |
166 | { |
167 | return &description; |
168 | } |
169 | + |
170 | +std::shared_ptr<void> get_module_context() |
171 | +{ |
172 | + return {}; |
173 | +} |
174 | |
175 | === modified file 'src/platforms/mesa/server/kms/symbols.map' |
176 | --- src/platforms/mesa/server/kms/symbols.map 2015-07-23 02:39:20 +0000 |
177 | +++ src/platforms/mesa/server/kms/symbols.map 2015-09-01 03:06:58 +0000 |
178 | @@ -1,3 +1,8 @@ |
179 | +MIR_SERVER_PLATFORM { |
180 | + global: |
181 | + get_module_context; |
182 | +}; |
183 | + |
184 | MIR_GRAPHICS_PLATFORM_4 { |
185 | global: |
186 | add_graphics_platform_options; |
187 | |
188 | === modified file 'src/platforms/mesa/server/x11/CMakeLists.txt' |
189 | --- src/platforms/mesa/server/x11/CMakeLists.txt 2015-08-27 16:57:05 +0000 |
190 | +++ src/platforms/mesa/server/x11/CMakeLists.txt 2015-09-01 03:06:58 +0000 |
191 | @@ -1,6 +1,13 @@ |
192 | add_subdirectory(graphics/) |
193 | add_subdirectory(input/) |
194 | |
195 | +include_directories( |
196 | + ${server_common_include_dirs} |
197 | + ${PROJECT_SOURCE_DIR}/src/platforms/mesa/server/common |
198 | + ${PROJECT_SOURCE_DIR}/include/platform |
199 | + ${DRM_INCLUDE_DIRS} |
200 | +) |
201 | + |
202 | add_library( |
203 | mirplatformservermesax11 MODULE |
204 | |
205 | |
206 | === modified file 'src/platforms/mesa/server/x11/X11_resources.cpp' |
207 | --- src/platforms/mesa/server/x11/X11_resources.cpp 2015-08-21 20:12:37 +0000 |
208 | +++ src/platforms/mesa/server/x11/X11_resources.cpp 2015-09-01 03:06:58 +0000 |
209 | @@ -19,6 +19,7 @@ |
210 | #define MIR_LOG_COMPONENT "x11-error" |
211 | #include "mir/log.h" |
212 | |
213 | +#include "graphics/platform.h" |
214 | #include "X11_resources.h" |
215 | |
216 | namespace mx = mir::X; |
217 | @@ -26,6 +27,16 @@ |
218 | //Force synchronous Xlib operation - for debugging |
219 | //#define FORCE_SYNCHRONOUS |
220 | |
221 | +std::shared_ptr<void> get_module_context() |
222 | +{ |
223 | + static std::shared_ptr<mx::X11Resources> anchor; |
224 | + |
225 | + if (!anchor) |
226 | + anchor = std::make_shared<mx::X11Resources>(); |
227 | + |
228 | + return anchor; |
229 | +} |
230 | + |
231 | int mx::mir_x11_error_handler(Display* dpy, XErrorEvent* eev) |
232 | { |
233 | char msg[80]; |
234 | |
235 | === modified file 'src/platforms/mesa/server/x11/graphics/CMakeLists.txt' |
236 | --- src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2015-09-01 02:26:10 +0000 |
237 | +++ src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2015-09-01 03:06:58 +0000 |
238 | @@ -1,16 +1,9 @@ |
239 | include_directories( |
240 | ${server_common_include_dirs} |
241 | ${PROJECT_SOURCE_DIR}/include/platform |
242 | - ${PROJECT_SOURCE_DIR}/include/client |
243 | ${PROJECT_SOURCE_DIR}/src/platforms/mesa/server/common |
244 | -) |
245 | - |
246 | -include_directories( |
247 | - ${DRM_INCLUDE_DIRS} |
248 | - ${GBM_INCLUDE_DIRS} |
249 | - ${EGL_INCLUDE_DIRS} |
250 | - ${GLESv2_INCLUDE_DIRS} |
251 | - ${UDEV_INCLUDE_DIRS} |
252 | + ${DRM_INCLUDE_DIRS} |
253 | + ${EGL_INCLUDE_DIRS} |
254 | ) |
255 | |
256 | add_library( |
257 | |
258 | === modified file 'src/platforms/mesa/server/x11/graphics/graphics.cpp' |
259 | --- src/platforms/mesa/server/x11/graphics/graphics.cpp 2015-08-21 20:12:37 +0000 |
260 | +++ src/platforms/mesa/server/x11/graphics/graphics.cpp 2015-09-01 03:06:58 +0000 |
261 | @@ -25,22 +25,23 @@ |
262 | namespace mx = mir::X; |
263 | namespace mgx = mg::X; |
264 | |
265 | -mx::X11Resources x11_resources; |
266 | - |
267 | std::shared_ptr<mg::Platform> create_host_platform( |
268 | std::shared_ptr<mo::Option> const& /*options*/, |
269 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/, |
270 | - std::shared_ptr<mg::DisplayReport> const& /*report*/) |
271 | + std::shared_ptr<mg::DisplayReport> const& /*report*/, |
272 | + std::shared_ptr<void> module_context) |
273 | { |
274 | - if (!x11_resources.get_conn()) |
275 | + auto context = std::static_pointer_cast<mx::X11Resources>(module_context); |
276 | + if (!context->get_conn()) |
277 | BOOST_THROW_EXCEPTION(std::runtime_error("Need valid x11 display")); |
278 | |
279 | - return std::make_shared<mgx::Platform>(x11_resources.get_conn()); |
280 | + return std::make_shared<mgx::Platform>(context->get_conn()); |
281 | } |
282 | |
283 | std::shared_ptr<mg::Platform> create_guest_platform( |
284 | std::shared_ptr<mg::DisplayReport> const& /*report*/, |
285 | - std::shared_ptr<mg::NestedContext> const&) |
286 | + std::shared_ptr<mg::NestedContext> const&, |
287 | + std::shared_ptr<void> /*module_context*/) |
288 | { |
289 | BOOST_THROW_EXCEPTION(std::runtime_error("Guest platform isn't supported under X")); |
290 | return nullptr; |
291 | |
292 | === modified file 'src/platforms/mesa/server/x11/input/CMakeLists.txt' |
293 | --- src/platforms/mesa/server/x11/input/CMakeLists.txt 2015-08-21 22:20:42 +0000 |
294 | +++ src/platforms/mesa/server/x11/input/CMakeLists.txt 2015-09-01 03:06:58 +0000 |
295 | @@ -1,5 +1,5 @@ |
296 | include_directories( |
297 | - ${server_common_include_dirs} |
298 | + ${PROJECT_SOURCE_DIR}/include/platform |
299 | ${PROJECT_SOURCE_DIR}/include/client |
300 | ) |
301 | |
302 | |
303 | === modified file 'src/platforms/mesa/server/x11/input/input.cpp' |
304 | --- src/platforms/mesa/server/x11/input/input.cpp 2015-08-21 20:12:37 +0000 |
305 | +++ src/platforms/mesa/server/x11/input/input.cpp 2015-09-01 03:06:58 +0000 |
306 | @@ -25,15 +25,16 @@ |
307 | namespace mx = mir::X; |
308 | namespace mix = mi::X; |
309 | |
310 | -extern mx::X11Resources x11_resources; |
311 | - |
312 | mir::UniqueModulePtr<mi::Platform> create_input_platform( |
313 | std::shared_ptr<mo::Option> const& /*options*/, |
314 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/, |
315 | std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry, |
316 | - std::shared_ptr<mi::InputReport> const& /*report*/) |
317 | + std::shared_ptr<mi::InputReport> const& /*report*/, |
318 | + std::shared_ptr<void> module_context) |
319 | { |
320 | - return mir::make_module_ptr<mix::XInputPlatform>(input_device_registry, x11_resources.get_conn()); |
321 | + auto context = std::static_pointer_cast<mx::X11Resources>(module_context); |
322 | + |
323 | + return mir::make_module_ptr<mix::XInputPlatform>(input_device_registry, context->get_conn()); |
324 | } |
325 | |
326 | void add_input_platform_options( |
327 | |
328 | === modified file 'src/platforms/mesa/server/x11/symbols.map' |
329 | --- src/platforms/mesa/server/x11/symbols.map 2015-09-01 02:26:10 +0000 |
330 | +++ src/platforms/mesa/server/x11/symbols.map 2015-09-01 03:06:58 +0000 |
331 | @@ -1,3 +1,8 @@ |
332 | +MIR_SERVER_PLATFORM { |
333 | + global: |
334 | + get_module_context; |
335 | +}; |
336 | + |
337 | MIR_GRAPHICS_PLATFORM_4 { |
338 | global: |
339 | add_graphics_platform_options; |
340 | |
341 | === modified file 'src/server/graphics/default_configuration.cpp' |
342 | --- src/server/graphics/default_configuration.cpp 2015-07-20 03:16:27 +0000 |
343 | +++ src/server/graphics/default_configuration.cpp 2015-09-01 03:06:58 +0000 |
344 | @@ -94,6 +94,10 @@ |
345 | } |
346 | platform_library = mir::graphics::module_for_device(platforms, dynamic_cast<mir::options::ProgramOption&>(*the_options())); |
347 | } |
348 | + auto get_module_context = platform_library->load_function<mir::GetModuleContext>( |
349 | + "get_module_context", |
350 | + "MIR_SERVER_PLATFORM"); |
351 | + auto context = get_module_context ? get_module_context() : nullptr; |
352 | auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>( |
353 | "create_host_platform", |
354 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
355 | @@ -111,11 +115,12 @@ |
356 | description->micro_version); |
357 | |
358 | if (!the_options()->is_set(options::host_socket_opt)) |
359 | - return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report()); |
360 | + return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report(), context); |
361 | else |
362 | return create_guest_platform( |
363 | the_display_report(), |
364 | - the_host_connection()); |
365 | + the_host_connection(), |
366 | + context); |
367 | |
368 | }); |
369 | } |
370 | |
371 | === modified file 'src/server/input/default_configuration.cpp' |
372 | --- src/server/input/default_configuration.cpp 2015-08-20 12:33:43 +0000 |
373 | +++ src/server/input/default_configuration.cpp 2015-09-01 03:06:58 +0000 |
374 | @@ -318,10 +318,14 @@ |
375 | |
376 | auto lib = std::make_shared<mir::SharedLibrary>( |
377 | options->get<std::string>(options::platform_input_lib)); |
378 | + auto get_module_context = lib->load_function<mir::GetModuleContext>( |
379 | + "get_module_context", |
380 | + "MIR_SERVER_PLATFORM"); |
381 | + auto context = get_module_context ? get_module_context() : nullptr; |
382 | auto create = lib->load_function<mi::CreatePlatform>( |
383 | "create_input_platform", |
384 | MIR_SERVER_INPUT_PLATFORM_VERSION); |
385 | - return create(the_options(), the_emergency_cleanup(), the_input_device_registry(), the_input_report()); |
386 | + return create(the_options(), the_emergency_cleanup(), the_input_device_registry(), the_input_report(), context); |
387 | }); |
388 | } |
389 | |
390 | |
391 | === modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp' |
392 | --- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2015-06-25 13:43:43 +0000 |
393 | +++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2015-09-01 03:06:58 +0000 |
394 | @@ -102,7 +102,8 @@ |
395 | platform = create_host_platform( |
396 | options, |
397 | std::make_shared<mtd::NullEmergencyCleanup>(), |
398 | - mr::null_display_report()); |
399 | + mr::null_display_report(), |
400 | + get_module_context()); |
401 | } |
402 | else |
403 | { |
404 | |
405 | === modified file 'tests/mir_test_doubles/platform_factory.cpp' |
406 | --- tests/mir_test_doubles/platform_factory.cpp 2015-08-21 20:35:15 +0000 |
407 | +++ tests/mir_test_doubles/platform_factory.cpp 2015-09-01 03:06:58 +0000 |
408 | @@ -40,7 +40,8 @@ |
409 | return create_host_platform( |
410 | std::make_shared<options::ProgramOption>(), |
411 | std::make_shared<NullEmergencyCleanup>(), |
412 | - report::null_display_report()); |
413 | + report::null_display_report(), |
414 | + get_module_context()); |
415 | } |
416 | |
417 | #elif MESA_KMS |
418 | |
419 | === modified file 'tests/mir_test_framework/stub_input.cpp' |
420 | --- tests/mir_test_framework/stub_input.cpp 2015-07-20 03:16:27 +0000 |
421 | +++ tests/mir_test_framework/stub_input.cpp 2015-09-01 03:06:58 +0000 |
422 | @@ -28,7 +28,8 @@ |
423 | std::shared_ptr<mo::Option> const& /*options*/, |
424 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/, |
425 | std::shared_ptr<mi::InputDeviceRegistry> const& input_device_registry, |
426 | - std::shared_ptr<mi::InputReport> const& /*report*/) |
427 | + std::shared_ptr<mi::InputReport> const& /*report*/, |
428 | + std::shared_ptr<void> /*module_context*/) |
429 | { |
430 | return mir::make_module_ptr<mtf::StubInputPlatform>(input_device_registry); |
431 | } |
432 | @@ -64,3 +65,8 @@ |
433 | { |
434 | return mir::make_module_ptr<mtf::FakeInputDeviceImpl>(info); |
435 | } |
436 | + |
437 | +extern "C" std::shared_ptr<void> get_module_context() |
438 | +{ |
439 | + return {}; |
440 | +} |
441 | |
442 | === modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp' |
443 | --- tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-07-23 02:39:20 +0000 |
444 | +++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-09-01 03:06:58 +0000 |
445 | @@ -294,7 +294,8 @@ |
446 | std::shared_ptr<mg::Platform> create_host_platform( |
447 | std::shared_ptr<mo::Option> const& /*options*/, |
448 | std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/, |
449 | - std::shared_ptr<mg::DisplayReport> const& /*report*/) |
450 | + std::shared_ptr<mg::DisplayReport> const& /*report*/, |
451 | + std::shared_ptr<void> /*module_context*/) |
452 | { |
453 | std::shared_ptr<mg::Platform> result{}; |
454 | |
455 | @@ -313,7 +314,8 @@ |
456 | |
457 | std::shared_ptr<mg::Platform> create_guest_platform( |
458 | std::shared_ptr<mg::DisplayReport> const&, |
459 | - std::shared_ptr<mg::NestedContext> const& context) |
460 | + std::shared_ptr<mg::NestedContext> const& context, |
461 | + std::shared_ptr<void> /*module_context*/) |
462 | { |
463 | auto graphics_platform = the_graphics_platform.lock(); |
464 | if (!graphics_platform) |
465 | @@ -339,3 +341,8 @@ |
466 | { |
467 | display_preset = display; |
468 | } |
469 | + |
470 | +extern "C" std::shared_ptr<void> get_module_context() |
471 | +{ |
472 | + return {}; |
473 | +} |
474 | |
475 | === modified file 'tests/mir_test_framework/symbols-server.map' |
476 | --- tests/mir_test_framework/symbols-server.map 2015-07-22 02:54:31 +0000 |
477 | +++ tests/mir_test_framework/symbols-server.map 2015-09-01 03:06:58 +0000 |
478 | @@ -1,3 +1,8 @@ |
479 | +MIR_SERVER_PLATFORM { |
480 | + global: |
481 | + get_module_context; |
482 | +}; |
483 | + |
484 | MIR_GRAPHICS_PLATFORM_4 { |
485 | global: |
486 | add_graphics_platform_options; |
487 | |
488 | === modified file 'tests/mir_test_framework/symbols-stub-input.map' |
489 | --- tests/mir_test_framework/symbols-stub-input.map 2015-08-27 08:41:14 +0000 |
490 | +++ tests/mir_test_framework/symbols-stub-input.map 2015-09-01 03:06:58 +0000 |
491 | @@ -1,3 +1,8 @@ |
492 | +MIR_SERVER_PLATFORM { |
493 | + global: |
494 | + get_module_context; |
495 | +}; |
496 | + |
497 | MIR_INPUT_PLATFORM_2 { |
498 | global: |
499 | add_input_platform_options; |
500 | |
501 | === modified file 'tests/unit-tests/graphics/android/test_platform.cpp' |
502 | --- tests/unit-tests/graphics/android/test_platform.cpp 2015-07-20 03:16:27 +0000 |
503 | +++ tests/unit-tests/graphics/android/test_platform.cpp 2015-09-01 03:06:58 +0000 |
504 | @@ -271,5 +271,5 @@ |
505 | EXPECT_CALL(hwaccess, hw_get_module(StrEq(GRALLOC_HARDWARE_MODULE_ID), _)) |
506 | .Times(AtMost(1)); |
507 | |
508 | - auto platform = create_guest_platform(mt::fake_shared(stub_report), nullptr); |
509 | + auto platform = create_guest_platform(mt::fake_shared(stub_report), nullptr, get_module_context()); |
510 | } |
Also platform ABI, graphics ABI and input ABI need to be bumped. Will bump separately.