Merge lp:~mir-team/mir/server-platform-probing into lp:mir
- server-platform-probing
- Merge into development-branch
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 |
Related bugs: |
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_
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.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2123
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
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?
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2124
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
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.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2132
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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_
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::ModuleProp
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
after merging, mirplatformgrap
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.
1 command line option for library
2 environment for library
3 environment for search path
4 command line option for search path
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
s/by/instead of/ on last comment
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.
> 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_
So with that I am done reviewing.
Andreas Pokorny (andreas-pokorny) wrote : Posted in a previous version of this proposal | # |
looks good
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2140
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2141
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
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.".
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2142
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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..
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.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2145
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2146
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2148
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2149
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Chris Halse Rogers (raof) wrote : | # |
Hm. I think that SharedLibraryPr
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.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2150
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2151
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2152
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2153
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2154
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2155
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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.
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/../
[1420010155.312103] (II) Loader: Loading module: bin/../
[1420010155.312518] (II) Loader: Loading module: bin/../
[1420010155.312695] (II) Loader: Loading module: bin/../
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/
[1420010358.848888] (EE) Loader: Failed to load libraries from path: /usr/local/
Could not connect to a display server.
Daniel van Vugt (vanvugt) wrote : | # |
(3) This smells like a bug (?) ...
[1420010081.113978] (WW) Loader: Failed to load module: bin/../
Daniel van Vugt (vanvugt) wrote : | # |
(2) Wrapping fixed here: https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2156
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
LGTM! Left some trivial inline thoughts.
Daniel van Vugt (vanvugt) wrote : | # |
(1) Fix proposed: https:/
(2) Fix landed (r2191)
(3) Still needs fixing, maybe?
Daniel van Vugt (vanvugt) wrote : | # |
BTW I haven't done any code review yet. Just manual testing and fixing the obvious issues right now...
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2157
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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/../
[1420010155.312103] (II) Loader: Loading module: bin/../
[1420010155.312518] (II) Loader: Loading module: bin/../
[1420010155.312695] (II) Loader: Loading module: bin/../
Fix proposed: https:/
(3) This warning appears to be new from this branch. Sounds like a bug:
[1420010081.113978] (WW) Loader: Failed to load module: bin/../
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2158
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Chris Halse Rogers (raof) wrote : | # |
LGTM now. I slightly prefer the client output to no client output.
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:/
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/
> dummy.so: undefined symbol: _ZN3mir4test4Pi
should be gone now.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2159
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2160
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2161
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2162
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) wrote : | # |
anpok: Careful with those spurious merges. Or at least spurious merge comments...?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2163
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2164
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2165
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2166
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alberto Aguirre (albaguirre) wrote : | # |
623 + catch (std::runtime_error const& err)
Why not std::exception?
===
2903 +++ tools/install_
2904 @@ -32,11 +32,11 @@
2905 lib/libmirclien
2906 lib/libmircommo
2907 lib/libmirplatf
2908 - lib/libmirplatf
2909 - lib/libmirclien
2910 + lib/platform-
2911 + lib/client-
2912 + lib/server-
2913 lib/libmirproto
2914 lib/libmirclien
2915 - lib/libmirplatf
2916 lib/libmirserve
===
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:/
Looks good otherwise.
Daniel van Vugt (vanvugt) wrote : | # |
Wrapped binaries work perfectly on the Android side if copied using rsync. Not sure if adb push does though.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2167
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
I think the log messages are rather informative. We should go ahead and TA this branch.
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.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Daniel van Vugt (vanvugt) wrote : | # |
Please don't create regressions intentionally. I didn't want to own this one, but somehow I do now.
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.
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
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-01-22 05:20:46 +0000 |
3 | +++ CMakeLists.txt 2015-01-22 15:40:28 +0000 |
4 | @@ -30,6 +30,10 @@ |
5 | set(MIR_VERSION_MINOR 11) # This should change at least with every MIRSERVER_ABI |
6 | set(MIR_VERSION_PATCH 0) |
7 | |
8 | +add_definitions(-DMIR_VERSION_MAJOR=${MIR_VERSION_MAJOR}) |
9 | +add_definitions(-DMIR_VERSION_MINOR=${MIR_VERSION_MINOR}) |
10 | +add_definitions(-DMIR_VERSION_MICRO=${MIR_VERSION_PATCH}) |
11 | + |
12 | set(MIR_VERSION ${MIR_VERSION_MAJOR}.${MIR_VERSION_MINOR}.${MIR_VERSION_PATCH}) |
13 | |
14 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
15 | |
16 | === modified file 'debian/control' |
17 | --- debian/control 2015-01-20 10:07:15 +0000 |
18 | +++ debian/control 2015-01-22 15:40:28 +0000 |
19 | @@ -59,6 +59,8 @@ |
20 | Contains the shared library containing the Google Protobuf definitions |
21 | required for Mir clients and servers. |
22 | |
23 | +#TODO: Packaging infrastructure for better dependency generation, |
24 | +# ala pkg-xorg's xviddriver:Provides and ABI detection. |
25 | Package: libmirserver29 |
26 | Section: libs |
27 | Architecture: i386 amd64 armhf arm64 |
28 | @@ -66,7 +68,7 @@ |
29 | Pre-Depends: ${misc:Pre-Depends} |
30 | Depends: ${misc:Depends}, |
31 | ${shlibs:Depends}, |
32 | - libmir${platform-driver}-mesa | libmir${platform-driver}-android, |
33 | + mir-platform-graphics-mesa | mir-platform-graphics-android, |
34 | Description: Display server for Ubuntu - server library |
35 | Mir is a display server running on linux systems, with a focus on efficiency, |
36 | robust operation and a well-defined driver model. |
37 | @@ -266,6 +268,34 @@ |
38 | Contains the shared libraries required for the Mir server and client. |
39 | |
40 | # Longer-term these drivers should move out-of-tree |
41 | +Package: mir-platform-graphics-mesa |
42 | +Section: libs |
43 | +Architecture: i386 amd64 armhf arm64 |
44 | +Multi-Arch: same |
45 | +Pre-Depends: ${misc:Pre-Depends} |
46 | +Depends: ${misc:Depends}, |
47 | + ${shlibs:Depends}, |
48 | +Description: Display server for Ubuntu - platform library for Mesa |
49 | + Mir is a display server running on linux systems, with a focus on efficiency, |
50 | + robust operation and a well-defined driver model. |
51 | + . |
52 | + Contains the shared libraries required for the Mir server to interact with |
53 | + the hardware platform using the Mesa drivers. |
54 | + |
55 | +Package: mir-platform-graphics-android |
56 | +Section: libs |
57 | +Architecture: i386 amd64 armhf |
58 | +Multi-Arch: same |
59 | +Pre-Depends: ${misc:Pre-Depends} |
60 | +Depends: ${misc:Depends}, |
61 | + ${shlibs:Depends}, |
62 | +Description: Display server for Ubuntu - platform library for Android |
63 | + Mir is a display server running on linux systems, with a focus on efficiency, |
64 | + robust operation and a well-defined driver model. |
65 | + . |
66 | + Contains the shared libraries required for the Mir server to interact with |
67 | + the hardware platform using the Android drivers. |
68 | + |
69 | Package: mir-client-platform-mesa |
70 | Section: libs |
71 | Architecture: i386 amd64 armhf arm64 |
72 | @@ -294,42 +324,14 @@ |
73 | Contains the shared libraries required for the Mir clients to interact with |
74 | the underlying hardware platform using the Android drivers. |
75 | |
76 | -Package: libmirplatform6driver-mesa |
77 | -Section: libs |
78 | -Architecture: i386 amd64 armhf arm64 |
79 | -Multi-Arch: same |
80 | -Pre-Depends: ${misc:Pre-Depends} |
81 | -Depends: ${misc:Depends}, |
82 | - ${shlibs:Depends}, |
83 | -Description: Display server for Ubuntu - platform library for Mesa |
84 | - Mir is a display server running on linux systems, with a focus on efficiency, |
85 | - robust operation and a well-defined driver model. |
86 | - . |
87 | - Contains the shared libraries required for the Mir server to interact with |
88 | - the hardware platform using the Mesa drivers. |
89 | - |
90 | -Package: libmirplatform6driver-android |
91 | -Section: libs |
92 | -Architecture: i386 amd64 armhf |
93 | -Multi-Arch: same |
94 | -Pre-Depends: ${misc:Pre-Depends} |
95 | -Depends: ${misc:Depends}, |
96 | - ${shlibs:Depends}, |
97 | -Description: Display server for Ubuntu - platform library for Android |
98 | - Mir is a display server running on linux systems, with a focus on efficiency, |
99 | - robust operation and a well-defined driver model. |
100 | - . |
101 | - Contains the shared libraries required for the Mir server to interact with |
102 | - the hardware platform using the Android drivers. |
103 | - |
104 | Package: mir-graphics-drivers-desktop |
105 | Section: libs |
106 | Architecture: i386 amd64 armhf arm64 |
107 | Multi-Arch: same |
108 | Pre-Depends: ${misc:Pre-Depends} |
109 | Depends: ${misc:Depends}, |
110 | - libmir${platform-driver}-mesa, |
111 | - mir-client-platform-mesa |
112 | + mir-platform-graphics-mesa, |
113 | + mir-client-platform-mesa, |
114 | Description: Display server for Ubuntu - desktop driver metapackage |
115 | Mir is a display server running on linux systems, with a focus on efficiency, |
116 | robust operation and a well-defined driver model. |
117 | @@ -343,8 +345,8 @@ |
118 | Multi-Arch: same |
119 | Pre-Depends: ${misc:Pre-Depends} |
120 | Depends: ${misc:Depends}, |
121 | - libmir${platform-driver}-android, |
122 | - mir-client-platform-android |
123 | + mir-platform-graphics-android, |
124 | + mir-client-platform-android, |
125 | Description: Display server for Ubuntu - android driver metapackage |
126 | Mir is a display server running on linux systems, with a focus on efficiency, |
127 | robust operation and a well-defined driver model. |
128 | |
129 | === removed file 'debian/libmirplatform6driver-android.install' |
130 | --- debian/libmirplatform6driver-android.install 2015-01-14 06:39:13 +0000 |
131 | +++ debian/libmirplatform6driver-android.install 1970-01-01 00:00:00 +0000 |
132 | @@ -1,1 +0,0 @@ |
133 | -usr/lib/*/mir/platform*driver/android/* |
134 | |
135 | === removed file 'debian/libmirplatform6driver-mesa.install' |
136 | --- debian/libmirplatform6driver-mesa.install 2015-01-14 06:39:13 +0000 |
137 | +++ debian/libmirplatform6driver-mesa.install 1970-01-01 00:00:00 +0000 |
138 | @@ -1,1 +0,0 @@ |
139 | -usr/lib/*/mir/platform*driver/mesa/* |
140 | |
141 | === added file 'debian/mir-platform-graphics-android.install' |
142 | --- debian/mir-platform-graphics-android.install 1970-01-01 00:00:00 +0000 |
143 | +++ debian/mir-platform-graphics-android.install 2015-01-22 15:40:28 +0000 |
144 | @@ -0,0 +1,1 @@ |
145 | +usr/lib/*/mir/server-platform/graphics-android.so |
146 | |
147 | === added file 'debian/mir-platform-graphics-mesa.install' |
148 | --- debian/mir-platform-graphics-mesa.install 1970-01-01 00:00:00 +0000 |
149 | +++ debian/mir-platform-graphics-mesa.install 2015-01-22 15:40:28 +0000 |
150 | @@ -0,0 +1,1 @@ |
151 | +usr/lib/*/mir/server-platform/graphics-mesa.so |
152 | |
153 | === modified file 'debian/mir-test-tools.install' |
154 | --- debian/mir-test-tools.install 2015-01-14 06:39:13 +0000 |
155 | +++ debian/mir-test-tools.install 2015-01-22 15:40:28 +0000 |
156 | @@ -5,5 +5,5 @@ |
157 | usr/bin/mir_performance_tests |
158 | usr/lib/*/mir/tools/libmirclientlttng.so |
159 | usr/lib/*/mir/tools/libmirserverlttng.so |
160 | -usr/lib/*/libmirplatformstub.so |
161 | +usr/lib/*/mir/server-platform/graphics-dummy.so |
162 | usr/lib/*/mir/client-platform/dummy.so |
163 | |
164 | === modified file 'debian/rules' |
165 | --- debian/rules 2015-01-16 02:57:31 +0000 |
166 | +++ debian/rules 2015-01-22 15:40:28 +0000 |
167 | @@ -13,8 +13,6 @@ |
168 | export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9 |
169 | export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9 |
170 | |
171 | -export PLATFORM_DRIVER = platform6driver |
172 | - |
173 | %: |
174 | dh $@ --parallel --fail-missing |
175 | |
176 | @@ -57,15 +55,4 @@ |
177 | # Delete the symlink so that --fail-missing doesn't think we've missed it |
178 | # accidentally. |
179 | -rm debian/tmp/usr/lib/*/libmirprotobuf.so |
180 | - dh_install --fail-missing \ |
181 | - -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmir$(PLATFORM_DRIVER).so |
182 | - sh debian/install_ld_so_conf.sh $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH) |
183 | - |
184 | -override_dh_installdeb: |
185 | - sh debian/create_postinst_prerm_scripts.sh \ |
186 | - $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH) |
187 | - dh_installdeb |
188 | - |
189 | -override_dh_gencontrol: |
190 | - dh_gencontrol -- \ |
191 | - -Vplatform-driver=$(PLATFORM_DRIVER) |
192 | + dh_install --fail-missing |
193 | |
194 | === modified file 'include/platform/mir/graphics/platform.h' |
195 | --- include/platform/mir/graphics/platform.h 2015-01-14 06:39:13 +0000 |
196 | +++ include/platform/mir/graphics/platform.h 2015-01-22 15:40:28 +0000 |
197 | @@ -24,6 +24,8 @@ |
198 | #include <EGL/egl.h> |
199 | #include <memory> |
200 | |
201 | +#include "mir/module_properties.h" |
202 | + |
203 | namespace mir |
204 | { |
205 | class EmergencyCleanupRegistry; |
206 | @@ -93,6 +95,25 @@ |
207 | }; |
208 | |
209 | /** |
210 | + * A measure of how well a platform supports a device |
211 | + * |
212 | + * \note This is compared as an integer; best + 1 is a valid PlatformPriority that |
213 | + * will be used in preference to a module that reports best. |
214 | + * Platform modules distributed with Mir will never use a priority higher |
215 | + * than best. |
216 | + */ |
217 | +enum PlatformPriority : uint32_t |
218 | +{ |
219 | + unsupported = 0, /**< Unable to function at all on this device */ |
220 | + supported = 128, /**< Capable of providing a functioning Platform on this device, |
221 | + * possibly with degraded performance or features. |
222 | + */ |
223 | + best = 256 /**< Capable of providing a Platform with the best features and |
224 | + * performance this device is capable of. |
225 | + */ |
226 | +}; |
227 | + |
228 | +/** |
229 | * Function prototype used to return a new host graphics platform. The host graphics platform |
230 | * is the system entity that owns the physical display and is a mir host server. |
231 | * |
232 | @@ -142,8 +163,17 @@ |
233 | */ |
234 | extern "C" typedef void(*AddPlatformOptions)( |
235 | boost::program_options::options_description& config); |
236 | -extern "C" void add_platform_options( |
237 | +extern "C" void add_graphics_platform_options( |
238 | boost::program_options::options_description& config); |
239 | + |
240 | +// TODO: We actually need to be more granular here; on a device with more |
241 | +// than one graphics system we may need a different platform per GPU, |
242 | +// so we should be associating platforms with graphics devices in some way |
243 | +extern "C" typedef PlatformPriority(*PlatformProbe)(); |
244 | +extern "C" PlatformPriority probe_graphcis_platform(); |
245 | + |
246 | +extern "C" typedef ModuleProperties const*(*DescribeModule)(); |
247 | +extern "C" ModuleProperties const* describe_graphics_module(); |
248 | } |
249 | } |
250 | |
251 | |
252 | === added file 'include/platform/mir/module_properties.h' |
253 | --- include/platform/mir/module_properties.h 1970-01-01 00:00:00 +0000 |
254 | +++ include/platform/mir/module_properties.h 2015-01-22 15:40:28 +0000 |
255 | @@ -0,0 +1,37 @@ |
256 | +/* |
257 | + * Copyright © 2014 Canonical Ltd. |
258 | + * |
259 | + * This program is free software: you can redistribute it and/or modify it |
260 | + * under the terms of the GNU Lesser General Public License version 3, |
261 | + * as published by the Free Software Foundation. |
262 | + * |
263 | + * This program is distributed in the hope that it will be useful, |
264 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
265 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
266 | + * GNU Lesser General Public License for more details. |
267 | + * |
268 | + * You should have received a copy of the GNU Lesser General Public License |
269 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
270 | + * |
271 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
272 | + */ |
273 | + |
274 | +#ifndef MIR_PLATFORM_MODULE_PROPERTIES_H_ |
275 | +#define MIR_PLATFORM_MODULE_PROPERTIES_H_ |
276 | + |
277 | +namespace mir |
278 | +{ |
279 | + |
280 | +/** |
281 | + * Describes a platform module |
282 | + */ |
283 | +struct ModuleProperties |
284 | +{ |
285 | + char const* name; |
286 | + int major_version; |
287 | + int minor_version; |
288 | + int micro_version; |
289 | +}; |
290 | +} |
291 | + |
292 | +#endif /* MIR_PLATFORM_MODULE_PROPERTIES_H_ */ |
293 | |
294 | === modified file 'platform-ABI-sha1sums' |
295 | --- platform-ABI-sha1sums 2015-01-20 03:21:20 +0000 |
296 | +++ platform-ABI-sha1sums 2015-01-22 15:40:28 +0000 |
297 | @@ -49,9 +49,10 @@ |
298 | 5dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h |
299 | d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h |
300 | 979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h |
301 | -5d72b98aecb0611060dec8995dbe017a342f7069 include/platform/mir/graphics/platform.h |
302 | +d3da5e58e8e1d5953b459d18f9dfe628fe0a25bd include/platform/mir/graphics/platform.h |
303 | d1ba61e687d75103e9e7aa0409080214f56a990b include/platform/mir/graphics/platform_ipc_operations.h |
304 | 1b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h |
305 | f0db0484b8ccc9091e73c80a2a200cb436b48bfb include/platform/mir/graphics/platform_operation_message.h |
306 | f18876766861e5d4f5ca999dbd176fe1fc520594 include/platform/mir/graphics/renderable.h |
307 | +5b3872b04b3686fe9a244572ca0787596431a2cb include/platform/mir/module_properties.h |
308 | b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h |
309 | |
310 | === modified file 'server-ABI-sha1sums' |
311 | --- server-ABI-sha1sums 2015-01-22 14:33:14 +0000 |
312 | +++ server-ABI-sha1sums 2015-01-22 15:40:28 +0000 |
313 | @@ -49,11 +49,12 @@ |
314 | 5dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h |
315 | d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h |
316 | 979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h |
317 | -5d72b98aecb0611060dec8995dbe017a342f7069 include/platform/mir/graphics/platform.h |
318 | +d3da5e58e8e1d5953b459d18f9dfe628fe0a25bd include/platform/mir/graphics/platform.h |
319 | d1ba61e687d75103e9e7aa0409080214f56a990b include/platform/mir/graphics/platform_ipc_operations.h |
320 | 1b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h |
321 | f0db0484b8ccc9091e73c80a2a200cb436b48bfb include/platform/mir/graphics/platform_operation_message.h |
322 | f18876766861e5d4f5ca999dbd176fe1fc520594 include/platform/mir/graphics/renderable.h |
323 | +5b3872b04b3686fe9a244572ca0787596431a2cb include/platform/mir/module_properties.h |
324 | b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h |
325 | f4030e400baf8baa9c38e7c6ec6b4a5ad7134aeb include/server/mir/compositor/compositor.h |
326 | a9f284ba4b05d58fd3eeb628d1f56fe4ac188526 include/server/mir/compositor/compositor_id.h |
327 | |
328 | === modified file 'src/CMakeLists.txt' |
329 | --- src/CMakeLists.txt 2015-01-22 03:10:13 +0000 |
330 | +++ src/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
331 | @@ -2,12 +2,6 @@ |
332 | # and the platform implementations. |
333 | set(MIRPLATFORM_ABI 6) |
334 | |
335 | -set(PLATFORM_DRIVER platform${MIRPLATFORM_ABI}driver) |
336 | -set(MIR_PLATFORM_DRIVER mir${PLATFORM_DRIVER}) |
337 | -set(MIR_PLATFORM_DRIVER_BINARY lib${MIR_PLATFORM_DRIVER}.so |
338 | - CACHE STRING "File name of Mir server platform drivers") |
339 | -add_definitions(-DMIR_PLATFORM_DRIVER_BINARY="${MIR_PLATFORM_DRIVER_BINARY}") |
340 | - |
341 | # We need MIR_CLIENT_PLATFORM_PATH in both libmirclient and the platform |
342 | # implementations |
343 | set(MIR_CLIENT_PLATFORM_PATH |
344 | @@ -47,3 +41,4 @@ |
345 | set(MIR_COMMON_OBJECTS ${MIR_COMMON_OBJECTS} PARENT_SCOPE) |
346 | set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE) |
347 | set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE) |
348 | +set(MIR_SERVER_PLATFORM_PATH ${MIR_SERVER_PLATFORM_PATH} PARENT_SCOPE) |
349 | |
350 | === modified file 'src/client/default_connection_configuration.cpp' |
351 | --- src/client/default_connection_configuration.cpp 2015-01-19 04:52:47 +0000 |
352 | +++ src/client/default_connection_configuration.cpp 2015-01-22 15:40:28 +0000 |
353 | @@ -226,7 +226,7 @@ |
354 | [this] () -> std::shared_ptr<mir::SharedLibraryProberReport> |
355 | { |
356 | auto val_raw = getenv("MIR_CLIENT_SHARED_LIBRARY_PROBER_REPORT"); |
357 | - std::string const val{val_raw ? val_raw : off_opt_val}; |
358 | + std::string const val{val_raw ? val_raw : log_opt_val}; |
359 | if (val == log_opt_val) |
360 | return std::make_shared<mir::logging::SharedLibraryProberReport>(the_logger()); |
361 | else if (val == lttng_opt_val) |
362 | |
363 | === modified file 'src/common/graphics/android/mir_native_window.cpp' |
364 | --- src/common/graphics/android/mir_native_window.cpp 2015-01-14 06:39:13 +0000 |
365 | +++ src/common/graphics/android/mir_native_window.cpp 2015-01-22 15:40:28 +0000 |
366 | @@ -20,7 +20,6 @@ |
367 | #include "mir/graphics/android/android_driver_interpreter.h" |
368 | #include "mir/graphics/android/sync_fence.h" |
369 | |
370 | -#include <iostream> |
371 | #include <boost/exception/diagnostic_information.hpp> |
372 | |
373 | namespace mg=mir::graphics; |
374 | |
375 | === added file 'src/include/platform/mir/graphics/platform_probe.h' |
376 | --- src/include/platform/mir/graphics/platform_probe.h 1970-01-01 00:00:00 +0000 |
377 | +++ src/include/platform/mir/graphics/platform_probe.h 2015-01-22 15:40:28 +0000 |
378 | @@ -0,0 +1,37 @@ |
379 | +/* |
380 | + * Copyright © 2014 Canonical Ltd. |
381 | + * |
382 | + * This program is free software: you can redistribute it and/or modify it |
383 | + * under the terms of the GNU Lesser General Public License version 3, |
384 | + * as published by the Free Software Foundation. |
385 | + * |
386 | + * This program is distributed in the hope that it will be useful, |
387 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
388 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
389 | + * GNU Lesser General Public License for more details. |
390 | + * |
391 | + * You should have received a copy of the GNU Lesser General Public License |
392 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
393 | + * |
394 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
395 | + */ |
396 | + |
397 | +#ifndef MIR_GRAPHICS_PLATFORM_PROBE_H_ |
398 | +#define MIR_GRAPHICS_PLATFORM_PROBE_H_ |
399 | + |
400 | +#include <vector> |
401 | +#include <memory> |
402 | +#include "mir/shared_library.h" |
403 | + |
404 | +namespace mir |
405 | +{ |
406 | +namespace graphics |
407 | +{ |
408 | +class Platform; |
409 | + |
410 | +std::shared_ptr<SharedLibrary> module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules); |
411 | + |
412 | +} |
413 | +} |
414 | + |
415 | +#endif // MIR_GRAPHICS_PLATFORM_PROBE_H_ |
416 | |
417 | === modified file 'src/include/platform/mir/options/configuration.h' |
418 | --- src/include/platform/mir/options/configuration.h 2015-01-14 06:39:13 +0000 |
419 | +++ src/include/platform/mir/options/configuration.h 2015-01-22 15:40:28 +0000 |
420 | @@ -33,6 +33,7 @@ |
421 | extern char const* const enable_input_opt; |
422 | extern char const* const session_mediator_report_opt; |
423 | extern char const* const msg_processor_report_opt; |
424 | +extern char const* const shared_library_prober_report_opt; |
425 | extern char const* const compositor_report_opt; |
426 | extern char const* const display_report_opt; |
427 | extern char const* const legacy_input_report_opt; |
428 | @@ -53,6 +54,7 @@ |
429 | extern char const* const lttng_opt_value; |
430 | |
431 | extern char const* const platform_graphics_lib; |
432 | +extern char const* const platform_path; |
433 | |
434 | class Configuration |
435 | { |
436 | |
437 | === modified file 'src/include/platform/mir/options/default_configuration.h' |
438 | --- src/include/platform/mir/options/default_configuration.h 2015-01-14 06:39:13 +0000 |
439 | +++ src/include/platform/mir/options/default_configuration.h 2015-01-22 15:40:28 +0000 |
440 | @@ -25,6 +25,7 @@ |
441 | |
442 | namespace mir |
443 | { |
444 | +class SharedLibrary; |
445 | namespace options |
446 | { |
447 | class DefaultConfiguration : public Configuration |
448 | @@ -42,6 +43,10 @@ |
449 | boost::program_options::options_description_easy_init add_options(); |
450 | |
451 | private: |
452 | + // MUST be the first member to ensure it's destroyed last, lest we attempt to |
453 | + // call destructors in DSOs we've unloaded. |
454 | + std::shared_ptr<SharedLibrary> platform_graphics_library; |
455 | + |
456 | void add_platform_options(); |
457 | // accessed via the base interface, when access to add_options() has been "lost" |
458 | std::shared_ptr<options::Option> the_options() const override; |
459 | |
460 | === removed file 'src/include/platform/mir/shared_library_loader.h' |
461 | --- src/include/platform/mir/shared_library_loader.h 2015-01-14 06:39:13 +0000 |
462 | +++ src/include/platform/mir/shared_library_loader.h 1970-01-01 00:00:00 +0000 |
463 | @@ -1,28 +0,0 @@ |
464 | -/* |
465 | - * Copyright © 2013 Canonical Ltd. |
466 | - * |
467 | - * This program is free software: you can redistribute it and/or modify it |
468 | - * under the terms of the GNU Lesser General Public License version 3, |
469 | - * as published by the Free Software Foundation. |
470 | - * |
471 | - * This program is distributed in the hope that it will be useful, |
472 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
473 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
474 | - * GNU Lesser General Public License for more details. |
475 | - * |
476 | - * You should have received a copy of the GNU Lesser General Public License |
477 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
478 | - * |
479 | - * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
480 | - */ |
481 | - |
482 | -#ifndef MIR_SHARED_LIBRARY_LOADER_H_ |
483 | -#define MIR_SHARED_LIBRARY_LOADER_H_ |
484 | - |
485 | -#include <string> |
486 | -namespace mir |
487 | -{ |
488 | -class SharedLibrary; |
489 | -SharedLibrary const* load_library(std::string const& libname); |
490 | -} |
491 | -#endif |
492 | |
493 | === modified file 'src/include/server/mir/default_server_configuration.h' |
494 | --- src/include/server/mir/default_server_configuration.h 2015-01-14 06:39:13 +0000 |
495 | +++ src/include/server/mir/default_server_configuration.h 2015-01-22 15:40:28 +0000 |
496 | @@ -40,6 +40,7 @@ |
497 | namespace mir |
498 | { |
499 | class ServerActionQueue; |
500 | +class SharedLibraryProberReport; |
501 | |
502 | namespace compositor |
503 | { |
504 | @@ -315,6 +316,7 @@ |
505 | |
506 | virtual std::shared_ptr<time::Clock> the_clock(); |
507 | virtual std::shared_ptr<ServerActionQueue> the_server_action_queue(); |
508 | + virtual std::shared_ptr<SharedLibraryProberReport> the_shared_library_prober_report(); |
509 | |
510 | protected: |
511 | std::shared_ptr<options::Option> the_options() const; |
512 | @@ -424,6 +426,7 @@ |
513 | CachedPtr<scene::CoordinateTranslator> coordinate_translator; |
514 | CachedPtr<EmergencyCleanup> emergency_cleanup; |
515 | CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener; |
516 | + CachedPtr<SharedLibraryProberReport> shared_library_prober_report; |
517 | |
518 | private: |
519 | std::shared_ptr<options::Configuration> const configuration_options; |
520 | |
521 | === modified file 'src/platform/CMakeLists.txt' |
522 | --- src/platform/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
523 | +++ src/platform/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
524 | @@ -7,12 +7,10 @@ |
525 | |
526 | set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) |
527 | |
528 | -add_library(mirplatformobjects OBJECT |
529 | - shared_library_loader.cpp |
530 | -) |
531 | +add_definitions(-DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}") |
532 | +add_definitions(-DMIR_SERVER_GRAPHICS_PLATFORM_VERSION="${MIR_SERVER_GRAPHICS_PLATFORM_VERSION}") |
533 | |
534 | set(MIR_PLATFORM_OBJECTS |
535 | - $<TARGET_OBJECTS:mirplatformobjects> |
536 | $<TARGET_OBJECTS:mirplatformgraphicscommon> |
537 | $<TARGET_OBJECTS:miroptions> |
538 | $<TARGET_OBJECTS:mirfatal> |
539 | @@ -31,17 +29,19 @@ |
540 | ) |
541 | |
542 | target_link_libraries(mirplatform |
543 | + |
544 | mircommon |
545 | ${MIR_PLATFORM_REFERENCES} |
546 | ) |
547 | |
548 | -set_target_properties(mirplatform |
549 | +set_target_properties( |
550 | + mirplatform |
551 | + |
552 | PROPERTIES |
553 | SOVERSION ${MIRPLATFORM_ABI} |
554 | LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}" |
555 | ) |
556 | |
557 | - |
558 | install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
559 | |
560 | add_subdirectory(graphics/) |
561 | |
562 | === modified file 'src/platform/graphics/CMakeLists.txt' |
563 | --- src/platform/graphics/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
564 | +++ src/platform/graphics/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
565 | @@ -12,6 +12,7 @@ |
566 | gl_program.cpp |
567 | gl_texture.cpp |
568 | tessellation_helpers.cpp |
569 | + platform_probe.cpp |
570 | ) |
571 | |
572 | add_library(mirplatformgraphicscommon OBJECT |
573 | |
574 | === added file 'src/platform/graphics/platform_probe.cpp' |
575 | --- src/platform/graphics/platform_probe.cpp 1970-01-01 00:00:00 +0000 |
576 | +++ src/platform/graphics/platform_probe.cpp 2015-01-22 15:40:28 +0000 |
577 | @@ -0,0 +1,59 @@ |
578 | +/* |
579 | + * Copyright © 2014 Canonical Ltd. |
580 | + * |
581 | + * This program is free software: you can redistribute it and/or modify it |
582 | + * under the terms of the GNU Lesser General Public License version 3, |
583 | + * as published by the Free Software Foundation. |
584 | + * |
585 | + * This program is distributed in the hope that it will be useful, |
586 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
587 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
588 | + * GNU Lesser General Public License for more details. |
589 | + * |
590 | + * You should have received a copy of the GNU Lesser General Public License |
591 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
592 | + * |
593 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
594 | + */ |
595 | + |
596 | +#include "mir/logging/logger.h" |
597 | +#include "mir/graphics/platform.h" |
598 | +#include "mir/graphics/platform_probe.h" |
599 | + |
600 | +#include <string> |
601 | +#include <boost/throw_exception.hpp> |
602 | + |
603 | +namespace ml = mir::logging; |
604 | + |
605 | +std::shared_ptr<mir::SharedLibrary> |
606 | +mir::graphics::module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules) |
607 | +{ |
608 | + mir::graphics::PlatformPriority best_priority_so_far = mir::graphics::unsupported; |
609 | + std::shared_ptr<mir::SharedLibrary> best_module_so_far; |
610 | + for (auto& module : modules) |
611 | + { |
612 | + try |
613 | + { |
614 | + auto probe = module->load_function<mir::graphics::PlatformProbe>("probe_graphics_platform", |
615 | + MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
616 | + auto module_priority = probe(); |
617 | + if (module_priority > best_priority_so_far) |
618 | + { |
619 | + best_priority_so_far = module_priority; |
620 | + best_module_so_far = module; |
621 | + } |
622 | + } |
623 | + catch (std::runtime_error const& err) |
624 | + { |
625 | + // Tried to probe a SharedLibrary that isn't a platform module? |
626 | + ml::log(ml::Severity::warning, |
627 | + std::string{"Failed to probe module. Not a platform library? Error: "} + err.what(), |
628 | + "Platform Probing"); |
629 | + } |
630 | + } |
631 | + if (best_priority_so_far > mir::graphics::unsupported) |
632 | + { |
633 | + return best_module_so_far; |
634 | + } |
635 | + BOOST_THROW_EXCEPTION((std::runtime_error{"Failed to find platform for current system"})); |
636 | +} |
637 | |
638 | === modified file 'src/platform/options/default_configuration.cpp' |
639 | --- src/platform/options/default_configuration.cpp 2015-01-14 06:39:13 +0000 |
640 | +++ src/platform/options/default_configuration.cpp 2015-01-22 15:40:28 +0000 |
641 | @@ -17,11 +17,13 @@ |
642 | */ |
643 | |
644 | #include "mir/shared_library.h" |
645 | -#include "mir/shared_library_loader.h" |
646 | #include "mir/options/default_configuration.h" |
647 | #include "mir/graphics/platform.h" |
648 | #include "mir/default_configuration.h" |
649 | #include "mir/abnormal_exit.h" |
650 | +#include "mir/shared_library_prober.h" |
651 | +#include "mir/logging/null_shared_library_prober_report.h" |
652 | +#include "mir/graphics/platform_probe.h" |
653 | |
654 | #include <dlfcn.h> |
655 | |
656 | @@ -39,6 +41,7 @@ |
657 | char const* const mo::connector_report_opt = "connector-report"; |
658 | char const* const mo::scene_report_opt = "scene-report"; |
659 | char const* const mo::input_report_opt = "input-report"; |
660 | +char const* const mo::shared_library_prober_report_opt = "shared-library-prober-report"; |
661 | char const* const mo::host_socket_opt = "host-socket"; |
662 | char const* const mo::frontend_threads_opt = "ipc-thread-pool"; |
663 | char const* const mo::name_opt = "name"; |
664 | @@ -52,12 +55,12 @@ |
665 | char const* const mo::lttng_opt_value = "lttng"; |
666 | |
667 | char const* const mo::platform_graphics_lib = "platform-graphics-lib"; |
668 | +char const* const mo::platform_path = "platform-path"; |
669 | |
670 | namespace |
671 | { |
672 | int const default_ipc_threads = 1; |
673 | bool const enable_input_default = true; |
674 | -char const* const default_platform_graphics_lib = MIR_PLATFORM_DRIVER_BINARY; |
675 | |
676 | // Hack around the way Qt loads mir: |
677 | // platform_api and therefore Mir are loaded via dlopen(..., RTLD_LOCAL). |
678 | @@ -114,8 +117,10 @@ |
679 | "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]") |
680 | (no_server_socket_opt, "Do not provide a socket filename for client connections") |
681 | (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections") |
682 | - (platform_graphics_lib, po::value<std::string>()->default_value(default_platform_graphics_lib), |
683 | - "Library to use for platform graphics support") |
684 | + (platform_graphics_lib, po::value<std::string>(), |
685 | + "Library to use for platform graphics support (default: autodetect)") |
686 | + (platform_path, po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PATH), |
687 | + "Directory to look for platform libraries (default: " MIR_SERVER_PLATFORM_PATH ")") |
688 | (enable_input_opt, po::value<bool>()->default_value(enable_input_default), |
689 | "Enable input.") |
690 | (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value), |
691 | @@ -134,6 +139,8 @@ |
692 | "How to handle the MessageProcessor report. [{log,lttng,off}]") |
693 | (scene_report_opt, po::value<std::string>()->default_value(off_opt_value), |
694 | "How to handle the scene report. [{log,lttng,off}]") |
695 | + (shared_library_prober_report_opt, po::value<std::string>()->default_value(log_opt_value), |
696 | + "How to handle the SharedLibraryProber report. [{log,lttng,off}]") |
697 | (frontend_threads_opt, po::value<int>()->default_value(default_ipc_threads), |
698 | "threads in frontend thread pool.") |
699 | (name_opt, po::value<std::string>(), |
700 | @@ -156,26 +163,48 @@ |
701 | po::options_description program_options; |
702 | program_options.add_options() |
703 | (platform_graphics_lib, |
704 | - po::value<std::string>()->default_value(default_platform_graphics_lib), ""); |
705 | + po::value<std::string>(), ""); |
706 | + program_options.add_options() |
707 | + (platform_path, |
708 | + po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PATH), |
709 | + ""); |
710 | mo::ProgramOption options; |
711 | options.parse_arguments(program_options, argc, argv); |
712 | |
713 | - std::string graphics_libname; |
714 | + ensure_loaded_with_rtld_global(); |
715 | + |
716 | + // TODO: We should just load all the platform plugins we can and present their options. |
717 | auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB"); |
718 | - if (!options.is_set(platform_graphics_lib) && env_libname) |
719 | - { |
720 | - graphics_libname = std::string{env_libname}; |
721 | - } |
722 | - else |
723 | - { |
724 | - graphics_libname = options.get<std::string>(platform_graphics_lib); |
725 | - } |
726 | - |
727 | - ensure_loaded_with_rtld_global(); |
728 | - |
729 | - auto graphics_lib = load_library(graphics_libname); |
730 | - auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options")); |
731 | - add_platform_options(*this->program_options); |
732 | + auto env_libpath = ::getenv("MIR_SERVER_PLATFORM_PATH"); |
733 | + try |
734 | + { |
735 | + if (options.is_set(platform_graphics_lib)) |
736 | + { |
737 | + platform_graphics_library = std::make_shared<mir::SharedLibrary>(options.get<std::string>(platform_graphics_lib)); |
738 | + } |
739 | + else if (env_libname) |
740 | + { |
741 | + platform_graphics_library = std::make_shared<mir::SharedLibrary>(std::string{env_libname}); |
742 | + } |
743 | + else |
744 | + { |
745 | + mir::logging::NullSharedLibraryProberReport null_report; |
746 | + auto const plugin_path = env_libpath ? env_libpath : options.get<std::string>(platform_path); |
747 | + auto plugins = mir::libraries_for_path(plugin_path, null_report); |
748 | + platform_graphics_library = mir::graphics::module_for_device(plugins); |
749 | + } |
750 | + |
751 | + auto add_platform_options = platform_graphics_library->load_function<mir::graphics::AddPlatformOptions>("add_graphics_platform_options"); |
752 | + add_platform_options(*this->program_options); |
753 | + } |
754 | + catch(...) |
755 | + { |
756 | + // We don't actually care at this point if this failed. |
757 | + // Maybe we've been pointed at the wrong place. Maybe this platform doesn't actually |
758 | + // *have* platform-specific options. |
759 | + // Regardless, if we need a platform and can't find one then we'll bail later |
760 | + // in startup with a useful error. |
761 | + } |
762 | } |
763 | |
764 | boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options() |
765 | |
766 | === modified file 'src/platform/symbols.map' |
767 | --- src/platform/symbols.map 2015-01-20 06:24:53 +0000 |
768 | +++ src/platform/symbols.map 2015-01-22 15:40:28 +0000 |
769 | @@ -6,7 +6,6 @@ |
770 | mir::fatal_error*; |
771 | mir::fatal_error_abort*; |
772 | mir::fatal_error_except*; |
773 | - mir::graphics::add_platform_options*; |
774 | mir::graphics::BufferBasic::BufferBasic*; |
775 | mir::graphics::Buffer::Buffer*; |
776 | mir::graphics::Buffer::can_bypass*; |
777 | @@ -17,8 +16,6 @@ |
778 | mir::graphics::Buffer::size*; |
779 | mir::graphics::Buffer::stride*; |
780 | mir::graphics::Buffer::write*; |
781 | - mir::graphics::create_guest_platform*; |
782 | - mir::graphics::create_host_platform*; |
783 | mir::graphics::Cursor::?Cursor*; |
784 | mir::graphics::Cursor::Cursor*; |
785 | mir::graphics::Cursor::hide*; |
786 | @@ -81,6 +78,7 @@ |
787 | mir::graphics::GraphicBufferAllocator::GraphicBufferAllocator*; |
788 | mir::graphics::GraphicBufferAllocator::operator*; |
789 | mir::graphics::GraphicBufferAllocator::supported_pixel_formats*; |
790 | + mir::graphics::module_for_device*; |
791 | mir::graphics::operator*; |
792 | mir::graphics::Platform::create_buffer_allocator*; |
793 | mir::graphics::Platform::create_display*; |
794 | @@ -127,6 +125,7 @@ |
795 | mir::options::glog_log_dir*; |
796 | mir::options::glog_minloglevel*; |
797 | mir::options::glog_stderrthreshold*; |
798 | + mir::options::platform_path*; |
799 | mir::options::host_socket_opt*; |
800 | mir::options::input_report_opt*; |
801 | mir::options::legacy_input_report_opt*; |
802 | @@ -154,6 +153,7 @@ |
803 | mir::options::scene_report_opt*; |
804 | mir::options::server_socket_opt*; |
805 | mir::options::session_mediator_report_opt*; |
806 | + mir::options::shared_library_prober_report_opt*; |
807 | mir::options::touchspots_opt*; |
808 | non-virtual?thunk?to?mir::graphics::Cursor::?Cursor*; |
809 | non-virtual?thunk?to?mir::graphics::CursorImage::?CursorImage*; |
810 | |
811 | === modified file 'src/platforms/CMakeLists.txt' |
812 | --- src/platforms/CMakeLists.txt 2015-01-22 03:10:13 +0000 |
813 | +++ src/platforms/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
814 | @@ -1,3 +1,19 @@ |
815 | +# This needs to change whenever the ABI between the platform |
816 | +# modules and the server changes in an incompatible way. |
817 | +# This ABI is much smaller than the full libmirplatform ABI. |
818 | +# |
819 | +# TODO: Add an extra driver-ABI check target. |
820 | +set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION "MIR_GRAPHICS_PLATFORM_1") |
821 | +set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION ${MIR_SERVER_GRAPHICS_PLATFORM_VERSION} PARENT_SCOPE) |
822 | + |
823 | +set(MIR_SERVER_PLATFORM_PATH |
824 | + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/mir/server-platform |
825 | +) |
826 | +set(MIR_SERVER_PLATFORM_PATH |
827 | + ${MIR_SERVER_PLATFORM_PATH} |
828 | + PARENT_SCOPE |
829 | +) |
830 | + |
831 | set(server_common_include_dirs |
832 | ${PROJECT_SOURCE_DIR}/include/platform |
833 | ) |
834 | |
835 | === modified file 'src/platforms/android/server/CMakeLists.txt' |
836 | --- src/platforms/android/server/CMakeLists.txt 2015-01-22 03:10:13 +0000 |
837 | +++ src/platforms/android/server/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
838 | @@ -38,20 +38,17 @@ |
839 | ipc_operations.cpp |
840 | hwc_blanking_control.cpp |
841 | ) |
842 | + |
843 | add_library(mirplatformgraphicsandroid SHARED |
844 | + |
845 | $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects> |
846 | ) |
847 | |
848 | -set_target_properties( |
849 | - mirplatformgraphicsandroid PROPERTIES |
850 | - OUTPUT_NAME ${MIR_PLATFORM_DRIVER} |
851 | - LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android |
852 | - LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${server_symbol_map}" |
853 | -) |
854 | +target_link_libraries( |
855 | + mirplatformgraphicsandroid |
856 | |
857 | -target_link_libraries(mirplatformgraphicsandroid |
858 | + mirsharedandroid |
859 | mirplatform |
860 | - mirsharedandroid |
861 | ${Boost_PROGRAM_OPTIONS_LIBRARY} |
862 | ${LIBHARDWARE_LIBRARIES} |
863 | ${EGL_LDFLAGS} ${EGL_LIBRARIES} |
864 | @@ -59,20 +56,14 @@ |
865 | ${ANDROID_PROPERTIES_LDFLAGS} |
866 | ) |
867 | |
868 | -install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${PLATFORM_DRIVER}/android) |
869 | - |
870 | -if (MIR_TEST_PLATFORM STREQUAL "android") |
871 | - add_custom_command(TARGET mirplatformgraphicsandroid |
872 | - POST_BUILD |
873 | - COMMAND ${CMAKE_COMMAND} -E remove ${MIR_PLATFORM_DRIVER_BINARY} |
874 | - COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> ${MIR_PLATFORM_DRIVER_BINARY} |
875 | - WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
876 | - ) |
877 | - |
878 | - install(CODE |
879 | - "execute_process( |
880 | - COMMAND ln -sf mir/${PLATFORM_DRIVER}/android/${MIR_PLATFORM_DRIVER_BINARY} |
881 | - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} |
882 | - )" |
883 | - ) |
884 | -endif() |
885 | +set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) |
886 | + |
887 | +set_target_properties( |
888 | + mirplatformgraphicsandroid PROPERTIES |
889 | + OUTPUT_NAME graphics-android |
890 | + LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules |
891 | + PREFIX "" |
892 | + LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}" |
893 | +) |
894 | + |
895 | +install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH}) |
896 | |
897 | === modified file 'src/platforms/android/server/platform.cpp' |
898 | --- src/platforms/android/server/platform.cpp 2015-01-22 03:10:13 +0000 |
899 | +++ src/platforms/android/server/platform.cpp 2015-01-22 15:40:28 +0000 |
900 | @@ -155,7 +155,7 @@ |
901 | return std::make_shared<mga::Platform>(nullptr, display_report, mga::OverlayOptimization::disabled); |
902 | } |
903 | |
904 | -extern "C" void add_platform_options( |
905 | +extern "C" void add_graphics_platform_options( |
906 | boost::program_options::options_description& config) |
907 | { |
908 | config.add_options() |
909 | @@ -166,3 +166,25 @@ |
910 | boost::program_options::value<bool>()->default_value(false), |
911 | "[platform-specific] Whether to disable overlay optimizations [{on,off}]"); |
912 | } |
913 | + |
914 | +extern "C" mg::PlatformPriority probe_graphics_platform() |
915 | +{ |
916 | + int err; |
917 | + hw_module_t const* hw_module; |
918 | + |
919 | + err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hw_module); |
920 | + |
921 | + return err < 0 ? mg::PlatformPriority::unsupported : mg::PlatformPriority::best; |
922 | +} |
923 | + |
924 | +mir::ModuleProperties const description = { |
925 | + "android", |
926 | + MIR_VERSION_MAJOR, |
927 | + MIR_VERSION_MINOR, |
928 | + MIR_VERSION_MICRO |
929 | +}; |
930 | + |
931 | +extern "C" mir::ModuleProperties const* describe_graphics_module() |
932 | +{ |
933 | + return &description; |
934 | +} |
935 | |
936 | === added file 'src/platforms/android/server/symbols.map' |
937 | --- src/platforms/android/server/symbols.map 1970-01-01 00:00:00 +0000 |
938 | +++ src/platforms/android/server/symbols.map 2015-01-22 15:40:28 +0000 |
939 | @@ -0,0 +1,10 @@ |
940 | +MIR_GRAPHICS_PLATFORM_1 { |
941 | + global: |
942 | + add_graphics_platform_options; |
943 | + create_host_platform; |
944 | + create_guest_platform; |
945 | + probe_graphics_platform; |
946 | + describe_graphics_module; |
947 | + local: |
948 | + *; |
949 | +}; |
950 | |
951 | === modified file 'src/platforms/common/server/symbols.map' |
952 | --- src/platforms/common/server/symbols.map 2015-01-22 03:10:13 +0000 |
953 | +++ src/platforms/common/server/symbols.map 2015-01-22 15:40:28 +0000 |
954 | @@ -1,8 +1,9 @@ |
955 | -MIR_PLATFORM_1 { |
956 | +MIR_GRAPHICS_PLATFORM_1 { |
957 | global: |
958 | - add_platform_options; |
959 | + add_graphics_platform_options; |
960 | + probe_graphics_platform; |
961 | create_host_platform; |
962 | create_guest_platform; |
963 | - mir_server_mesa_egl_native_display_is_valid; |
964 | + describe_graphics_module; |
965 | local: *; |
966 | }; |
967 | |
968 | === modified file 'src/platforms/mesa/server/CMakeLists.txt' |
969 | --- src/platforms/mesa/server/CMakeLists.txt 2015-01-22 03:10:13 +0000 |
970 | +++ src/platforms/mesa/server/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
971 | @@ -15,7 +15,9 @@ |
972 | string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) |
973 | add_definitions(-D__GBM__) |
974 | |
975 | -add_library(mirplatformgraphicsmesaobjects OBJECT |
976 | +add_library( |
977 | + mirplatformgraphicsmesaobjects OBJECT |
978 | + |
979 | platform.cpp |
980 | buffer_allocator.cpp |
981 | gbm_buffer.cpp |
982 | @@ -38,18 +40,15 @@ |
983 | nested_authentication.cpp |
984 | ) |
985 | |
986 | -add_library(mirplatformgraphicsmesa SHARED |
987 | +add_library( |
988 | + mirplatformgraphicsmesa MODULE |
989 | + |
990 | $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects> |
991 | ) |
992 | |
993 | -set_target_properties( |
994 | - mirplatformgraphicsmesa PROPERTIES |
995 | - OUTPUT_NAME ${MIR_PLATFORM_DRIVER} |
996 | - LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa |
997 | - LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${server_symbol_map}" |
998 | -) |
999 | +target_link_libraries( |
1000 | + mirplatformgraphicsmesa |
1001 | |
1002 | -target_link_libraries(mirplatformgraphicsmesa |
1003 | mirplatform |
1004 | ${Boost_PROGRAM_OPTIONS_LIBRARY} |
1005 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
1006 | @@ -58,20 +57,14 @@ |
1007 | ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} |
1008 | ) |
1009 | |
1010 | -install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${PLATFORM_DRIVER}/mesa) |
1011 | - |
1012 | -if (MIR_TEST_PLATFORM STREQUAL "mesa") |
1013 | - add_custom_command(TARGET mirplatformgraphicsmesa |
1014 | - POST_BUILD |
1015 | - COMMAND ${CMAKE_COMMAND} -E remove ${MIR_PLATFORM_DRIVER_BINARY} |
1016 | - COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> ${MIR_PLATFORM_DRIVER_BINARY} |
1017 | - WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} |
1018 | - ) |
1019 | - |
1020 | - install(CODE |
1021 | - "execute_process( |
1022 | - COMMAND ln -sf mir/${PLATFORM_DRIVER}/mesa/${MIR_PLATFORM_DRIVER_BINARY} |
1023 | - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} |
1024 | - )" |
1025 | - ) |
1026 | -endif() |
1027 | +set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) |
1028 | + |
1029 | +set_target_properties( |
1030 | + mirplatformgraphicsmesa PROPERTIES |
1031 | + OUTPUT_NAME graphics-mesa |
1032 | + LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules |
1033 | + PREFIX "" |
1034 | + LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}" |
1035 | +) |
1036 | + |
1037 | +install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH}) |
1038 | |
1039 | === modified file 'src/platforms/mesa/server/platform.cpp' |
1040 | --- src/platforms/mesa/server/platform.cpp 2015-01-22 03:10:13 +0000 |
1041 | +++ src/platforms/mesa/server/platform.cpp 2015-01-22 15:40:28 +0000 |
1042 | @@ -26,6 +26,7 @@ |
1043 | #include "mir/options/option.h" |
1044 | #include "mir/graphics/native_buffer.h" |
1045 | #include "mir/emergency_cleanup_registry.h" |
1046 | +#include "mir/udev/wrapper.h" |
1047 | |
1048 | |
1049 | #include <boost/throw_exception.hpp> |
1050 | @@ -192,7 +193,7 @@ |
1051 | return false; |
1052 | } |
1053 | |
1054 | -extern "C" void add_platform_options(boost::program_options::options_description& config) |
1055 | +extern "C" void add_graphics_platform_options(boost::program_options::options_description& config) |
1056 | { |
1057 | config.add_options() |
1058 | (vt_option_name, |
1059 | @@ -202,3 +203,33 @@ |
1060 | boost::program_options::value<bool>()->default_value(true), |
1061 | "[platform-specific] utilize the bypass optimization for fullscreen surfaces."); |
1062 | } |
1063 | + |
1064 | +extern "C" mg::PlatformPriority probe_graphics_platform() |
1065 | +{ |
1066 | + auto udev = std::make_shared<mir::udev::Context>(); |
1067 | + |
1068 | + mir::udev::Enumerator drm_devices{udev}; |
1069 | + drm_devices.match_subsystem("drm"); |
1070 | + drm_devices.match_sysname("card[0-9]*"); |
1071 | + drm_devices.scan_devices(); |
1072 | + |
1073 | + for (auto& device : drm_devices) |
1074 | + { |
1075 | + static_cast<void>(device); |
1076 | + return mg::PlatformPriority::best; |
1077 | + } |
1078 | + |
1079 | + return mg::PlatformPriority::unsupported; |
1080 | +} |
1081 | + |
1082 | +mir::ModuleProperties const description = { |
1083 | + "mesa", |
1084 | + MIR_VERSION_MAJOR, |
1085 | + MIR_VERSION_MINOR, |
1086 | + MIR_VERSION_MICRO |
1087 | +}; |
1088 | + |
1089 | +extern "C" mir::ModuleProperties const* describe_graphics_module() |
1090 | +{ |
1091 | + return &description; |
1092 | +} |
1093 | |
1094 | === added file 'src/platforms/mesa/server/symbols.map' |
1095 | --- src/platforms/mesa/server/symbols.map 1970-01-01 00:00:00 +0000 |
1096 | +++ src/platforms/mesa/server/symbols.map 2015-01-22 15:40:28 +0000 |
1097 | @@ -0,0 +1,16 @@ |
1098 | +MIR_GRAPHICS_PLATFORM_1 { |
1099 | + global: |
1100 | + add_graphics_platform_options; |
1101 | + create_host_platform; |
1102 | + create_guest_platform; |
1103 | + probe_graphics_platform; |
1104 | + describe_graphics_module; |
1105 | + local: |
1106 | + *; |
1107 | +}; |
1108 | + |
1109 | +# Mesa EGL platform requires this, because madness. |
1110 | +MIR_MESA_EGL_INTEGRATION { |
1111 | + global: |
1112 | + mir_server_mesa_egl_native_display_is_valid; |
1113 | +}; |
1114 | |
1115 | === modified file 'src/server/CMakeLists.txt' |
1116 | --- src/server/CMakeLists.txt 2015-01-20 10:07:15 +0000 |
1117 | +++ src/server/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1118 | @@ -11,6 +11,9 @@ |
1119 | ${GLIB_INCLUDE_DIRS} |
1120 | ) |
1121 | |
1122 | +add_definitions(-DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}") |
1123 | +add_definitions(-DMIR_SERVER_GRAPHICS_PLATFORM_VERSION="${MIR_SERVER_GRAPHICS_PLATFORM_VERSION}") |
1124 | + |
1125 | add_subdirectory(compositor/) |
1126 | add_subdirectory(graphics/) |
1127 | add_subdirectory(input/) |
1128 | @@ -78,8 +81,9 @@ |
1129 | ) |
1130 | |
1131 | target_link_libraries(mirserver LINK_PUBLIC |
1132 | + |
1133 | + mirclient |
1134 | mirplatform |
1135 | - mirclient |
1136 | mircommon |
1137 | mirprotobuf |
1138 | 3rd_party |
1139 | |
1140 | === modified file 'src/server/graphics/CMakeLists.txt' |
1141 | --- src/server/graphics/CMakeLists.txt 2015-01-16 02:57:31 +0000 |
1142 | +++ src/server/graphics/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1143 | @@ -1,4 +1,4 @@ |
1144 | -include_directories(${GLESv2_INCLUDE_DIRS}) |
1145 | +include_directories(${GLESv2_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}) |
1146 | |
1147 | add_library( |
1148 | mirgraphics OBJECT |
1149 | |
1150 | === modified file 'src/server/graphics/default_configuration.cpp' |
1151 | --- src/server/graphics/default_configuration.cpp 2015-01-16 02:57:31 +0000 |
1152 | +++ src/server/graphics/default_configuration.cpp 2015-01-22 15:40:28 +0000 |
1153 | @@ -30,10 +30,11 @@ |
1154 | #include "mir/graphics/gl_config.h" |
1155 | #include "mir/graphics/platform.h" |
1156 | #include "mir/graphics/cursor.h" |
1157 | +#include "mir/graphics/platform_probe.h" |
1158 | #include "program_factory.h" |
1159 | |
1160 | #include "mir/shared_library.h" |
1161 | -#include "mir/shared_library_loader.h" |
1162 | +#include "mir/shared_library_prober.h" |
1163 | #include "mir/abnormal_exit.h" |
1164 | #include "mir/emergency_cleanup.h" |
1165 | #include "mir/log.h" |
1166 | @@ -45,8 +46,15 @@ |
1167 | #include <map> |
1168 | |
1169 | namespace mg = mir::graphics; |
1170 | +namespace ml = mir::logging; |
1171 | namespace mgn = mir::graphics::nested; |
1172 | |
1173 | +namespace |
1174 | +{ |
1175 | +// TODO: Temporary, until we actually manage module lifetimes |
1176 | +static std::shared_ptr<mir::SharedLibrary> platform_library; |
1177 | +} |
1178 | + |
1179 | std::shared_ptr<mg::DisplayConfigurationPolicy> |
1180 | mir::DefaultServerConfiguration::the_display_configuration_policy() |
1181 | { |
1182 | @@ -65,7 +73,6 @@ |
1183 | return wrapped; |
1184 | } |
1185 | |
1186 | - |
1187 | namespace |
1188 | { |
1189 | //TODO: what is the point of NestedContext if its just the same as mgn:HostConnection? |
1190 | @@ -102,24 +109,49 @@ |
1191 | return graphics_platform( |
1192 | [this]()->std::shared_ptr<mg::Platform> |
1193 | { |
1194 | - auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib)); |
1195 | + // fallback to standalone if host socket is unset |
1196 | + if (the_options()->is_set(options::platform_graphics_lib)) |
1197 | + { |
1198 | + platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib)); |
1199 | + } |
1200 | + else |
1201 | + { |
1202 | + auto const& path = the_options()->get<std::string>(options::platform_path); |
1203 | + auto platforms = mir::libraries_for_path(path, *the_shared_library_prober_report()); |
1204 | + if (platforms.empty()) |
1205 | + { |
1206 | + auto msg = "Failed to find any platform plugins in: " + path; |
1207 | + throw std::runtime_error(msg.c_str()); |
1208 | + } |
1209 | + platform_library = mir::graphics::module_for_device(platforms); |
1210 | + } |
1211 | + auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>( |
1212 | + "create_host_platform", |
1213 | + MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
1214 | + auto create_guest_platform = platform_library->load_function<mg::CreateGuestPlatform>( |
1215 | + "create_guest_platform", |
1216 | + MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
1217 | + auto describe_module = platform_library->load_function<mg::DescribeModule>( |
1218 | + "describe_graphics_module", |
1219 | + MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
1220 | + auto description = describe_module(); |
1221 | + ml::log(ml::Severity::informational, |
1222 | + std::string{"Selected driver: "} + description->name + " (version " + |
1223 | + std::to_string(description->major_version) + "." + |
1224 | + std::to_string(description->minor_version) + "." + |
1225 | + std::to_string(description->micro_version) + ")", |
1226 | + "Platform Loader"); |
1227 | |
1228 | - auto create_host_platform = graphics_lib->load_function<mg::CreateHostPlatform>("create_host_platform"); |
1229 | - auto create_guest_platform = graphics_lib->load_function<mg::CreateGuestPlatform>("create_guest_platform"); |
1230 | - if (the_options()->is_set(options::host_socket_opt)) |
1231 | - { |
1232 | + if (!the_options()->is_set(options::host_socket_opt)) |
1233 | + return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report()); |
1234 | + else |
1235 | return create_guest_platform( |
1236 | the_display_report(), |
1237 | std::make_shared<MirConnectionNestedContext>(the_host_connection())); |
1238 | - } |
1239 | - else |
1240 | - { |
1241 | - return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report()); |
1242 | - } |
1243 | + |
1244 | }); |
1245 | } |
1246 | |
1247 | - |
1248 | std::shared_ptr<mg::GraphicBufferAllocator> |
1249 | mir::DefaultServerConfiguration::the_buffer_allocator() |
1250 | { |
1251 | |
1252 | === modified file 'src/server/report/default_server_configuration.cpp' |
1253 | --- src/server/report/default_server_configuration.cpp 2014-03-06 06:05:17 +0000 |
1254 | +++ src/server/report/default_server_configuration.cpp 2015-01-22 15:40:28 +0000 |
1255 | @@ -117,3 +117,12 @@ |
1256 | return report_factory(options::scene_report_opt)->create_scene_report(); |
1257 | }); |
1258 | } |
1259 | + |
1260 | +auto mir::DefaultServerConfiguration::the_shared_library_prober_report() -> std::shared_ptr<SharedLibraryProberReport> |
1261 | +{ |
1262 | + return shared_library_prober_report( |
1263 | + [this]()->std::shared_ptr<SharedLibraryProberReport> |
1264 | + { |
1265 | + return report_factory(options::shared_library_prober_report_opt)->create_shared_library_prober_report(); |
1266 | + }); |
1267 | +} |
1268 | |
1269 | === modified file 'src/server/report/logging/logging_report_factory.cpp' |
1270 | --- src/server/report/logging/logging_report_factory.cpp 2014-02-11 15:18:07 +0000 |
1271 | +++ src/server/report/logging/logging_report_factory.cpp 2015-01-22 15:40:28 +0000 |
1272 | @@ -25,6 +25,7 @@ |
1273 | #include "scene_report.h" |
1274 | #include "session_mediator_report.h" |
1275 | #include "input_report.h" |
1276 | +#include "mir/logging/shared_library_prober_report.h" |
1277 | |
1278 | #include "mir/default_server_configuration.h" |
1279 | |
1280 | @@ -72,4 +73,8 @@ |
1281 | return std::make_shared<logging::InputReport>(logger); |
1282 | } |
1283 | |
1284 | +std::shared_ptr<mir::SharedLibraryProberReport> mr::LoggingReportFactory::create_shared_library_prober_report() |
1285 | +{ |
1286 | + return std::make_shared<mir::logging::SharedLibraryProberReport>(logger); |
1287 | +} |
1288 | |
1289 | |
1290 | === modified file 'src/server/report/logging_report_factory.h' |
1291 | --- src/server/report/logging_report_factory.h 2014-02-11 15:18:07 +0000 |
1292 | +++ src/server/report/logging_report_factory.h 2015-01-22 15:40:28 +0000 |
1293 | @@ -47,6 +47,7 @@ |
1294 | std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override; |
1295 | std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override; |
1296 | std::shared_ptr<input::InputReport> create_input_report() override; |
1297 | + std::shared_ptr<mir::SharedLibraryProberReport> create_shared_library_prober_report() override; |
1298 | |
1299 | private: |
1300 | std::shared_ptr<mir::logging::Logger> const logger; |
1301 | |
1302 | === modified file 'src/server/report/lttng/CMakeLists.txt' |
1303 | --- src/server/report/lttng/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
1304 | +++ src/server/report/lttng/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1305 | @@ -17,6 +17,7 @@ |
1306 | session_mediator_report.cpp |
1307 | scene_report.cpp |
1308 | server_tracepoint_provider.cpp |
1309 | + shared_library_prober_report.cpp |
1310 | ) |
1311 | |
1312 | add_library( |
1313 | |
1314 | === modified file 'src/server/report/lttng/lttng_report_factory.cpp' |
1315 | --- src/server/report/lttng/lttng_report_factory.cpp 2014-02-11 15:18:07 +0000 |
1316 | +++ src/server/report/lttng/lttng_report_factory.cpp 2015-01-22 15:40:28 +0000 |
1317 | @@ -25,6 +25,7 @@ |
1318 | #include "message_processor_report.h" |
1319 | #include "scene_report.h" |
1320 | #include "session_mediator_report.h" |
1321 | +#include "shared_library_prober_report.h" |
1322 | |
1323 | std::shared_ptr<mir::compositor::CompositorReport> mir::report::LttngReportFactory::create_compositor_report() |
1324 | { |
1325 | @@ -61,4 +62,9 @@ |
1326 | return std::make_shared<lttng::InputReport>(); |
1327 | } |
1328 | |
1329 | +std::shared_ptr<mir::SharedLibraryProberReport> mir::report::LttngReportFactory::create_shared_library_prober_report() |
1330 | +{ |
1331 | + return std::make_shared<lttng::SharedLibraryProberReport>(); |
1332 | +} |
1333 | + |
1334 | |
1335 | |
1336 | === added file 'src/server/report/lttng/shared_library_prober_report.cpp' |
1337 | --- src/server/report/lttng/shared_library_prober_report.cpp 1970-01-01 00:00:00 +0000 |
1338 | +++ src/server/report/lttng/shared_library_prober_report.cpp 2015-01-22 15:40:28 +0000 |
1339 | @@ -0,0 +1,52 @@ |
1340 | +/* |
1341 | + * Copyright © 2014 Canonical Ltd. |
1342 | + * |
1343 | + * This program is free software: you can redistribute it and/or modify |
1344 | + * it under the terms of the GNU General Public License version 3 as |
1345 | + * published by the Free Software Foundation. |
1346 | + * |
1347 | + * This program is distributed in the hope that it will be useful, |
1348 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1349 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1350 | + * GNU General Public License for more details. |
1351 | + * |
1352 | + * You should have received a copy of the GNU General Public License |
1353 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1354 | + * |
1355 | + * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
1356 | + */ |
1357 | + |
1358 | +#include "shared_library_prober_report.h" |
1359 | + |
1360 | +#include "mir/report/lttng/mir_tracepoint.h" |
1361 | + |
1362 | +#define TRACEPOINT_DEFINE |
1363 | +#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE |
1364 | +#include "shared_library_prober_report_tp.h" |
1365 | + |
1366 | +namespace mrl = mir::report::lttng; |
1367 | +namespace bf = boost::filesystem; |
1368 | + |
1369 | +void mrl::SharedLibraryProberReport::probing_path(bf::path const& path) |
1370 | +{ |
1371 | + mir_tracepoint(mir_server_shared_library_prober, probing_path, |
1372 | + path.string().c_str()); |
1373 | +} |
1374 | + |
1375 | +void mrl::SharedLibraryProberReport::probing_failed(bf::path const& path, std::exception const& error) |
1376 | +{ |
1377 | + mir_tracepoint(mir_server_shared_library_prober, probing_failed, |
1378 | + path.string().c_str(), error.what()); |
1379 | +} |
1380 | + |
1381 | +void mrl::SharedLibraryProberReport::loading_library(bf::path const& filename) |
1382 | +{ |
1383 | + mir_tracepoint(mir_server_shared_library_prober, loading_library, |
1384 | + filename.string().c_str()); |
1385 | +} |
1386 | + |
1387 | +void mrl::SharedLibraryProberReport::loading_failed(bf::path const& filename, std::exception const& error) |
1388 | +{ |
1389 | + mir_tracepoint(mir_server_shared_library_prober, loading_failed, |
1390 | + filename.string().c_str(), error.what()); |
1391 | +} |
1392 | |
1393 | === added file 'src/server/report/lttng/shared_library_prober_report.h' |
1394 | --- src/server/report/lttng/shared_library_prober_report.h 1970-01-01 00:00:00 +0000 |
1395 | +++ src/server/report/lttng/shared_library_prober_report.h 2015-01-22 15:40:28 +0000 |
1396 | @@ -0,0 +1,48 @@ |
1397 | +/* |
1398 | + * Copyright © 2014 Canonical Ltd. |
1399 | + * |
1400 | + * This program is free software: you can redistribute it and/or modify it |
1401 | + * under the terms of the GNU General Public License version 3, |
1402 | + * as published by the Free Software Foundation. |
1403 | + * |
1404 | + * This program is distributed in the hope that it will be useful, |
1405 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1406 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1407 | + * GNU General Public License for more details. |
1408 | + * |
1409 | + * You should have received a copy of the GNU General Public License |
1410 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1411 | + * |
1412 | + * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
1413 | + */ |
1414 | + |
1415 | +#ifndef MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_ |
1416 | +#define MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_ |
1417 | + |
1418 | +#include "server_tracepoint_provider.h" |
1419 | +#include "mir/shared_library_prober_report.h" |
1420 | + |
1421 | +namespace mir |
1422 | +{ |
1423 | +namespace report |
1424 | +{ |
1425 | +namespace lttng |
1426 | +{ |
1427 | + |
1428 | +class SharedLibraryProberReport : public mir::SharedLibraryProberReport |
1429 | +{ |
1430 | +public: |
1431 | + void probing_path(boost::filesystem::path const& path) override; |
1432 | + void probing_failed(boost::filesystem::path const& path, std::exception const& error) override; |
1433 | + void loading_library(boost::filesystem::path const& filename) override; |
1434 | + void loading_failed(boost::filesystem::path const& filename, std::exception const& error) override; |
1435 | + |
1436 | +private: |
1437 | + ServerTracepointProvider tp_provider; |
1438 | +}; |
1439 | + |
1440 | +} |
1441 | +} |
1442 | +} |
1443 | + |
1444 | +#endif /* MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_ */ |
1445 | |
1446 | === added file 'src/server/report/lttng/shared_library_prober_report_tp.h' |
1447 | --- src/server/report/lttng/shared_library_prober_report_tp.h 1970-01-01 00:00:00 +0000 |
1448 | +++ src/server/report/lttng/shared_library_prober_report_tp.h 2015-01-22 15:40:28 +0000 |
1449 | @@ -0,0 +1,70 @@ |
1450 | +/* |
1451 | + * Copyright © 2014 Canonical Ltd. |
1452 | + * |
1453 | + * This program is free software: you can redistribute it and/or modify it |
1454 | + * under the terms of the GNU General Public License version 3, |
1455 | + * as published by the Free Software Foundation. |
1456 | + * |
1457 | + * This program is distributed in the hope that it will be useful, |
1458 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1459 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1460 | + * GNU General Public License for more details. |
1461 | + * |
1462 | + * You should have received a copy of the GNU General Public License |
1463 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1464 | + * |
1465 | + * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> |
1466 | + */ |
1467 | + |
1468 | +#undef TRACEPOINT_PROVIDER |
1469 | +#define TRACEPOINT_PROVIDER mir_server_shared_library_prober |
1470 | + |
1471 | +#undef TRACEPOINT_INCLUDE |
1472 | +#define TRACEPOINT_INCLUDE "./shared_library_prober_report_tp.h" |
1473 | + |
1474 | +#if !defined(MIR_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ) |
1475 | +#define MIR_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_ |
1476 | + |
1477 | +#include "lttng_utils.h" |
1478 | + |
1479 | +TRACEPOINT_EVENT( |
1480 | + mir_server_shared_library_prober, |
1481 | + probing_path, |
1482 | + TP_ARGS(const char*, path), |
1483 | + TP_FIELDS( |
1484 | + ctf_string(path, path) |
1485 | + ) |
1486 | +) |
1487 | + |
1488 | +TRACEPOINT_EVENT( |
1489 | + mir_server_shared_library_prober, |
1490 | + probing_failed, |
1491 | + TP_ARGS(const char*, path, const char*, message), |
1492 | + TP_FIELDS( |
1493 | + ctf_string(path, path) |
1494 | + ctf_string(message, message) |
1495 | + ) |
1496 | +) |
1497 | + |
1498 | +TRACEPOINT_EVENT( |
1499 | + mir_server_shared_library_prober, |
1500 | + loading_library, |
1501 | + TP_ARGS(const char*, path), |
1502 | + TP_FIELDS( |
1503 | + ctf_string(path, path) |
1504 | + ) |
1505 | +) |
1506 | + |
1507 | +TRACEPOINT_EVENT( |
1508 | + mir_server_shared_library_prober, |
1509 | + loading_failed, |
1510 | + TP_ARGS(const char*, path, const char*, message), |
1511 | + TP_FIELDS( |
1512 | + ctf_string(path, path) |
1513 | + ctf_string(message, message) |
1514 | + ) |
1515 | +) |
1516 | + |
1517 | +#endif /* MIR_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_ */ |
1518 | + |
1519 | +#include <lttng/tracepoint-event.h> |
1520 | |
1521 | === modified file 'src/server/report/lttng/tracepoints.c' |
1522 | --- src/server/report/lttng/tracepoints.c 2014-02-03 11:44:32 +0000 |
1523 | +++ src/server/report/lttng/tracepoints.c 2015-01-22 15:40:28 +0000 |
1524 | @@ -8,3 +8,4 @@ |
1525 | #include "session_mediator_report_tp.h" |
1526 | #include "scene_report_tp.h" |
1527 | #include "message_processor_report_tp.h" |
1528 | +#include "shared_library_prober_report_tp.h" |
1529 | |
1530 | === modified file 'src/server/report/lttng_report_factory.h' |
1531 | --- src/server/report/lttng_report_factory.h 2014-02-11 15:18:07 +0000 |
1532 | +++ src/server/report/lttng_report_factory.h 2015-01-22 15:40:28 +0000 |
1533 | @@ -35,6 +35,7 @@ |
1534 | std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override; |
1535 | std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override; |
1536 | std::shared_ptr<input::InputReport> create_input_report() override; |
1537 | + std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() override; |
1538 | }; |
1539 | } |
1540 | } |
1541 | |
1542 | === modified file 'src/server/report/null/null_report_factory.cpp' |
1543 | --- src/server/report/null/null_report_factory.cpp 2014-02-17 22:35:23 +0000 |
1544 | +++ src/server/report/null/null_report_factory.cpp 2015-01-22 15:40:28 +0000 |
1545 | @@ -25,6 +25,7 @@ |
1546 | #include "display_report.h" |
1547 | #include "input_report.h" |
1548 | #include "scene_report.h" |
1549 | +#include "mir/logging/null_shared_library_prober_report.h" |
1550 | |
1551 | std::shared_ptr<mir::compositor::CompositorReport> mir::report::NullReportFactory::create_compositor_report() |
1552 | { |
1553 | @@ -61,11 +62,21 @@ |
1554 | return std::make_shared<null::InputReport>(); |
1555 | } |
1556 | |
1557 | +std::shared_ptr<mir::SharedLibraryProberReport> mir::report::NullReportFactory::create_shared_library_prober_report() |
1558 | +{ |
1559 | + return std::make_shared<logging::NullSharedLibraryProberReport>(); |
1560 | +} |
1561 | + |
1562 | std::shared_ptr<mir::compositor::CompositorReport> mir::report::null_compositor_report() |
1563 | { |
1564 | return NullReportFactory{}.create_compositor_report(); |
1565 | } |
1566 | |
1567 | +std::shared_ptr<mir::SharedLibraryProberReport> mir::report::null_shared_library_prober_report() |
1568 | +{ |
1569 | + return NullReportFactory{}.create_shared_library_prober_report(); |
1570 | +} |
1571 | + |
1572 | std::shared_ptr<mir::graphics::DisplayReport> mir::report::null_display_report() |
1573 | { |
1574 | return NullReportFactory{}.create_display_report(); |
1575 | |
1576 | === modified file 'src/server/report/null_report_factory.h' |
1577 | --- src/server/report/null_report_factory.h 2014-02-17 22:35:23 +0000 |
1578 | +++ src/server/report/null_report_factory.h 2015-01-22 15:40:28 +0000 |
1579 | @@ -35,6 +35,7 @@ |
1580 | std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override; |
1581 | std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override; |
1582 | std::shared_ptr<input::InputReport> create_input_report() override; |
1583 | + std::shared_ptr<mir::SharedLibraryProberReport> create_shared_library_prober_report() override; |
1584 | }; |
1585 | |
1586 | std::shared_ptr<compositor::CompositorReport> null_compositor_report(); |
1587 | @@ -44,6 +45,7 @@ |
1588 | std::shared_ptr<frontend::SessionMediatorReport> null_session_mediator_report(); |
1589 | std::shared_ptr<frontend::MessageProcessorReport> null_message_processor_report(); |
1590 | std::shared_ptr<input::InputReport> null_input_report(); |
1591 | +std::shared_ptr<mir::SharedLibraryProberReport> null_shared_library_prober_report(); |
1592 | |
1593 | } |
1594 | } |
1595 | |
1596 | === modified file 'src/server/report/report_factory.h' |
1597 | --- src/server/report/report_factory.h 2014-02-11 15:18:07 +0000 |
1598 | +++ src/server/report/report_factory.h 2015-01-22 15:40:28 +0000 |
1599 | @@ -23,6 +23,7 @@ |
1600 | |
1601 | namespace mir |
1602 | { |
1603 | +class SharedLibraryProberReport; |
1604 | namespace compositor |
1605 | { |
1606 | class CompositorReport; |
1607 | @@ -59,6 +60,7 @@ |
1608 | virtual std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() = 0; |
1609 | virtual std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() = 0; |
1610 | virtual std::shared_ptr<input::InputReport> create_input_report() = 0; |
1611 | + virtual std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() = 0; |
1612 | |
1613 | protected: |
1614 | ReportFactory() = default; |
1615 | |
1616 | === modified file 'src/server/server.cpp' |
1617 | --- src/server/server.cpp 2015-01-19 11:40:40 +0000 |
1618 | +++ src/server/server.cpp 2015-01-22 15:40:28 +0000 |
1619 | @@ -188,12 +188,15 @@ |
1620 | // TODO this is an ugly frig to avoid exposing the render factory to end users and tests running headless |
1621 | auto the_renderer_factory() -> std::shared_ptr<compositor::RendererFactory> override |
1622 | { |
1623 | - auto const graphics_lib = the_options()->get<std::string>(options::platform_graphics_lib); |
1624 | + auto const& options = the_options(); |
1625 | + if (options->is_set(options::platform_graphics_lib)) |
1626 | + { |
1627 | + auto const graphics_lib = options->get<std::string>(options::platform_graphics_lib); |
1628 | |
1629 | - if (graphics_lib != "libmirplatformstub.so") |
1630 | - return mir::DefaultServerConfiguration::the_renderer_factory(); |
1631 | - else |
1632 | - return std::make_shared<StubRendererFactory>(); |
1633 | + if (graphics_lib.find("graphics-dummy.so") != std::string::npos) |
1634 | + return std::make_shared<StubRendererFactory>(); |
1635 | + } |
1636 | + return mir::DefaultServerConfiguration::the_renderer_factory(); |
1637 | } |
1638 | |
1639 | using mir::DefaultServerConfiguration::the_options; |
1640 | |
1641 | === modified file 'src/server/symbols.map' |
1642 | --- src/server/symbols.map 2015-01-21 08:38:18 +0000 |
1643 | +++ src/server/symbols.map 2015-01-22 15:40:28 +0000 |
1644 | @@ -110,6 +110,7 @@ |
1645 | mir::DefaultServerConfiguration::the_session_event_sink*; |
1646 | mir::DefaultServerConfiguration::the_session_listener*; |
1647 | mir::DefaultServerConfiguration::the_session_mediator_report*; |
1648 | + mir::DefaultServerConfiguration::the_shared_library_prober_report*; |
1649 | mir::DefaultServerConfiguration::the_shell_display_layout*; |
1650 | mir::DefaultServerConfiguration::the_shell_focus_setter*; |
1651 | mir::DefaultServerConfiguration::the_snapshot_strategy*; |
1652 | @@ -594,6 +595,7 @@ |
1653 | non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_event_sink*; |
1654 | non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_listener*; |
1655 | non-virtual?thunk?to?mir::DefaultServerConfiguration::the_session_mediator_report*; |
1656 | + non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shared_library_prober_report*; |
1657 | non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shell_display_layout*; |
1658 | non-virtual?thunk?to?mir::DefaultServerConfiguration::the_shell_focus_setter*; |
1659 | non-virtual?thunk?to?mir::DefaultServerConfiguration::the_snapshot_strategy*; |
1660 | |
1661 | === modified file 'src/wrapper.c' |
1662 | --- src/wrapper.c 2015-01-14 06:39:13 +0000 |
1663 | +++ src/wrapper.c 2015-01-22 15:40:28 +0000 |
1664 | @@ -46,6 +46,9 @@ |
1665 | *dest_max = '\0'; |
1666 | setenv("MIR_CLIENT_PLATFORM_PATH", path, 1); |
1667 | printf("MIR_CLIENT_PLATFORM_PATH=%s\n", path); |
1668 | + strncpy(pivot+7, "server-modules/", pivot_max-7); |
1669 | + setenv("MIR_SERVER_PLATFORM_PATH", path, 1); |
1670 | + printf("MIR_SERVER_PLATFORM_PATH=%s\n", path); |
1671 | |
1672 | pivot[6] = '\0'; /* truncate lib/client-modules to just lib */ |
1673 | setenv("LD_LIBRARY_PATH", path, 1); |
1674 | |
1675 | === modified file 'tests/acceptance-tests/CMakeLists.txt' |
1676 | --- tests/acceptance-tests/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
1677 | +++ tests/acceptance-tests/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1678 | @@ -4,10 +4,6 @@ |
1679 | ${CMAKE_SOURCE_DIR} |
1680 | ) |
1681 | |
1682 | -add_definitions( |
1683 | - -DMIR_PLATFORM_DRIVER_BINARY="${MIR_PLATFORM_DRIVER_BINARY}" |
1684 | -) |
1685 | - |
1686 | set( |
1687 | SOURCES |
1688 | |
1689 | @@ -67,9 +63,9 @@ |
1690 | mirplatform |
1691 | |
1692 | mir-test |
1693 | + mir-test-framework |
1694 | mir-test-doubles |
1695 | mir-test-doubles-platform |
1696 | - mir-test-framework |
1697 | 3rd_party |
1698 | |
1699 | ${PROTOBUF_LIBRARIES} |
1700 | |
1701 | === modified file 'tests/acceptance-tests/server_configuration_wrapping.cpp' |
1702 | --- tests/acceptance-tests/server_configuration_wrapping.cpp 2014-11-06 03:56:24 +0000 |
1703 | +++ tests/acceptance-tests/server_configuration_wrapping.cpp 2015-01-22 15:40:28 +0000 |
1704 | @@ -21,11 +21,14 @@ |
1705 | |
1706 | #include "mir_test_framework/headless_test.h" |
1707 | |
1708 | +#include "mir_test_framework/executable_path.h" |
1709 | + |
1710 | #include <gtest/gtest.h> |
1711 | #include <gmock/gmock.h> |
1712 | |
1713 | namespace ms = mir::scene; |
1714 | namespace msh = mir::shell; |
1715 | +namespace mtf = mir_test_framework; |
1716 | |
1717 | using namespace testing; |
1718 | |
1719 | |
1720 | === modified file 'tests/acceptance-tests/test_symbols_required_by_mesa.cpp' |
1721 | --- tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2015-01-14 06:39:13 +0000 |
1722 | +++ tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2015-01-22 15:40:28 +0000 |
1723 | @@ -28,7 +28,7 @@ |
1724 | |
1725 | TEST(SymbolsRequiredByMesa, are_exported_by_client_platform_mesa) |
1726 | { |
1727 | - auto const handle = dlopen((mtf::library_path() + "/client-modules/mesa.so").c_str(), RTLD_LAZY); |
1728 | + auto const handle = dlopen(mtf::client_platform("mesa.so").c_str(), RTLD_LAZY); |
1729 | ASSERT_THAT(handle, NotNull()); |
1730 | |
1731 | auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid"); |
1732 | @@ -39,7 +39,7 @@ |
1733 | |
1734 | TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics) |
1735 | { |
1736 | - auto const handle = dlopen(MIR_PLATFORM_DRIVER_BINARY, RTLD_LAZY); |
1737 | + auto const handle = dlopen(mtf::server_platform("graphics-mesa.so").c_str(), RTLD_LAZY); |
1738 | ASSERT_THAT(handle, NotNull()); |
1739 | |
1740 | auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid"); |
1741 | |
1742 | === modified file 'tests/include/mir_test_framework/client_platform_factory.h' |
1743 | --- tests/include/mir_test_framework/client_platform_factory.h 2015-01-15 15:17:02 +0000 |
1744 | +++ tests/include/mir_test_framework/client_platform_factory.h 2015-01-22 15:40:28 +0000 |
1745 | @@ -37,7 +37,7 @@ |
1746 | mtd::MockClientContext ctx; |
1747 | ON_CALL(ctx, populate(_)) |
1748 | .WillByDefault(Invoke([](MirPlatformPackage& package) { ::memset(&package, 0, sizeof(package)); })); |
1749 | - platform_library = std::make_shared<mir::SharedLibrary>(library_path() + "/client-modules/android.so"); |
1750 | + platform_library = std::make_shared<mir::SharedLibrary>(client_platform("android.so")); |
1751 | auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform"); |
1752 | return platform_factory(&ctx); |
1753 | } |
1754 | @@ -52,7 +52,7 @@ |
1755 | ::memset(&package, 0, sizeof(package)); |
1756 | package.fd_items = 1; |
1757 | })); |
1758 | - platform_library = std::make_shared<mir::SharedLibrary>(library_path() + "/client-modules/mesa.so"); |
1759 | + platform_library = std::make_shared<mir::SharedLibrary>(client_platform("mesa.so")); |
1760 | auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform"); |
1761 | return platform_factory(&ctx); |
1762 | } |
1763 | |
1764 | === modified file 'tests/include/mir_test_framework/executable_path.h' |
1765 | --- tests/include/mir_test_framework/executable_path.h 2015-01-14 06:39:13 +0000 |
1766 | +++ tests/include/mir_test_framework/executable_path.h 2015-01-22 15:40:28 +0000 |
1767 | @@ -26,5 +26,7 @@ |
1768 | std::string executable_path(); |
1769 | |
1770 | std::string library_path(); |
1771 | +std::string server_platform(std::string const& name); |
1772 | +std::string client_platform(std::string const& name); |
1773 | } |
1774 | #endif /* MIR_TEST_FRAMEWORK_EXECUTABLE_PATH_H_ */ |
1775 | |
1776 | === modified file 'tests/include/mir_test_framework/headless_test.h' |
1777 | --- tests/include/mir_test_framework/headless_test.h 2015-01-14 06:39:13 +0000 |
1778 | +++ tests/include/mir_test_framework/headless_test.h 2015-01-22 15:40:28 +0000 |
1779 | @@ -32,7 +32,7 @@ |
1780 | { |
1781 | /** Basic fixture for tests that don't use graphics hardware. |
1782 | * This provides a mechanism for temporarily setting environment variables. |
1783 | - * It automatically sets "MIR_SERVER_PLATFORM_GRAPHICS_LIB" to "libmirplatformstub.so" |
1784 | + * It automatically sets "MIR_SERVER_PLATFORM_GRAPHICS_LIB" to "graphics-dummy.so" |
1785 | * as the tests do not hit the graphics hardware. |
1786 | */ |
1787 | class HeadlessTest : public ::testing::Test, public AsyncServerRunner |
1788 | |
1789 | === added file 'tests/include/mir_test_framework/stub_server_platform_factory.h' |
1790 | --- tests/include/mir_test_framework/stub_server_platform_factory.h 1970-01-01 00:00:00 +0000 |
1791 | +++ tests/include/mir_test_framework/stub_server_platform_factory.h 2015-01-22 15:40:28 +0000 |
1792 | @@ -0,0 +1,49 @@ |
1793 | +/* |
1794 | + * Copyright © 2014 Canonical Ltd. |
1795 | + * |
1796 | + * This program is free software: you can redistribute it and/or modify it |
1797 | + * under the terms of the GNU General Public License version 3, |
1798 | + * as published by the Free Software Foundation. |
1799 | + * |
1800 | + * This program is distributed in the hope that it will be useful, |
1801 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1802 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1803 | + * GNU General Public License for more details. |
1804 | + * |
1805 | + * You should have received a copy of the GNU General Public License |
1806 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1807 | + * |
1808 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
1809 | + */ |
1810 | + |
1811 | +#ifndef MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_ |
1812 | +#define MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_ |
1813 | + |
1814 | +#include "mir/geometry/rectangle.h" |
1815 | + |
1816 | +#include "mir/graphics/platform.h" |
1817 | +#include <vector> |
1818 | + |
1819 | +namespace geom = mir::geometry; |
1820 | + |
1821 | +namespace mir |
1822 | +{ |
1823 | +namespace graphics |
1824 | +{ |
1825 | +class Platform; |
1826 | +} |
1827 | +} |
1828 | + |
1829 | +namespace mg = mir::graphics; |
1830 | + |
1831 | +namespace mir_test_framework |
1832 | +{ |
1833 | + |
1834 | +std::shared_ptr<mg::Platform> make_stubbed_server_graphics_platform(std::vector<geom::Rectangle> const& display_rects); |
1835 | + |
1836 | +void set_next_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects); |
1837 | + |
1838 | +void set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display); |
1839 | + |
1840 | +} |
1841 | +#endif /* MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_ */ |
1842 | |
1843 | === modified file 'tests/integration-tests/CMakeLists.txt' |
1844 | --- tests/integration-tests/CMakeLists.txt 2015-01-21 17:30:44 +0000 |
1845 | +++ tests/integration-tests/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1846 | @@ -99,6 +99,15 @@ |
1847 | ${GTEST_BOTH_LIBRARIES} |
1848 | ${GMOCK_LIBRARY} |
1849 | ${GMOCK_MAIN_LIBRARY} |
1850 | + # Mesa platform dependencies |
1851 | + ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
1852 | + ${GBM_LDFLAGS} ${GBM_LIBRARIES} |
1853 | + # Android platform dependencies |
1854 | + ${LIBHARDWARE_LIBRARIES} |
1855 | + ${ANDROID_PROPERTIES_LIBRARIES} |
1856 | + # Shared platform dependencies |
1857 | + ${EGL_LDFLAGS} ${EGL_LIBRARIES} |
1858 | + ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} |
1859 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1860 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
1861 | ${GBM_LDFLAGS} ${GBM_LIBRARIES} |
1862 | @@ -108,7 +117,7 @@ |
1863 | ${MIR_SERVER_REFERENCES} |
1864 | ) |
1865 | |
1866 | -if (MIR_TEST_PLATFORM STREQUAL "android") |
1867 | +if (MIR_BUILD_PLATFORM_ANDROID) |
1868 | target_link_libraries(mir_integration_tests |
1869 | mirsharedandroid |
1870 | ${ANDROID_PROPERTIES_LDFLAGS} |
1871 | |
1872 | === modified file 'tests/mir_test_doubles/CMakeLists.txt' |
1873 | --- tests/mir_test_doubles/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
1874 | +++ tests/mir_test_doubles/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1875 | @@ -31,16 +31,18 @@ |
1876 | ) |
1877 | |
1878 | if (MIR_BUILD_PLATFORM_MESA) |
1879 | -include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}) |
1880 | -list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS |
1881 | - ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp |
1882 | - ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp |
1883 | -) |
1884 | + include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}) |
1885 | + list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS |
1886 | + ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp |
1887 | + ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp |
1888 | + ) |
1889 | endif() |
1890 | + |
1891 | if (MIR_BUILD_PLATFORM_ANDROID) |
1892 | -list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS |
1893 | - ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp |
1894 | -) |
1895 | + include_directories(SYSTEM ${ANDROID_HEADERS_INCLUDE_DIRS}) |
1896 | + list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS |
1897 | + ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp |
1898 | + ) |
1899 | endif() |
1900 | |
1901 | add_library( |
1902 | |
1903 | === modified file 'tests/mir_test_framework/CMakeLists.txt' |
1904 | --- tests/mir_test_framework/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
1905 | +++ tests/mir_test_framework/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
1906 | @@ -11,6 +11,11 @@ |
1907 | ${ANDROID_HEADERS_INCLUDE_DIRS} |
1908 | ) |
1909 | |
1910 | +add_definitions( |
1911 | + -DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}" |
1912 | + -DMIR_SERVER_PLATFORM_PATH="${MIR_SERVER_PLATFORM_PATH}" |
1913 | + ) |
1914 | + |
1915 | set( |
1916 | TEST_FRAMEWORK_SRCS |
1917 | |
1918 | @@ -34,6 +39,7 @@ |
1919 | process.cpp |
1920 | using_stub_client_platform.cpp |
1921 | stub_client_platform_factory.cpp |
1922 | + stub_server_platform_factory.cpp |
1923 | udev_environment.cpp |
1924 | declarative_placement_strategy.cpp |
1925 | fake_event_hub_server_configuration.cpp |
1926 | @@ -59,8 +65,8 @@ |
1927 | target_link_libraries( |
1928 | mir-test-framework |
1929 | |
1930 | - mirplatformstub |
1931 | 3rd_party |
1932 | + mir-test-doubles |
1933 | |
1934 | ${PROTOBUF_LIBRARIES} |
1935 | ${Boost_LIBRARIES} |
1936 | @@ -94,6 +100,31 @@ |
1937 | LINK_FLAGS "-Wl,--version-script,${symbol_map}" |
1938 | ) |
1939 | |
1940 | +set(server_symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-server.map) |
1941 | +add_library( |
1942 | + mirplatformgraphicsstub MODULE |
1943 | + |
1944 | + platform_graphics_dummy.cpp |
1945 | + stubbed_graphics_platform.cpp |
1946 | +) |
1947 | + |
1948 | +target_link_libraries( |
1949 | + mirplatformgraphicsstub |
1950 | + |
1951 | + mir-test |
1952 | + mir-test-framework |
1953 | + mir-test-doubles |
1954 | + ${UMOCKDEV_LDFLAGS} ${UMOCKDEV_LIBRARIES} |
1955 | +) |
1956 | + |
1957 | +set_target_properties( |
1958 | + mirplatformgraphicsstub PROPERTIES; |
1959 | + LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules |
1960 | + OUTPUT_NAME graphics-dummy |
1961 | + PREFIX "" |
1962 | + LINK_FLAGS "-Wl,--version-script,${server_symbol_map}" |
1963 | +) |
1964 | + |
1965 | add_custom_command(TARGET mir-test-framework POST_BUILD |
1966 | COMMAND ${CMAKE_COMMAND} -E copy_directory |
1967 | ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings |
1968 | @@ -105,21 +136,8 @@ |
1969 | COMMENT "Copying testing cursor themes to build dir..." |
1970 | ) |
1971 | |
1972 | -add_library( |
1973 | - mirplatformstub SHARED |
1974 | - stubbed_graphics_platform.cpp |
1975 | -) |
1976 | - |
1977 | -target_link_libraries(mirplatformstub |
1978 | - mirplatform |
1979 | - mir-test-doubles |
1980 | - mir-test |
1981 | -) |
1982 | - |
1983 | -set_target_properties(mirplatformstub |
1984 | - PROPERTIES |
1985 | - LINK_FLAGS "-Wl,--exclude-libs=ALL" |
1986 | -) |
1987 | - |
1988 | -install(TARGETS mirplatformstub LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
1989 | +string (REPLACE " -Wl,--no-undefined" " " CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) |
1990 | + |
1991 | +install(TARGETS mirplatformgraphicsstub LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH}) |
1992 | + |
1993 | install(TARGETS mirclientplatformstub LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH}) |
1994 | |
1995 | === modified file 'tests/mir_test_framework/executable_path.cpp' |
1996 | --- tests/mir_test_framework/executable_path.cpp 2015-01-14 06:39:13 +0000 |
1997 | +++ tests/mir_test_framework/executable_path.cpp 2015-01-22 15:40:28 +0000 |
1998 | @@ -24,6 +24,7 @@ |
1999 | #include <stdexcept> |
2000 | #include <boost/throw_exception.hpp> |
2001 | #include <boost/exception/errinfo_errno.hpp> |
2002 | +#include <boost/filesystem.hpp> |
2003 | |
2004 | std::string mir_test_framework::executable_path() |
2005 | { |
2006 | @@ -43,3 +44,29 @@ |
2007 | { |
2008 | return executable_path() + "/../lib"; |
2009 | } |
2010 | + |
2011 | +std::string mir_test_framework::server_platform(std::string const& name) |
2012 | +{ |
2013 | + for (auto const& option : |
2014 | + {library_path() + "/server-modules/", library_path() + "/server-platform/", std::string(MIR_SERVER_PLATFORM_PATH) + '/'}) |
2015 | + { |
2016 | + auto path_to_test = option + name; |
2017 | + if (boost::filesystem::exists(path_to_test)) |
2018 | + return path_to_test; |
2019 | + } |
2020 | + |
2021 | + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to find server platform in standard search locations")); |
2022 | +} |
2023 | + |
2024 | +std::string mir_test_framework::client_platform(std::string const& name) |
2025 | +{ |
2026 | + for (auto const& option : |
2027 | + {library_path() + "/client-modules/", library_path() + "/client-platform/", std::string(MIR_CLIENT_PLATFORM_PATH) + '/'}) |
2028 | + { |
2029 | + auto path_to_test = option + name; |
2030 | + if (boost::filesystem::exists(path_to_test)) |
2031 | + return path_to_test; |
2032 | + } |
2033 | + |
2034 | + BOOST_THROW_EXCEPTION(std::runtime_error("Failed to find server platform in standard search locations")); |
2035 | +} |
2036 | |
2037 | === modified file 'tests/mir_test_framework/headless_test.cpp' |
2038 | --- tests/mir_test_framework/headless_test.cpp 2015-01-14 06:39:13 +0000 |
2039 | +++ tests/mir_test_framework/headless_test.cpp 2015-01-22 15:40:28 +0000 |
2040 | @@ -17,52 +17,30 @@ |
2041 | */ |
2042 | |
2043 | #include "mir_test_framework/headless_test.h" |
2044 | +#include "mir_test_framework/stub_server_platform_factory.h" |
2045 | |
2046 | #include "mir/shared_library.h" |
2047 | #include "mir/geometry/rectangle.h" |
2048 | +#include "mir_test_framework/executable_path.h" |
2049 | |
2050 | #include <boost/throw_exception.hpp> |
2051 | |
2052 | namespace geom = mir::geometry; |
2053 | namespace mtf = mir_test_framework; |
2054 | |
2055 | -namespace |
2056 | -{ |
2057 | -const char* const mir_server_platform_graphics_lib = "MIR_SERVER_PLATFORM_GRAPHICS_LIB"; |
2058 | - |
2059 | -std::chrono::seconds const timeout{10}; |
2060 | -} |
2061 | - |
2062 | mtf::HeadlessTest::HeadlessTest() |
2063 | { |
2064 | - add_to_environment(mir_server_platform_graphics_lib, "libmirplatformstub.so"); |
2065 | + add_to_environment("MIR_SERVER_PLATFORM_GRAPHICS_LIB", mtf::server_platform("graphics-dummy.so").c_str()); |
2066 | } |
2067 | |
2068 | mtf::HeadlessTest::~HeadlessTest() noexcept = default; |
2069 | |
2070 | - |
2071 | void mtf::HeadlessTest::preset_display(std::shared_ptr<mir::graphics::Display> const& display) |
2072 | { |
2073 | - if (!server_platform_graphics_lib) |
2074 | - server_platform_graphics_lib.reset(new mir::SharedLibrary{getenv(mir_server_platform_graphics_lib)}); |
2075 | - |
2076 | - typedef void (*PresetDisplay)(std::shared_ptr<mir::graphics::Display> const&); |
2077 | - |
2078 | - auto const preset_display = |
2079 | - server_platform_graphics_lib->load_function<PresetDisplay>("preset_display"); |
2080 | - |
2081 | - preset_display(display); |
2082 | + mtf::set_next_preset_display(display); |
2083 | } |
2084 | |
2085 | void mtf::HeadlessTest::initial_display_layout(std::vector<geom::Rectangle> const& display_rects) |
2086 | { |
2087 | - if (!server_platform_graphics_lib) |
2088 | - server_platform_graphics_lib.reset(new mir::SharedLibrary{getenv(mir_server_platform_graphics_lib)}); |
2089 | - |
2090 | - typedef void (*SetDisplayRects)(std::unique_ptr<std::vector<geom::Rectangle>>&&); |
2091 | - |
2092 | - auto const set_display_rects = |
2093 | - server_platform_graphics_lib->load_function<SetDisplayRects>("set_display_rects"); |
2094 | - |
2095 | - set_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>(new std::vector<geom::Rectangle>(display_rects))); |
2096 | + mtf::set_next_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>(new std::vector<geom::Rectangle>(display_rects))); |
2097 | } |
2098 | |
2099 | === added file 'tests/mir_test_framework/platform_graphics_dummy.cpp' |
2100 | --- tests/mir_test_framework/platform_graphics_dummy.cpp 1970-01-01 00:00:00 +0000 |
2101 | +++ tests/mir_test_framework/platform_graphics_dummy.cpp 2015-01-22 15:40:28 +0000 |
2102 | @@ -0,0 +1,36 @@ |
2103 | +/* |
2104 | + * Copyright © 2014 Canonical Ltd. |
2105 | + * |
2106 | + * This program is free software: you can redistribute it and/or modify it |
2107 | + * under the terms of the GNU General Public License version 3, |
2108 | + * as published by the Free Software Foundation. |
2109 | + * |
2110 | + * This program is distributed in the hope that it will be useful, |
2111 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2112 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2113 | + * GNU General Public License for more details. |
2114 | + * |
2115 | + * You should have received a copy of the GNU General Public License |
2116 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2117 | + * |
2118 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>> |
2119 | + */ |
2120 | + |
2121 | +#include "mir/graphics/platform.h" |
2122 | + |
2123 | +extern "C" mir::graphics::PlatformPriority probe_graphics_platform() |
2124 | +{ |
2125 | + return mir::graphics::supported; |
2126 | +} |
2127 | + |
2128 | +mir::ModuleProperties const description { |
2129 | + "dummy", |
2130 | + MIR_VERSION_MAJOR, |
2131 | + MIR_VERSION_MINOR, |
2132 | + MIR_VERSION_MICRO |
2133 | +}; |
2134 | + |
2135 | +extern "C" mir::ModuleProperties const* describe_graphics_module() |
2136 | +{ |
2137 | + return &description; |
2138 | +} |
2139 | |
2140 | === modified file 'tests/mir_test_framework/stub_client_platform_factory.cpp' |
2141 | --- tests/mir_test_framework/stub_client_platform_factory.cpp 2015-01-15 15:17:02 +0000 |
2142 | +++ tests/mir_test_framework/stub_client_platform_factory.cpp 2015-01-22 15:40:28 +0000 |
2143 | @@ -22,6 +22,7 @@ |
2144 | #include "mir/client_buffer.h" |
2145 | #include "mir/client_platform.h" |
2146 | |
2147 | +#include <unistd.h> |
2148 | #include <string.h> |
2149 | |
2150 | namespace mcl = mir::client; |
2151 | |
2152 | === added file 'tests/mir_test_framework/stub_server_platform_factory.cpp' |
2153 | --- tests/mir_test_framework/stub_server_platform_factory.cpp 1970-01-01 00:00:00 +0000 |
2154 | +++ tests/mir_test_framework/stub_server_platform_factory.cpp 2015-01-22 15:40:28 +0000 |
2155 | @@ -0,0 +1,72 @@ |
2156 | + |
2157 | +/* |
2158 | + * Copyright © 2014 Canonical Ltd. |
2159 | + * |
2160 | + * This program is free software: you can redistribute it and/or modify it |
2161 | + * under the terms of the GNU General Public License version 3, |
2162 | + * as published by the Free Software Foundation. |
2163 | + * |
2164 | + * This program is distributed in the hope that it will be useful, |
2165 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2166 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2167 | + * GNU General Public License for more details. |
2168 | + * |
2169 | + * You should have received a copy of the GNU General Public License |
2170 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2171 | + * |
2172 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
2173 | + */ |
2174 | + |
2175 | +#include "mir/shared_library.h" |
2176 | + |
2177 | +#include "mir/geometry/rectangle.h" |
2178 | + |
2179 | +#include "mir_test_framework/executable_path.h" |
2180 | +#include "mir_test_framework/stub_server_platform_factory.h" |
2181 | + |
2182 | +#include <vector> |
2183 | + |
2184 | +namespace geom = mir::geometry; |
2185 | +namespace mg = mir::graphics; |
2186 | +namespace mtf = mir_test_framework; |
2187 | + |
2188 | +namespace |
2189 | +{ |
2190 | +// NOTE: Raw pointer, deliberately leaked to bypass all the fun |
2191 | +// issues around global destructor ordering. |
2192 | +mir::SharedLibrary* platform_lib{nullptr}; |
2193 | + |
2194 | +void ensure_platform_library() |
2195 | +{ |
2196 | + if (!platform_lib) |
2197 | + { |
2198 | + platform_lib = new mir::SharedLibrary{mtf::server_platform("graphics-dummy.so")}; |
2199 | + } |
2200 | +} |
2201 | +} |
2202 | + |
2203 | +std::shared_ptr<mg::Platform> mtf::make_stubbed_server_graphics_platform(std::vector<geom::Rectangle> const& display_rects) |
2204 | +{ |
2205 | + ensure_platform_library(); |
2206 | + auto factory = platform_lib->load_function<std::shared_ptr<mg::Platform>(*)(std::vector<geom::Rectangle> const&)>("create_stub_platform"); |
2207 | + |
2208 | + return factory(display_rects); |
2209 | +} |
2210 | + |
2211 | +void mtf::set_next_display_rects(std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects) |
2212 | +{ |
2213 | + ensure_platform_library(); |
2214 | + |
2215 | + auto rect_setter = platform_lib->load_function<void(*)(std::unique_ptr<std::vector<geom::Rectangle>>&&)>("set_next_display_rects"); |
2216 | + |
2217 | + rect_setter(std::move(display_rects)); |
2218 | +} |
2219 | + |
2220 | +void mtf::set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display) |
2221 | +{ |
2222 | + ensure_platform_library(); |
2223 | + |
2224 | + auto display_setter = platform_lib->load_function<void(*)(std::shared_ptr<mir::graphics::Display> const&)>("set_next_preset_display"); |
2225 | + |
2226 | + display_setter(display); |
2227 | +} |
2228 | |
2229 | === modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp' |
2230 | --- tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-01-14 06:39:13 +0000 |
2231 | +++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2015-01-22 15:40:28 +0000 |
2232 | @@ -243,8 +243,6 @@ |
2233 | |
2234 | namespace |
2235 | { |
2236 | -std::unique_ptr<std::vector<geom::Rectangle>> chosen_display_rects; |
2237 | - |
2238 | struct GuestPlatformAdapter : mg::Platform |
2239 | { |
2240 | GuestPlatformAdapter( |
2241 | @@ -285,6 +283,12 @@ |
2242 | }; |
2243 | |
2244 | std::weak_ptr<mg::Platform> the_graphics_platform{}; |
2245 | +std::unique_ptr<std::vector<geom::Rectangle>> chosen_display_rects; |
2246 | +} |
2247 | + |
2248 | +extern "C" std::shared_ptr<mg::Platform> create_stub_platform(std::vector<geom::Rectangle> const& display_rects) |
2249 | +{ |
2250 | + return std::make_shared<mtf::StubGraphicPlatform>(display_rects); |
2251 | } |
2252 | |
2253 | extern "C" std::shared_ptr<mg::Platform> create_host_platform( |
2254 | @@ -296,12 +300,12 @@ |
2255 | |
2256 | if (auto const display_rects = std::move(chosen_display_rects)) |
2257 | { |
2258 | - result = std::make_shared<mtf::StubGraphicPlatform>(*display_rects); |
2259 | + result = create_stub_platform(*display_rects); |
2260 | } |
2261 | else |
2262 | { |
2263 | static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}}; |
2264 | - result = std::make_shared<mtf::StubGraphicPlatform>(default_display_rects); |
2265 | + result = create_stub_platform(default_display_rects); |
2266 | } |
2267 | the_graphics_platform = result; |
2268 | return result; |
2269 | @@ -315,18 +319,18 @@ |
2270 | return std::make_shared<GuestPlatformAdapter>(context, graphics_platform); |
2271 | } |
2272 | |
2273 | -extern "C" void add_platform_options( |
2274 | +extern "C" void add_graphis_platform_options( |
2275 | boost::program_options::options_description& /*config*/) |
2276 | { |
2277 | } |
2278 | |
2279 | -extern "C" void set_display_rects( |
2280 | +extern "C" void set_next_display_rects( |
2281 | std::unique_ptr<std::vector<geom::Rectangle>>&& display_rects) |
2282 | { |
2283 | chosen_display_rects = std::move(display_rects); |
2284 | } |
2285 | |
2286 | -extern "C" void preset_display(std::shared_ptr<mir::graphics::Display> const& display) |
2287 | +extern "C" void set_next_preset_display(std::shared_ptr<mir::graphics::Display> const& display) |
2288 | { |
2289 | display_preset = display; |
2290 | } |
2291 | |
2292 | === modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp' |
2293 | --- tests/mir_test_framework/stubbed_server_configuration.cpp 2015-01-14 06:39:13 +0000 |
2294 | +++ tests/mir_test_framework/stubbed_server_configuration.cpp 2015-01-22 15:40:28 +0000 |
2295 | @@ -19,7 +19,7 @@ |
2296 | #include "mir_test_framework/stubbed_server_configuration.h" |
2297 | #include "mir_test_framework/command_line_server_configuration.h" |
2298 | |
2299 | -#include "stubbed_graphics_platform.h" |
2300 | +#include "mir_test_framework/stub_server_platform_factory.h" |
2301 | |
2302 | #include "mir/options/default_configuration.h" |
2303 | #include "mir/graphics/cursor.h" |
2304 | @@ -92,7 +92,7 @@ |
2305 | { |
2306 | if (!graphics_platform) |
2307 | { |
2308 | - graphics_platform = std::make_shared<StubGraphicPlatform>(display_rects); |
2309 | + graphics_platform = mtf::make_stubbed_server_graphics_platform(display_rects); |
2310 | } |
2311 | |
2312 | return graphics_platform; |
2313 | |
2314 | === added file 'tests/mir_test_framework/symbols-server.map' |
2315 | --- tests/mir_test_framework/symbols-server.map 1970-01-01 00:00:00 +0000 |
2316 | +++ tests/mir_test_framework/symbols-server.map 2015-01-22 15:40:28 +0000 |
2317 | @@ -0,0 +1,8 @@ |
2318 | +MIR_GRAPHICS_PLATFORM_1 { |
2319 | + global: |
2320 | + add_graphics_platform_options; |
2321 | + create_host_platform; |
2322 | + create_guest_platform; |
2323 | + probe_graphics_platform; |
2324 | + describe_graphics_module; |
2325 | +}; |
2326 | |
2327 | === modified file 'tests/mir_test_framework/testing_client_options.cpp' |
2328 | --- tests/mir_test_framework/testing_client_options.cpp 2015-01-19 04:52:47 +0000 |
2329 | +++ tests/mir_test_framework/testing_client_options.cpp 2015-01-22 15:40:28 +0000 |
2330 | @@ -16,63 +16,12 @@ |
2331 | * Authored by: Kevin DuBois <kevin.dubois@canonical.com> |
2332 | */ |
2333 | |
2334 | -#include "mir_test_framework/testing_client_configuration.h" |
2335 | #include "mir_test_framework/stub_client_connection_configuration.h" |
2336 | -#include "mir_test_doubles/stub_client_buffer_factory.h" |
2337 | -#include "mir/options/program_option.h" |
2338 | #include "src/client/default_connection_configuration.h" |
2339 | -#include "mir/client_platform_factory.h" |
2340 | -#include "mir/client_buffer_factory.h" |
2341 | -#include "mir/client_buffer.h" |
2342 | -#include "mir/client_platform.h" |
2343 | -#include "src/client/mir_connection.h" |
2344 | +#include "mir_test_framework/stub_client_platform_factory.h" |
2345 | |
2346 | namespace mcl = mir::client; |
2347 | -namespace mtf=mir_test_framework; |
2348 | -namespace geom = mir::geometry; |
2349 | -namespace mtd = mir::test::doubles; |
2350 | - |
2351 | -namespace |
2352 | -{ |
2353 | -struct StubClientPlatform : public mcl::ClientPlatform |
2354 | -{ |
2355 | - MirPlatformType platform_type() const |
2356 | - { |
2357 | - return mir_platform_type_gbm; |
2358 | - } |
2359 | - |
2360 | - std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory() |
2361 | - { |
2362 | - return std::make_shared<mtd::StubClientBufferFactory>(); |
2363 | - } |
2364 | - |
2365 | - std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*) |
2366 | - { |
2367 | - auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678lu); |
2368 | - return std::make_shared<EGLNativeWindowType>(fake_window); |
2369 | - } |
2370 | - |
2371 | - std::shared_ptr<EGLNativeDisplayType> create_egl_native_display() |
2372 | - { |
2373 | - auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678lu); |
2374 | - return std::make_shared<EGLNativeDisplayType>(fake_display); |
2375 | - } |
2376 | - |
2377 | - MirNativeBuffer* convert_native_buffer(mir::graphics::NativeBuffer*) const |
2378 | - { |
2379 | - return nullptr; |
2380 | - } |
2381 | -}; |
2382 | - |
2383 | -struct StubClientPlatformFactory : public mcl::ClientPlatformFactory |
2384 | -{ |
2385 | - std::shared_ptr<mcl::ClientPlatform> create_client_platform(mcl::ClientContext*) |
2386 | - { |
2387 | - return std::make_shared<StubClientPlatform>(); |
2388 | - } |
2389 | -}; |
2390 | - |
2391 | -} |
2392 | +namespace mtf = mir_test_framework; |
2393 | |
2394 | mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file) |
2395 | : DefaultConnectionConfiguration(socket_file) |
2396 | |
2397 | === modified file 'tests/unit-tests/CMakeLists.txt' |
2398 | --- tests/unit-tests/CMakeLists.txt 2015-01-22 03:10:13 +0000 |
2399 | +++ tests/unit-tests/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
2400 | @@ -1,7 +1,23 @@ |
2401 | include(CMakeDependentOption) |
2402 | |
2403 | +add_definitions(-DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/") |
2404 | + |
2405 | +if (MIR_BUILD_PLATFORM_ANDROID) |
2406 | + add_definitions(-DMIR_BUILD_PLATFORM_ANDROID) |
2407 | +endif() |
2408 | + |
2409 | +if (MIR_BUILD_PLATFORM_MESA) |
2410 | + add_definitions(-DMIR_BUILD_PLATFORM_MESA) |
2411 | +endif() |
2412 | + |
2413 | include_directories( |
2414 | ${CMAKE_SOURCE_DIR} |
2415 | + |
2416 | + ${ANDROID_HEADERS_INCLUDE_DIRS} |
2417 | + ${DRM_INCLUDE_DIRS} |
2418 | + ${GBM_INCLUDE_DIRS} |
2419 | + ${UMOCKDEV_INCLUDE_DIRS} |
2420 | + |
2421 | ${PROJECT_SOURCE_DIR}/src/include/platform |
2422 | ${PROJECT_SOURCE_DIR}/src/include/server |
2423 | ${PROJECT_SOURCE_DIR}/src/include/client |
2424 | @@ -10,12 +26,6 @@ |
2425 | ${GLIB_INCLUDE_DIRS} |
2426 | ) |
2427 | |
2428 | -add_definitions( |
2429 | - -DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/" |
2430 | - -DMIR_CLIENT_DRIVER_BINARY="${MIR_CLIENT_DRIVER_BINARY}" |
2431 | -) |
2432 | - |
2433 | -include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${UMOCKDEV_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}) |
2434 | # TODO: Aim to remove |
2435 | include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES}) |
2436 | |
2437 | @@ -79,9 +89,9 @@ |
2438 | demo-shell |
2439 | |
2440 | mir-test |
2441 | + mir-test-framework |
2442 | mir-test-doubles |
2443 | mir-test-doubles-platform |
2444 | - mir-test-framework |
2445 | |
2446 | 3rd_party |
2447 | |
2448 | @@ -91,6 +101,15 @@ |
2449 | ${GMOCK_MAIN_LIBRARY} |
2450 | ${Boost_LIBRARIES} |
2451 | ${UMOCKDEV_LIBRARIES} |
2452 | + # Mesa platform dependencies |
2453 | + ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
2454 | + ${GBM_LDFLAGS} ${GBM_LIBRARIES} |
2455 | + # Android platform dependencies |
2456 | + ${LIBHARDWARE_LIBRARIES} |
2457 | + ${ANDROID_PROPERTIES_LIBRARIES} |
2458 | + # Shared platform dependencies |
2459 | + ${EGL_LDFLAGS} ${EGL_LIBRARIES} |
2460 | + ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES} |
2461 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
2462 | ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES} |
2463 | ${DRM_LDFLAGS} ${DRM_LIBRARIES} |
2464 | @@ -99,7 +118,7 @@ |
2465 | ${MIR_SERVER_REFERENCES} |
2466 | ) |
2467 | |
2468 | -if (MIR_TEST_PLATFORM STREQUAL "android") |
2469 | +if (MIR_BUILD_PLATFORM_ANDROID) |
2470 | target_link_libraries(mir_unit_tests |
2471 | mirsharedandroid |
2472 | ${ANDROID_PROPERTIES_LDFLAGS} |
2473 | |
2474 | === modified file 'tests/unit-tests/client/CMakeLists.txt' |
2475 | --- tests/unit-tests/client/CMakeLists.txt 2015-01-14 06:39:13 +0000 |
2476 | +++ tests/unit-tests/client/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
2477 | @@ -13,6 +13,7 @@ |
2478 | ${CMAKE_CURRENT_SOURCE_DIR}/test_probing_client_platform_factory.cpp |
2479 | ${CMAKE_CURRENT_SOURCE_DIR}/test_mir_prompt_session.cpp |
2480 | ${CMAKE_CURRENT_SOURCE_DIR}/test_event_distributor.cpp |
2481 | + ${CMAKE_CURRENT_SOURCE_DIR}/test_probing_client_platform_factory.cpp |
2482 | ${CMAKE_CURRENT_SOURCE_DIR}/test_periodic_perf_report.cpp |
2483 | ) |
2484 | |
2485 | |
2486 | === modified file 'tests/unit-tests/client/test_client_platform.cpp' |
2487 | --- tests/unit-tests/client/test_client_platform.cpp 2015-01-19 04:52:47 +0000 |
2488 | +++ tests/unit-tests/client/test_client_platform.cpp 2015-01-22 15:40:28 +0000 |
2489 | @@ -59,7 +59,7 @@ |
2490 | struct ClientPlatformTest : public ::testing::TestWithParam<ClientPlatformTraits const*> |
2491 | { |
2492 | ClientPlatformTest() |
2493 | - : platform_library{mtf::library_path() + "/" + GetParam()->platform_library_name}, |
2494 | + : platform_library{mtf::client_platform(GetParam()->platform_library_name)}, |
2495 | create_client_platform{platform_library.load_function<mcl::CreateClientPlatform>("create_client_platform")}, |
2496 | probe{platform_library.load_function<mcl::ClientPlatformProbe>("is_appropriate_module")} |
2497 | { |
2498 | @@ -78,7 +78,7 @@ |
2499 | }; |
2500 | |
2501 | #ifdef MIR_BUILD_PLATFORM_ANDROID |
2502 | -ClientPlatformTraits const android_platform{"/client-modules/android.so", |
2503 | +ClientPlatformTraits const android_platform{"android.so", |
2504 | [](MirPlatformPackage& pkg) |
2505 | { |
2506 | ::memset(&pkg, 0, sizeof(pkg)); |
2507 | @@ -93,7 +93,7 @@ |
2508 | #endif |
2509 | |
2510 | #ifdef MIR_BUILD_PLATFORM_MESA |
2511 | -ClientPlatformTraits const mesa_platform{"/client-modules/mesa.so", |
2512 | +ClientPlatformTraits const mesa_platform{"mesa.so", |
2513 | [](MirPlatformPackage& pkg) |
2514 | { |
2515 | ::memset(&pkg, 0, sizeof(pkg)); |
2516 | @@ -108,7 +108,7 @@ |
2517 | |
2518 | #endif |
2519 | |
2520 | -ClientPlatformTraits const dummy_platform{"/client-modules/dummy.so", |
2521 | +ClientPlatformTraits const dummy_platform{"dummy.so", |
2522 | [](MirPlatformPackage& pkg) |
2523 | { |
2524 | mtf::create_stub_platform_package(pkg); |
2525 | |
2526 | === modified file 'tests/unit-tests/client/test_probing_client_platform_factory.cpp' |
2527 | --- tests/unit-tests/client/test_probing_client_platform_factory.cpp 2015-01-15 15:17:02 +0000 |
2528 | +++ tests/unit-tests/client/test_probing_client_platform_factory.cpp 2015-01-22 15:40:28 +0000 |
2529 | @@ -36,10 +36,10 @@ |
2530 | { |
2531 | std::vector<std::shared_ptr<mir::SharedLibrary>> modules; |
2532 | #ifdef MIR_BUILD_PLATFORM_MESA |
2533 | - modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/mesa.so")); |
2534 | + modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("mesa.so"))); |
2535 | #endif |
2536 | #ifdef MIR_BUILD_PLATFORM_ANDROID |
2537 | - modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/android.so")); |
2538 | + modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("android.so"))); |
2539 | #endif |
2540 | return modules; |
2541 | } |
2542 | @@ -127,7 +127,7 @@ |
2543 | auto modules = all_available_modules(); |
2544 | // NOTE: For minimum fuss, load something that has minimal side-effects... |
2545 | modules.push_back(std::make_shared<mir::SharedLibrary>("libc.so.6")); |
2546 | - modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/dummy.so")); |
2547 | + modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("dummy.so"))); |
2548 | |
2549 | mir::client::ProbingClientPlatformFactory factory{modules}; |
2550 | |
2551 | |
2552 | === modified file 'tests/unit-tests/graphics/CMakeLists.txt' |
2553 | --- tests/unit-tests/graphics/CMakeLists.txt 2015-01-16 02:57:31 +0000 |
2554 | +++ tests/unit-tests/graphics/CMakeLists.txt 2015-01-22 15:40:28 +0000 |
2555 | @@ -10,6 +10,7 @@ |
2556 | ${CMAKE_CURRENT_SOURCE_DIR}/test_surfaceless_egl_context.cpp |
2557 | ${CMAKE_CURRENT_SOURCE_DIR}/test_overlapping_output_grouping.cpp |
2558 | ${CMAKE_CURRENT_SOURCE_DIR}/test_program_factory.cpp |
2559 | + ${CMAKE_CURRENT_SOURCE_DIR}/test_platform_prober.cpp |
2560 | ${CMAKE_CURRENT_SOURCE_DIR}/test_software_cursor.cpp |
2561 | ) |
2562 | |
2563 | |
2564 | === modified file 'tests/unit-tests/graphics/android/test_platform.cpp' |
2565 | --- tests/unit-tests/graphics/android/test_platform.cpp 2015-01-22 03:10:13 +0000 |
2566 | +++ tests/unit-tests/graphics/android/test_platform.cpp 2015-01-22 15:40:28 +0000 |
2567 | @@ -28,6 +28,8 @@ |
2568 | #include "mir_test_doubles/fd_matcher.h" |
2569 | #include "mir_test/fake_shared.h" |
2570 | #include "mir_test_doubles/mock_android_native_buffer.h" |
2571 | +#include "mir_test_framework/executable_path.h" |
2572 | +#include "mir/shared_library.h" |
2573 | #include <system/window.h> |
2574 | #include <gtest/gtest.h> |
2575 | |
2576 | @@ -38,6 +40,9 @@ |
2577 | namespace mr=mir::report; |
2578 | namespace geom=mir::geometry; |
2579 | namespace mo=mir::options; |
2580 | +namespace mtf=mir_test_framework; |
2581 | + |
2582 | +static const char probe_platform[] = "probe_graphics_platform"; |
2583 | |
2584 | class PlatformBufferIPCPackaging : public ::testing::Test |
2585 | { |
2586 | @@ -227,6 +232,27 @@ |
2587 | EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display()); |
2588 | } |
2589 | |
2590 | +TEST(AndroidGraphicsPlatform, probe_returns_unsupported_when_no_hwaccess) |
2591 | +{ |
2592 | + using namespace testing; |
2593 | + NiceMock<mtd::HardwareAccessMock> hwaccess; |
2594 | + |
2595 | + ON_CALL(hwaccess, hw_get_module(_,_)).WillByDefault(Return(-1)); |
2596 | + |
2597 | + mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android.so")}; |
2598 | + auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform); |
2599 | + EXPECT_EQ(mg::PlatformPriority::unsupported, probe()); |
2600 | +} |
2601 | + |
2602 | +TEST(AndroidGraphicsPlatform, probe_returns_best_when_hwaccess_succeeds) |
2603 | +{ |
2604 | + testing::NiceMock<mtd::HardwareAccessMock> hwaccess; |
2605 | + |
2606 | + mir::SharedLibrary platform_lib{mtf::server_platform("graphics-android.so")}; |
2607 | + auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform); |
2608 | + EXPECT_EQ(mg::PlatformPriority::best, probe()); |
2609 | +} |
2610 | + |
2611 | TEST(NestedPlatformCreation, doesnt_access_display_hardware) |
2612 | { |
2613 | using namespace testing; |
2614 | |
2615 | === modified file 'tests/unit-tests/graphics/mesa/test_platform.cpp' |
2616 | --- tests/unit-tests/graphics/mesa/test_platform.cpp 2015-01-22 03:10:13 +0000 |
2617 | +++ tests/unit-tests/graphics/mesa/test_platform.cpp 2015-01-22 15:40:28 +0000 |
2618 | @@ -23,6 +23,7 @@ |
2619 | #include "src/platforms/mesa/server/platform.h" |
2620 | #include "src/server/report/null_report_factory.h" |
2621 | #include "mir/emergency_cleanup_registry.h" |
2622 | +#include "mir/shared_library.h" |
2623 | |
2624 | #include "mir_test_doubles/mock_buffer.h" |
2625 | #include "mir_test_doubles/mock_buffer_ipc_message.h" |
2626 | @@ -33,6 +34,7 @@ |
2627 | #include <gtest/gtest.h> |
2628 | |
2629 | #include "mir_test_framework/udev_environment.h" |
2630 | +#include "mir_test_framework/executable_path.h" |
2631 | #include "mir_test/pipe.h" |
2632 | |
2633 | #include "mir_test_doubles/mock_drm.h" |
2634 | @@ -55,6 +57,8 @@ |
2635 | namespace |
2636 | { |
2637 | |
2638 | +const char probe_platform[] = "probe_graphics_platform"; |
2639 | + |
2640 | class MesaGraphicsPlatform : public ::testing::Test |
2641 | { |
2642 | public: |
2643 | @@ -338,3 +342,23 @@ |
2644 | |
2645 | Mock::VerifyAndClearExpectations(&mock_drm); |
2646 | } |
2647 | + |
2648 | +TEST_F(MesaGraphicsPlatform, probe_returns_unsupported_when_no_drm_udev_devices) |
2649 | +{ |
2650 | + mtf::UdevEnvironment udev_environment; |
2651 | + |
2652 | + mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa.so")}; |
2653 | + auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform); |
2654 | + EXPECT_EQ(mg::PlatformPriority::unsupported, probe()); |
2655 | +} |
2656 | + |
2657 | +TEST_F(MesaGraphicsPlatform, probe_returns_best_when_drm_devices_exist) |
2658 | +{ |
2659 | + mtf::UdevEnvironment udev_environment; |
2660 | + |
2661 | + udev_environment.add_standard_device("standard-drm-devices"); |
2662 | + |
2663 | + mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa.so")}; |
2664 | + auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform); |
2665 | + EXPECT_EQ(mg::PlatformPriority::best, probe()); |
2666 | +} |
2667 | |
2668 | === added file 'tests/unit-tests/graphics/test_platform_prober.cpp' |
2669 | --- tests/unit-tests/graphics/test_platform_prober.cpp 1970-01-01 00:00:00 +0000 |
2670 | +++ tests/unit-tests/graphics/test_platform_prober.cpp 2015-01-22 15:40:28 +0000 |
2671 | @@ -0,0 +1,215 @@ |
2672 | +/* |
2673 | + * Copyright © 2014 Canonical Ltd. |
2674 | + * |
2675 | + * This program is free software: you can redistribute it and/or modify |
2676 | + * it under the terms of the GNU General Public License version 3 as |
2677 | + * published by the Free Software Foundation. |
2678 | + * |
2679 | + * This program is distributed in the hope that it will be useful, |
2680 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2681 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2682 | + * GNU General Public License for more details. |
2683 | + * |
2684 | + * You should have received a copy of the GNU General Public License |
2685 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2686 | + * |
2687 | + * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> |
2688 | + */ |
2689 | + |
2690 | +#include <gtest/gtest.h> |
2691 | + |
2692 | +#include "mir/graphics/platform.h" |
2693 | +#include "mir/graphics/platform_probe.h" |
2694 | + |
2695 | +#include "mir/raii.h" |
2696 | + |
2697 | +#ifdef MIR_BUILD_PLATFORM_MESA |
2698 | +#include "mir_test_doubles/mock_drm.h" |
2699 | +#include "mir_test_doubles/mock_gbm.h" |
2700 | +#endif |
2701 | + |
2702 | +#ifdef MIR_BUILD_PLATFORM_ANDROID |
2703 | +#include "mir_test_doubles/mock_android_hw.h" |
2704 | +#endif |
2705 | + |
2706 | +#include "mir_test_framework/udev_environment.h" |
2707 | +#include "mir_test_framework/executable_path.h" |
2708 | + |
2709 | +namespace mtf = mir_test_framework; |
2710 | +namespace mtd = mir::test::doubles; |
2711 | + |
2712 | +namespace |
2713 | +{ |
2714 | +const char describe_module[] = "describe_graphics_module"; |
2715 | + |
2716 | +std::vector<std::shared_ptr<mir::SharedLibrary>> available_platforms() |
2717 | +{ |
2718 | + std::vector<std::shared_ptr<mir::SharedLibrary>> modules; |
2719 | + |
2720 | +#ifdef MIR_BUILD_PLATFORM_MESA |
2721 | + modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-mesa.so"))); |
2722 | +#endif |
2723 | +#ifdef MIR_BUILD_PLATFORM_ANDROID |
2724 | + modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-android.so"))); |
2725 | +#endif |
2726 | + return modules; |
2727 | +} |
2728 | + |
2729 | +void add_dummy_platform(std::vector<std::shared_ptr<mir::SharedLibrary>>& modules) |
2730 | +{ |
2731 | + modules.insert(modules.begin(), std::make_shared<mir::SharedLibrary>(mtf::server_platform("graphics-dummy.so"))); |
2732 | +} |
2733 | + |
2734 | +std::shared_ptr<void> ensure_android_probing_fails() |
2735 | +{ |
2736 | +#ifdef MIR_BUILD_PLATFORM_ANDROID |
2737 | + using namespace testing; |
2738 | + auto mock_android = std::make_shared<NiceMock<mtd::HardwareAccessMock>>(); |
2739 | + ON_CALL(*mock_android, hw_get_module(_, _)) |
2740 | + .WillByDefault(Return(-1)); |
2741 | + return mock_android; |
2742 | +#else |
2743 | + return std::shared_ptr<void>{}; |
2744 | +#endif |
2745 | +} |
2746 | + |
2747 | +std::shared_ptr<void> ensure_mesa_probing_fails() |
2748 | +{ |
2749 | + return std::make_shared<mtf::UdevEnvironment>(); |
2750 | +} |
2751 | + |
2752 | +std::shared_ptr<void> ensure_mesa_probing_succeeds() |
2753 | +{ |
2754 | + auto udev = std::make_shared<mtf::UdevEnvironment>(); |
2755 | + |
2756 | + udev->add_standard_device("standard-drm-devices"); |
2757 | + |
2758 | + return udev; |
2759 | +} |
2760 | + |
2761 | +std::shared_ptr<void> ensure_android_probing_succeeds() |
2762 | +{ |
2763 | +#ifdef MIR_BUILD_PLATFORM_ANDROID |
2764 | + using namespace testing; |
2765 | + auto mock_android = std::make_shared<NiceMock<mtd::HardwareAccessMock>>(); |
2766 | + ON_CALL(*mock_android, hw_get_module(_, _)) |
2767 | + .WillByDefault(Return(0)); |
2768 | + return mock_android; |
2769 | +#else |
2770 | + return std::shared_ptr<void>{}; |
2771 | +#endif |
2772 | +} |
2773 | +} |
2774 | + |
2775 | +TEST(ServerPlatformProbe, ConstructingWithNoModulesIsAnError) |
2776 | +{ |
2777 | + std::vector<std::shared_ptr<mir::SharedLibrary>> empty_modules; |
2778 | + EXPECT_THROW(mir::graphics::module_for_device(empty_modules), |
2779 | + std::runtime_error); |
2780 | +} |
2781 | + |
2782 | +#ifdef MIR_BUILD_PLATFORM_MESA |
2783 | +TEST(ServerPlatformProbe, LoadsMesaPlatformWhenDrmDevicePresent) |
2784 | +{ |
2785 | + using namespace testing; |
2786 | + auto block_android = ensure_android_probing_fails(); |
2787 | + auto fake_mesa = ensure_mesa_probing_succeeds(); |
2788 | + |
2789 | + auto modules = available_platforms(); |
2790 | + |
2791 | + auto module = mir::graphics::module_for_device(modules); |
2792 | + ASSERT_NE(nullptr, module); |
2793 | + |
2794 | + auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module); |
2795 | + auto description = descriptor(); |
2796 | + |
2797 | + EXPECT_THAT(description->name, HasSubstr("mesa")); |
2798 | +} |
2799 | +#endif |
2800 | + |
2801 | +#ifdef MIR_BUILD_PLATFORM_ANDROID |
2802 | +TEST(ServerPlatformProbe, LoadsAndroidPlatformWhenHwaccessSucceeds) |
2803 | +{ |
2804 | + using namespace testing; |
2805 | + |
2806 | + auto block_mesa = ensure_mesa_probing_fails(); |
2807 | + auto fake_android = ensure_android_probing_succeeds(); |
2808 | + |
2809 | + auto modules = available_platforms(); |
2810 | + |
2811 | + auto module = mir::graphics::module_for_device(modules); |
2812 | + ASSERT_NE(nullptr, module); |
2813 | + |
2814 | + auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module); |
2815 | + auto description = descriptor(); |
2816 | + |
2817 | + EXPECT_THAT(description->name, HasSubstr("android")); |
2818 | +} |
2819 | +#endif |
2820 | + |
2821 | +TEST(ServerPlatformProbe, ThrowsExceptionWhenNothingProbesSuccessfully) |
2822 | +{ |
2823 | + using namespace testing; |
2824 | + auto block_android = ensure_android_probing_fails(); |
2825 | + auto block_mesa = ensure_mesa_probing_fails(); |
2826 | + |
2827 | + |
2828 | + EXPECT_THROW(mir::graphics::module_for_device(available_platforms()), |
2829 | + std::runtime_error); |
2830 | +} |
2831 | + |
2832 | +TEST(ServerPlatformProbe, LoadsSupportedModuleWhenNoBestModule) |
2833 | +{ |
2834 | + using namespace testing; |
2835 | + auto block_android = ensure_android_probing_fails(); |
2836 | + auto block_mesa = ensure_mesa_probing_fails(); |
2837 | + |
2838 | + auto modules = available_platforms(); |
2839 | + add_dummy_platform(modules); |
2840 | + |
2841 | + auto module = mir::graphics::module_for_device(modules); |
2842 | + ASSERT_NE(nullptr, module); |
2843 | + |
2844 | + auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module); |
2845 | + auto description = descriptor(); |
2846 | + |
2847 | + EXPECT_THAT(description->name, HasSubstr("dummy")); |
2848 | +} |
2849 | + |
2850 | +TEST(ServerPlatformProbe, LoadsMesaOrAndroidInPreferenceToDummy) |
2851 | +{ |
2852 | + using namespace testing; |
2853 | + |
2854 | + auto ensure_mesa = ensure_mesa_probing_succeeds(); |
2855 | + auto ensure_android = ensure_android_probing_succeeds(); |
2856 | + |
2857 | + auto modules = available_platforms(); |
2858 | + add_dummy_platform(modules); |
2859 | + |
2860 | + auto module = mir::graphics::module_for_device(modules); |
2861 | + ASSERT_NE(nullptr, module); |
2862 | + |
2863 | + auto descriptor = module->load_function<mir::graphics::DescribeModule>(describe_module); |
2864 | + auto description = descriptor(); |
2865 | + |
2866 | + EXPECT_THAT(description->name, Not(HasSubstr("dummy"))); |
2867 | +} |
2868 | + |
2869 | +TEST(ServerPlatformProbe, IgnoresNonPlatformModules) |
2870 | +{ |
2871 | + using namespace testing; |
2872 | + |
2873 | + auto ensure_mesa = ensure_mesa_probing_succeeds(); |
2874 | + auto ensure_android = ensure_android_probing_succeeds(); |
2875 | + |
2876 | + auto modules = available_platforms(); |
2877 | + add_dummy_platform(modules); |
2878 | + |
2879 | + // NOTE: We want to load something that doesn't link with libmirplatform, |
2880 | + // due to protobuf throwing a screaming hissy fit if it gets loaded twice. |
2881 | + modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::client_platform("dummy.so"))); |
2882 | + |
2883 | + |
2884 | + auto module = mir::graphics::module_for_device(modules); |
2885 | + EXPECT_NE(nullptr, module); |
2886 | +} |
2887 | |
2888 | === modified file 'tests/unit-tests/shared_library_test.cpp' |
2889 | --- tests/unit-tests/shared_library_test.cpp 2015-01-14 06:39:13 +0000 |
2890 | +++ tests/unit-tests/shared_library_test.cpp 2015-01-22 15:40:28 +0000 |
2891 | @@ -59,7 +59,7 @@ |
2892 | public: |
2893 | SharedLibrary() |
2894 | : nonexistent_library{"imma_totally_not_a_library"}, |
2895 | - existing_library{mtf::library_path() + "/client-modules/mesa.so"}, |
2896 | + existing_library{mtf::client_platform("mesa.so")}, |
2897 | nonexistent_function{"yo_dawg"}, |
2898 | existing_function{"create_client_platform"}, |
2899 | existent_version{"MIR_CLIENT_PLATFORM_2"}, |
2900 | |
2901 | === modified file 'tools/install_on_android.sh' |
2902 | --- tools/install_on_android.sh 2015-01-14 06:39:13 +0000 |
2903 | +++ tools/install_on_android.sh 2015-01-22 15:40:28 +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.* |
2917 | do |
2918 | adb push $x ${RUN_DIR} |
2919 | |
2920 | === modified file 'tools/valgrind_suppressions_armhf' |
2921 | --- tools/valgrind_suppressions_armhf 2015-01-14 06:39:13 +0000 |
2922 | +++ tools/valgrind_suppressions_armhf 2015-01-22 15:40:28 +0000 |
2923 | @@ -127,6 +127,15 @@ |
2924 | # memory errors. |
2925 | |
2926 | { |
2927 | + spurious_strlen_addr4 |
2928 | + Memcheck:Addr4 |
2929 | + ... |
2930 | + fun:dlsym |
2931 | + ... |
2932 | + fun:_ZN50SharedLibrary_load_nonexistent_function_fails_Test8TestBodyEv |
2933 | +} |
2934 | + |
2935 | +{ |
2936 | mir_sharedlibrary_cond |
2937 | Memcheck:Cond |
2938 | fun:_ZN3mir13SharedLibraryC1EPKc |
FAILED: Continuous integration, rev:2122 jenkins. qa.ubuntu. com/job/ mir-ci/ 2295/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/391/ console jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/391/ console jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/365/ console jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 286/console jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 365/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2295/ rebuild
http://