Mir

Merge lp:~mir-team/mir/server-platform-probing into lp:mir

Proposed by Andreas Pokorny
Status: Merged
Merged at revision: 2254
Proposed branch: lp:~mir-team/mir/server-platform-probing
Merge into: lp:mir
Prerequisite: lp:~mir-team/mir/probe-client-drivers
Diff against target: 2938 lines (+1285/-339)
82 files modified
CMakeLists.txt (+4/-0)
debian/control (+35/-33)
debian/libmirplatform6driver-android.install (+0/-1)
debian/libmirplatform6driver-mesa.install (+0/-1)
debian/mir-platform-graphics-android.install (+1/-0)
debian/mir-platform-graphics-mesa.install (+1/-0)
debian/mir-test-tools.install (+1/-1)
debian/rules (+1/-14)
include/platform/mir/graphics/platform.h (+31/-1)
include/platform/mir/module_properties.h (+37/-0)
platform-ABI-sha1sums (+2/-1)
server-ABI-sha1sums (+2/-1)
src/CMakeLists.txt (+1/-6)
src/client/default_connection_configuration.cpp (+1/-1)
src/common/graphics/android/mir_native_window.cpp (+0/-1)
src/include/platform/mir/graphics/platform_probe.h (+37/-0)
src/include/platform/mir/options/configuration.h (+2/-0)
src/include/platform/mir/options/default_configuration.h (+5/-0)
src/include/platform/mir/shared_library_loader.h (+0/-28)
src/include/server/mir/default_server_configuration.h (+3/-0)
src/platform/CMakeLists.txt (+6/-6)
src/platform/graphics/CMakeLists.txt (+1/-0)
src/platform/graphics/platform_probe.cpp (+59/-0)
src/platform/options/default_configuration.cpp (+49/-20)
src/platform/symbols.map (+3/-3)
src/platforms/CMakeLists.txt (+16/-0)
src/platforms/android/server/CMakeLists.txt (+16/-25)
src/platforms/android/server/platform.cpp (+23/-1)
src/platforms/android/server/symbols.map (+10/-0)
src/platforms/common/server/symbols.map (+4/-3)
src/platforms/mesa/server/CMakeLists.txt (+19/-26)
src/platforms/mesa/server/platform.cpp (+32/-1)
src/platforms/mesa/server/symbols.map (+16/-0)
src/server/CMakeLists.txt (+5/-1)
src/server/graphics/CMakeLists.txt (+1/-1)
src/server/graphics/default_configuration.cpp (+45/-13)
src/server/report/default_server_configuration.cpp (+9/-0)
src/server/report/logging/logging_report_factory.cpp (+5/-0)
src/server/report/logging_report_factory.h (+1/-0)
src/server/report/lttng/CMakeLists.txt (+1/-0)
src/server/report/lttng/lttng_report_factory.cpp (+6/-0)
src/server/report/lttng/shared_library_prober_report.cpp (+52/-0)
src/server/report/lttng/shared_library_prober_report.h (+48/-0)
src/server/report/lttng/shared_library_prober_report_tp.h (+70/-0)
src/server/report/lttng/tracepoints.c (+1/-0)
src/server/report/lttng_report_factory.h (+1/-0)
src/server/report/null/null_report_factory.cpp (+11/-0)
src/server/report/null_report_factory.h (+2/-0)
src/server/report/report_factory.h (+2/-0)
src/server/server.cpp (+8/-5)
src/server/symbols.map (+2/-0)
src/wrapper.c (+3/-0)
tests/acceptance-tests/CMakeLists.txt (+1/-5)
tests/acceptance-tests/server_configuration_wrapping.cpp (+3/-0)
tests/acceptance-tests/test_symbols_required_by_mesa.cpp (+2/-2)
tests/include/mir_test_framework/client_platform_factory.h (+2/-2)
tests/include/mir_test_framework/executable_path.h (+2/-0)
tests/include/mir_test_framework/headless_test.h (+1/-1)
tests/include/mir_test_framework/stub_server_platform_factory.h (+49/-0)
tests/integration-tests/CMakeLists.txt (+10/-1)
tests/mir_test_doubles/CMakeLists.txt (+10/-8)
tests/mir_test_framework/CMakeLists.txt (+36/-18)
tests/mir_test_framework/executable_path.cpp (+27/-0)
tests/mir_test_framework/headless_test.cpp (+5/-27)
tests/mir_test_framework/platform_graphics_dummy.cpp (+36/-0)
tests/mir_test_framework/stub_client_platform_factory.cpp (+1/-0)
tests/mir_test_framework/stub_server_platform_factory.cpp (+72/-0)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+11/-7)
tests/mir_test_framework/stubbed_server_configuration.cpp (+2/-2)
tests/mir_test_framework/symbols-server.map (+8/-0)
tests/mir_test_framework/testing_client_options.cpp (+2/-53)
tests/unit-tests/CMakeLists.txt (+27/-8)
tests/unit-tests/client/CMakeLists.txt (+1/-0)
tests/unit-tests/client/test_client_platform.cpp (+4/-4)
tests/unit-tests/client/test_probing_client_platform_factory.cpp (+3/-3)
tests/unit-tests/graphics/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_platform.cpp (+26/-0)
tests/unit-tests/graphics/mesa/test_platform.cpp (+24/-0)
tests/unit-tests/graphics/test_platform_prober.cpp (+215/-0)
tests/unit-tests/shared_library_test.cpp (+1/-1)
tools/install_on_android.sh (+3/-3)
tools/valgrind_suppressions_armhf (+9/-0)
To merge this branch: bzr merge lp:~mir-team/mir/server-platform-probing
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Cemil Azizoglu (community) Approve
Alberto Aguirre (community) Approve
Alan Griffiths Approve
Chris Halse Rogers Approve
Daniel van Vugt Needs Fixing
Robert Carr (community) Approve
Andreas Pokorny (community) Approve
Review via email: mp+244982@code.launchpad.net

This proposal supersedes a proposal from 2014-12-01.

Commit message

Add server-side platform probing support.

Modules are checked in MIR_SERVER_PLATFORM_PATH, with configuration overrides available to both force a specific module and to check in a specific path.

Modules are probed to determine whether they can drive the available hardware. If a real platform - Android or Mesa - is capable of driving the hardware then it is used; otherwise the stub platform is loaded.

Description of the change

The second part of driver loading.

This removes our update-alternatives cludge, and should make bugs like lp #1396978 a thing of the past.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

first run over the mp:

+ 996 too much indent

What is the idea behind ModuleProperties? Just human readable information about the module, or something to base the module selection on?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote : Posted in a previous version of this proposal

ModuleProperties is meant to be human-readable information.

Ah. I see I've failed to log that anywhere. I'll update so that the driver selected gets logged.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

Since you already used 'graphics' in the ABI and since we are slowly moving towards an input platform library:
suggestion: l308: platform_library -> platfom_graphics_library

l772: catch by reference

l:1671 : why those changes? I thought this only changes the server side part?

l:1746: It seems that the contents of input_recordings/ are not in use anymore, you could also just drop it.

less of a needs fixing: Thinking about input platform: mir::ModuleProperties instead of mir::graphics::ModuleProperties or do you expect graphics related information there?

review: Needs Fixing
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

after merging, mirplatformgraphicsstub needs mir-test-doubles now.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

Why do you deal with environment in 918 and the following by just using options.parse_environment(.."MIR_SERVER_"). Additionally the priority between environment value and command line option is in the current MP:

1 command line option for library
2 environment for library
3 environment for search path
4 command line option for search path

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

s/by/instead of/ on last comment

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

> Why do you deal with environment in 918 and the following by just using
> options.parse_environment(.."MIR_SERVER_"). Additionally the priority between
> environment value and command line option is in the current MP:

nm, forgot about mir::options behavior towards unknown environment variables..

additional nits:
 677, 749 for (

With this MP we could rename the graphics_platform_path to just platform_path, and the define MIR_SERVER_PLATFORM_VERSION to MIR_SERVER_GRAPHICS_PLATFORM_VERSION.

So with that I am done reviewing.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

looks good

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Carr (robertcarr) wrote : Posted in a previous version of this proposal

lgtm

p.s. if you are going to continue using this indentation style consider proposing an update to the style guide "Use only spaces, and indent 4 spaces at a time.".

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal

Needs another merge with lp:mir .. there are further conflicts in headless_test and more..

review: Needs Fixing
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

did the merging, and while doing that also added "_graphics_" to the C-entry points of the graphics platform ABI.

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
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
Chris Halse Rogers (raof) wrote :

Hm. I think that SharedLibraryProbeReport is a mistake.

I had it in the client platform because we currently have no way to log from the client, but on the server it really just wants to be logged.

I now think the correct solution is to add logging support to the client library and then log everywhere. For a temporary fix, I think it'd be OK to default to log_opt_value rather than none_opt_value.

Otherwise (unsurprisingly!) +1.

review: Needs Fixing
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
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
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
Andreas Pokorny (andreas-pokorny) wrote :

not blocking but something to look into afterwards: + 730 to + 765, the whole handling of platform library specific configuration options.

The rest works fairly well and looks good to me.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(1) Clients now output log messages (against the will of the client/toolkit author):
[1420010155.311855] (II) Loader: Loading modules from: bin/../lib/client-modules/
[1420010155.312103] (II) Loader: Loading module: bin/../lib/client-modules/dummy.so
[1420010155.312518] (II) Loader: Loading module: bin/../lib/client-modules/mesa.so
[1420010155.312695] (II) Loader: Loading module: bin/../lib/client-modules/android.so
We need to avoid upsetting client/toolkit developers, but also especially users of clients. A library like libmirclient should not write to stdout/stderr except on error.

(2) mirout (et al?) need wrapping applied. See also (1)
$ sudo bin/mirout
[1420010358.848748] (II) Loader: Loading modules from: /usr/local/lib/mir/client-platform/
[1420010358.848888] (EE) Loader: Failed to load libraries from path: /usr/local/lib/mir/client-platform/ (error was:No such file or directory)
Could not connect to a display server.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(3) This smells like a bug (?) ...
[1420010081.113978] (WW) Loader: Failed to load module: bin/../lib/server-modules/graphics-dummy.so (error was:bin/../lib/server-modules/graphics-dummy.so: undefined symbol: _ZN3mir4test4PipeD1Ev)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Carr (robertcarr) wrote :

LGTM! Left some trivial inline thoughts.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(1) Fix proposed: https://code.launchpad.net/~vanvugt/mir/log-level/+merge/245718

(2) Fix landed (r2191)

(3) Still needs fixing, maybe?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

BTW I haven't done any code review yet. Just manual testing and fixing the obvious issues right now...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Results from manual testing:

(1) Clients now output noisy log messages (against the will of the client/toolkit author):
[1420010155.311855] (II) Loader: Loading modules from: bin/../lib/client-modules/
[1420010155.312103] (II) Loader: Loading module: bin/../lib/client-modules/dummy.so
[1420010155.312518] (II) Loader: Loading module: bin/../lib/client-modules/mesa.so
[1420010155.312695] (II) Loader: Loading module: bin/../lib/client-modules/android.so
Fix proposed: https://code.launchpad.net/~vanvugt/mir/log-level/+merge/246092

(3) This warning appears to be new from this branch. Sounds like a bug:
[1420010081.113978] (WW) Loader: Failed to load module: bin/../lib/server-modules/graphics-dummy.so (error was:bin/../lib/server-modules/graphics-dummy.so: undefined symbol: _ZN3mir4test4PipeD1Ev)

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

LGTM now. I slightly prefer the client output to no client output.

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

> Results from manual testing:
>
> (1) Clients now output noisy log messages (against the will of the
> client/toolkit author):
> [...]
> Fix proposed: https://code.launchpad.net/~vanvugt/mir/log-level/+merge/246092

So it will be addressed there?

> (3) This warning appears to be new from this branch. Sounds like a bug:
> [1420010081.113978] (WW) Loader: Failed to load module: bin/../lib/server-
> modules/graphics-dummy.so (error was:bin/../lib/server-modules/graphics-
> dummy.so: undefined symbol: _ZN3mir4test4PipeD1Ev)

should be gone now.

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

(1) I'd rather have this future bug fixed before it ever affects lp:mir. It becomes a regression if we land this without having fixed the client logging first.

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

OK

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

anpok: Careful with those spurious merges. Or at least spurious merge comments...?

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
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
Alberto Aguirre (albaguirre) wrote :

623 + catch (std::runtime_error const& err)

Why not std::exception?

===
2903 +++ tools/install_on_android.sh 2015-01-21 10:31:54 +0000
2904 @@ -32,11 +32,11 @@
2905 lib/libmirclient.so.* \
2906 lib/libmircommon.so.* \
2907 lib/libmirplatform.so.* \
2908 - lib/libmirplatform*driver.so \
2909 - lib/libmirclient*driver.so \
2910 + lib/platform-graphics-dummy.so \
2911 + lib/client-modules/* \
2912 + lib/server-modules/* \
2913 lib/libmirprotobuf.so.* \
2914 lib/libmirclient-debug-extension.so.* \
2915 - lib/libmirplatformstub.so \
2916 lib/libmirserver.so.*
===

Needs more modifications to work, given the current wrapper (i.e. copying the .mir_xxx executables and creating a bin and lib directory on the android side. But it looks like that's a pre-existing issue and is being addressed in https://code.launchpad.net/~andreas-pokorny/mir/unwrap-the-wrap/+merge/247117

Looks good otherwise.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Wrapped binaries work perfectly on the Android side if copied using rsync. Not sure if adb push does though.

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

I think the log messages are rather informative. We should go ahead and TA this branch.

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

Gave this branch a final test. It looks good. I'd rather land this and not wait for a minor issue to hold such a large MP up. Hopefully we can address the logging issue before we land on the distro.

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

Please don't create regressions intentionally. I didn't want to own this one, but somehow I do now.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm, there's a simple way to avoid blocking on the log-level branch actually. Just remove any log calls from mircommon/mirclient that might appear as a result of this branch.

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

I don't regard it as a regression. What module gets loaded is vital information - exactly what logging was designed to do. Besides we are not flooding the terminal (as that was one of the criteria for logging).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-01-22 05:20:46 +0000
+++ CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -30,6 +30,10 @@
30set(MIR_VERSION_MINOR 11) # This should change at least with every MIRSERVER_ABI30set(MIR_VERSION_MINOR 11) # This should change at least with every MIRSERVER_ABI
31set(MIR_VERSION_PATCH 0)31set(MIR_VERSION_PATCH 0)
3232
33add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR})
34add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR})
35add_definitions(-DMIR_VERSION_MICRO=${MIR_VERSION_PATCH})
36
33set(MIR_VERSION ${MIR_VERSION_MAJOR}.${MIR_VERSION_MINOR}.${MIR_VERSION_PATCH})37set(MIR_VERSION ${MIR_VERSION_MAJOR}.${MIR_VERSION_MINOR}.${MIR_VERSION_PATCH})
3438
35set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)39set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
3640
=== modified file 'debian/control'
--- debian/control 2015-01-20 10:07:15 +0000
+++ debian/control 2015-01-22 15:40:28 +0000
@@ -59,6 +59,8 @@
59 Contains the shared library containing the Google Protobuf definitions59 Contains the shared library containing the Google Protobuf definitions
60 required for Mir clients and servers.60 required for Mir clients and servers.
6161
62#TODO: Packaging infrastructure for better dependency generation,
63# ala pkg-xorg's xviddriver:Provides and ABI detection.
62Package: libmirserver2964Package: libmirserver29
63Section: libs65Section: libs
64Architecture: i386 amd64 armhf arm6466Architecture: i386 amd64 armhf arm64
@@ -66,7 +68,7 @@
66Pre-Depends: ${misc:Pre-Depends}68Pre-Depends: ${misc:Pre-Depends}
67Depends: ${misc:Depends},69Depends: ${misc:Depends},
68 ${shlibs:Depends},70 ${shlibs:Depends},
69 libmir${platform-driver}-mesa | libmir${platform-driver}-android,71 mir-platform-graphics-mesa | mir-platform-graphics-android,
70Description: Display server for Ubuntu - server library72Description: Display server for Ubuntu - server library
71 Mir is a display server running on linux systems, with a focus on efficiency,73 Mir is a display server running on linux systems, with a focus on efficiency,
72 robust operation and a well-defined driver model.74 robust operation and a well-defined driver model.
@@ -266,6 +268,34 @@
266 Contains the shared libraries required for the Mir server and client.268 Contains the shared libraries required for the Mir server and client.
267269
268# Longer-term these drivers should move out-of-tree270# Longer-term these drivers should move out-of-tree
271Package: mir-platform-graphics-mesa
272Section: libs
273Architecture: i386 amd64 armhf arm64
274Multi-Arch: same
275Pre-Depends: ${misc:Pre-Depends}
276Depends: ${misc:Depends},
277 ${shlibs:Depends},
278Description: Display server for Ubuntu - platform library for Mesa
279 Mir is a display server running on linux systems, with a focus on efficiency,
280 robust operation and a well-defined driver model.
281 .
282 Contains the shared libraries required for the Mir server to interact with
283 the hardware platform using the Mesa drivers.
284
285Package: mir-platform-graphics-android
286Section: libs
287Architecture: i386 amd64 armhf
288Multi-Arch: same
289Pre-Depends: ${misc:Pre-Depends}
290Depends: ${misc:Depends},
291 ${shlibs:Depends},
292Description: Display server for Ubuntu - platform library for Android
293 Mir is a display server running on linux systems, with a focus on efficiency,
294 robust operation and a well-defined driver model.
295 .
296 Contains the shared libraries required for the Mir server to interact with
297 the hardware platform using the Android drivers.
298
269Package: mir-client-platform-mesa299Package: mir-client-platform-mesa
270Section: libs300Section: libs
271Architecture: i386 amd64 armhf arm64301Architecture: i386 amd64 armhf arm64
@@ -294,42 +324,14 @@
294 Contains the shared libraries required for the Mir clients to interact with324 Contains the shared libraries required for the Mir clients to interact with
295 the underlying hardware platform using the Android drivers.325 the underlying hardware platform using the Android drivers.
296326
297Package: libmirplatform6driver-mesa
298Section: libs
299Architecture: i386 amd64 armhf arm64
300Multi-Arch: same
301Pre-Depends: ${misc:Pre-Depends}
302Depends: ${misc:Depends},
303 ${shlibs:Depends},
304Description: Display server for Ubuntu - platform library for Mesa
305 Mir is a display server running on linux systems, with a focus on efficiency,
306 robust operation and a well-defined driver model.
307 .
308 Contains the shared libraries required for the Mir server to interact with
309 the hardware platform using the Mesa drivers.
310
311Package: libmirplatform6driver-android
312Section: libs
313Architecture: i386 amd64 armhf
314Multi-Arch: same
315Pre-Depends: ${misc:Pre-Depends}
316Depends: ${misc:Depends},
317 ${shlibs:Depends},
318Description: Display server for Ubuntu - platform library for Android
319 Mir is a display server running on linux systems, with a focus on efficiency,
320 robust operation and a well-defined driver model.
321 .
322 Contains the shared libraries required for the Mir server to interact with
323 the hardware platform using the Android drivers.
324
325Package: mir-graphics-drivers-desktop327Package: mir-graphics-drivers-desktop
326Section: libs328Section: libs
327Architecture: i386 amd64 armhf arm64329Architecture: i386 amd64 armhf arm64
328Multi-Arch: same330Multi-Arch: same
329Pre-Depends: ${misc:Pre-Depends}331Pre-Depends: ${misc:Pre-Depends}
330Depends: ${misc:Depends},332Depends: ${misc:Depends},
331 libmir${platform-driver}-mesa,333 mir-platform-graphics-mesa,
332 mir-client-platform-mesa334 mir-client-platform-mesa,
333Description: Display server for Ubuntu - desktop driver metapackage335Description: Display server for Ubuntu - desktop driver metapackage
334 Mir is a display server running on linux systems, with a focus on efficiency,336 Mir is a display server running on linux systems, with a focus on efficiency,
335 robust operation and a well-defined driver model.337 robust operation and a well-defined driver model.
@@ -343,8 +345,8 @@
343Multi-Arch: same345Multi-Arch: same
344Pre-Depends: ${misc:Pre-Depends}346Pre-Depends: ${misc:Pre-Depends}
345Depends: ${misc:Depends},347Depends: ${misc:Depends},
346 libmir${platform-driver}-android,348 mir-platform-graphics-android,
347 mir-client-platform-android349 mir-client-platform-android,
348Description: Display server for Ubuntu - android driver metapackage350Description: Display server for Ubuntu - android driver metapackage
349 Mir is a display server running on linux systems, with a focus on efficiency,351 Mir is a display server running on linux systems, with a focus on efficiency,
350 robust operation and a well-defined driver model.352 robust operation and a well-defined driver model.
351353
=== removed file 'debian/libmirplatform6driver-android.install'
--- debian/libmirplatform6driver-android.install 2015-01-14 06:39:13 +0000
+++ debian/libmirplatform6driver-android.install 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1usr/lib/*/mir/platform*driver/android/*
20
=== removed file 'debian/libmirplatform6driver-mesa.install'
--- debian/libmirplatform6driver-mesa.install 2015-01-14 06:39:13 +0000
+++ debian/libmirplatform6driver-mesa.install 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1usr/lib/*/mir/platform*driver/mesa/*
20
=== added file 'debian/mir-platform-graphics-android.install'
--- debian/mir-platform-graphics-android.install 1970-01-01 00:00:00 +0000
+++ debian/mir-platform-graphics-android.install 2015-01-22 15:40:28 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/mir/server-platform/graphics-android.so
02
=== added file 'debian/mir-platform-graphics-mesa.install'
--- debian/mir-platform-graphics-mesa.install 1970-01-01 00:00:00 +0000
+++ debian/mir-platform-graphics-mesa.install 2015-01-22 15:40:28 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/mir/server-platform/graphics-mesa.so
02
=== modified file 'debian/mir-test-tools.install'
--- debian/mir-test-tools.install 2015-01-14 06:39:13 +0000
+++ debian/mir-test-tools.install 2015-01-22 15:40:28 +0000
@@ -5,5 +5,5 @@
5usr/bin/mir_performance_tests5usr/bin/mir_performance_tests
6usr/lib/*/mir/tools/libmirclientlttng.so6usr/lib/*/mir/tools/libmirclientlttng.so
7usr/lib/*/mir/tools/libmirserverlttng.so7usr/lib/*/mir/tools/libmirserverlttng.so
8usr/lib/*/libmirplatformstub.so8usr/lib/*/mir/server-platform/graphics-dummy.so
9usr/lib/*/mir/client-platform/dummy.so9usr/lib/*/mir/client-platform/dummy.so
1010
=== modified file 'debian/rules'
--- debian/rules 2015-01-16 02:57:31 +0000
+++ debian/rules 2015-01-22 15:40:28 +0000
@@ -13,8 +13,6 @@
13export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.913export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
14export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.914export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
1515
16export PLATFORM_DRIVER = platform6driver
17
18%:16%:
19 dh $@ --parallel --fail-missing17 dh $@ --parallel --fail-missing
2018
@@ -57,15 +55,4 @@
57# Delete the symlink so that --fail-missing doesn't think we've missed it55# Delete the symlink so that --fail-missing doesn't think we've missed it
58# accidentally.56# accidentally.
59 -rm debian/tmp/usr/lib/*/libmirprotobuf.so57 -rm debian/tmp/usr/lib/*/libmirprotobuf.so
60 dh_install --fail-missing \58 dh_install --fail-missing
61 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmir$(PLATFORM_DRIVER).so
62 sh debian/install_ld_so_conf.sh $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
63
64override_dh_installdeb:
65 sh debian/create_postinst_prerm_scripts.sh \
66 $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
67 dh_installdeb
68
69override_dh_gencontrol:
70 dh_gencontrol -- \
71 -Vplatform-driver=$(PLATFORM_DRIVER)
7259
=== modified file 'include/platform/mir/graphics/platform.h'
--- include/platform/mir/graphics/platform.h 2015-01-14 06:39:13 +0000
+++ include/platform/mir/graphics/platform.h 2015-01-22 15:40:28 +0000
@@ -24,6 +24,8 @@
24#include <EGL/egl.h>24#include <EGL/egl.h>
25#include <memory>25#include <memory>
2626
27#include "mir/module_properties.h"
28
27namespace mir29namespace mir
28{30{
29class EmergencyCleanupRegistry;31class EmergencyCleanupRegistry;
@@ -93,6 +95,25 @@
93};95};
9496
95/**97/**
98 * A measure of how well a platform supports a device
99 *
100 * \note This is compared as an integer; best + 1 is a valid PlatformPriority that
101 * will be used in preference to a module that reports best.
102 * Platform modules distributed with Mir will never use a priority higher
103 * than best.
104 */
105enum PlatformPriority : uint32_t
106{
107 unsupported = 0, /**< Unable to function at all on this device */
108 supported = 128, /**< Capable of providing a functioning Platform on this device,
109 * possibly with degraded performance or features.
110 */
111 best = 256 /**< Capable of providing a Platform with the best features and
112 * performance this device is capable of.
113 */
114};
115
116/**
96 * Function prototype used to return a new host graphics platform. The host graphics platform117 * Function prototype used to return a new host graphics platform. The host graphics platform
97 * is the system entity that owns the physical display and is a mir host server.118 * is the system entity that owns the physical display and is a mir host server.
98 *119 *
@@ -142,8 +163,17 @@
142 */163 */
143extern "C" typedef void(*AddPlatformOptions)(164extern "C" typedef void(*AddPlatformOptions)(
144 boost::program_options::options_description& config);165 boost::program_options::options_description& config);
145extern "C" void add_platform_options(166extern "C" void add_graphics_platform_options(
146 boost::program_options::options_description& config);167 boost::program_options::options_description& config);
168
169// TODO: We actually need to be more granular here; on a device with more
170// than one graphics system we may need a different platform per GPU,
171// so we should be associating platforms with graphics devices in some way
172extern "C" typedef PlatformPriority(*PlatformProbe)();
173extern "C" PlatformPriority probe_graphcis_platform();
174
175extern "C" typedef ModuleProperties const*(*DescribeModule)();
176extern "C" ModuleProperties const* describe_graphics_module();
147}177}
148}178}
149179
150180
=== added file 'include/platform/mir/module_properties.h'
--- include/platform/mir/module_properties.h 1970-01-01 00:00:00 +0000
+++ include/platform/mir/module_properties.h 2015-01-22 15:40:28 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright © 2014 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_PLATFORM_MODULE_PROPERTIES_H_
20#define MIR_PLATFORM_MODULE_PROPERTIES_H_
21
22namespace mir
23{
24
25/**
26 * Describes a platform module
27 */
28struct ModuleProperties
29{
30 char const* name;
31 int major_version;
32 int minor_version;
33 int micro_version;
34};
35}
36
37#endif /* MIR_PLATFORM_MODULE_PROPERTIES_H_ */
038
=== modified file 'platform-ABI-sha1sums'
--- platform-ABI-sha1sums 2015-01-20 03:21:20 +0000
+++ platform-ABI-sha1sums 2015-01-22 15:40:28 +0000
@@ -49,9 +49,10 @@
495dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h495dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h
50d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h50d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h
51979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h51979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
525d72b98aecb0611060dec8995dbe017a342f7069 include/platform/mir/graphics/platform.h52d3da5e58e8e1d5953b459d18f9dfe628fe0a25bd include/platform/mir/graphics/platform.h
53d1ba61e687d75103e9e7aa0409080214f56a990b include/platform/mir/graphics/platform_ipc_operations.h53d1ba61e687d75103e9e7aa0409080214f56a990b include/platform/mir/graphics/platform_ipc_operations.h
541b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h541b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h
55f0db0484b8ccc9091e73c80a2a200cb436b48bfb include/platform/mir/graphics/platform_operation_message.h55f0db0484b8ccc9091e73c80a2a200cb436b48bfb include/platform/mir/graphics/platform_operation_message.h
56f18876766861e5d4f5ca999dbd176fe1fc520594 include/platform/mir/graphics/renderable.h56f18876766861e5d4f5ca999dbd176fe1fc520594 include/platform/mir/graphics/renderable.h
575b3872b04b3686fe9a244572ca0787596431a2cb include/platform/mir/module_properties.h
57b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h58b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
5859
=== modified file 'server-ABI-sha1sums'
--- server-ABI-sha1sums 2015-01-22 14:33:14 +0000
+++ server-ABI-sha1sums 2015-01-22 15:40:28 +0000
@@ -49,11 +49,12 @@
495dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h495dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h
50d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h50d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h
51979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h51979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
525d72b98aecb0611060dec8995dbe017a342f7069 include/platform/mir/graphics/platform.h52d3da5e58e8e1d5953b459d18f9dfe628fe0a25bd include/platform/mir/graphics/platform.h
53d1ba61e687d75103e9e7aa0409080214f56a990b include/platform/mir/graphics/platform_ipc_operations.h53d1ba61e687d75103e9e7aa0409080214f56a990b include/platform/mir/graphics/platform_ipc_operations.h
541b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h541b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h
55f0db0484b8ccc9091e73c80a2a200cb436b48bfb include/platform/mir/graphics/platform_operation_message.h55f0db0484b8ccc9091e73c80a2a200cb436b48bfb include/platform/mir/graphics/platform_operation_message.h
56f18876766861e5d4f5ca999dbd176fe1fc520594 include/platform/mir/graphics/renderable.h56f18876766861e5d4f5ca999dbd176fe1fc520594 include/platform/mir/graphics/renderable.h
575b3872b04b3686fe9a244572ca0787596431a2cb include/platform/mir/module_properties.h
57b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h58b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
58f4030e400baf8baa9c38e7c6ec6b4a5ad7134aeb include/server/mir/compositor/compositor.h59f4030e400baf8baa9c38e7c6ec6b4a5ad7134aeb include/server/mir/compositor/compositor.h
59a9f284ba4b05d58fd3eeb628d1f56fe4ac188526 include/server/mir/compositor/compositor_id.h60a9f284ba4b05d58fd3eeb628d1f56fe4ac188526 include/server/mir/compositor/compositor_id.h
6061
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2015-01-22 03:10:13 +0000
+++ src/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -2,12 +2,6 @@
2# and the platform implementations.2# and the platform implementations.
3set(MIRPLATFORM_ABI 6)3set(MIRPLATFORM_ABI 6)
44
5set(PLATFORM_DRIVER platform${MIRPLATFORM_ABI}driver)
6set(MIR_PLATFORM_DRIVER mir${PLATFORM_DRIVER})
7set(MIR_PLATFORM_DRIVER_BINARY lib${MIR_PLATFORM_DRIVER}.so
8 CACHE STRING "File name of Mir server platform drivers")
9add_definitions(-DMIR_PLATFORM_DRIVER_BINARY="${MIR_PLATFORM_DRIVER_BINARY}")
10
11# We need MIR_CLIENT_PLATFORM_PATH in both libmirclient and the platform5# We need MIR_CLIENT_PLATFORM_PATH in both libmirclient and the platform
12# implementations6# implementations
13set(MIR_CLIENT_PLATFORM_PATH7set(MIR_CLIENT_PLATFORM_PATH
@@ -47,3 +41,4 @@
47set(MIR_COMMON_OBJECTS ${MIR_COMMON_OBJECTS} PARENT_SCOPE)41set(MIR_COMMON_OBJECTS ${MIR_COMMON_OBJECTS} PARENT_SCOPE)
48set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)42set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)
49set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE)43set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE)
44set(MIR_SERVER_PLATFORM_PATH ${MIR_SERVER_PLATFORM_PATH} PARENT_SCOPE)
5045
=== modified file 'src/client/default_connection_configuration.cpp'
--- src/client/default_connection_configuration.cpp 2015-01-19 04:52:47 +0000
+++ src/client/default_connection_configuration.cpp 2015-01-22 15:40:28 +0000
@@ -226,7 +226,7 @@
226 [this] () -> std::shared_ptr<mir::SharedLibraryProberReport>226 [this] () -> std::shared_ptr<mir::SharedLibraryProberReport>
227 {227 {
228 auto val_raw = getenv("MIR_CLIENT_SHARED_LIBRARY_PROBER_REPORT");228 auto val_raw = getenv("MIR_CLIENT_SHARED_LIBRARY_PROBER_REPORT");
229 std::string const val{val_raw ? val_raw : off_opt_val};229 std::string const val{val_raw ? val_raw : log_opt_val};
230 if (val == log_opt_val)230 if (val == log_opt_val)
231 return std::make_shared<mir::logging::SharedLibraryProberReport>(the_logger());231 return std::make_shared<mir::logging::SharedLibraryProberReport>(the_logger());
232 else if (val == lttng_opt_val)232 else if (val == lttng_opt_val)
233233
=== modified file 'src/common/graphics/android/mir_native_window.cpp'
--- src/common/graphics/android/mir_native_window.cpp 2015-01-14 06:39:13 +0000
+++ src/common/graphics/android/mir_native_window.cpp 2015-01-22 15:40:28 +0000
@@ -20,7 +20,6 @@
20#include "mir/graphics/android/android_driver_interpreter.h"20#include "mir/graphics/android/android_driver_interpreter.h"
21#include "mir/graphics/android/sync_fence.h"21#include "mir/graphics/android/sync_fence.h"
2222
23#include <iostream>
24#include <boost/exception/diagnostic_information.hpp> 23#include <boost/exception/diagnostic_information.hpp>
2524
26namespace mg=mir::graphics;25namespace mg=mir::graphics;
2726
=== added file 'src/include/platform/mir/graphics/platform_probe.h'
--- src/include/platform/mir/graphics/platform_probe.h 1970-01-01 00:00:00 +0000
+++ src/include/platform/mir/graphics/platform_probe.h 2015-01-22 15:40:28 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright © 2014 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_PLATFORM_PROBE_H_
20#define MIR_GRAPHICS_PLATFORM_PROBE_H_
21
22#include <vector>
23#include <memory>
24#include "mir/shared_library.h"
25
26namespace mir
27{
28namespace graphics
29{
30class Platform;
31
32std::shared_ptr<SharedLibrary> module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules);
33
34}
35}
36
37#endif // MIR_GRAPHICS_PLATFORM_PROBE_H_
038
=== modified file 'src/include/platform/mir/options/configuration.h'
--- src/include/platform/mir/options/configuration.h 2015-01-14 06:39:13 +0000
+++ src/include/platform/mir/options/configuration.h 2015-01-22 15:40:28 +0000
@@ -33,6 +33,7 @@
33extern char const* const enable_input_opt;33extern char const* const enable_input_opt;
34extern char const* const session_mediator_report_opt;34extern char const* const session_mediator_report_opt;
35extern char const* const msg_processor_report_opt;35extern char const* const msg_processor_report_opt;
36extern char const* const shared_library_prober_report_opt;
36extern char const* const compositor_report_opt;37extern char const* const compositor_report_opt;
37extern char const* const display_report_opt;38extern char const* const display_report_opt;
38extern char const* const legacy_input_report_opt;39extern char const* const legacy_input_report_opt;
@@ -53,6 +54,7 @@
53extern char const* const lttng_opt_value;54extern char const* const lttng_opt_value;
5455
55extern char const* const platform_graphics_lib;56extern char const* const platform_graphics_lib;
57extern char const* const platform_path;
5658
57class Configuration59class Configuration
58{60{
5961
=== modified file 'src/include/platform/mir/options/default_configuration.h'
--- src/include/platform/mir/options/default_configuration.h 2015-01-14 06:39:13 +0000
+++ src/include/platform/mir/options/default_configuration.h 2015-01-22 15:40:28 +0000
@@ -25,6 +25,7 @@
2525
26namespace mir26namespace mir
27{27{
28class SharedLibrary;
28namespace options29namespace options
29{30{
30class DefaultConfiguration : public Configuration31class DefaultConfiguration : public Configuration
@@ -42,6 +43,10 @@
42 boost::program_options::options_description_easy_init add_options();43 boost::program_options::options_description_easy_init add_options();
4344
44private:45private:
46 // MUST be the first member to ensure it's destroyed last, lest we attempt to
47 // call destructors in DSOs we've unloaded.
48 std::shared_ptr<SharedLibrary> platform_graphics_library;
49
45 void add_platform_options();50 void add_platform_options();
46 // accessed via the base interface, when access to add_options() has been "lost"51 // accessed via the base interface, when access to add_options() has been "lost"
47 std::shared_ptr<options::Option> the_options() const override;52 std::shared_ptr<options::Option> the_options() const override;
4853
=== removed file 'src/include/platform/mir/shared_library_loader.h'
--- src/include/platform/mir/shared_library_loader.h 2015-01-14 06:39:13 +0000
+++ src/include/platform/mir/shared_library_loader.h 1970-01-01 00:00:00 +0000
@@ -1,28 +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: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_SHARED_LIBRARY_LOADER_H_
20#define MIR_SHARED_LIBRARY_LOADER_H_
21
22#include <string>
23namespace mir
24{
25class SharedLibrary;
26SharedLibrary const* load_library(std::string const& libname);
27}
28#endif
290
=== modified file 'src/include/server/mir/default_server_configuration.h'
--- src/include/server/mir/default_server_configuration.h 2015-01-14 06:39:13 +0000
+++ src/include/server/mir/default_server_configuration.h 2015-01-22 15:40:28 +0000
@@ -40,6 +40,7 @@
40namespace mir40namespace mir
41{41{
42class ServerActionQueue;42class ServerActionQueue;
43class SharedLibraryProberReport;
4344
44namespace compositor45namespace compositor
45{46{
@@ -315,6 +316,7 @@
315316
316 virtual std::shared_ptr<time::Clock> the_clock();317 virtual std::shared_ptr<time::Clock> the_clock();
317 virtual std::shared_ptr<ServerActionQueue> the_server_action_queue();318 virtual std::shared_ptr<ServerActionQueue> the_server_action_queue();
319 virtual std::shared_ptr<SharedLibraryProberReport> the_shared_library_prober_report();
318320
319protected:321protected:
320 std::shared_ptr<options::Option> the_options() const;322 std::shared_ptr<options::Option> the_options() const;
@@ -424,6 +426,7 @@
424 CachedPtr<scene::CoordinateTranslator> coordinate_translator;426 CachedPtr<scene::CoordinateTranslator> coordinate_translator;
425 CachedPtr<EmergencyCleanup> emergency_cleanup;427 CachedPtr<EmergencyCleanup> emergency_cleanup;
426 CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener;428 CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener;
429 CachedPtr<SharedLibraryProberReport> shared_library_prober_report;
427430
428private:431private:
429 std::shared_ptr<options::Configuration> const configuration_options;432 std::shared_ptr<options::Configuration> const configuration_options;
430433
=== modified file 'src/platform/CMakeLists.txt'
--- src/platform/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ src/platform/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -7,12 +7,10 @@
77
8set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)8set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
99
10add_library(mirplatformobjects OBJECT10add_definitions(-DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}")
11 shared_library_loader.cpp11add_definitions(-DMIR_SERVER_GRAPHICS_PLATFORM_VERSION="${MIR_SERVER_GRAPHICS_PLATFORM_VERSION}")
12)
1312
14set(MIR_PLATFORM_OBJECTS13set(MIR_PLATFORM_OBJECTS
15 $<TARGET_OBJECTS:mirplatformobjects>
16 $<TARGET_OBJECTS:mirplatformgraphicscommon>14 $<TARGET_OBJECTS:mirplatformgraphicscommon>
17 $<TARGET_OBJECTS:miroptions>15 $<TARGET_OBJECTS:miroptions>
18 $<TARGET_OBJECTS:mirfatal>16 $<TARGET_OBJECTS:mirfatal>
@@ -31,17 +29,19 @@
31)29)
3230
33target_link_libraries(mirplatform31target_link_libraries(mirplatform
32
34 mircommon33 mircommon
35 ${MIR_PLATFORM_REFERENCES}34 ${MIR_PLATFORM_REFERENCES}
36)35)
3736
38set_target_properties(mirplatform37set_target_properties(
38 mirplatform
39
39 PROPERTIES40 PROPERTIES
40 SOVERSION ${MIRPLATFORM_ABI}41 SOVERSION ${MIRPLATFORM_ABI}
41 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"42 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
42)43)
4344
44
45install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})45install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
4646
47add_subdirectory(graphics/)47add_subdirectory(graphics/)
4848
=== modified file 'src/platform/graphics/CMakeLists.txt'
--- src/platform/graphics/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ src/platform/graphics/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -12,6 +12,7 @@
12 gl_program.cpp12 gl_program.cpp
13 gl_texture.cpp13 gl_texture.cpp
14 tessellation_helpers.cpp14 tessellation_helpers.cpp
15 platform_probe.cpp
15)16)
1617
17add_library(mirplatformgraphicscommon OBJECT18add_library(mirplatformgraphicscommon OBJECT
1819
=== added file 'src/platform/graphics/platform_probe.cpp'
--- src/platform/graphics/platform_probe.cpp 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/platform_probe.cpp 2015-01-22 15:40:28 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright © 2014 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include "mir/logging/logger.h"
20#include "mir/graphics/platform.h"
21#include "mir/graphics/platform_probe.h"
22
23#include <string>
24#include <boost/throw_exception.hpp>
25
26namespace ml = mir::logging;
27
28std::shared_ptr<mir::SharedLibrary>
29mir::graphics::module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules)
30{
31 mir::graphics::PlatformPriority best_priority_so_far = mir::graphics::unsupported;
32 std::shared_ptr<mir::SharedLibrary> best_module_so_far;
33 for (auto& module : modules)
34 {
35 try
36 {
37 auto probe = module->load_function<mir::graphics::PlatformProbe>("probe_graphics_platform",
38 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
39 auto module_priority = probe();
40 if (module_priority > best_priority_so_far)
41 {
42 best_priority_so_far = module_priority;
43 best_module_so_far = module;
44 }
45 }
46 catch (std::runtime_error const& err)
47 {
48 // Tried to probe a SharedLibrary that isn't a platform module?
49 ml::log(ml::Severity::warning,
50 std::string{"Failed to probe module. Not a platform library? Error: "} + err.what(),
51 "Platform Probing");
52 }
53 }
54 if (best_priority_so_far > mir::graphics::unsupported)
55 {
56 return best_module_so_far;
57 }
58 BOOST_THROW_EXCEPTION((std::runtime_error{"Failed to find platform for current system"}));
59}
060
=== modified file 'src/platform/options/default_configuration.cpp'
--- src/platform/options/default_configuration.cpp 2015-01-14 06:39:13 +0000
+++ src/platform/options/default_configuration.cpp 2015-01-22 15:40:28 +0000
@@ -17,11 +17,13 @@
17 */17 */
1818
19#include "mir/shared_library.h"19#include "mir/shared_library.h"
20#include "mir/shared_library_loader.h"
21#include "mir/options/default_configuration.h"20#include "mir/options/default_configuration.h"
22#include "mir/graphics/platform.h"21#include "mir/graphics/platform.h"
23#include "mir/default_configuration.h"22#include "mir/default_configuration.h"
24#include "mir/abnormal_exit.h"23#include "mir/abnormal_exit.h"
24#include "mir/shared_library_prober.h"
25#include "mir/logging/null_shared_library_prober_report.h"
26#include "mir/graphics/platform_probe.h"
2527
26#include <dlfcn.h>28#include <dlfcn.h>
2729
@@ -39,6 +41,7 @@
39char const* const mo::connector_report_opt = "connector-report";41char const* const mo::connector_report_opt = "connector-report";
40char const* const mo::scene_report_opt = "scene-report";42char const* const mo::scene_report_opt = "scene-report";
41char const* const mo::input_report_opt = "input-report";43char const* const mo::input_report_opt = "input-report";
44char const* const mo::shared_library_prober_report_opt = "shared-library-prober-report";
42char const* const mo::host_socket_opt = "host-socket";45char const* const mo::host_socket_opt = "host-socket";
43char const* const mo::frontend_threads_opt = "ipc-thread-pool";46char const* const mo::frontend_threads_opt = "ipc-thread-pool";
44char const* const mo::name_opt = "name";47char const* const mo::name_opt = "name";
@@ -52,12 +55,12 @@
52char const* const mo::lttng_opt_value = "lttng";55char const* const mo::lttng_opt_value = "lttng";
5356
54char const* const mo::platform_graphics_lib = "platform-graphics-lib";57char const* const mo::platform_graphics_lib = "platform-graphics-lib";
58char const* const mo::platform_path = "platform-path";
5559
56namespace60namespace
57{61{
58int const default_ipc_threads = 1;62int const default_ipc_threads = 1;
59bool const enable_input_default = true;63bool const enable_input_default = true;
60char const* const default_platform_graphics_lib = MIR_PLATFORM_DRIVER_BINARY;
6164
62// Hack around the way Qt loads mir:65// Hack around the way Qt loads mir:
63// platform_api and therefore Mir are loaded via dlopen(..., RTLD_LOCAL).66// platform_api and therefore Mir are loaded via dlopen(..., RTLD_LOCAL).
@@ -114,8 +117,10 @@
114 "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]")117 "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]")
115 (no_server_socket_opt, "Do not provide a socket filename for client connections")118 (no_server_socket_opt, "Do not provide a socket filename for client connections")
116 (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections")119 (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections")
117 (platform_graphics_lib, po::value<std::string>()->default_value(default_platform_graphics_lib),120 (platform_graphics_lib, po::value<std::string>(),
118 "Library to use for platform graphics support")121 "Library to use for platform graphics support (default: autodetect)")
122 (platform_path, po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PATH),
123 "Directory to look for platform libraries (default: " MIR_SERVER_PLATFORM_PATH ")")
119 (enable_input_opt, po::value<bool>()->default_value(enable_input_default),124 (enable_input_opt, po::value<bool>()->default_value(enable_input_default),
120 "Enable input.")125 "Enable input.")
121 (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value),126 (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value),
@@ -134,6 +139,8 @@
134 "How to handle the MessageProcessor report. [{log,lttng,off}]")139 "How to handle the MessageProcessor report. [{log,lttng,off}]")
135 (scene_report_opt, po::value<std::string>()->default_value(off_opt_value),140 (scene_report_opt, po::value<std::string>()->default_value(off_opt_value),
136 "How to handle the scene report. [{log,lttng,off}]")141 "How to handle the scene report. [{log,lttng,off}]")
142 (shared_library_prober_report_opt, po::value<std::string>()->default_value(log_opt_value),
143 "How to handle the SharedLibraryProber report. [{log,lttng,off}]")
137 (frontend_threads_opt, po::value<int>()->default_value(default_ipc_threads),144 (frontend_threads_opt, po::value<int>()->default_value(default_ipc_threads),
138 "threads in frontend thread pool.")145 "threads in frontend thread pool.")
139 (name_opt, po::value<std::string>(),146 (name_opt, po::value<std::string>(),
@@ -156,26 +163,48 @@
156 po::options_description program_options;163 po::options_description program_options;
157 program_options.add_options()164 program_options.add_options()
158 (platform_graphics_lib,165 (platform_graphics_lib,
159 po::value<std::string>()->default_value(default_platform_graphics_lib), "");166 po::value<std::string>(), "");
167 program_options.add_options()
168 (platform_path,
169 po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PATH),
170 "");
160 mo::ProgramOption options;171 mo::ProgramOption options;
161 options.parse_arguments(program_options, argc, argv);172 options.parse_arguments(program_options, argc, argv);
162173
163 std::string graphics_libname;174 ensure_loaded_with_rtld_global();
175
176 // TODO: We should just load all the platform plugins we can and present their options.
164 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");177 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");
165 if (!options.is_set(platform_graphics_lib) && env_libname)178 auto env_libpath = ::getenv("MIR_SERVER_PLATFORM_PATH");
166 {179 try
167 graphics_libname = std::string{env_libname};180 {
168 }181 if (options.is_set(platform_graphics_lib))
169 else182 {
170 {183 platform_graphics_library = std::make_shared<mir::SharedLibrary>(options.get<std::string>(platform_graphics_lib));
171 graphics_libname = options.get<std::string>(platform_graphics_lib);184 }
172 }185 else if (env_libname)
173186 {
174 ensure_loaded_with_rtld_global();187 platform_graphics_library = std::make_shared<mir::SharedLibrary>(std::string{env_libname});
175188 }
176 auto graphics_lib = load_library(graphics_libname);189 else
177 auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options"));190 {
178 add_platform_options(*this->program_options);191 mir::logging::NullSharedLibraryProberReport null_report;
192 auto const plugin_path = env_libpath ? env_libpath : options.get<std::string>(platform_path);
193 auto plugins = mir::libraries_for_path(plugin_path, null_report);
194 platform_graphics_library = mir::graphics::module_for_device(plugins);
195 }
196
197 auto add_platform_options = platform_graphics_library->load_function<mir::graphics::AddPlatformOptions>("add_graphics_platform_options");
198 add_platform_options(*this->program_options);
199 }
200 catch(...)
201 {
202 // We don't actually care at this point if this failed.
203 // Maybe we've been pointed at the wrong place. Maybe this platform doesn't actually
204 // *have* platform-specific options.
205 // Regardless, if we need a platform and can't find one then we'll bail later
206 // in startup with a useful error.
207 }
179}208}
180209
181boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()210boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()
182211
=== modified file 'src/platform/symbols.map'
--- src/platform/symbols.map 2015-01-20 06:24:53 +0000
+++ src/platform/symbols.map 2015-01-22 15:40:28 +0000
@@ -6,7 +6,6 @@
6 mir::fatal_error*;6 mir::fatal_error*;
7 mir::fatal_error_abort*;7 mir::fatal_error_abort*;
8 mir::fatal_error_except*;8 mir::fatal_error_except*;
9 mir::graphics::add_platform_options*;
10 mir::graphics::BufferBasic::BufferBasic*;9 mir::graphics::BufferBasic::BufferBasic*;
11 mir::graphics::Buffer::Buffer*;10 mir::graphics::Buffer::Buffer*;
12 mir::graphics::Buffer::can_bypass*;11 mir::graphics::Buffer::can_bypass*;
@@ -17,8 +16,6 @@
17 mir::graphics::Buffer::size*;16 mir::graphics::Buffer::size*;
18 mir::graphics::Buffer::stride*;17 mir::graphics::Buffer::stride*;
19 mir::graphics::Buffer::write*;18 mir::graphics::Buffer::write*;
20 mir::graphics::create_guest_platform*;
21 mir::graphics::create_host_platform*;
22 mir::graphics::Cursor::?Cursor*;19 mir::graphics::Cursor::?Cursor*;
23 mir::graphics::Cursor::Cursor*;20 mir::graphics::Cursor::Cursor*;
24 mir::graphics::Cursor::hide*;21 mir::graphics::Cursor::hide*;
@@ -81,6 +78,7 @@
81 mir::graphics::GraphicBufferAllocator::GraphicBufferAllocator*;78 mir::graphics::GraphicBufferAllocator::GraphicBufferAllocator*;
82 mir::graphics::GraphicBufferAllocator::operator*;79 mir::graphics::GraphicBufferAllocator::operator*;
83 mir::graphics::GraphicBufferAllocator::supported_pixel_formats*;80 mir::graphics::GraphicBufferAllocator::supported_pixel_formats*;
81 mir::graphics::module_for_device*;
84 mir::graphics::operator*;82 mir::graphics::operator*;
85 mir::graphics::Platform::create_buffer_allocator*;83 mir::graphics::Platform::create_buffer_allocator*;
86 mir::graphics::Platform::create_display*;84 mir::graphics::Platform::create_display*;
@@ -127,6 +125,7 @@
127 mir::options::glog_log_dir*;125 mir::options::glog_log_dir*;
128 mir::options::glog_minloglevel*;126 mir::options::glog_minloglevel*;
129 mir::options::glog_stderrthreshold*;127 mir::options::glog_stderrthreshold*;
128 mir::options::platform_path*;
130 mir::options::host_socket_opt*;129 mir::options::host_socket_opt*;
131 mir::options::input_report_opt*;130 mir::options::input_report_opt*;
132 mir::options::legacy_input_report_opt*;131 mir::options::legacy_input_report_opt*;
@@ -154,6 +153,7 @@
154 mir::options::scene_report_opt*;153 mir::options::scene_report_opt*;
155 mir::options::server_socket_opt*;154 mir::options::server_socket_opt*;
156 mir::options::session_mediator_report_opt*;155 mir::options::session_mediator_report_opt*;
156 mir::options::shared_library_prober_report_opt*;
157 mir::options::touchspots_opt*;157 mir::options::touchspots_opt*;
158 non-virtual?thunk?to?mir::graphics::Cursor::?Cursor*;158 non-virtual?thunk?to?mir::graphics::Cursor::?Cursor*;
159 non-virtual?thunk?to?mir::graphics::CursorImage::?CursorImage*;159 non-virtual?thunk?to?mir::graphics::CursorImage::?CursorImage*;
160160
=== modified file 'src/platforms/CMakeLists.txt'
--- src/platforms/CMakeLists.txt 2015-01-22 03:10:13 +0000
+++ src/platforms/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -1,3 +1,19 @@
1# This needs to change whenever the ABI between the platform
2# modules and the server changes in an incompatible way.
3# This ABI is much smaller than the full libmirplatform ABI.
4#
5# TODO: Add an extra driver-ABI check target.
6set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION "MIR_GRAPHICS_PLATFORM_1")
7set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION ${MIR_SERVER_GRAPHICS_PLATFORM_VERSION} PARENT_SCOPE)
8
9set(MIR_SERVER_PLATFORM_PATH
10 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/mir/server-platform
11)
12set(MIR_SERVER_PLATFORM_PATH
13 ${MIR_SERVER_PLATFORM_PATH}
14 PARENT_SCOPE
15)
16
1set(server_common_include_dirs17set(server_common_include_dirs
2 ${PROJECT_SOURCE_DIR}/include/platform18 ${PROJECT_SOURCE_DIR}/include/platform
3)19)
420
=== modified file 'src/platforms/android/server/CMakeLists.txt'
--- src/platforms/android/server/CMakeLists.txt 2015-01-22 03:10:13 +0000
+++ src/platforms/android/server/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -38,20 +38,17 @@
38 ipc_operations.cpp38 ipc_operations.cpp
39 hwc_blanking_control.cpp39 hwc_blanking_control.cpp
40)40)
41
41add_library(mirplatformgraphicsandroid SHARED42add_library(mirplatformgraphicsandroid SHARED
43
42 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>44 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>
43)45)
4446
45set_target_properties(47target_link_libraries(
46 mirplatformgraphicsandroid PROPERTIES48 mirplatformgraphicsandroid
47 OUTPUT_NAME ${MIR_PLATFORM_DRIVER}
48 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
49 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${server_symbol_map}"
50)
5149
52target_link_libraries(mirplatformgraphicsandroid50 mirsharedandroid
53 mirplatform51 mirplatform
54 mirsharedandroid
55 ${Boost_PROGRAM_OPTIONS_LIBRARY}52 ${Boost_PROGRAM_OPTIONS_LIBRARY}
56 ${LIBHARDWARE_LIBRARIES}53 ${LIBHARDWARE_LIBRARIES}
57 ${EGL_LDFLAGS} ${EGL_LIBRARIES}54 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
@@ -59,20 +56,14 @@
59 ${ANDROID_PROPERTIES_LDFLAGS}56 ${ANDROID_PROPERTIES_LDFLAGS}
60)57)
6158
62install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${PLATFORM_DRIVER}/android)59set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
6360
64if (MIR_TEST_PLATFORM STREQUAL "android")61set_target_properties(
65 add_custom_command(TARGET mirplatformgraphicsandroid62 mirplatformgraphicsandroid PROPERTIES
66 POST_BUILD63 OUTPUT_NAME graphics-android
67 COMMAND ${CMAKE_COMMAND} -E remove ${MIR_PLATFORM_DRIVER_BINARY}64 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
68 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> ${MIR_PLATFORM_DRIVER_BINARY}65 PREFIX ""
69 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}66 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
70 )67)
7168
72 install(CODE69install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH})
73 "execute_process(
74 COMMAND ln -sf mir/${PLATFORM_DRIVER}/android/${MIR_PLATFORM_DRIVER_BINARY}
75 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
76 )"
77 )
78endif()
7970
=== modified file 'src/platforms/android/server/platform.cpp'
--- src/platforms/android/server/platform.cpp 2015-01-22 03:10:13 +0000
+++ src/platforms/android/server/platform.cpp 2015-01-22 15:40:28 +0000
@@ -155,7 +155,7 @@
155 return std::make_shared<mga::Platform>(nullptr, display_report, mga::OverlayOptimization::disabled);155 return std::make_shared<mga::Platform>(nullptr, display_report, mga::OverlayOptimization::disabled);
156}156}
157157
158extern "C" void add_platform_options(158extern "C" void add_graphics_platform_options(
159 boost::program_options::options_description& config)159 boost::program_options::options_description& config)
160{160{
161 config.add_options()161 config.add_options()
@@ -166,3 +166,25 @@
166 boost::program_options::value<bool>()->default_value(false),166 boost::program_options::value<bool>()->default_value(false),
167 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");167 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");
168}168}
169
170extern "C" mg::PlatformPriority probe_graphics_platform()
171{
172 int err;
173 hw_module_t const* hw_module;
174
175 err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hw_module);
176
177 return err < 0 ? mg::PlatformPriority::unsupported : mg::PlatformPriority::best;
178}
179
180mir::ModuleProperties const description = {
181 "android",
182 MIR_VERSION_MAJOR,
183 MIR_VERSION_MINOR,
184 MIR_VERSION_MICRO
185};
186
187extern "C" mir::ModuleProperties const* describe_graphics_module()
188{
189 return &description;
190}
169191
=== added file 'src/platforms/android/server/symbols.map'
--- src/platforms/android/server/symbols.map 1970-01-01 00:00:00 +0000
+++ src/platforms/android/server/symbols.map 2015-01-22 15:40:28 +0000
@@ -0,0 +1,10 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_graphics_platform_options;
4 create_host_platform;
5 create_guest_platform;
6 probe_graphics_platform;
7 describe_graphics_module;
8 local:
9 *;
10};
011
=== modified file 'src/platforms/common/server/symbols.map'
--- src/platforms/common/server/symbols.map 2015-01-22 03:10:13 +0000
+++ src/platforms/common/server/symbols.map 2015-01-22 15:40:28 +0000
@@ -1,8 +1,9 @@
1MIR_PLATFORM_1 {1MIR_GRAPHICS_PLATFORM_1 {
2 global: 2 global:
3 add_platform_options;3 add_graphics_platform_options;
4 probe_graphics_platform;
4 create_host_platform;5 create_host_platform;
5 create_guest_platform;6 create_guest_platform;
6 mir_server_mesa_egl_native_display_is_valid;7 describe_graphics_module;
7 local: *;8 local: *;
8};9};
910
=== modified file 'src/platforms/mesa/server/CMakeLists.txt'
--- src/platforms/mesa/server/CMakeLists.txt 2015-01-22 03:10:13 +0000
+++ src/platforms/mesa/server/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -15,7 +15,9 @@
15string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})15string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
16add_definitions(-D__GBM__)16add_definitions(-D__GBM__)
1717
18add_library(mirplatformgraphicsmesaobjects OBJECT18add_library(
19 mirplatformgraphicsmesaobjects OBJECT
20
19 platform.cpp21 platform.cpp
20 buffer_allocator.cpp22 buffer_allocator.cpp
21 gbm_buffer.cpp23 gbm_buffer.cpp
@@ -38,18 +40,15 @@
38 nested_authentication.cpp40 nested_authentication.cpp
39)41)
4042
41add_library(mirplatformgraphicsmesa SHARED43add_library(
44 mirplatformgraphicsmesa MODULE
45
42 $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects>46 $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects>
43)47)
4448
45set_target_properties(49target_link_libraries(
46 mirplatformgraphicsmesa PROPERTIES50 mirplatformgraphicsmesa
47 OUTPUT_NAME ${MIR_PLATFORM_DRIVER}
48 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
49 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${server_symbol_map}"
50)
5151
52target_link_libraries(mirplatformgraphicsmesa
53 mirplatform52 mirplatform
54 ${Boost_PROGRAM_OPTIONS_LIBRARY}53 ${Boost_PROGRAM_OPTIONS_LIBRARY}
55 ${DRM_LDFLAGS} ${DRM_LIBRARIES}54 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -58,20 +57,14 @@
58 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}57 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
59)58)
6059
61install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${PLATFORM_DRIVER}/mesa)60set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
6261
63if (MIR_TEST_PLATFORM STREQUAL "mesa")62set_target_properties(
64 add_custom_command(TARGET mirplatformgraphicsmesa63 mirplatformgraphicsmesa PROPERTIES
65 POST_BUILD64 OUTPUT_NAME graphics-mesa
66 COMMAND ${CMAKE_COMMAND} -E remove ${MIR_PLATFORM_DRIVER_BINARY}65 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
67 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> ${MIR_PLATFORM_DRIVER_BINARY}66 PREFIX ""
68 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}67 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
69 )68)
7069
71 install(CODE70install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH})
72 "execute_process(
73 COMMAND ln -sf mir/${PLATFORM_DRIVER}/mesa/${MIR_PLATFORM_DRIVER_BINARY}
74 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
75 )"
76 )
77endif()
7871
=== modified file 'src/platforms/mesa/server/platform.cpp'
--- src/platforms/mesa/server/platform.cpp 2015-01-22 03:10:13 +0000
+++ src/platforms/mesa/server/platform.cpp 2015-01-22 15:40:28 +0000
@@ -26,6 +26,7 @@
26#include "mir/options/option.h"26#include "mir/options/option.h"
27#include "mir/graphics/native_buffer.h"27#include "mir/graphics/native_buffer.h"
28#include "mir/emergency_cleanup_registry.h"28#include "mir/emergency_cleanup_registry.h"
29#include "mir/udev/wrapper.h"
2930
3031
31#include <boost/throw_exception.hpp>32#include <boost/throw_exception.hpp>
@@ -192,7 +193,7 @@
192 return false;193 return false;
193}194}
194195
195extern "C" void add_platform_options(boost::program_options::options_description& config)196extern "C" void add_graphics_platform_options(boost::program_options::options_description& config)
196{197{
197 config.add_options()198 config.add_options()
198 (vt_option_name,199 (vt_option_name,
@@ -202,3 +203,33 @@
202 boost::program_options::value<bool>()->default_value(true),203 boost::program_options::value<bool>()->default_value(true),
203 "[platform-specific] utilize the bypass optimization for fullscreen surfaces.");204 "[platform-specific] utilize the bypass optimization for fullscreen surfaces.");
204}205}
206
207extern "C" mg::PlatformPriority probe_graphics_platform()
208{
209 auto udev = std::make_shared<mir::udev::Context>();
210
211 mir::udev::Enumerator drm_devices{udev};
212 drm_devices.match_subsystem("drm");
213 drm_devices.match_sysname("card[0-9]*");
214 drm_devices.scan_devices();
215
216 for (auto& device : drm_devices)
217 {
218 static_cast<void>(device);
219 return mg::PlatformPriority::best;
220 }
221
222 return mg::PlatformPriority::unsupported;
223}
224
225mir::ModuleProperties const description = {
226 "mesa",
227 MIR_VERSION_MAJOR,
228 MIR_VERSION_MINOR,
229 MIR_VERSION_MICRO
230};
231
232extern "C" mir::ModuleProperties const* describe_graphics_module()
233{
234 return &description;
235}
205236
=== added file 'src/platforms/mesa/server/symbols.map'
--- src/platforms/mesa/server/symbols.map 1970-01-01 00:00:00 +0000
+++ src/platforms/mesa/server/symbols.map 2015-01-22 15:40:28 +0000
@@ -0,0 +1,16 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_graphics_platform_options;
4 create_host_platform;
5 create_guest_platform;
6 probe_graphics_platform;
7 describe_graphics_module;
8 local:
9 *;
10};
11
12# Mesa EGL platform requires this, because madness.
13MIR_MESA_EGL_INTEGRATION {
14 global:
15 mir_server_mesa_egl_native_display_is_valid;
16};
017
=== modified file 'src/server/CMakeLists.txt'
--- src/server/CMakeLists.txt 2015-01-20 10:07:15 +0000
+++ src/server/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -11,6 +11,9 @@
11 ${GLIB_INCLUDE_DIRS}11 ${GLIB_INCLUDE_DIRS}
12)12)
1313
14add_definitions(-DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}")
15add_definitions(-DMIR_SERVER_GRAPHICS_PLATFORM_VERSION="${MIR_SERVER_GRAPHICS_PLATFORM_VERSION}")
16
14add_subdirectory(compositor/)17add_subdirectory(compositor/)
15add_subdirectory(graphics/)18add_subdirectory(graphics/)
16add_subdirectory(input/)19add_subdirectory(input/)
@@ -78,8 +81,9 @@
78)81)
7982
80target_link_libraries(mirserver LINK_PUBLIC83target_link_libraries(mirserver LINK_PUBLIC
84
85 mirclient
81 mirplatform86 mirplatform
82 mirclient
83 mircommon87 mircommon
84 mirprotobuf88 mirprotobuf
85 3rd_party89 3rd_party
8690
=== modified file 'src/server/graphics/CMakeLists.txt'
--- src/server/graphics/CMakeLists.txt 2015-01-16 02:57:31 +0000
+++ src/server/graphics/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -1,4 +1,4 @@
1include_directories(${GLESv2_INCLUDE_DIRS})1include_directories(${GLESv2_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR})
22
3add_library(3add_library(
4 mirgraphics OBJECT4 mirgraphics OBJECT
55
=== modified file 'src/server/graphics/default_configuration.cpp'
--- src/server/graphics/default_configuration.cpp 2015-01-16 02:57:31 +0000
+++ src/server/graphics/default_configuration.cpp 2015-01-22 15:40:28 +0000
@@ -30,10 +30,11 @@
30#include "mir/graphics/gl_config.h"30#include "mir/graphics/gl_config.h"
31#include "mir/graphics/platform.h"31#include "mir/graphics/platform.h"
32#include "mir/graphics/cursor.h"32#include "mir/graphics/cursor.h"
33#include "mir/graphics/platform_probe.h"
33#include "program_factory.h"34#include "program_factory.h"
3435
35#include "mir/shared_library.h"36#include "mir/shared_library.h"
36#include "mir/shared_library_loader.h"37#include "mir/shared_library_prober.h"
37#include "mir/abnormal_exit.h"38#include "mir/abnormal_exit.h"
38#include "mir/emergency_cleanup.h"39#include "mir/emergency_cleanup.h"
39#include "mir/log.h"40#include "mir/log.h"
@@ -45,8 +46,15 @@
45#include <map>46#include <map>
4647
47namespace mg = mir::graphics;48namespace mg = mir::graphics;
49namespace ml = mir::logging;
48namespace mgn = mir::graphics::nested;50namespace mgn = mir::graphics::nested;
4951
52namespace
53{
54// TODO: Temporary, until we actually manage module lifetimes
55static std::shared_ptr<mir::SharedLibrary> platform_library;
56}
57
50std::shared_ptr<mg::DisplayConfigurationPolicy>58std::shared_ptr<mg::DisplayConfigurationPolicy>
51mir::DefaultServerConfiguration::the_display_configuration_policy()59mir::DefaultServerConfiguration::the_display_configuration_policy()
52{60{
@@ -65,7 +73,6 @@
65 return wrapped;73 return wrapped;
66}74}
6775
68
69namespace76namespace
70{77{
71//TODO: what is the point of NestedContext if its just the same as mgn:HostConnection?78//TODO: what is the point of NestedContext if its just the same as mgn:HostConnection?
@@ -102,24 +109,49 @@
102 return graphics_platform(109 return graphics_platform(
103 [this]()->std::shared_ptr<mg::Platform>110 [this]()->std::shared_ptr<mg::Platform>
104 {111 {
105 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));112 // fallback to standalone if host socket is unset
113 if (the_options()->is_set(options::platform_graphics_lib))
114 {
115 platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib));
116 }
117 else
118 {
119 auto const& path = the_options()->get<std::string>(options::platform_path);
120 auto platforms = mir::libraries_for_path(path, *the_shared_library_prober_report());
121 if (platforms.empty())
122 {
123 auto msg = "Failed to find any platform plugins in: " + path;
124 throw std::runtime_error(msg.c_str());
125 }
126 platform_library = mir::graphics::module_for_device(platforms);
127 }
128 auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>(
129 "create_host_platform",
130 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
131 auto create_guest_platform = platform_library->load_function<mg::CreateGuestPlatform>(
132 "create_guest_platform",
133 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
134 auto describe_module = platform_library->load_function<mg::DescribeModule>(
135 "describe_graphics_module",
136 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
137 auto description = describe_module();
138 ml::log(ml::Severity::informational,
139 std::string{"Selected driver: "} + description->name + " (version " +
140 std::to_string(description->major_version) + "." +
141 std::to_string(description->minor_version) + "." +
142 std::to_string(description->micro_version) + ")",
143 "Platform Loader");
106144
107 auto create_host_platform = graphics_lib->load_function<mg::CreateHostPlatform>("create_host_platform");145 if (!the_options()->is_set(options::host_socket_opt))
108 auto create_guest_platform = graphics_lib->load_function<mg::CreateGuestPlatform>("create_guest_platform");146 return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report());
109 if (the_options()->is_set(options::host_socket_opt))147 else
110 {
111 return create_guest_platform(148 return create_guest_platform(
112 the_display_report(),149 the_display_report(),
113 std::make_shared<MirConnectionNestedContext>(the_host_connection()));150 std::make_shared<MirConnectionNestedContext>(the_host_connection()));
114 }151
115 else
116 {
117 return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report());
118 }
119 });152 });
120}153}
121154
122
123std::shared_ptr<mg::GraphicBufferAllocator>155std::shared_ptr<mg::GraphicBufferAllocator>
124mir::DefaultServerConfiguration::the_buffer_allocator()156mir::DefaultServerConfiguration::the_buffer_allocator()
125{157{
126158
=== modified file 'src/server/report/default_server_configuration.cpp'
--- src/server/report/default_server_configuration.cpp 2014-03-06 06:05:17 +0000
+++ src/server/report/default_server_configuration.cpp 2015-01-22 15:40:28 +0000
@@ -117,3 +117,12 @@
117 return report_factory(options::scene_report_opt)->create_scene_report();117 return report_factory(options::scene_report_opt)->create_scene_report();
118 });118 });
119}119}
120
121auto mir::DefaultServerConfiguration::the_shared_library_prober_report() -> std::shared_ptr<SharedLibraryProberReport>
122{
123 return shared_library_prober_report(
124 [this]()->std::shared_ptr<SharedLibraryProberReport>
125 {
126 return report_factory(options::shared_library_prober_report_opt)->create_shared_library_prober_report();
127 });
128}
120129
=== modified file 'src/server/report/logging/logging_report_factory.cpp'
--- src/server/report/logging/logging_report_factory.cpp 2014-02-11 15:18:07 +0000
+++ src/server/report/logging/logging_report_factory.cpp 2015-01-22 15:40:28 +0000
@@ -25,6 +25,7 @@
25#include "scene_report.h"25#include "scene_report.h"
26#include "session_mediator_report.h"26#include "session_mediator_report.h"
27#include "input_report.h"27#include "input_report.h"
28#include "mir/logging/shared_library_prober_report.h"
2829
29#include "mir/default_server_configuration.h"30#include "mir/default_server_configuration.h"
3031
@@ -72,4 +73,8 @@
72 return std::make_shared<logging::InputReport>(logger);73 return std::make_shared<logging::InputReport>(logger);
73}74}
7475
76std::shared_ptr<mir::SharedLibraryProberReport> mr::LoggingReportFactory::create_shared_library_prober_report()
77{
78 return std::make_shared<mir::logging::SharedLibraryProberReport>(logger);
79}
7580
7681
=== modified file 'src/server/report/logging_report_factory.h'
--- src/server/report/logging_report_factory.h 2014-02-11 15:18:07 +0000
+++ src/server/report/logging_report_factory.h 2015-01-22 15:40:28 +0000
@@ -47,6 +47,7 @@
47 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;47 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
48 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;48 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
49 std::shared_ptr<input::InputReport> create_input_report() override;49 std::shared_ptr<input::InputReport> create_input_report() override;
50 std::shared_ptr<mir::SharedLibraryProberReport> create_shared_library_prober_report() override;
5051
51private:52private:
52 std::shared_ptr<mir::logging::Logger> const logger;53 std::shared_ptr<mir::logging::Logger> const logger;
5354
=== modified file 'src/server/report/lttng/CMakeLists.txt'
--- src/server/report/lttng/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ src/server/report/lttng/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -17,6 +17,7 @@
17 session_mediator_report.cpp17 session_mediator_report.cpp
18 scene_report.cpp18 scene_report.cpp
19 server_tracepoint_provider.cpp19 server_tracepoint_provider.cpp
20 shared_library_prober_report.cpp
20)21)
2122
22add_library(23add_library(
2324
=== modified file 'src/server/report/lttng/lttng_report_factory.cpp'
--- src/server/report/lttng/lttng_report_factory.cpp 2014-02-11 15:18:07 +0000
+++ src/server/report/lttng/lttng_report_factory.cpp 2015-01-22 15:40:28 +0000
@@ -25,6 +25,7 @@
25#include "message_processor_report.h"25#include "message_processor_report.h"
26#include "scene_report.h"26#include "scene_report.h"
27#include "session_mediator_report.h"27#include "session_mediator_report.h"
28#include "shared_library_prober_report.h"
2829
29std::shared_ptr<mir::compositor::CompositorReport> mir::report::LttngReportFactory::create_compositor_report()30std::shared_ptr<mir::compositor::CompositorReport> mir::report::LttngReportFactory::create_compositor_report()
30{31{
@@ -61,4 +62,9 @@
61 return std::make_shared<lttng::InputReport>();62 return std::make_shared<lttng::InputReport>();
62}63}
6364
65std::shared_ptr<mir::SharedLibraryProberReport> mir::report::LttngReportFactory::create_shared_library_prober_report()
66{
67 return std::make_shared<lttng::SharedLibraryProberReport>();
68}
69
6470
6571
=== added file 'src/server/report/lttng/shared_library_prober_report.cpp'
--- src/server/report/lttng/shared_library_prober_report.cpp 1970-01-01 00:00:00 +0000
+++ src/server/report/lttng/shared_library_prober_report.cpp 2015-01-22 15:40:28 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright © 2014 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: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#include "shared_library_prober_report.h"
20
21#include "mir/report/lttng/mir_tracepoint.h"
22
23#define TRACEPOINT_DEFINE
24#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
25#include "shared_library_prober_report_tp.h"
26
27namespace mrl = mir::report::lttng;
28namespace bf = boost::filesystem;
29
30void mrl::SharedLibraryProberReport::probing_path(bf::path const& path)
31{
32 mir_tracepoint(mir_server_shared_library_prober, probing_path,
33 path.string().c_str());
34}
35
36void mrl::SharedLibraryProberReport::probing_failed(bf::path const& path, std::exception const& error)
37{
38 mir_tracepoint(mir_server_shared_library_prober, probing_failed,
39 path.string().c_str(), error.what());
40}
41
42void mrl::SharedLibraryProberReport::loading_library(bf::path const& filename)
43{
44 mir_tracepoint(mir_server_shared_library_prober, loading_library,
45 filename.string().c_str());
46}
47
48void mrl::SharedLibraryProberReport::loading_failed(bf::path const& filename, std::exception const& error)
49{
50 mir_tracepoint(mir_server_shared_library_prober, loading_failed,
51 filename.string().c_str(), error.what());
52}
053
=== added file 'src/server/report/lttng/shared_library_prober_report.h'
--- src/server/report/lttng/shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ src/server/report/lttng/shared_library_prober_report.h 2015-01-22 15:40:28 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU 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 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: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#ifndef MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include "server_tracepoint_provider.h"
23#include "mir/shared_library_prober_report.h"
24
25namespace mir
26{
27namespace report
28{
29namespace lttng
30{
31
32class SharedLibraryProberReport : public mir::SharedLibraryProberReport
33{
34public:
35 void probing_path(boost::filesystem::path const& path) override;
36 void probing_failed(boost::filesystem::path const& path, std::exception const& error) override;
37 void loading_library(boost::filesystem::path const& filename) override;
38 void loading_failed(boost::filesystem::path const& filename, std::exception const& error) override;
39
40private:
41 ServerTracepointProvider tp_provider;
42};
43
44}
45}
46}
47
48#endif /* MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_ */
049
=== added file 'src/server/report/lttng/shared_library_prober_report_tp.h'
--- src/server/report/lttng/shared_library_prober_report_tp.h 1970-01-01 00:00:00 +0000
+++ src/server/report/lttng/shared_library_prober_report_tp.h 2015-01-22 15:40:28 +0000
@@ -0,0 +1,70 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU 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 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: Andreas Pokorny <andreas.pokorny@canonical.com>
17 */
18
19#undef TRACEPOINT_PROVIDER
20#define TRACEPOINT_PROVIDER mir_server_shared_library_prober
21
22#undef TRACEPOINT_INCLUDE
23#define TRACEPOINT_INCLUDE "./shared_library_prober_report_tp.h"
24
25#if !defined(MIR_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ)
26#define MIR_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_
27
28#include "lttng_utils.h"
29
30TRACEPOINT_EVENT(
31 mir_server_shared_library_prober,
32 probing_path,
33 TP_ARGS(const char*, path),
34 TP_FIELDS(
35 ctf_string(path, path)
36 )
37)
38
39TRACEPOINT_EVENT(
40 mir_server_shared_library_prober,
41 probing_failed,
42 TP_ARGS(const char*, path, const char*, message),
43 TP_FIELDS(
44 ctf_string(path, path)
45 ctf_string(message, message)
46 )
47)
48
49TRACEPOINT_EVENT(
50 mir_server_shared_library_prober,
51 loading_library,
52 TP_ARGS(const char*, path),
53 TP_FIELDS(
54 ctf_string(path, path)
55 )
56)
57
58TRACEPOINT_EVENT(
59 mir_server_shared_library_prober,
60 loading_failed,
61 TP_ARGS(const char*, path, const char*, message),
62 TP_FIELDS(
63 ctf_string(path, path)
64 ctf_string(message, message)
65 )
66)
67
68#endif /* MIR_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_ */
69
70#include <lttng/tracepoint-event.h>
071
=== modified file 'src/server/report/lttng/tracepoints.c'
--- src/server/report/lttng/tracepoints.c 2014-02-03 11:44:32 +0000
+++ src/server/report/lttng/tracepoints.c 2015-01-22 15:40:28 +0000
@@ -8,3 +8,4 @@
8#include "session_mediator_report_tp.h"8#include "session_mediator_report_tp.h"
9#include "scene_report_tp.h"9#include "scene_report_tp.h"
10#include "message_processor_report_tp.h"10#include "message_processor_report_tp.h"
11#include "shared_library_prober_report_tp.h"
1112
=== modified file 'src/server/report/lttng_report_factory.h'
--- src/server/report/lttng_report_factory.h 2014-02-11 15:18:07 +0000
+++ src/server/report/lttng_report_factory.h 2015-01-22 15:40:28 +0000
@@ -35,6 +35,7 @@
35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
37 std::shared_ptr<input::InputReport> create_input_report() override;37 std::shared_ptr<input::InputReport> create_input_report() override;
38 std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() override;
38};39};
39}40}
40}41}
4142
=== modified file 'src/server/report/null/null_report_factory.cpp'
--- src/server/report/null/null_report_factory.cpp 2014-02-17 22:35:23 +0000
+++ src/server/report/null/null_report_factory.cpp 2015-01-22 15:40:28 +0000
@@ -25,6 +25,7 @@
25#include "display_report.h"25#include "display_report.h"
26#include "input_report.h"26#include "input_report.h"
27#include "scene_report.h"27#include "scene_report.h"
28#include "mir/logging/null_shared_library_prober_report.h"
2829
29std::shared_ptr<mir::compositor::CompositorReport> mir::report::NullReportFactory::create_compositor_report()30std::shared_ptr<mir::compositor::CompositorReport> mir::report::NullReportFactory::create_compositor_report()
30{31{
@@ -61,11 +62,21 @@
61 return std::make_shared<null::InputReport>();62 return std::make_shared<null::InputReport>();
62}63}
6364
65std::shared_ptr<mir::SharedLibraryProberReport> mir::report::NullReportFactory::create_shared_library_prober_report()
66{
67 return std::make_shared<logging::NullSharedLibraryProberReport>();
68}
69
64std::shared_ptr<mir::compositor::CompositorReport> mir::report::null_compositor_report()70std::shared_ptr<mir::compositor::CompositorReport> mir::report::null_compositor_report()
65{71{
66 return NullReportFactory{}.create_compositor_report();72 return NullReportFactory{}.create_compositor_report();
67}73}
6874
75std::shared_ptr<mir::SharedLibraryProberReport> mir::report::null_shared_library_prober_report()
76{
77 return NullReportFactory{}.create_shared_library_prober_report();
78}
79
69std::shared_ptr<mir::graphics::DisplayReport> mir::report::null_display_report()80std::shared_ptr<mir::graphics::DisplayReport> mir::report::null_display_report()
70{81{
71 return NullReportFactory{}.create_display_report();82 return NullReportFactory{}.create_display_report();
7283
=== modified file 'src/server/report/null_report_factory.h'
--- src/server/report/null_report_factory.h 2014-02-17 22:35:23 +0000
+++ src/server/report/null_report_factory.h 2015-01-22 15:40:28 +0000
@@ -35,6 +35,7 @@
35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
37 std::shared_ptr<input::InputReport> create_input_report() override;37 std::shared_ptr<input::InputReport> create_input_report() override;
38 std::shared_ptr<mir::SharedLibraryProberReport> create_shared_library_prober_report() override;
38};39};
3940
40std::shared_ptr<compositor::CompositorReport> null_compositor_report();41std::shared_ptr<compositor::CompositorReport> null_compositor_report();
@@ -44,6 +45,7 @@
44std::shared_ptr<frontend::SessionMediatorReport> null_session_mediator_report();45std::shared_ptr<frontend::SessionMediatorReport> null_session_mediator_report();
45std::shared_ptr<frontend::MessageProcessorReport> null_message_processor_report();46std::shared_ptr<frontend::MessageProcessorReport> null_message_processor_report();
46std::shared_ptr<input::InputReport> null_input_report();47std::shared_ptr<input::InputReport> null_input_report();
48std::shared_ptr<mir::SharedLibraryProberReport> null_shared_library_prober_report();
4749
48}50}
49}51}
5052
=== modified file 'src/server/report/report_factory.h'
--- src/server/report/report_factory.h 2014-02-11 15:18:07 +0000
+++ src/server/report/report_factory.h 2015-01-22 15:40:28 +0000
@@ -23,6 +23,7 @@
2323
24namespace mir24namespace mir
25{25{
26class SharedLibraryProberReport;
26namespace compositor27namespace compositor
27{28{
28class CompositorReport;29class CompositorReport;
@@ -59,6 +60,7 @@
59 virtual std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() = 0;60 virtual std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() = 0;
60 virtual std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() = 0;61 virtual std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() = 0;
61 virtual std::shared_ptr<input::InputReport> create_input_report() = 0;62 virtual std::shared_ptr<input::InputReport> create_input_report() = 0;
63 virtual std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() = 0;
6264
63protected:65protected:
64 ReportFactory() = default;66 ReportFactory() = default;
6567
=== modified file 'src/server/server.cpp'
--- src/server/server.cpp 2015-01-19 11:40:40 +0000
+++ src/server/server.cpp 2015-01-22 15:40:28 +0000
@@ -188,12 +188,15 @@
188 // TODO this is an ugly frig to avoid exposing the render factory to end users and tests running headless188 // TODO this is an ugly frig to avoid exposing the render factory to end users and tests running headless
189 auto the_renderer_factory() -> std::shared_ptr<compositor::RendererFactory> override189 auto the_renderer_factory() -> std::shared_ptr<compositor::RendererFactory> override
190 {190 {
191 auto const graphics_lib = the_options()->get<std::string>(options::platform_graphics_lib);191 auto const& options = the_options();
192 if (options->is_set(options::platform_graphics_lib))
193 {
194 auto const graphics_lib = options->get<std::string>(options::platform_graphics_lib);
192195
193 if (graphics_lib != "libmirplatformstub.so")196 if (graphics_lib.find("graphics-dummy.so") != std::string::npos)
194 return mir::DefaultServerConfiguration::the_renderer_factory();197 return std::make_shared<StubRendererFactory>();
195 else198 }
196 return std::make_shared<StubRendererFactory>();199 return mir::DefaultServerConfiguration::the_renderer_factory();
197 }200 }
198201
199 using mir::DefaultServerConfiguration::the_options;202 using mir::DefaultServerConfiguration::the_options;
200203
=== modified file 'src/server/symbols.map'
--- src/server/symbols.map 2015-01-21 08:38:18 +0000
+++ src/server/symbols.map 2015-01-22 15:40:28 +0000
@@ -110,6 +110,7 @@
110 mir::DefaultServerConfiguration::the_session_event_sink*;110 mir::DefaultServerConfiguration::the_session_event_sink*;
111 mir::DefaultServerConfiguration::the_session_listener*;111 mir::DefaultServerConfiguration::the_session_listener*;
112 mir::DefaultServerConfiguration::the_session_mediator_report*;112 mir::DefaultServerConfiguration::the_session_mediator_report*;
113 mir::DefaultServerConfiguration::the_shared_library_prober_report*;
113 mir::DefaultServerConfiguration::the_shell_display_layout*;114 mir::DefaultServerConfiguration::the_shell_display_layout*;
114 mir::DefaultServerConfiguration::the_shell_focus_setter*;115 mir::DefaultServerConfiguration::the_shell_focus_setter*;
115 mir::DefaultServerConfiguration::the_snapshot_strategy*;116 mir::DefaultServerConfiguration::the_snapshot_strategy*;
@@ -594,6 +595,7 @@
594 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_event_sink*;595 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_event_sink*;
595 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_listener*;596 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_listener*;
596 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_mediator_report*;597 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_mediator_report*;
598 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shared_library_prober_report*;
597 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shell_display_layout*;599 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shell_display_layout*;
598 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shell_focus_setter*;600 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shell_focus_setter*;
599 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_snapshot_strategy*;601 non-virtual?thunk?to?mir::DefaultServerConfiguration::the_snapshot_strategy*;
600602
=== modified file 'src/wrapper.c'
--- src/wrapper.c 2015-01-14 06:39:13 +0000
+++ src/wrapper.c 2015-01-22 15:40:28 +0000
@@ -46,6 +46,9 @@
46 *dest_max = '\0';46 *dest_max = '\0';
47 setenv("MIR_CLIENT_PLATFORM_PATH", path, 1);47 setenv("MIR_CLIENT_PLATFORM_PATH", path, 1);
48 printf("MIR_CLIENT_PLATFORM_PATH=%s\n", path);48 printf("MIR_CLIENT_PLATFORM_PATH=%s\n", path);
49 strncpy(pivot+7, "server-modules/", pivot_max-7);
50 setenv("MIR_SERVER_PLATFORM_PATH", path, 1);
51 printf("MIR_SERVER_PLATFORM_PATH=%s\n", path);
4952
50 pivot[6] = '\0'; /* truncate lib/client-modules to just lib */53 pivot[6] = '\0'; /* truncate lib/client-modules to just lib */
51 setenv("LD_LIBRARY_PATH", path, 1);54 setenv("LD_LIBRARY_PATH", path, 1);
5255
=== modified file 'tests/acceptance-tests/CMakeLists.txt'
--- tests/acceptance-tests/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ tests/acceptance-tests/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -4,10 +4,6 @@
4 ${CMAKE_SOURCE_DIR}4 ${CMAKE_SOURCE_DIR}
5)5)
66
7add_definitions(
8 -DMIR_PLATFORM_DRIVER_BINARY="${MIR_PLATFORM_DRIVER_BINARY}"
9)
10
11set(7set(
12 SOURCES8 SOURCES
139
@@ -67,9 +63,9 @@
67 mirplatform63 mirplatform
6864
69 mir-test65 mir-test
66 mir-test-framework
70 mir-test-doubles67 mir-test-doubles
71 mir-test-doubles-platform68 mir-test-doubles-platform
72 mir-test-framework
73 3rd_party69 3rd_party
7470
75 ${PROTOBUF_LIBRARIES}71 ${PROTOBUF_LIBRARIES}
7672
=== modified file 'tests/acceptance-tests/server_configuration_wrapping.cpp'
--- tests/acceptance-tests/server_configuration_wrapping.cpp 2014-11-06 03:56:24 +0000
+++ tests/acceptance-tests/server_configuration_wrapping.cpp 2015-01-22 15:40:28 +0000
@@ -21,11 +21,14 @@
2121
22#include "mir_test_framework/headless_test.h"22#include "mir_test_framework/headless_test.h"
2323
24#include "mir_test_framework/executable_path.h"
25
24#include <gtest/gtest.h>26#include <gtest/gtest.h>
25#include <gmock/gmock.h>27#include <gmock/gmock.h>
2628
27namespace ms = mir::scene;29namespace ms = mir::scene;
28namespace msh = mir::shell;30namespace msh = mir::shell;
31namespace mtf = mir_test_framework;
2932
30using namespace testing;33using namespace testing;
3134
3235
=== modified file 'tests/acceptance-tests/test_symbols_required_by_mesa.cpp'
--- tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2015-01-14 06:39:13 +0000
+++ tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2015-01-22 15:40:28 +0000
@@ -28,7 +28,7 @@
2828
29TEST(SymbolsRequiredByMesa, are_exported_by_client_platform_mesa)29TEST(SymbolsRequiredByMesa, are_exported_by_client_platform_mesa)
30{30{
31 auto const handle = dlopen((mtf::library_path() + "/client-modules/mesa.so").c_str(), RTLD_LAZY);31 auto const handle = dlopen(mtf::client_platform("mesa.so").c_str(), RTLD_LAZY);
32 ASSERT_THAT(handle, NotNull());32 ASSERT_THAT(handle, NotNull());
3333
34 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");34 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");
@@ -39,7 +39,7 @@
3939
40TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics)40TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics)
41{41{
42 auto const handle = dlopen(MIR_PLATFORM_DRIVER_BINARY, RTLD_LAZY);42 auto const handle = dlopen(mtf::server_platform("graphics-mesa.so").c_str(), RTLD_LAZY);
43 ASSERT_THAT(handle, NotNull());43 ASSERT_THAT(handle, NotNull());
4444
45 auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid");45 auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid");
4646
=== modified file 'tests/include/mir_test_framework/client_platform_factory.h'
--- tests/include/mir_test_framework/client_platform_factory.h 2015-01-15 15:17:02 +0000
+++ tests/include/mir_test_framework/client_platform_factory.h 2015-01-22 15:40:28 +0000
@@ -37,7 +37,7 @@
37 mtd::MockClientContext ctx;37 mtd::MockClientContext ctx;
38 ON_CALL(ctx, populate(_))38 ON_CALL(ctx, populate(_))
39 .WillByDefault(Invoke([](MirPlatformPackage& package) { ::memset(&package, 0, sizeof(package)); }));39 .WillByDefault(Invoke([](MirPlatformPackage& package) { ::memset(&package, 0, sizeof(package)); }));
40 platform_library = std::make_shared<mir::SharedLibrary>(library_path() + "/client-modules/android.so");40 platform_library = std::make_shared<mir::SharedLibrary>(client_platform("android.so"));
41 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");41 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
42 return platform_factory(&ctx);42 return platform_factory(&ctx);
43}43}
@@ -52,7 +52,7 @@
52 ::memset(&package, 0, sizeof(package));52 ::memset(&package, 0, sizeof(package));
53 package.fd_items = 1;53 package.fd_items = 1;
54 }));54 }));
55 platform_library = std::make_shared<mir::SharedLibrary>(library_path() + "/client-modules/mesa.so");55 platform_library = std::make_shared<mir::SharedLibrary>(client_platform("mesa.so"));
56 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");56 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
57 return platform_factory(&ctx);57 return platform_factory(&ctx);
58}58}
5959
=== modified file 'tests/include/mir_test_framework/executable_path.h'
--- tests/include/mir_test_framework/executable_path.h 2015-01-14 06:39:13 +0000
+++ tests/include/mir_test_framework/executable_path.h 2015-01-22 15:40:28 +0000
@@ -26,5 +26,7 @@
26std::string executable_path();26std::string executable_path();
2727
28std::string library_path();28std::string library_path();
29std::string server_platform(std::string const& name);
30std::string client_platform(std::string const& name);
29}31}
30#endif /* MIR_TEST_FRAMEWORK_EXECUTABLE_PATH_H_ */32#endif /* MIR_TEST_FRAMEWORK_EXECUTABLE_PATH_H_ */
3133
=== modified file 'tests/include/mir_test_framework/headless_test.h'
--- tests/include/mir_test_framework/headless_test.h 2015-01-14 06:39:13 +0000
+++ tests/include/mir_test_framework/headless_test.h 2015-01-22 15:40:28 +0000
@@ -32,7 +32,7 @@
32{32{
33/** Basic fixture for tests that don't use graphics hardware.33/** Basic fixture for tests that don't use graphics hardware.
34 * This provides a mechanism for temporarily setting environment variables.34 * This provides a mechanism for temporarily setting environment variables.
35 * It automatically sets "MIR_SERVER_PLATFORM_GRAPHICS_LIB" to "libmirplatformstub.so"35 * It automatically sets "MIR_SERVER_PLATFORM_GRAPHICS_LIB" to "graphics-dummy.so"
36 * as the tests do not hit the graphics hardware.36 * as the tests do not hit the graphics hardware.
37 */37 */
38class HeadlessTest : public ::testing::Test, public AsyncServerRunner38class HeadlessTest : public ::testing::Test, public AsyncServerRunner
3939
=== added file 'tests/include/mir_test_framework/stub_server_platform_factory.h'
--- tests/include/mir_test_framework/stub_server_platform_factory.h 1970-01-01 00:00:00 +0000
+++ tests/include/mir_test_framework/stub_server_platform_factory.h 2015-01-22 15:40:28 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU 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 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_
20#define MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_
21
22#include "mir/geometry/rectangle.h"
23
24#include "mir/graphics/platform.h"
25#include <vector>
26
27namespace geom = mir::geometry;
28
29namespace mir
30{
31namespace graphics
32{
33class Platform;
34}
35}
36
37namespace mg = mir::graphics;
38
39namespace mir_test_framework
40{
41
42std::shared_ptr<mg::Platform> make_stubbed_server_graphics_platform(std::vector<geom::Rectangle> const& display_rects);
43
44void set_next_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects);
45
46void set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display);
47
48}
49#endif /* MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_ */
050
=== modified file 'tests/integration-tests/CMakeLists.txt'
--- tests/integration-tests/CMakeLists.txt 2015-01-21 17:30:44 +0000
+++ tests/integration-tests/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -99,6 +99,15 @@
99 ${GTEST_BOTH_LIBRARIES}99 ${GTEST_BOTH_LIBRARIES}
100 ${GMOCK_LIBRARY}100 ${GMOCK_LIBRARY}
101 ${GMOCK_MAIN_LIBRARY}101 ${GMOCK_MAIN_LIBRARY}
102 # Mesa platform dependencies
103 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
104 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
105 # Android platform dependencies
106 ${LIBHARDWARE_LIBRARIES}
107 ${ANDROID_PROPERTIES_LIBRARIES}
108 # Shared platform dependencies
109 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
110 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
102 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.111 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
103 ${DRM_LDFLAGS} ${DRM_LIBRARIES}112 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
104 ${GBM_LDFLAGS} ${GBM_LIBRARIES}113 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
@@ -108,7 +117,7 @@
108 ${MIR_SERVER_REFERENCES}117 ${MIR_SERVER_REFERENCES}
109)118)
110119
111if (MIR_TEST_PLATFORM STREQUAL "android")120if (MIR_BUILD_PLATFORM_ANDROID)
112target_link_libraries(mir_integration_tests121target_link_libraries(mir_integration_tests
113 mirsharedandroid122 mirsharedandroid
114 ${ANDROID_PROPERTIES_LDFLAGS}123 ${ANDROID_PROPERTIES_LDFLAGS}
115124
=== modified file 'tests/mir_test_doubles/CMakeLists.txt'
--- tests/mir_test_doubles/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ tests/mir_test_doubles/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -31,16 +31,18 @@
31)31)
3232
33if (MIR_BUILD_PLATFORM_MESA)33if (MIR_BUILD_PLATFORM_MESA)
34include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})34 include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
35list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS35 list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS
36 ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp36 ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp
37 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp37 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp
38)38 )
39endif()39endif()
40
40if (MIR_BUILD_PLATFORM_ANDROID)41if (MIR_BUILD_PLATFORM_ANDROID)
41list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS42 include_directories(SYSTEM ${ANDROID_HEADERS_INCLUDE_DIRS})
42 ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp43 list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS
43)44 ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp
45 )
44endif()46endif()
4547
46add_library(48add_library(
4749
=== modified file 'tests/mir_test_framework/CMakeLists.txt'
--- tests/mir_test_framework/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ tests/mir_test_framework/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -11,6 +11,11 @@
11 ${ANDROID_HEADERS_INCLUDE_DIRS}11 ${ANDROID_HEADERS_INCLUDE_DIRS}
12)12)
1313
14add_definitions(
15 -DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}"
16 -DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}"
17 )
18
14set(19set(
15 TEST_FRAMEWORK_SRCS20 TEST_FRAMEWORK_SRCS
1621
@@ -34,6 +39,7 @@
34 process.cpp39 process.cpp
35 using_stub_client_platform.cpp40 using_stub_client_platform.cpp
36 stub_client_platform_factory.cpp41 stub_client_platform_factory.cpp
42 stub_server_platform_factory.cpp
37 udev_environment.cpp43 udev_environment.cpp
38 declarative_placement_strategy.cpp44 declarative_placement_strategy.cpp
39 fake_event_hub_server_configuration.cpp45 fake_event_hub_server_configuration.cpp
@@ -59,8 +65,8 @@
59target_link_libraries(65target_link_libraries(
60 mir-test-framework66 mir-test-framework
6167
62 mirplatformstub
63 3rd_party68 3rd_party
69 mir-test-doubles
6470
65 ${PROTOBUF_LIBRARIES}71 ${PROTOBUF_LIBRARIES}
66 ${Boost_LIBRARIES}72 ${Boost_LIBRARIES}
@@ -94,6 +100,31 @@
94 LINK_FLAGS "-Wl,--version-script,${symbol_map}"100 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
95)101)
96102
103set(server_symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-server.map)
104add_library(
105 mirplatformgraphicsstub MODULE
106
107 platform_graphics_dummy.cpp
108 stubbed_graphics_platform.cpp
109)
110
111target_link_libraries(
112 mirplatformgraphicsstub
113
114 mir-test
115 mir-test-framework
116 mir-test-doubles
117 ${UMOCKDEV_LDFLAGS} ${UMOCKDEV_LIBRARIES}
118)
119
120set_target_properties(
121 mirplatformgraphicsstub PROPERTIES;
122 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
123 OUTPUT_NAME graphics-dummy
124 PREFIX ""
125 LINK_FLAGS "-Wl,--version-script,${server_symbol_map}"
126)
127
97add_custom_command(TARGET mir-test-framework POST_BUILD128add_custom_command(TARGET mir-test-framework POST_BUILD
98 COMMAND ${CMAKE_COMMAND} -E copy_directory129 COMMAND ${CMAKE_COMMAND} -E copy_directory
99 ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings130 ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings
@@ -105,21 +136,8 @@
105 COMMENT "Copying testing cursor themes to build dir..."136 COMMENT "Copying testing cursor themes to build dir..."
106)137)
107138
108add_library(139string (REPLACE " -Wl,--no-undefined" " " CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
109 mirplatformstub SHARED140
110 stubbed_graphics_platform.cpp141install(TARGETS mirplatformgraphicsstub LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH})
111)142
112
113target_link_libraries(mirplatformstub
114 mirplatform
115 mir-test-doubles
116 mir-test
117)
118
119set_target_properties(mirplatformstub
120 PROPERTIES
121 LINK_FLAGS "-Wl,--exclude-libs=ALL"
122)
123
124install(TARGETS mirplatformstub LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
125install(TARGETS mirclientplatformstub LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})143install(TARGETS mirclientplatformstub LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
126144
=== modified file 'tests/mir_test_framework/executable_path.cpp'
--- tests/mir_test_framework/executable_path.cpp 2015-01-14 06:39:13 +0000
+++ tests/mir_test_framework/executable_path.cpp 2015-01-22 15:40:28 +0000
@@ -24,6 +24,7 @@
24#include <stdexcept>24#include <stdexcept>
25#include <boost/throw_exception.hpp>25#include <boost/throw_exception.hpp>
26#include <boost/exception/errinfo_errno.hpp>26#include <boost/exception/errinfo_errno.hpp>
27#include <boost/filesystem.hpp>
2728
28std::string mir_test_framework::executable_path()29std::string mir_test_framework::executable_path()
29{30{
@@ -43,3 +44,29 @@
43{44{
44 return executable_path() + "/../lib";45 return executable_path() + "/../lib";
45}46}
47
48std::string mir_test_framework::server_platform(std::string const& name)
49{
50 for (auto const& option :
51 {library_path() + "/server-modules/", library_path() + "/server-platform/", std::string(MIR_SERVER_PLATFORM_PATH) + '/'})
52 {
53 auto path_to_test = option + name;
54 if (boost::filesystem::exists(path_to_test))
55 return path_to_test;
56 }
57
58 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to find server platform in standard search locations"));
59}
60
61std::string mir_test_framework::client_platform(std::string const& name)
62{
63 for (auto const& option :
64 {library_path() + "/client-modules/", library_path() + "/client-platform/", std::string(MIR_CLIENT_PLATFORM_PATH) + '/'})
65 {
66 auto path_to_test = option + name;
67 if (boost::filesystem::exists(path_to_test))
68 return path_to_test;
69 }
70
71 BOOST_THROW_EXCEPTION(std::runtime_error("Failed to find server platform in standard search locations"));
72}
4673
=== modified file 'tests/mir_test_framework/headless_test.cpp'
--- tests/mir_test_framework/headless_test.cpp 2015-01-14 06:39:13 +0000
+++ tests/mir_test_framework/headless_test.cpp 2015-01-22 15:40:28 +0000
@@ -17,52 +17,30 @@
17 */17 */
1818
19#include "mir_test_framework/headless_test.h"19#include "mir_test_framework/headless_test.h"
20#include "mir_test_framework/stub_server_platform_factory.h"
2021
21#include "mir/shared_library.h"22#include "mir/shared_library.h"
22#include "mir/geometry/rectangle.h"23#include "mir/geometry/rectangle.h"
24#include "mir_test_framework/executable_path.h"
2325
24#include <boost/throw_exception.hpp>26#include <boost/throw_exception.hpp>
2527
26namespace geom = mir::geometry;28namespace geom = mir::geometry;
27namespace mtf = mir_test_framework;29namespace mtf = mir_test_framework;
2830
29namespace
30{
31const char* const mir_server_platform_graphics_lib = "MIR_SERVER_PLATFORM_GRAPHICS_LIB";
32
33std::chrono::seconds const timeout{10};
34}
35
36mtf::HeadlessTest::HeadlessTest()31mtf::HeadlessTest::HeadlessTest()
37{32{
38 add_to_environment(mir_server_platform_graphics_lib, "libmirplatformstub.so");33 add_to_environment("MIR_SERVER_PLATFORM_GRAPHICS_LIB", mtf::server_platform("graphics-dummy.so").c_str());
39}34}
4035
41mtf::HeadlessTest::~HeadlessTest() noexcept = default;36mtf::HeadlessTest::~HeadlessTest() noexcept = default;
4237
43
44void mtf::HeadlessTest::preset_display(std::shared_ptr<mir::graphics::Display> const& display)38void mtf::HeadlessTest::preset_display(std::shared_ptr<mir::graphics::Display> const& display)
45{39{
46 if (!server_platform_graphics_lib)40 mtf::set_next_preset_display(display);
47 server_platform_graphics_lib.reset(new mir::SharedLibrary{getenv(mir_server_platform_graphics_lib)});
48
49 typedef void (*PresetDisplay)(std::shared_ptr<mir::graphics::Display> const&);
50
51 auto const preset_display =
52 server_platform_graphics_lib->load_function<PresetDisplay>("preset_display");
53
54 preset_display(display);
55}41}
5642
57void mtf::HeadlessTest::initial_display_layout(std::vector<geom::Rectangle> const& display_rects)43void mtf::HeadlessTest::initial_display_layout(std::vector<geom::Rectangle> const& display_rects)
58{44{
59 if (!server_platform_graphics_lib)45 mtf::set_next_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>(new std::vector<geom::Rectangle>(display_rects)));
60 server_platform_graphics_lib.reset(new mir::SharedLibrary{getenv(mir_server_platform_graphics_lib)});
61
62 typedef void (*SetDisplayRects)(std::unique_ptr<std::vector<geom::Rectangle>>&&);
63
64 auto const set_display_rects =
65 server_platform_graphics_lib->load_function<SetDisplayRects>("set_display_rects");
66
67 set_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>(new std::vector<geom::Rectangle>(display_rects)));
68}46}
6947
=== added file 'tests/mir_test_framework/platform_graphics_dummy.cpp'
--- tests/mir_test_framework/platform_graphics_dummy.cpp 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/platform_graphics_dummy.cpp 2015-01-22 15:40:28 +0000
@@ -0,0 +1,36 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU 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 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>>
17 */
18
19#include "mir/graphics/platform.h"
20
21extern "C" mir::graphics::PlatformPriority probe_graphics_platform()
22{
23 return mir::graphics::supported;
24}
25
26mir::ModuleProperties const description {
27 "dummy",
28 MIR_VERSION_MAJOR,
29 MIR_VERSION_MINOR,
30 MIR_VERSION_MICRO
31};
32
33extern "C" mir::ModuleProperties const* describe_graphics_module()
34{
35 return &description;
36}
037
=== modified file 'tests/mir_test_framework/stub_client_platform_factory.cpp'
--- tests/mir_test_framework/stub_client_platform_factory.cpp 2015-01-15 15:17:02 +0000
+++ tests/mir_test_framework/stub_client_platform_factory.cpp 2015-01-22 15:40:28 +0000
@@ -22,6 +22,7 @@
22#include "mir/client_buffer.h"22#include "mir/client_buffer.h"
23#include "mir/client_platform.h"23#include "mir/client_platform.h"
2424
25#include <unistd.h>
25#include <string.h>26#include <string.h>
2627
27namespace mcl = mir::client;28namespace mcl = mir::client;
2829
=== added file 'tests/mir_test_framework/stub_server_platform_factory.cpp'
--- tests/mir_test_framework/stub_server_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/stub_server_platform_factory.cpp 2015-01-22 15:40:28 +0000
@@ -0,0 +1,72 @@
1
2/*
3 * Copyright © 2014 Canonical Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 3,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
18 */
19
20#include "mir/shared_library.h"
21
22#include "mir/geometry/rectangle.h"
23
24#include "mir_test_framework/executable_path.h"
25#include "mir_test_framework/stub_server_platform_factory.h"
26
27#include <vector>
28
29namespace geom = mir::geometry;
30namespace mg = mir::graphics;
31namespace mtf = mir_test_framework;
32
33namespace
34{
35// NOTE: Raw pointer, deliberately leaked to bypass all the fun
36// issues around global destructor ordering.
37mir::SharedLibrary* platform_lib{nullptr};
38
39void ensure_platform_library()
40{
41 if (!platform_lib)
42 {
43 platform_lib = new mir::SharedLibrary{mtf::server_platform("graphics-dummy.so")};
44 }
45}
46}
47
48std::shared_ptr<mg::Platform> mtf::make_stubbed_server_graphics_platform(std::vector<geom::Rectangle> const& display_rects)
49{
50 ensure_platform_library();
51 auto factory = platform_lib->load_function<std::shared_ptr<mg::Platform>(*)(std::vector<geom::Rectangle> const&)>("create_stub_platform");
52
53 return factory(display_rects);
54}
55
56void mtf::set_next_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects)
57{
58 ensure_platform_library();
59
60 auto rect_setter = platform_lib->load_function<void(*)(std::unique_ptr<std::vector<geom::Rectangle>>&&)>("set_next_display_rects");
61
62 rect_setter(std::move(display_rects));
63}
64
65void mtf::set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display)
66{
67 ensure_platform_library();
68
69 auto display_setter = platform_lib->load_function<void(*)(std::shared_ptr<mir::graphics::Display> const&)>("set_next_preset_display");
70
71 display_setter(display);
72}
073
=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-01-14 06:39:13 +0000
+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-01-22 15:40:28 +0000
@@ -243,8 +243,6 @@
243243
244namespace244namespace
245{245{
246std::unique_ptr<std::vector<geom::Rectangle>> chosen_display_rects;
247
248struct GuestPlatformAdapter : mg::Platform246struct GuestPlatformAdapter : mg::Platform
249{247{
250 GuestPlatformAdapter(248 GuestPlatformAdapter(
@@ -285,6 +283,12 @@
285};283};
286284
287std::weak_ptr<mg::Platform> the_graphics_platform{};285std::weak_ptr<mg::Platform> the_graphics_platform{};
286std::unique_ptr<std::vector<geom::Rectangle>> chosen_display_rects;
287}
288
289extern "C" std::shared_ptr<mg::Platform> create_stub_platform(std::vector<geom::Rectangle> const& display_rects)
290{
291 return std::make_shared<mtf::StubGraphicPlatform>(display_rects);
288}292}
289293
290extern "C" std::shared_ptr<mg::Platform> create_host_platform(294extern "C" std::shared_ptr<mg::Platform> create_host_platform(
@@ -296,12 +300,12 @@
296300
297 if (auto const display_rects = std::move(chosen_display_rects))301 if (auto const display_rects = std::move(chosen_display_rects))
298 {302 {
299 result = std::make_shared<mtf::StubGraphicPlatform>(*display_rects);303 result = create_stub_platform(*display_rects);
300 }304 }
301 else305 else
302 {306 {
303 static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};307 static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};
304 result = std::make_shared<mtf::StubGraphicPlatform>(default_display_rects);308 result = create_stub_platform(default_display_rects);
305 }309 }
306 the_graphics_platform = result;310 the_graphics_platform = result;
307 return result;311 return result;
@@ -315,18 +319,18 @@
315 return std::make_shared<GuestPlatformAdapter>(context, graphics_platform);319 return std::make_shared<GuestPlatformAdapter>(context, graphics_platform);
316}320}
317321
318extern "C" void add_platform_options(322extern "C" void add_graphis_platform_options(
319 boost::program_options::options_description& /*config*/)323 boost::program_options::options_description& /*config*/)
320{324{
321}325}
322326
323extern "C" void set_display_rects(327extern "C" void set_next_display_rects(
324 std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects)328 std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects)
325{329{
326 chosen_display_rects = std::move(display_rects);330 chosen_display_rects = std::move(display_rects);
327}331}
328332
329extern "C" void preset_display(std::shared_ptr<mir::graphics::Display> const& display)333extern "C" void set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display)
330{334{
331 display_preset = display;335 display_preset = display;
332}336}
333337
=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
--- tests/mir_test_framework/stubbed_server_configuration.cpp 2015-01-14 06:39:13 +0000
+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2015-01-22 15:40:28 +0000
@@ -19,7 +19,7 @@
19#include "mir_test_framework/stubbed_server_configuration.h"19#include "mir_test_framework/stubbed_server_configuration.h"
20#include "mir_test_framework/command_line_server_configuration.h"20#include "mir_test_framework/command_line_server_configuration.h"
2121
22#include "stubbed_graphics_platform.h"22#include "mir_test_framework/stub_server_platform_factory.h"
2323
24#include "mir/options/default_configuration.h"24#include "mir/options/default_configuration.h"
25#include "mir/graphics/cursor.h"25#include "mir/graphics/cursor.h"
@@ -92,7 +92,7 @@
92{92{
93 if (!graphics_platform)93 if (!graphics_platform)
94 {94 {
95 graphics_platform = std::make_shared<StubGraphicPlatform>(display_rects);95 graphics_platform = mtf::make_stubbed_server_graphics_platform(display_rects);
96 }96 }
9797
98 return graphics_platform;98 return graphics_platform;
9999
=== added file 'tests/mir_test_framework/symbols-server.map'
--- tests/mir_test_framework/symbols-server.map 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/symbols-server.map 2015-01-22 15:40:28 +0000
@@ -0,0 +1,8 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_graphics_platform_options;
4 create_host_platform;
5 create_guest_platform;
6 probe_graphics_platform;
7 describe_graphics_module;
8};
09
=== modified file 'tests/mir_test_framework/testing_client_options.cpp'
--- tests/mir_test_framework/testing_client_options.cpp 2015-01-19 04:52:47 +0000
+++ tests/mir_test_framework/testing_client_options.cpp 2015-01-22 15:40:28 +0000
@@ -16,63 +16,12 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#include "mir_test_framework/testing_client_configuration.h"
20#include "mir_test_framework/stub_client_connection_configuration.h"19#include "mir_test_framework/stub_client_connection_configuration.h"
21#include "mir_test_doubles/stub_client_buffer_factory.h"
22#include "mir/options/program_option.h"
23#include "src/client/default_connection_configuration.h"20#include "src/client/default_connection_configuration.h"
24#include "mir/client_platform_factory.h"21#include "mir_test_framework/stub_client_platform_factory.h"
25#include "mir/client_buffer_factory.h"
26#include "mir/client_buffer.h"
27#include "mir/client_platform.h"
28#include "src/client/mir_connection.h"
2922
30namespace mcl = mir::client;23namespace mcl = mir::client;
31namespace mtf=mir_test_framework;24namespace mtf = mir_test_framework;
32namespace geom = mir::geometry;
33namespace mtd = mir::test::doubles;
34
35namespace
36{
37struct StubClientPlatform : public mcl::ClientPlatform
38{
39 MirPlatformType platform_type() const
40 {
41 return mir_platform_type_gbm;
42 }
43
44 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
45 {
46 return std::make_shared<mtd::StubClientBufferFactory>();
47 }
48
49 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*)
50 {
51 auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678lu);
52 return std::make_shared<EGLNativeWindowType>(fake_window);
53 }
54
55 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display()
56 {
57 auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678lu);
58 return std::make_shared<EGLNativeDisplayType>(fake_display);
59 }
60
61 MirNativeBuffer* convert_native_buffer(mir::graphics::NativeBuffer*) const
62 {
63 return nullptr;
64 }
65};
66
67struct StubClientPlatformFactory : public mcl::ClientPlatformFactory
68{
69 std::shared_ptr<mcl::ClientPlatform> create_client_platform(mcl::ClientContext*)
70 {
71 return std::make_shared<StubClientPlatform>();
72 }
73};
74
75}
7625
77mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)26mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)
78 : DefaultConnectionConfiguration(socket_file)27 : DefaultConnectionConfiguration(socket_file)
7928
=== modified file 'tests/unit-tests/CMakeLists.txt'
--- tests/unit-tests/CMakeLists.txt 2015-01-22 03:10:13 +0000
+++ tests/unit-tests/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -1,7 +1,23 @@
1include(CMakeDependentOption)1include(CMakeDependentOption)
22
3add_definitions(-DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/")
4
5if (MIR_BUILD_PLATFORM_ANDROID)
6 add_definitions(-DMIR_BUILD_PLATFORM_ANDROID)
7endif()
8
9if (MIR_BUILD_PLATFORM_MESA)
10 add_definitions(-DMIR_BUILD_PLATFORM_MESA)
11endif()
12
3include_directories(13include_directories(
4 ${CMAKE_SOURCE_DIR}14 ${CMAKE_SOURCE_DIR}
15
16 ${ANDROID_HEADERS_INCLUDE_DIRS}
17 ${DRM_INCLUDE_DIRS}
18 ${GBM_INCLUDE_DIRS}
19 ${UMOCKDEV_INCLUDE_DIRS}
20
5 ${PROJECT_SOURCE_DIR}/src/include/platform21 ${PROJECT_SOURCE_DIR}/src/include/platform
6 ${PROJECT_SOURCE_DIR}/src/include/server22 ${PROJECT_SOURCE_DIR}/src/include/server
7 ${PROJECT_SOURCE_DIR}/src/include/client23 ${PROJECT_SOURCE_DIR}/src/include/client
@@ -10,12 +26,6 @@
10 ${GLIB_INCLUDE_DIRS}26 ${GLIB_INCLUDE_DIRS}
11)27)
1228
13add_definitions(
14 -DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/"
15 -DMIR_CLIENT_DRIVER_BINARY="${MIR_CLIENT_DRIVER_BINARY}"
16)
17
18include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${UMOCKDEV_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
19# TODO: Aim to remove29# TODO: Aim to remove
20include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES})30include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES})
2131
@@ -79,9 +89,9 @@
79 demo-shell89 demo-shell
8090
81 mir-test91 mir-test
92 mir-test-framework
82 mir-test-doubles93 mir-test-doubles
83 mir-test-doubles-platform94 mir-test-doubles-platform
84 mir-test-framework
8595
86 3rd_party96 3rd_party
8797
@@ -91,6 +101,15 @@
91 ${GMOCK_MAIN_LIBRARY}101 ${GMOCK_MAIN_LIBRARY}
92 ${Boost_LIBRARIES}102 ${Boost_LIBRARIES}
93 ${UMOCKDEV_LIBRARIES}103 ${UMOCKDEV_LIBRARIES}
104 # Mesa platform dependencies
105 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
106 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
107 # Android platform dependencies
108 ${LIBHARDWARE_LIBRARIES}
109 ${ANDROID_PROPERTIES_LIBRARIES}
110 # Shared platform dependencies
111 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
112 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
94 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.113 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
95 ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES}114 ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES}
96 ${DRM_LDFLAGS} ${DRM_LIBRARIES}115 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -99,7 +118,7 @@
99 ${MIR_SERVER_REFERENCES}118 ${MIR_SERVER_REFERENCES}
100)119)
101120
102if (MIR_TEST_PLATFORM STREQUAL "android")121if (MIR_BUILD_PLATFORM_ANDROID)
103target_link_libraries(mir_unit_tests 122target_link_libraries(mir_unit_tests
104 mirsharedandroid123 mirsharedandroid
105 ${ANDROID_PROPERTIES_LDFLAGS}124 ${ANDROID_PROPERTIES_LDFLAGS}
106125
=== modified file 'tests/unit-tests/client/CMakeLists.txt'
--- tests/unit-tests/client/CMakeLists.txt 2015-01-14 06:39:13 +0000
+++ tests/unit-tests/client/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -13,6 +13,7 @@
13 ${CMAKE_CURRENT_SOURCE_DIR}/test_probing_client_platform_factory.cpp13 ${CMAKE_CURRENT_SOURCE_DIR}/test_probing_client_platform_factory.cpp
14 ${CMAKE_CURRENT_SOURCE_DIR}/test_mir_prompt_session.cpp14 ${CMAKE_CURRENT_SOURCE_DIR}/test_mir_prompt_session.cpp
15 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_distributor.cpp15 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_distributor.cpp
16 ${CMAKE_CURRENT_SOURCE_DIR}/test_probing_client_platform_factory.cpp
16 ${CMAKE_CURRENT_SOURCE_DIR}/test_periodic_perf_report.cpp17 ${CMAKE_CURRENT_SOURCE_DIR}/test_periodic_perf_report.cpp
17)18)
1819
1920
=== modified file 'tests/unit-tests/client/test_client_platform.cpp'
--- tests/unit-tests/client/test_client_platform.cpp 2015-01-19 04:52:47 +0000
+++ tests/unit-tests/client/test_client_platform.cpp 2015-01-22 15:40:28 +0000
@@ -59,7 +59,7 @@
59struct ClientPlatformTest : public ::testing::TestWithParam<ClientPlatformTraits const*>59struct ClientPlatformTest : public ::testing::TestWithParam<ClientPlatformTraits const*>
60{60{
61 ClientPlatformTest()61 ClientPlatformTest()
62 : platform_library{mtf::library_path() + "/" + GetParam()->platform_library_name},62 : platform_library{mtf::client_platform(GetParam()->platform_library_name)},
63 create_client_platform{platform_library.load_function<mcl::CreateClientPlatform>("create_client_platform")},63 create_client_platform{platform_library.load_function<mcl::CreateClientPlatform>("create_client_platform")},
64 probe{platform_library.load_function<mcl::ClientPlatformProbe>("is_appropriate_module")}64 probe{platform_library.load_function<mcl::ClientPlatformProbe>("is_appropriate_module")}
65 {65 {
@@ -78,7 +78,7 @@
78};78};
7979
80#ifdef MIR_BUILD_PLATFORM_ANDROID80#ifdef MIR_BUILD_PLATFORM_ANDROID
81ClientPlatformTraits const android_platform{"/client-modules/android.so",81ClientPlatformTraits const android_platform{"android.so",
82 [](MirPlatformPackage& pkg)82 [](MirPlatformPackage& pkg)
83 {83 {
84 ::memset(&pkg, 0, sizeof(pkg));84 ::memset(&pkg, 0, sizeof(pkg));
@@ -93,7 +93,7 @@
93#endif93#endif
9494
95#ifdef MIR_BUILD_PLATFORM_MESA95#ifdef MIR_BUILD_PLATFORM_MESA
96ClientPlatformTraits const mesa_platform{"/client-modules/mesa.so",96ClientPlatformTraits const mesa_platform{"mesa.so",
97 [](MirPlatformPackage& pkg)97 [](MirPlatformPackage& pkg)
98 {98 {
99 ::memset(&pkg, 0, sizeof(pkg));99 ::memset(&pkg, 0, sizeof(pkg));
@@ -108,7 +108,7 @@
108108
109#endif109#endif
110110
111ClientPlatformTraits const dummy_platform{"/client-modules/dummy.so",111ClientPlatformTraits const dummy_platform{"dummy.so",
112 [](MirPlatformPackage& pkg)112 [](MirPlatformPackage& pkg)
113 {113 {
114 mtf::create_stub_platform_package(pkg);114 mtf::create_stub_platform_package(pkg);
115115
=== modified file 'tests/unit-tests/client/test_probing_client_platform_factory.cpp'
--- tests/unit-tests/client/test_probing_client_platform_factory.cpp 2015-01-15 15:17:02 +0000
+++ tests/unit-tests/client/test_probing_client_platform_factory.cpp 2015-01-22 15:40:28 +0000
@@ -36,10 +36,10 @@
36{36{
37 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;37 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;
38#ifdef MIR_BUILD_PLATFORM_MESA38#ifdef MIR_BUILD_PLATFORM_MESA
39 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/mesa.so"));39 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("mesa.so")));
40#endif40#endif
41#ifdef MIR_BUILD_PLATFORM_ANDROID41#ifdef MIR_BUILD_PLATFORM_ANDROID
42 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/android.so"));42 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("android.so")));
43#endif43#endif
44 return modules;44 return modules;
45}45}
@@ -127,7 +127,7 @@
127 auto modules = all_available_modules();127 auto modules = all_available_modules();
128 // NOTE: For minimum fuss, load something that has minimal side-effects...128 // NOTE: For minimum fuss, load something that has minimal side-effects...
129 modules.push_back(std::make_shared<mir::SharedLibrary>("libc.so.6"));129 modules.push_back(std::make_shared<mir::SharedLibrary>("libc.so.6"));
130 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/dummy.so"));130 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("dummy.so")));
131131
132 mir::client::ProbingClientPlatformFactory factory{modules};132 mir::client::ProbingClientPlatformFactory factory{modules};
133133
134134
=== modified file 'tests/unit-tests/graphics/CMakeLists.txt'
--- tests/unit-tests/graphics/CMakeLists.txt 2015-01-16 02:57:31 +0000
+++ tests/unit-tests/graphics/CMakeLists.txt 2015-01-22 15:40:28 +0000
@@ -10,6 +10,7 @@
10 ${CMAKE_CURRENT_SOURCE_DIR}/test_surfaceless_egl_context.cpp10 ${CMAKE_CURRENT_SOURCE_DIR}/test_surfaceless_egl_context.cpp
11 ${CMAKE_CURRENT_SOURCE_DIR}/test_overlapping_output_grouping.cpp11 ${CMAKE_CURRENT_SOURCE_DIR}/test_overlapping_output_grouping.cpp
12 ${CMAKE_CURRENT_SOURCE_DIR}/test_program_factory.cpp12 ${CMAKE_CURRENT_SOURCE_DIR}/test_program_factory.cpp
13 ${CMAKE_CURRENT_SOURCE_DIR}/test_platform_prober.cpp
13 ${CMAKE_CURRENT_SOURCE_DIR}/test_software_cursor.cpp14 ${CMAKE_CURRENT_SOURCE_DIR}/test_software_cursor.cpp
14)15)
1516
1617
=== modified file 'tests/unit-tests/graphics/android/test_platform.cpp'
--- tests/unit-tests/graphics/android/test_platform.cpp 2015-01-22 03:10:13 +0000
+++ tests/unit-tests/graphics/android/test_platform.cpp 2015-01-22 15:40:28 +0000
@@ -28,6 +28,8 @@
28#include "mir_test_doubles/fd_matcher.h"28#include "mir_test_doubles/fd_matcher.h"
29#include "mir_test/fake_shared.h"29#include "mir_test/fake_shared.h"
30#include "mir_test_doubles/mock_android_native_buffer.h"30#include "mir_test_doubles/mock_android_native_buffer.h"
31#include "mir_test_framework/executable_path.h"
32#include "mir/shared_library.h"
31#include <system/window.h>33#include <system/window.h>
32#include <gtest/gtest.h>34#include <gtest/gtest.h>
3335
@@ -38,6 +40,9 @@
38namespace mr=mir::report;40namespace mr=mir::report;
39namespace geom=mir::geometry;41namespace geom=mir::geometry;
40namespace mo=mir::options;42namespace mo=mir::options;
43namespace mtf=mir_test_framework;
44
45static const char probe_platform[] = "probe_graphics_platform";
4146
42class PlatformBufferIPCPackaging : public ::testing::Test47class PlatformBufferIPCPackaging : public ::testing::Test
43{48{
@@ -227,6 +232,27 @@
227 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());232 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());
228}233}
229234
235TEST(AndroidGraphicsPlatform, probe_returns_unsupported_when_no_hwaccess)
236{
237 using namespace testing;
238 NiceMock<mtd::HardwareAccessMock> hwaccess;
239
240 ON_CALL(hwaccess, hw_get_module(_,_)).WillByDefault(Return(-1));
241
242 mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android.so")};
243 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
244 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
245}
246
247TEST(AndroidGraphicsPlatform, probe_returns_best_when_hwaccess_succeeds)
248{
249 testing::NiceMock<mtd::HardwareAccessMock> hwaccess;
250
251 mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android.so")};
252 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
253 EXPECT_EQ(mg::PlatformPriority::best, probe());
254}
255
230TEST(NestedPlatformCreation, doesnt_access_display_hardware)256TEST(NestedPlatformCreation, doesnt_access_display_hardware)
231{257{
232 using namespace testing;258 using namespace testing;
233259
=== modified file 'tests/unit-tests/graphics/mesa/test_platform.cpp'
--- tests/unit-tests/graphics/mesa/test_platform.cpp 2015-01-22 03:10:13 +0000
+++ tests/unit-tests/graphics/mesa/test_platform.cpp 2015-01-22 15:40:28 +0000
@@ -23,6 +23,7 @@
23#include "src/platforms/mesa/server/platform.h"23#include "src/platforms/mesa/server/platform.h"
24#include "src/server/report/null_report_factory.h"24#include "src/server/report/null_report_factory.h"
25#include "mir/emergency_cleanup_registry.h"25#include "mir/emergency_cleanup_registry.h"
26#include "mir/shared_library.h"
2627
27#include "mir_test_doubles/mock_buffer.h"28#include "mir_test_doubles/mock_buffer.h"
28#include "mir_test_doubles/mock_buffer_ipc_message.h"29#include "mir_test_doubles/mock_buffer_ipc_message.h"
@@ -33,6 +34,7 @@
33#include <gtest/gtest.h>34#include <gtest/gtest.h>
3435
35#include "mir_test_framework/udev_environment.h"36#include "mir_test_framework/udev_environment.h"
37#include "mir_test_framework/executable_path.h"
36#include "mir_test/pipe.h"38#include "mir_test/pipe.h"
3739
38#include "mir_test_doubles/mock_drm.h"40#include "mir_test_doubles/mock_drm.h"
@@ -55,6 +57,8 @@
55namespace57namespace
56{58{
5759
60const char probe_platform[] = "probe_graphics_platform";
61
58class MesaGraphicsPlatform : public ::testing::Test62class MesaGraphicsPlatform : public ::testing::Test
59{63{
60public:64public:
@@ -338,3 +342,23 @@
338342
339 Mock::VerifyAndClearExpectations(&mock_drm);343 Mock::VerifyAndClearExpectations(&mock_drm);
340}344}
345
346TEST_F(MesaGraphicsPlatform, probe_returns_unsupported_when_no_drm_udev_devices)
347{
348 mtf::UdevEnvironment udev_environment;
349
350 mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa.so")};
351 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
352 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
353}
354
355TEST_F(MesaGraphicsPlatform, probe_returns_best_when_drm_devices_exist)
356{
357 mtf::UdevEnvironment udev_environment;
358
359 udev_environment.add_standard_device("standard-drm-devices");
360
361 mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa.so")};
362 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
363 EXPECT_EQ(mg::PlatformPriority::best, probe());
364}
341365
=== added file 'tests/unit-tests/graphics/test_platform_prober.cpp'
--- tests/unit-tests/graphics/test_platform_prober.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit-tests/graphics/test_platform_prober.cpp 2015-01-22 15:40:28 +0000
@@ -0,0 +1,215 @@
1/*
2 * Copyright © 2014 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include <gtest/gtest.h>
20
21#include "mir/graphics/platform.h"
22#include "mir/graphics/platform_probe.h"
23
24#include "mir/raii.h"
25
26#ifdef MIR_BUILD_PLATFORM_MESA
27#include "mir_test_doubles/mock_drm.h"
28#include "mir_test_doubles/mock_gbm.h"
29#endif
30
31#ifdef MIR_BUILD_PLATFORM_ANDROID
32#include "mir_test_doubles/mock_android_hw.h"
33#endif
34
35#include "mir_test_framework/udev_environment.h"
36#include "mir_test_framework/executable_path.h"
37
38namespace mtf = mir_test_framework;
39namespace mtd = mir::test::doubles;
40
41namespace
42{
43const char describe_module[] = "describe_graphics_module";
44
45std::vector<std::shared_ptr<mir::SharedLibrary>> available_platforms()
46{
47 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;
48
49#ifdef MIR_BUILD_PLATFORM_MESA
50 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-mesa.so")));
51#endif
52#ifdef MIR_BUILD_PLATFORM_ANDROID
53 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-android.so")));
54#endif
55 return modules;
56}
57
58void add_dummy_platform(std::vector<std::shared_ptr<mir::SharedLibrary>>& modules)
59{
60 modules.insert(modules.begin(), std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-dummy.so")));
61}
62
63std::shared_ptr<void> ensure_android_probing_fails()
64{
65#ifdef MIR_BUILD_PLATFORM_ANDROID
66 using namespace testing;
67 auto mock_android = std::make_shared<NiceMock<mtd::HardwareAccessMock>>();
68 ON_CALL(*mock_android, hw_get_module(_, _))
69 .WillByDefault(Return(-1));
70 return mock_android;
71#else
72 return std::shared_ptr<void>{};
73#endif
74}
75
76std::shared_ptr<void> ensure_mesa_probing_fails()
77{
78 return std::make_shared<mtf::UdevEnvironment>();
79}
80
81std::shared_ptr<void> ensure_mesa_probing_succeeds()
82{
83 auto udev = std::make_shared<mtf::UdevEnvironment>();
84
85 udev->add_standard_device("standard-drm-devices");
86
87 return udev;
88}
89
90std::shared_ptr<void> ensure_android_probing_succeeds()
91{
92#ifdef MIR_BUILD_PLATFORM_ANDROID
93 using namespace testing;
94 auto mock_android = std::make_shared<NiceMock<mtd::HardwareAccessMock>>();
95 ON_CALL(*mock_android, hw_get_module(_, _))
96 .WillByDefault(Return(0));
97 return mock_android;
98#else
99 return std::shared_ptr<void>{};
100#endif
101}
102}
103
104TEST(ServerPlatformProbe, ConstructingWithNoModulesIsAnError)
105{
106 std::vector<std::shared_ptr<mir::SharedLibrary>> empty_modules;
107 EXPECT_THROW(mir::graphics::module_for_device(empty_modules),
108 std::runtime_error);
109}
110
111#ifdef MIR_BUILD_PLATFORM_MESA
112TEST(ServerPlatformProbe, LoadsMesaPlatformWhenDrmDevicePresent)
113{
114 using namespace testing;
115 auto block_android = ensure_android_probing_fails();
116 auto fake_mesa = ensure_mesa_probing_succeeds();
117
118 auto modules = available_platforms();
119
120 auto module = mir::graphics::module_for_device(modules);
121 ASSERT_NE(nullptr, module);
122
123 auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module);
124 auto description = descriptor();
125
126 EXPECT_THAT(description->name, HasSubstr("mesa"));
127}
128#endif
129
130#ifdef MIR_BUILD_PLATFORM_ANDROID
131TEST(ServerPlatformProbe, LoadsAndroidPlatformWhenHwaccessSucceeds)
132{
133 using namespace testing;
134
135 auto block_mesa = ensure_mesa_probing_fails();
136 auto fake_android = ensure_android_probing_succeeds();
137
138 auto modules = available_platforms();
139
140 auto module = mir::graphics::module_for_device(modules);
141 ASSERT_NE(nullptr, module);
142
143 auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module);
144 auto description = descriptor();
145
146 EXPECT_THAT(description->name, HasSubstr("android"));
147}
148#endif
149
150TEST(ServerPlatformProbe, ThrowsExceptionWhenNothingProbesSuccessfully)
151{
152 using namespace testing;
153 auto block_android = ensure_android_probing_fails();
154 auto block_mesa = ensure_mesa_probing_fails();
155
156
157 EXPECT_THROW(mir::graphics::module_for_device(available_platforms()),
158 std::runtime_error);
159}
160
161TEST(ServerPlatformProbe, LoadsSupportedModuleWhenNoBestModule)
162{
163 using namespace testing;
164 auto block_android = ensure_android_probing_fails();
165 auto block_mesa = ensure_mesa_probing_fails();
166
167 auto modules = available_platforms();
168 add_dummy_platform(modules);
169
170 auto module = mir::graphics::module_for_device(modules);
171 ASSERT_NE(nullptr, module);
172
173 auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module);
174 auto description = descriptor();
175
176 EXPECT_THAT(description->name, HasSubstr("dummy"));
177}
178
179TEST(ServerPlatformProbe, LoadsMesaOrAndroidInPreferenceToDummy)
180{
181 using namespace testing;
182
183 auto ensure_mesa = ensure_mesa_probing_succeeds();
184 auto ensure_android = ensure_android_probing_succeeds();
185
186 auto modules = available_platforms();
187 add_dummy_platform(modules);
188
189 auto module = mir::graphics::module_for_device(modules);
190 ASSERT_NE(nullptr, module);
191
192 auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module);
193 auto description = descriptor();
194
195 EXPECT_THAT(description->name, Not(HasSubstr("dummy")));
196}
197
198TEST(ServerPlatformProbe, IgnoresNonPlatformModules)
199{
200 using namespace testing;
201
202 auto ensure_mesa = ensure_mesa_probing_succeeds();
203 auto ensure_android = ensure_android_probing_succeeds();
204
205 auto modules = available_platforms();
206 add_dummy_platform(modules);
207
208 // NOTE: We want to load something that doesn't link with libmirplatform,
209 // due to protobuf throwing a screaming hissy fit if it gets loaded twice.
210 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("dummy.so")));
211
212
213 auto module = mir::graphics::module_for_device(modules);
214 EXPECT_NE(nullptr, module);
215}
0216
=== modified file 'tests/unit-tests/shared_library_test.cpp'
--- tests/unit-tests/shared_library_test.cpp 2015-01-14 06:39:13 +0000
+++ tests/unit-tests/shared_library_test.cpp 2015-01-22 15:40:28 +0000
@@ -59,7 +59,7 @@
59public:59public:
60 SharedLibrary()60 SharedLibrary()
61 : nonexistent_library{"imma_totally_not_a_library"},61 : nonexistent_library{"imma_totally_not_a_library"},
62 existing_library{mtf::library_path() + "/client-modules/mesa.so"},62 existing_library{mtf::client_platform("mesa.so")},
63 nonexistent_function{"yo_dawg"},63 nonexistent_function{"yo_dawg"},
64 existing_function{"create_client_platform"},64 existing_function{"create_client_platform"},
65 existent_version{"MIR_CLIENT_PLATFORM_2"},65 existent_version{"MIR_CLIENT_PLATFORM_2"},
6666
=== modified file 'tools/install_on_android.sh'
--- tools/install_on_android.sh 2015-01-14 06:39:13 +0000
+++ tools/install_on_android.sh 2015-01-22 15:40:28 +0000
@@ -32,11 +32,11 @@
32 lib/libmirclient.so.* \32 lib/libmirclient.so.* \
33 lib/libmircommon.so.* \33 lib/libmircommon.so.* \
34 lib/libmirplatform.so.* \34 lib/libmirplatform.so.* \
35 lib/libmirplatform*driver.so \35 lib/platform-graphics-dummy.so \
36 lib/libmirclient*driver.so \36 lib/client-modules/* \
37 lib/server-modules/* \
37 lib/libmirprotobuf.so.* \38 lib/libmirprotobuf.so.* \
38 lib/libmirclient-debug-extension.so.* \39 lib/libmirclient-debug-extension.so.* \
39 lib/libmirplatformstub.so \
40 lib/libmirserver.so.*40 lib/libmirserver.so.*
41 do41 do
42 adb push $x ${RUN_DIR}42 adb push $x ${RUN_DIR}
4343
=== modified file 'tools/valgrind_suppressions_armhf'
--- tools/valgrind_suppressions_armhf 2015-01-14 06:39:13 +0000
+++ tools/valgrind_suppressions_armhf 2015-01-22 15:40:28 +0000
@@ -127,6 +127,15 @@
127# memory errors.127# memory errors.
128128
129{129{
130 spurious_strlen_addr4
131 Memcheck:Addr4
132 ...
133 fun:dlsym
134 ...
135 fun:_ZN50SharedLibrary_load_nonexistent_function_fails_Test8TestBodyEv
136}
137
138{
130 mir_sharedlibrary_cond139 mir_sharedlibrary_cond
131 Memcheck:Cond140 Memcheck:Cond
132 fun:_ZN3mir13SharedLibraryC1EPKc141 fun:_ZN3mir13SharedLibraryC1EPKc

Subscribers

People subscribed via source and target branches