Mir

Merge lp:~raof/mir/proper-driver-loading into lp:mir

Proposed by Chris Halse Rogers
Status: Rejected
Rejected by: Chris Halse Rogers
Proposed branch: lp:~raof/mir/proper-driver-loading
Merge into: lp:mir
Diff against target: 3783 lines (+1833/-412) (has conflicts)
94 files modified
benchmarks/frame-uniformity/CMakeLists.txt (+2/-1)
debian/control (+48/-30)
debian/mir-client-platform-android.install (+1/-1)
debian/mir-client-platform-mesa.install (+1/-1)
debian/mir-platform-graphics-android.install (+1/-1)
debian/mir-platform-graphics-mesa.install (+1/-1)
debian/mir-test-tools.install (+2/-1)
debian/rules (+5/-3)
include/platform/mir/graphics/platform.h (+36/-0)
include/platform/mir/options/configuration.h (+1/-0)
platform-ABI-sha1sums (+8/-1)
server-ABI-sha1sums (+8/-1)
src/CMakeLists.txt (+2/-0)
src/client/CMakeLists.txt (+17/-13)
src/client/android/CMakeLists.txt (+7/-22)
src/client/android/android_native_display_container.cpp (+16/-4)
src/client/android/android_native_display_container.h (+8/-1)
src/client/android/client_platform_factory.cpp (+21/-5)
src/client/android/client_platform_factory.h (+2/-5)
src/client/android/symbols.map (+5/-4)
src/client/client_context.h (+0/-1)
src/client/client_platform_factory.h (+5/-2)
src/client/connection_configuration.h (+0/-3)
src/client/default_connection_configuration.cpp (+23/-18)
src/client/default_connection_configuration.h (+0/-4)
src/client/egl_native_display_container.h (+3/-1)
src/client/mesa/CMakeLists.txt (+6/-22)
src/client/mesa/client_platform.cpp (+1/-1)
src/client/mesa/client_platform_factory.cpp (+19/-5)
src/client/mesa/client_platform_factory.h (+0/-5)
src/client/mesa/mesa_native_display_container.cpp (+5/-5)
src/client/mesa/mesa_native_display_container.h (+1/-1)
src/client/mesa/native_surface.cpp (+0/-1)
src/client/mesa/symbols.map (+6/-4)
src/client/mir_connection.cpp (+7/-9)
src/client/mir_connection.h (+2/-2)
src/client/probing_client_platform_factory.cpp (+38/-0)
src/client/probing_client_platform_factory.h (+27/-0)
src/common/graphics/android/mir_native_window.cpp (+0/-1)
src/common/symbols.map (+1/-0)
src/include/platform/mir/shared_library_loader.h (+0/-28)
src/platform/CMakeLists.txt (+22/-12)
src/platform/graphics/CMakeLists.txt (+1/-0)
src/platform/graphics/android/CMakeLists.txt (+16/-25)
src/platform/graphics/android/platform.cpp (+19/-0)
src/platform/graphics/android/symbols.map (+8/-0)
src/platform/graphics/mesa/CMakeLists.txt (+19/-26)
src/platform/graphics/mesa/platform.cpp (+28/-0)
src/platform/graphics/mesa/symbols.map (+8/-0)
src/platform/graphics/platform_probe.cpp (+50/-0)
src/platform/graphics/platform_probe.h (+37/-0)
src/platform/options/default_configuration.cpp (+67/-20)
src/platform/symbols.map (+2/-0)
src/server/CMakeLists.txt (+5/-1)
src/server/graphics/CMakeLists.txt (+1/-1)
src/server/graphics/default_configuration.cpp (+68/-5)
src/server/server.cpp (+1/-1)
tests/acceptance-tests/CMakeLists.txt (+0/-5)
tests/acceptance-tests/server_configuration_wrapping.cpp (+3/-0)
tests/acceptance-tests/test_symbols_required_by_mesa.cpp (+6/-3)
tests/include/mir_test_doubles/mock_android_alloc_device.h (+4/-0)
tests/include/mir_test_doubles/mock_client_context.h (+0/-6)
tests/include/mir_test_doubles/mock_hwc_composer_device_1.h (+5/-0)
tests/include/mir_test_framework/client_platform_factory.h (+72/-0)
tests/include/mir_test_framework/stub_client_platform_factory.h (+33/-0)
tests/include/mir_test_framework/stub_server_platform_factory.h (+45/-0)
tests/integration-tests/CMakeLists.txt (+21/-2)
tests/mir_test_doubles/CMakeLists.txt (+13/-10)
tests/mir_test_framework/CMakeLists.txt (+54/-21)
tests/mir_test_framework/headless_test.cpp (+10/-0)
tests/mir_test_framework/platform_graphics_dummy.cpp (+33/-0)
tests/mir_test_framework/stub_client_platform_factory.cpp (+147/-0)
tests/mir_test_framework/stub_client_platform_module.cpp (+35/-0)
tests/mir_test_framework/stub_server_platform_factory.cpp (+54/-0)
tests/mir_test_framework/stubbed_graphics_platform.cpp (+13/-0)
tests/mir_test_framework/stubbed_server_configuration.cpp (+2/-2)
tests/mir_test_framework/symbols-client.map (+7/-0)
tests/mir_test_framework/symbols-server.map (+8/-0)
tests/mir_test_framework/testing_client_options.cpp (+8/-6)
tests/unit-tests/CMakeLists.txt (+31/-9)
tests/unit-tests/client/CMakeLists.txt (+1/-0)
tests/unit-tests/client/android/test_android_client_platform.cpp (+4/-7)
tests/unit-tests/client/mesa/test_client_platform.cpp (+7/-6)
tests/unit-tests/client/mesa/test_mesa_native_display_container.cpp (+1/-1)
tests/unit-tests/client/test_client_platform.cpp (+109/-29)
tests/unit-tests/client/test_probing_client_platform_factory.cpp (+141/-0)
tests/unit-tests/graphics/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_platform.cpp (+24/-0)
tests/unit-tests/graphics/mesa/test_platform.cpp (+22/-0)
tests/unit-tests/graphics/test_platform_prober.cpp (+214/-0)
tests/unit-tests/shared_library_test.cpp (+3/-3)
tests/unit-tests/test_shared_library_prober.cpp (+1/-0)
tools/install_on_android.sh (+4/-3)
tools/valgrind_suppressions_armhf (+9/-0)
Text conflict in debian/control
Text conflict in debian/rules
Text conflict in platform-ABI-sha1sums
Text conflict in server-ABI-sha1sums
Text conflict in tests/mir_test_framework/headless_test.cpp
Text conflict in tests/mir_test_framework/stubbed_graphics_platform.cpp
Text conflict in tests/mir_test_framework/testing_client_options.cpp
To merge this branch: bzr merge lp:~raof/mir/proper-driver-loading
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Mir development team Pending
Review via email: mp+243007@code.launchpad.net

Commit message

Move the platform plugins into a private directory

We now probe all the DSOs in the driver directory and load the appropriate one, with the appropriate version.
DSO filenames are irrelevant, so everything is now parallel installable.

Description of the change

This is basically a resubmit of https://code.launchpad.net/~raof/mir/privatise-all-the-things/+merge/234063

I *had* hoped to additionally break it out into chunks, but LP seems to be super-confused.

The three MPs
https://code.launchpad.net/~raof/mir/client-driver-probing/+merge/242865
https://code.launchpad.net/~raof/mir/server-side-platform-probing/+merge/243005
https://code.launchpad.net/~raof/mir/plugin-probe-packaging/+merge/243006
should be stacked one on top of the other, if you'd like to review incrementalish bits (although they're not individually landable).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

2104. By Chris Halse Rogers

Packaging for probable client/server platform plugins

2103. By Chris Halse Rogers

Oops. Add a whole bunch of accidentally missing files

2102. By Chris Halse Rogers

Move dummy modules alongside their regular counterparts

2101. By Chris Halse Rogers

Implement server-side graphics platform probe

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'benchmarks/frame-uniformity/CMakeLists.txt'
--- benchmarks/frame-uniformity/CMakeLists.txt 2014-11-20 09:53:04 +0000
+++ benchmarks/frame-uniformity/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -24,15 +24,16 @@
24target_link_libraries(frame_uniformity_test_client24target_link_libraries(frame_uniformity_test_client
25 mirserver25 mirserver
26 mirclient26 mirclient
27 mirplatform
27 28
28 mir-test29 mir-test
29 mir-test-framework30 mir-test-framework
30 mir-test-doubles31 mir-test-doubles
31 mir-test-doubles-platform32 mir-test-doubles-platform
3233
34
33 # Why does this have to come after mir-test-framework here but not in tests/acceptance-tests/35 # Why does this have to come after mir-test-framework here but not in tests/acceptance-tests/
34 # /CMakeLists.txt? ~racarr36 # /CMakeLists.txt? ~racarr
35 mirplatform
3637
37 3rd_party38 3rd_party
38 ${PROTOBUF_LIBRARIES}39 ${PROTOBUF_LIBRARIES}
3940
=== modified file 'debian/control'
--- debian/control 2014-11-27 03:48:20 +0000
+++ debian/control 2014-11-27 07:32:44 +0000
@@ -67,7 +67,11 @@
67Pre-Depends: ${misc:Pre-Depends}67Pre-Depends: ${misc:Pre-Depends}
68Depends: ${misc:Depends},68Depends: ${misc:Depends},
69 ${shlibs:Depends},69 ${shlibs:Depends},
70<<<<<<< TREE
70 libmir${platform-driver}-mesa | libmir${platform-driver}-android,71 libmir${platform-driver}-mesa | libmir${platform-driver}-android,
72=======
73 mir-platform-graphics-mesa | mir-platform-graphics-android,
74>>>>>>> MERGE-SOURCE
71Description: Display server for Ubuntu - server library75Description: Display server for Ubuntu - server library
72 Mir is a display server running on linux systems, with a focus on efficiency,76 Mir is a display server running on linux systems, with a focus on efficiency,
73 robust operation and a well-defined driver model.77 robust operation and a well-defined driver model.
@@ -144,7 +148,11 @@
144Pre-Depends: ${misc:Pre-Depends}148Pre-Depends: ${misc:Pre-Depends}
145Depends: ${misc:Depends},149Depends: ${misc:Depends},
146 ${shlibs:Depends},150 ${shlibs:Depends},
151<<<<<<< TREE
147 libmir${client-driver}-mesa | libmir${client-driver}-android,152 libmir${client-driver}-mesa | libmir${client-driver}-android,
153=======
154 mir-client-platform-mesa | mir-client-platform-android,
155>>>>>>> MERGE-SOURCE
148Description: Display server for Ubuntu - client library156Description: Display server for Ubuntu - client library
149 Mir is a display server running on linux systems, with a focus on efficiency,157 Mir is a display server running on linux systems, with a focus on efficiency,
150 robust operation and a well-defined driver model.158 robust operation and a well-defined driver model.
@@ -266,7 +274,35 @@
266 Contains the shared libraries required for the Mir server and client.274 Contains the shared libraries required for the Mir server and client.
267275
268# Longer-term these drivers should move out-of-tree276# Longer-term these drivers should move out-of-tree
269Package: libmirclient8driver-mesa277Package: mir-platform-graphics-mesa
278Section: libs
279Architecture: i386 amd64 armhf arm64
280Multi-Arch: same
281Pre-Depends: ${misc:Pre-Depends}
282Depends: ${misc:Depends},
283 ${shlibs:Depends},
284Description: Display server for Ubuntu - platform library for Mesa
285 Mir is a display server running on linux systems, with a focus on efficiency,
286 robust operation and a well-defined driver model.
287 .
288 Contains the shared libraries required for the Mir server to interact with
289 the hardware platform using the Mesa drivers.
290
291Package: mir-platform-graphics-android
292Section: libs
293Architecture: i386 amd64 armhf
294Multi-Arch: same
295Pre-Depends: ${misc:Pre-Depends}
296Depends: ${misc:Depends},
297 ${shlibs:Depends},
298Description: Display server for Ubuntu - platform library for Android
299 Mir is a display server running on linux systems, with a focus on efficiency,
300 robust operation and a well-defined driver model.
301 .
302 Contains the shared libraries required for the Mir server to interact with
303 the hardware platform using the Android drivers.
304
305Package: mir-client-platform-mesa
270Section: libs306Section: libs
271Architecture: i386 amd64 armhf arm64307Architecture: i386 amd64 armhf arm64
272Multi-Arch: same308Multi-Arch: same
@@ -280,7 +316,7 @@
280 Contains the shared libraries required for the Mir clients to interact with316 Contains the shared libraries required for the Mir clients to interact with
281 the underlying hardware platform using the Mesa drivers.317 the underlying hardware platform using the Mesa drivers.
282318
283Package: libmirclient8driver-android319Package: mir-client-platform-android
284Section: libs320Section: libs
285Architecture: i386 amd64 armhf321Architecture: i386 amd64 armhf
286Multi-Arch: same322Multi-Arch: same
@@ -294,42 +330,19 @@
294 Contains the shared libraries required for the Mir clients to interact with330 Contains the shared libraries required for the Mir clients to interact with
295 the underlying hardware platform using the Android drivers.331 the underlying hardware platform using the Android drivers.
296332
297Package: libmirplatform4driver-mesa
298Section: libs
299Architecture: i386 amd64 armhf arm64
300Multi-Arch: same
301Pre-Depends: ${misc:Pre-Depends}
302Depends: ${misc:Depends},
303 ${shlibs:Depends},
304Description: Display server for Ubuntu - platform library for Mesa
305 Mir is a display server running on linux systems, with a focus on efficiency,
306 robust operation and a well-defined driver model.
307 .
308 Contains the shared libraries required for the Mir server to interact with
309 the hardware platform using the Mesa drivers.
310
311Package: libmirplatform4driver-android
312Section: libs
313Architecture: i386 amd64 armhf
314Multi-Arch: same
315Pre-Depends: ${misc:Pre-Depends}
316Depends: ${misc:Depends},
317 ${shlibs:Depends},
318Description: Display server for Ubuntu - platform library for Android
319 Mir is a display server running on linux systems, with a focus on efficiency,
320 robust operation and a well-defined driver model.
321 .
322 Contains the shared libraries required for the Mir server to interact with
323 the hardware platform using the Android drivers.
324
325Package: mir-graphics-drivers-desktop333Package: mir-graphics-drivers-desktop
326Section: libs334Section: libs
327Architecture: i386 amd64 armhf arm64335Architecture: i386 amd64 armhf arm64
328Multi-Arch: same336Multi-Arch: same
329Pre-Depends: ${misc:Pre-Depends}337Pre-Depends: ${misc:Pre-Depends}
330Depends: ${misc:Depends},338Depends: ${misc:Depends},
339<<<<<<< TREE
331 libmir${platform-driver}-mesa,340 libmir${platform-driver}-mesa,
332 libmir${client-driver}-mesa341 libmir${client-driver}-mesa
342=======
343 mir-platform-graphics-mesa,
344 mir-client-platform-mesa,
345>>>>>>> MERGE-SOURCE
333Description: Display server for Ubuntu - desktop driver metapackage346Description: Display server for Ubuntu - desktop driver metapackage
334 Mir is a display server running on linux systems, with a focus on efficiency,347 Mir is a display server running on linux systems, with a focus on efficiency,
335 robust operation and a well-defined driver model.348 robust operation and a well-defined driver model.
@@ -343,8 +356,13 @@
343Multi-Arch: same356Multi-Arch: same
344Pre-Depends: ${misc:Pre-Depends}357Pre-Depends: ${misc:Pre-Depends}
345Depends: ${misc:Depends},358Depends: ${misc:Depends},
359<<<<<<< TREE
346 libmir${platform-driver}-android,360 libmir${platform-driver}-android,
347 libmir${client-driver}-android361 libmir${client-driver}-android
362=======
363 mir-platform-graphics-android,
364 mir-client-platform-android,
365>>>>>>> MERGE-SOURCE
348Description: Display server for Ubuntu - android driver metapackage366Description: Display server for Ubuntu - android driver metapackage
349 Mir is a display server running on linux systems, with a focus on efficiency,367 Mir is a display server running on linux systems, with a focus on efficiency,
350 robust operation and a well-defined driver model.368 robust operation and a well-defined driver model.
351369
=== renamed file 'debian/libmirclient8driver-android.install' => 'debian/mir-client-platform-android.install'
--- debian/libmirclient8driver-android.install 2014-11-24 02:16:00 +0000
+++ debian/mir-client-platform-android.install 2014-11-27 07:32:44 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/client*driver/android/*1usr/lib/*/mir/client-platform/android.so
22
=== renamed file 'debian/libmirclient8driver-mesa.install' => 'debian/mir-client-platform-mesa.install'
--- debian/libmirclient8driver-mesa.install 2014-11-24 02:16:00 +0000
+++ debian/mir-client-platform-mesa.install 2014-11-27 07:32:44 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/client*driver/mesa/*1usr/lib/*/mir/client-platform/mesa.so
22
=== renamed file 'debian/libmirplatform4driver-android.install' => 'debian/mir-platform-graphics-android.install'
--- debian/libmirplatform4driver-android.install 2014-11-24 02:16:00 +0000
+++ debian/mir-platform-graphics-android.install 2014-11-27 07:32:44 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/platform*driver/android/*1usr/lib/*/mir/server-platform/graphics-android.so
22
=== renamed file 'debian/libmirplatform4driver-mesa.install' => 'debian/mir-platform-graphics-mesa.install'
--- debian/libmirplatform4driver-mesa.install 2014-11-24 02:16:00 +0000
+++ debian/mir-platform-graphics-mesa.install 2014-11-27 07:32:44 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/platform*driver/mesa/*1usr/lib/*/mir/server-platform/graphics-mesa.so
22
=== modified file 'debian/mir-test-tools.install'
--- debian/mir-test-tools.install 2014-11-24 02:16:00 +0000
+++ debian/mir-test-tools.install 2014-11-27 07:32:44 +0000
@@ -5,4 +5,5 @@
5usr/bin/mir_performance_tests5usr/bin/mir_performance_tests
6usr/lib/*/mir/tools/libmirclientlttng.so6usr/lib/*/mir/tools/libmirclientlttng.so
7usr/lib/*/mir/tools/libmirserverlttng.so7usr/lib/*/mir/tools/libmirserverlttng.so
8usr/lib/*/libmirplatformstub.so8usr/lib/*/mir/client-platform/dummy.so
9usr/lib/*/mir/server-platform/graphics-dummy.so
910
=== modified file 'debian/rules'
--- debian/rules 2014-11-27 03:48:20 +0000
+++ debian/rules 2014-11-27 07:32:44 +0000
@@ -13,9 +13,6 @@
13export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.913export CC=$(DEB_HOST_GNU_TYPE)-gcc-4.9
14export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.914export CXX=$(DEB_HOST_GNU_TYPE)-g++-4.9
1515
16export PLATFORM_DRIVER = platform4driver
17export CLIENT_DRIVER = client8driver
18
19%:16%:
20 dh $@ --parallel --fail-missing17 dh $@ --parallel --fail-missing
2118
@@ -57,6 +54,7 @@
57# Nothing outside Mir should link to libmirprotobuf directly.54# Nothing outside Mir should link to libmirprotobuf directly.
58# Delete the symlink so that --fail-missing doesn't think we've missed it55# Delete the symlink so that --fail-missing doesn't think we've missed it
59# accidentally.56# accidentally.
57<<<<<<< TREE
60 rm debian/tmp/usr/lib/*/libmirprotobuf.so58 rm debian/tmp/usr/lib/*/libmirprotobuf.so
61 dh_install --fail-missing \59 dh_install --fail-missing \
62 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmir$(PLATFORM_DRIVER).so \60 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmir$(PLATFORM_DRIVER).so \
@@ -72,3 +70,7 @@
72 dh_gencontrol -- \70 dh_gencontrol -- \
73 -Vplatform-driver=$(PLATFORM_DRIVER) \71 -Vplatform-driver=$(PLATFORM_DRIVER) \
74 -Vclient-driver=$(CLIENT_DRIVER)72 -Vclient-driver=$(CLIENT_DRIVER)
73=======
74 -rm debian/tmp/usr/lib/*/libmirprotobuf.so
75 dh_install --fail-missing
76>>>>>>> MERGE-SOURCE
7577
=== modified file 'include/platform/mir/graphics/platform.h'
--- include/platform/mir/graphics/platform.h 2014-11-27 03:48:20 +0000
+++ include/platform/mir/graphics/platform.h 2014-11-27 07:32:44 +0000
@@ -96,6 +96,33 @@
96};96};
9797
98/**98/**
99 * A measure of how good this module is at supporting the current device
100 *
101 * \note This is compared as an integer; best + 1 is a valid PlatformPriority that
102 * will be used in preference to a module that reports best.
103 * Platform modules distributed with Mir will never use a priority higher
104 * than best.
105 */
106enum PlatformPriority : uint32_t
107{
108 unsupported = 0, /**< Unable to function at all on this device */
109 supported = 128, /**< Capable of providing a functioning Platform on this device,
110 * possibly with degraded performance or features.
111 */
112 best = 256 /**< Capable of providing a Platform with the best features and
113 * performance this device is capable of.
114 */
115};
116
117/**
118 * Describes a platform module
119 */
120struct ModuleProperties
121{
122 char const* name;
123};
124
125/**
99 * Function prototype used to return a new graphics platform.126 * Function prototype used to return a new graphics platform.
100 *127 *
101 * \param [in] options options to use for this platform128 * \param [in] options options to use for this platform
@@ -118,6 +145,15 @@
118 boost::program_options::options_description& config);145 boost::program_options::options_description& config);
119extern "C" void add_platform_options(146extern "C" void add_platform_options(
120 boost::program_options::options_description& config);147 boost::program_options::options_description& config);
148
149// TODO: We actually need to be more granular here; on a device with more
150// than one graphics system we may need a different platform per GPU,
151// so we should be associating platforms with graphics devices in some way
152extern "C" typedef PlatformPriority(*PlatformProbe)();
153extern "C" PlatformPriority probe_platform();
154
155extern "C" typedef ModuleProperties const*(*DescribeModule)();
156extern "C" ModuleProperties const* describe_module();
121}157}
122}158}
123159
124160
=== modified file 'include/platform/mir/options/configuration.h'
--- include/platform/mir/options/configuration.h 2014-11-24 02:16:00 +0000
+++ include/platform/mir/options/configuration.h 2014-11-27 07:32:44 +0000
@@ -54,6 +54,7 @@
54extern char const* const lttng_opt_value;54extern char const* const lttng_opt_value;
5555
56extern char const* const platform_graphics_lib;56extern char const* const platform_graphics_lib;
57extern char const* const platform_graphics_path;
5758
58class Configuration59class Configuration
59{60{
6061
=== modified file 'platform-ABI-sha1sums'
--- platform-ABI-sha1sums 2014-11-27 03:48:20 +0000
+++ platform-ABI-sha1sums 2014-11-27 07:32:44 +0000
@@ -37,12 +37,19 @@
375dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h375dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h
38d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h38d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h
39979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h39979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
40<<<<<<< TREE
409bbe7eef3a470d7c2daf74de2943a2d03f80aa20 include/platform/mir/graphics/native_platform.h419bbe7eef3a470d7c2daf74de2943a2d03f80aa20 include/platform/mir/graphics/native_platform.h
413bd5f663b62fd1e4be92518a27ed5a0f6a82f20b include/platform/mir/graphics/platform.h423bd5f663b62fd1e4be92518a27ed5a0f6a82f20b include/platform/mir/graphics/platform.h
43=======
44f90a35371e236a6cfec8e9a8474dbb3305c7621e include/platform/mir/graphics/internal_client.h
45c9730cac4a3a101f9706ec6f444958abe047fd88 include/platform/mir/graphics/internal_surface.h
46c187e4d1ca333ded84d4599c6527b13a658dd77a include/platform/mir/graphics/native_platform.h
473a859b3d78822d95910a3053684ab3948af176b6 include/platform/mir/graphics/platform.h
48>>>>>>> MERGE-SOURCE
423b3463d2513f4c3985f2400496dab333518f9a13 include/platform/mir/graphics/platform_ipc_operations.h493b3463d2513f4c3985f2400496dab333518f9a13 include/platform/mir/graphics/platform_ipc_operations.h
431b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h501b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h
4484c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h5184c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
45abeb45a8c6bfc81a12136f25e455e9803c32c10e include/platform/mir/options/configuration.h5293a154564a8b25a36c91492b6dc3d8663604ad06 include/platform/mir/options/configuration.h
4647007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h5347007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h
47b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h54b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
483c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h553c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h
4956
=== modified file 'server-ABI-sha1sums'
--- server-ABI-sha1sums 2014-11-27 03:48:20 +0000
+++ server-ABI-sha1sums 2014-11-27 07:32:44 +0000
@@ -37,12 +37,19 @@
375dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h375dc095474ef3e294c0aa4008e9ed997bdb21d34c include/platform/mir/graphics/gl_config.h
38d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h38d0442a5d5d88a4be6e3e1f99e433c1c43a86bfce include/platform/mir/graphics/gl_context.h
39979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h39979d2c1ac723ccef538d9a378228a02b0f173bd7 include/platform/mir/graphics/graphic_buffer_allocator.h
40<<<<<<< TREE
409bbe7eef3a470d7c2daf74de2943a2d03f80aa20 include/platform/mir/graphics/native_platform.h419bbe7eef3a470d7c2daf74de2943a2d03f80aa20 include/platform/mir/graphics/native_platform.h
413bd5f663b62fd1e4be92518a27ed5a0f6a82f20b include/platform/mir/graphics/platform.h423bd5f663b62fd1e4be92518a27ed5a0f6a82f20b include/platform/mir/graphics/platform.h
43=======
44f90a35371e236a6cfec8e9a8474dbb3305c7621e include/platform/mir/graphics/internal_client.h
45c9730cac4a3a101f9706ec6f444958abe047fd88 include/platform/mir/graphics/internal_surface.h
46c187e4d1ca333ded84d4599c6527b13a658dd77a include/platform/mir/graphics/native_platform.h
473a859b3d78822d95910a3053684ab3948af176b6 include/platform/mir/graphics/platform.h
48>>>>>>> MERGE-SOURCE
423b3463d2513f4c3985f2400496dab333518f9a13 include/platform/mir/graphics/platform_ipc_operations.h493b3463d2513f4c3985f2400496dab333518f9a13 include/platform/mir/graphics/platform_ipc_operations.h
431b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h501b77fb3290af00dc7d1c11dcc5388972dacb9ec3 include/platform/mir/graphics/platform_ipc_package.h
4484c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h5184c063346b3bd51b4624d9f940008d4c3f8be066 include/platform/mir/graphics/renderable.h
45abeb45a8c6bfc81a12136f25e455e9803c32c10e include/platform/mir/options/configuration.h5293a154564a8b25a36c91492b6dc3d8663604ad06 include/platform/mir/options/configuration.h
4647007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h5347007c783c174f8e94d332c4b13c6b01358b48fb include/platform/mir/options/default_configuration.h
47b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h54b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
483c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h553c37cc31e8b290b89c311d82f02e07d342766451 include/platform/mir/options/program_option.h
4956
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -20,3 +20,5 @@
20set(MIR_PLATFORM_REFERENCES ${MIR_PLATFORM_REFERENCES} PARENT_SCOPE)20set(MIR_PLATFORM_REFERENCES ${MIR_PLATFORM_REFERENCES} PARENT_SCOPE)
21set(MIR_COMMON_OBJECTS ${MIR_COMMON_OBJECTS} PARENT_SCOPE)21set(MIR_COMMON_OBJECTS ${MIR_COMMON_OBJECTS} PARENT_SCOPE)
22set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)22set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)
23set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE)
24set(MIR_SERVER_PLATFORM_PLUGIN_PATH ${MIR_SERVER_PLATFORM_PLUGIN_PATH} PARENT_SCOPE)
2325
=== modified file 'src/client/CMakeLists.txt'
--- src/client/CMakeLists.txt 2014-11-27 03:48:20 +0000
+++ src/client/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -1,13 +1,3 @@
1set(MIRCLIENT_ABI 8)
2set(CLIENT_DRIVER client${MIRCLIENT_ABI}driver)
3set(MIR_CLIENT_DRIVER mir${CLIENT_DRIVER})
4set(MIR_CLIENT_DRIVER_BINARY lib${MIR_CLIENT_DRIVER}.so
5 CACHE STRING "File name of Mir client drivers")
6add_definitions(
7 -DMIR_CLIENT_DRIVER_BINARY="${MIR_CLIENT_DRIVER_BINARY}"
8 -DMIR_LOGGING_COMPONENT_FALLBACK="mirclient"
9)
10
11set(PREFIX "${CMAKE_INSTALL_PREFIX}")1set(PREFIX "${CMAKE_INSTALL_PREFIX}")
12set(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")2set(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")
13set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")3set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
@@ -33,6 +23,19 @@
33 ${DRM_INCLUDE_DIRS}23 ${DRM_INCLUDE_DIRS}
34)24)
3525
26set(MIRCLIENT_ABI 8)
27set(CLIENT_PLATFORM_VERSION "MIR_CLIENT_PLATFORM_2")
28set(symbol_map ${CMAKE_SOURCE_DIR}/src/client/symbols.map)
29
30set(MIR_CLIENT_PLATFORM_PATH
31 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/mir/client-platform
32)
33set(MIR_CLIENT_PLATFORM_PATH ${MIR_CLIENT_PLATFORM_PATH} PARENT_SCOPE)
34
35add_definitions(-DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}/")
36add_definitions(-DCLIENT_PLATFORM_VERSION="${CLIENT_PLATFORM_VERSION}")
37add_definitions(-DMIR_LOGGING_COMPONENT_FALLBACK="mirclient")
38
36add_subdirectory(rpc/)39add_subdirectory(rpc/)
37add_subdirectory(lttng/)40add_subdirectory(lttng/)
3841
@@ -72,6 +75,7 @@
72 mir_prompt_session.cpp75 mir_prompt_session.cpp
73 mir_prompt_session_api.cpp76 mir_prompt_session_api.cpp
74 mir_event_distributor.cpp77 mir_event_distributor.cpp
78 probing_client_platform_factory.cpp
75 periodic_perf_report.cpp79 periodic_perf_report.cpp
76)80)
7781
@@ -81,8 +85,6 @@
81 $<TARGET_OBJECTS:mirclientobjects>85 $<TARGET_OBJECTS:mirclientobjects>
82)86)
8387
84set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
85
86set_target_properties(88set_target_properties(
87 mirclient89 mirclient
8890
@@ -91,7 +93,9 @@
91 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"93 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
92)94)
9395
94target_link_libraries(mirclient96target_link_libraries(
97 mirclient
98
95 mirclientrpc99 mirclientrpc
96 mirclientlttngstatic100 mirclientlttngstatic
97 mircommon101 mircommon
98102
=== modified file 'src/client/android/CMakeLists.txt'
--- src/client/android/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/client/android/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -14,17 +14,18 @@
14)14)
1515
16add_library(16add_library(
17 mirclientplatformandroid SHARED17 mirclientplatformandroid MODULE
18 18
19 $<TARGET_OBJECTS:mirclientplatformandroidobjects>19 $<TARGET_OBJECTS:mirclientplatformandroidobjects>
20 $<TARGET_OBJECTS:mirclient_platformimpl>20 $<TARGET_OBJECTS:mirclient_platformimpl>
21)21)
2222
23set_target_properties(23set_target_properties(
24 mirclientplatformandroid PROPERTIES24 mirclientplatformandroid PROPERTIES
25 OUTPUT_NAME ${MIR_CLIENT_DRIVER}25 OUTPUT_NAME android
26 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android26 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/client-modules
27 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"27 PREFIX ""
28 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
28)29)
2930
30target_link_libraries(mirclientplatformandroid31target_link_libraries(mirclientplatformandroid
@@ -33,20 +34,4 @@
33 ${LIBHARDWARE_LIBRARIES}34 ${LIBHARDWARE_LIBRARIES}
34)35)
3536
36install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${CLIENT_DRIVER}/android)37install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
37
38if (MIR_TEST_PLATFORM STREQUAL "android")
39 add_custom_command(TARGET mirclientplatformandroid
40 POST_BUILD
41 COMMAND ${CMAKE_COMMAND} -E remove ${MIR_CLIENT_DRIVER_BINARY}
42 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirclientplatformandroid> ${MIR_CLIENT_DRIVER_BINARY}
43 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
44 )
45
46 install(CODE
47 "execute_process(
48 COMMAND ln -sf mir/${CLIENT_DRIVER}/android/${MIR_CLIENT_DRIVER_BINARY}
49 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
50 )"
51 )
52endif()
5338
=== modified file 'src/client/android/android_native_display_container.cpp'
--- src/client/android/android_native_display_container.cpp 2014-11-24 02:16:00 +0000
+++ src/client/android/android_native_display_container.cpp 2014-11-27 07:32:44 +0000
@@ -62,16 +62,28 @@
62bool62bool
63mcla::AndroidNativeDisplayContainer::validate(MirEGLNativeDisplayType display) const63mcla::AndroidNativeDisplayContainer::validate(MirEGLNativeDisplayType display) const
64{64{
65 return mir_connection_is_valid(static_cast<MirConnection*>(display));65 std::lock_guard<std::mutex> lg(guard);
66 return (valid_displays.find(display) != valid_displays.end());
66}67}
6768
68MirEGLNativeDisplayType69MirEGLNativeDisplayType
69mcla::AndroidNativeDisplayContainer::create(MirConnection* connection)70mcla::AndroidNativeDisplayContainer::create(ClientContext* context)
70{71{
71 return static_cast<MirEGLNativeDisplayType>(connection);72 std::lock_guard<std::mutex> lg(guard);
73 auto egl_display = static_cast<MirEGLNativeDisplayType>(context);
74 valid_displays.insert(egl_display);
75
76 return egl_display;
72}77}
7378
74void79void
75mcla::AndroidNativeDisplayContainer::release(MirEGLNativeDisplayType /* display */)80mcla::AndroidNativeDisplayContainer::release(MirEGLNativeDisplayType display)
76{81{
82 std::lock_guard<std::mutex> lg(guard);
83
84 auto it = valid_displays.find(display);
85 if (it == valid_displays.end())
86 return;
87
88 valid_displays.erase(it);
77}89}
7890
=== modified file 'src/client/android/android_native_display_container.h'
--- src/client/android/android_native_display_container.h 2013-05-02 00:11:18 +0000
+++ src/client/android/android_native_display_container.h 2014-11-27 07:32:44 +0000
@@ -23,6 +23,9 @@
2323
24#include "mir_toolkit/client_types.h"24#include "mir_toolkit/client_types.h"
2525
26#include <unordered_set>
27#include <mutex>
28
26namespace mir29namespace mir
27{30{
28namespace client31namespace client
@@ -36,7 +39,7 @@
36 AndroidNativeDisplayContainer();39 AndroidNativeDisplayContainer();
37 virtual ~AndroidNativeDisplayContainer();40 virtual ~AndroidNativeDisplayContainer();
3841
39 MirEGLNativeDisplayType create(MirConnection* connection);42 MirEGLNativeDisplayType create(ClientContext* context) override;
40 void release(MirEGLNativeDisplayType display);43 void release(MirEGLNativeDisplayType display);
4144
42 bool validate(MirEGLNativeDisplayType display) const;45 bool validate(MirEGLNativeDisplayType display) const;
@@ -44,6 +47,10 @@
44protected:47protected:
45 AndroidNativeDisplayContainer(AndroidNativeDisplayContainer const&) = delete;48 AndroidNativeDisplayContainer(AndroidNativeDisplayContainer const&) = delete;
46 AndroidNativeDisplayContainer& operator=(AndroidNativeDisplayContainer const&) = delete;49 AndroidNativeDisplayContainer& operator=(AndroidNativeDisplayContainer const&) = delete;
50
51private:
52 std::mutex mutable guard;
53 std::unordered_set<MirEGLNativeDisplayType> valid_displays;
47};54};
4855
49}56}
5057
=== modified file 'src/client/android/client_platform_factory.cpp'
--- src/client/android/client_platform_factory.cpp 2014-02-07 15:43:41 +0000
+++ src/client/android/client_platform_factory.cpp 2014-11-27 07:32:44 +0000
@@ -16,19 +16,35 @@
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */17 */
1818
19#include "client_platform_factory.h"19#include "../client_platform_factory.h"
20#include "mir_toolkit/client_types.h"
21#include "../client_context.h"
20#include "android_client_platform.h"22#include "android_client_platform.h"
2123
24#include <stdexcept>
25
22namespace mcl = mir::client;26namespace mcl = mir::client;
23namespace mcla = mcl::android;27namespace mcla = mcl::android;
2428
25std::shared_ptr<mcl::ClientPlatform>29extern "C" std::shared_ptr<mcl::ClientPlatform>
26mcla::ClientPlatformFactory::create_client_platform(mcl::ClientContext* /*context*/)30mcl::create_client_platform(mcl::ClientContext* context)
27{31{
32 MirPlatformPackage platform;
33 context->populate(platform);
34 if (platform.data_items != 0 || platform.fd_items != 0)
35 {
36 throw new std::runtime_error{"Attempted to create Android client platform on non-Android server"};
37 }
28 return std::make_shared<mcla::AndroidClientPlatform>();38 return std::make_shared<mcla::AndroidClientPlatform>();
29}39}
3040
31extern "C" std::shared_ptr<mcl::ClientPlatformFactory> mcl::create_client_platform_factory()41extern "C" bool
42mcl::is_appropriate_module(mcl::ClientContext* context)
32{43{
33 return std::make_shared<mcla::ClientPlatformFactory>();44 MirPlatformPackage platform;
45 context->populate(platform);
46 // TODO: Actually check what platform we're using, rather than blindly
47 // hope we can distinguish them from the stuff they've put in the
48 // PlatformPackage.
49 return platform.data_items == 0 && platform.fd_items == 0;
34}50}
3551
=== modified file 'src/client/android/client_platform_factory.h'
--- src/client/android/client_platform_factory.h 2014-02-07 15:43:41 +0000
+++ src/client/android/client_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -28,11 +28,8 @@
28namespace android28namespace android
29{29{
3030
31class ClientPlatformFactory : public client::ClientPlatformFactory31extern "C" std::shared_ptr<ClientPlatform>
32{32create_client_platform(ClientContext* context);
33public:
34 std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) override;
35};
3633
37}34}
38}35}
3936
=== modified file 'src/client/android/symbols.map'
--- src/client/android/symbols.map 2014-11-24 02:16:00 +0000
+++ src/client/android/symbols.map 2014-11-27 07:32:44 +0000
@@ -1,5 +1,6 @@
1MIR_CLIENTPLATFORM_1 {1MIR_CLIENT_PLATFORM_2 {
2 global: 2 global:
3 create_client_platform_factory;3 create_client_platform;
4 is_appropriate_module;
4 local: *;5 local: *;
5};
6\ No newline at end of file6\ No newline at end of file
7};
78
=== modified file 'src/client/client_context.h'
--- src/client/client_context.h 2013-08-28 03:41:48 +0000
+++ src/client/client_context.h 2014-11-27 07:32:44 +0000
@@ -29,7 +29,6 @@
29public:29public:
30 virtual ~ClientContext() {}30 virtual ~ClientContext() {}
3131
32 virtual MirConnection* mir_connection() = 0;
33 virtual void populate(MirPlatformPackage& platform_package) = 0;32 virtual void populate(MirPlatformPackage& platform_package) = 0;
3433
35protected:34protected:
3635
=== modified file 'src/client/client_platform_factory.h'
--- src/client/client_platform_factory.h 2014-03-06 06:05:17 +0000
+++ src/client/client_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -41,8 +41,11 @@
41 ClientPlatformFactory& operator=(ClientPlatformFactory const& p) = delete;41 ClientPlatformFactory& operator=(ClientPlatformFactory const& p) = delete;
42};42};
4343
44extern "C" typedef std::shared_ptr<ClientPlatformFactory>(*CreateClientPlatformFactory)();44extern "C" typedef std::shared_ptr<ClientPlatform>(*CreateClientPlatform)(ClientContext* context);
45extern "C" std::shared_ptr<ClientPlatformFactory> create_client_platform_factory();45extern "C" std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context);
46
47extern "C" typedef bool (*ClientPlatformProbe)(ClientContext* context);
48extern "C" bool is_appropriate_module(ClientContext* context);
4649
47}50}
48}51}
4952
=== modified file 'src/client/connection_configuration.h'
--- src/client/connection_configuration.h 2014-11-24 02:16:00 +0000
+++ src/client/connection_configuration.h 2014-11-27 07:32:44 +0000
@@ -39,8 +39,6 @@
39class Logger;39class Logger;
40}40}
4141
42class SharedLibrary;
43
44namespace client42namespace client
45{43{
46class ConnectionSurfaceMap;44class ConnectionSurfaceMap;
@@ -65,7 +63,6 @@
65 virtual std::shared_ptr<LifecycleControl> the_lifecycle_control() = 0;63 virtual std::shared_ptr<LifecycleControl> the_lifecycle_control() = 0;
66 virtual std::shared_ptr<EventSink> the_event_sink() = 0;64 virtual std::shared_ptr<EventSink> the_event_sink() = 0;
67 virtual std::shared_ptr<EventHandlerRegister> the_event_handler_register() = 0;65 virtual std::shared_ptr<EventHandlerRegister> the_event_handler_register() = 0;
68 virtual std::shared_ptr<SharedLibrary> the_platform_library() = 0;
6966
70protected:67protected:
71 ConnectionConfiguration() = default;68 ConnectionConfiguration() = default;
7269
=== modified file 'src/client/default_connection_configuration.cpp'
--- src/client/default_connection_configuration.cpp 2014-11-24 02:16:00 +0000
+++ src/client/default_connection_configuration.cpp 2014-11-27 07:32:44 +0000
@@ -35,6 +35,7 @@
35#include "lifecycle_control.h"35#include "lifecycle_control.h"
36#include "mir/shared_library.h"36#include "mir/shared_library.h"
37#include "client_platform_factory.h"37#include "client_platform_factory.h"
38#include "probing_client_platform_factory.h"
38#include "mir_event_distributor.h"39#include "mir_event_distributor.h"
39#include "mir/shared_library_prober.h"40#include "mir/shared_library_prober.h"
4041
@@ -47,7 +48,10 @@
47std::string const off_opt_val{"off"};48std::string const off_opt_val{"off"};
48std::string const log_opt_val{"log"};49std::string const log_opt_val{"log"};
49std::string const lttng_opt_val{"lttng"};50std::string const lttng_opt_val{"lttng"};
50std::string const default_platform_lib{MIR_CLIENT_DRIVER_BINARY};51
52// Shove this here until we properly manage the lifetime of our
53// loadable modules
54std::shared_ptr<mcl::ProbingClientPlatformFactory> the_platform_prober;
5155
52// Hack around the way Qt loads mir:56// Hack around the way Qt loads mir:
53// qtmir and therefore Mir are loaded via dlopen(..., RTLD_LOCAL).57// qtmir and therefore Mir are loaded via dlopen(..., RTLD_LOCAL).
@@ -108,11 +112,23 @@
108 return client_platform_factory(112 return client_platform_factory(
109 [this]113 [this]
110 {114 {
111 auto const create_client_platform_factory =115 ensure_loaded_with_rtld_global();
112 the_platform_library()->load_function<mcl::CreateClientPlatformFactory>(116 auto const platform_override = getenv("MIR_CLIENT_PLATFORM_LIB");
113 "create_client_platform_factory");117 std::vector<std::shared_ptr<mir::SharedLibrary>> platform_plugins;
114118 if (platform_override)
115 return create_client_platform_factory();119 {
120 platform_plugins.push_back(std::make_shared<mir::SharedLibrary>(platform_override));
121 }
122 else
123 {
124 auto const platform_path_override = getenv("MIR_CLIENT_PLATFORM_PATH");
125 auto const platform_path = platform_path_override ? platform_path_override : MIR_CLIENT_PLATFORM_PATH;
126 platform_plugins = mir::libraries_for_path(platform_path, *the_shared_library_prober_report());
127 }
128
129 the_platform_prober = std::make_shared<mcl::ProbingClientPlatformFactory>(platform_plugins);
130
131 return the_platform_prober;
116 });132 });
117}133}
118134
@@ -211,6 +227,7 @@
211 {227 {
212 auto val_raw = getenv("MIR_CLIENT_SHARED_LIBRARY_PROBER_REPORT");228 auto val_raw = getenv("MIR_CLIENT_SHARED_LIBRARY_PROBER_REPORT");
213 std::string const val{val_raw ? val_raw : off_opt_val};229 std::string const val{val_raw ? val_raw : off_opt_val};
230
214 if (val == log_opt_val)231 if (val == log_opt_val)
215 return std::make_shared<mir::logging::SharedLibraryProberReport>(the_logger());232 return std::make_shared<mir::logging::SharedLibraryProberReport>(the_logger());
216 else if (val == lttng_opt_val)233 else if (val == lttng_opt_val)
@@ -219,15 +236,3 @@
219 return std::make_shared<mir::logging::NullSharedLibraryProberReport>();236 return std::make_shared<mir::logging::NullSharedLibraryProberReport>();
220 });237 });
221}238}
222
223std::shared_ptr<mir::SharedLibrary> mcl::DefaultConnectionConfiguration::the_platform_library()
224{
225 if (!platform_library)
226 {
227 ensure_loaded_with_rtld_global();
228 auto const val_raw = getenv("MIR_CLIENT_PLATFORM_LIB");
229 std::string const libname{val_raw ? val_raw : default_platform_lib};
230 platform_library = std::make_shared<mir::SharedLibrary>(libname);
231 }
232 return platform_library;
233}
234239
=== modified file 'src/client/default_connection_configuration.h'
--- src/client/default_connection_configuration.h 2014-11-24 02:16:00 +0000
+++ src/client/default_connection_configuration.h 2014-11-27 07:32:44 +0000
@@ -60,16 +60,12 @@
60 std::shared_ptr<EventSink> the_event_sink() override;60 std::shared_ptr<EventSink> the_event_sink() override;
61 std::shared_ptr<EventHandlerRegister> the_event_handler_register() override;61 std::shared_ptr<EventHandlerRegister> the_event_handler_register() override;
62 std::shared_ptr<mir::SharedLibraryProberReport> the_shared_library_prober_report();62 std::shared_ptr<mir::SharedLibraryProberReport> the_shared_library_prober_report();
63 std::shared_ptr<SharedLibrary> the_platform_library() override;
6463
65 virtual std::string the_socket_file();64 virtual std::string the_socket_file();
66 virtual std::shared_ptr<rpc::RpcReport> the_rpc_report();65 virtual std::shared_ptr<rpc::RpcReport> the_rpc_report();
67 virtual std::shared_ptr<input::receiver::InputReceiverReport> the_input_receiver_report();66 virtual std::shared_ptr<input::receiver::InputReceiverReport> the_input_receiver_report();
6867
69protected:68protected:
70 // MUST be first data member so it is destroyed last.
71 std::shared_ptr<mir::SharedLibrary> platform_library;
72
73 CachedPtr<google::protobuf::RpcChannel> rpc_channel;69 CachedPtr<google::protobuf::RpcChannel> rpc_channel;
74 CachedPtr<mir::logging::Logger> logger;70 CachedPtr<mir::logging::Logger> logger;
75 CachedPtr<ClientPlatformFactory> client_platform_factory;71 CachedPtr<ClientPlatformFactory> client_platform_factory;
7672
=== modified file 'src/client/egl_native_display_container.h'
--- src/client/egl_native_display_container.h 2014-03-06 06:05:17 +0000
+++ src/client/egl_native_display_container.h 2014-11-27 07:32:44 +0000
@@ -26,12 +26,14 @@
26namespace client26namespace client
27{27{
2828
29class ClientContext;
30
29class EGLNativeDisplayContainer31class EGLNativeDisplayContainer
30{32{
31public:33public:
32 virtual ~EGLNativeDisplayContainer() {}34 virtual ~EGLNativeDisplayContainer() {}
3335
34 virtual MirEGLNativeDisplayType create(MirConnection* connection) = 0;36 virtual MirEGLNativeDisplayType create(ClientContext* context) = 0;
35 virtual void release(MirEGLNativeDisplayType display) = 0;37 virtual void release(MirEGLNativeDisplayType display) = 0;
3638
37 virtual bool validate(MirEGLNativeDisplayType display) const = 0;39 virtual bool validate(MirEGLNativeDisplayType display) const = 0;
3840
=== modified file 'src/client/mesa/CMakeLists.txt'
--- src/client/mesa/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/client/mesa/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -15,7 +15,7 @@
15)15)
1616
17add_library(17add_library(
18 mirclientplatformmesa SHARED18 mirclientplatformmesa MODULE
1919
20 $<TARGET_OBJECTS:mirclientplatformmesaobjects>20 $<TARGET_OBJECTS:mirclientplatformmesaobjects>
21 $<TARGET_OBJECTS:mirclient_platformimpl>21 $<TARGET_OBJECTS:mirclient_platformimpl>
@@ -23,9 +23,10 @@
2323
24set_target_properties(24set_target_properties(
25 mirclientplatformmesa PROPERTIES25 mirclientplatformmesa PROPERTIES
26 OUTPUT_NAME ${MIR_CLIENT_DRIVER}26 OUTPUT_NAME mesa
27 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa27 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/client-modules
28 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"28 PREFIX ""
29 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
29)30)
3031
31target_link_libraries(mirclientplatformmesa32target_link_libraries(mirclientplatformmesa
@@ -33,21 +34,4 @@
33 ${DRM_LDFLAGS} ${DRM_LIBRARIES}34 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
34)35)
3536
36install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${CLIENT_DRIVER}/mesa)37install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
37
38if (MIR_TEST_PLATFORM STREQUAL "mesa")
39 add_custom_command(TARGET mirclientplatformmesa
40 POST_BUILD
41 COMMAND ${CMAKE_COMMAND} -E remove ${MIR_CLIENT_DRIVER_BINARY}
42 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirclientplatformmesa> ${MIR_CLIENT_DRIVER_BINARY}
43 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
44 )
45
46 install(CODE
47 "execute_process(
48 COMMAND ln -sf mir/${CLIENT_DRIVER}/mesa/${MIR_CLIENT_DRIVER_BINARY}
49 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
50 )"
51 )
52endif()
53
5438
=== modified file 'src/client/mesa/client_platform.cpp'
--- src/client/mesa/client_platform.cpp 2014-03-06 06:05:17 +0000
+++ src/client/mesa/client_platform.cpp 2014-11-27 07:32:44 +0000
@@ -95,7 +95,7 @@
95std::shared_ptr<EGLNativeDisplayType> mclm::ClientPlatform::create_egl_native_display()95std::shared_ptr<EGLNativeDisplayType> mclm::ClientPlatform::create_egl_native_display()
96{96{
97 MirEGLNativeDisplayType *mir_native_display = new MirEGLNativeDisplayType;97 MirEGLNativeDisplayType *mir_native_display = new MirEGLNativeDisplayType;
98 *mir_native_display = display_container.create(context->mir_connection());98 *mir_native_display = display_container.create(context);
99 auto egl_native_display = reinterpret_cast<EGLNativeDisplayType*>(mir_native_display);99 auto egl_native_display = reinterpret_cast<EGLNativeDisplayType*>(mir_native_display);
100100
101 return std::shared_ptr<EGLNativeDisplayType>(egl_native_display, NativeDisplayDeleter(display_container));101 return std::shared_ptr<EGLNativeDisplayType>(egl_native_display, NativeDisplayDeleter(display_container));
102102
=== modified file 'src/client/mesa/client_platform_factory.cpp'
--- src/client/mesa/client_platform_factory.cpp 2014-02-07 15:43:41 +0000
+++ src/client/mesa/client_platform_factory.cpp 2014-11-27 07:32:44 +0000
@@ -16,13 +16,16 @@
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */17 */
1818
19#include "client_platform_factory.h"19#include "../client_platform_factory.h"
20#include "client_platform.h"20#include "client_platform.h"
21#include "mir_toolkit/client_types.h"
22#include "../client_context.h"
21#include "buffer_file_ops.h"23#include "buffer_file_ops.h"
22#include "../egl_native_display_container.h"24#include "../egl_native_display_container.h"
2325
24#include <sys/mman.h>26#include <sys/mman.h>
25#include <unistd.h>27#include <unistd.h>
28#include <stdexcept>
2629
27namespace mcl = mir::client;30namespace mcl = mir::client;
28namespace mclm = mcl::mesa;31namespace mclm = mcl::mesa;
@@ -57,15 +60,26 @@
5760
58}61}
5962
60std::shared_ptr<mcl::ClientPlatform>63extern "C" std::shared_ptr<mcl::ClientPlatform> mcl::create_client_platform(mcl::ClientContext* context)
61mclm::ClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
62{64{
65 MirPlatformPackage package;
66 context->populate(package);
67 if (package.data_items != 0 || package.fd_items != 1)
68 {
69 throw std::runtime_error{"Attempted to create Mesa client platform on non-Mesa server"};
70 }
63 auto buffer_file_ops = std::make_shared<RealBufferFileOps>();71 auto buffer_file_ops = std::make_shared<RealBufferFileOps>();
64 return std::make_shared<mclm::ClientPlatform>(72 return std::make_shared<mclm::ClientPlatform>(
65 context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());73 context, buffer_file_ops, mcl::EGLNativeDisplayContainer::instance());
66}74}
6775
68extern "C" std::shared_ptr<mcl::ClientPlatformFactory> mcl::create_client_platform_factory()76extern "C" bool
77mcl::is_appropriate_module(mcl::ClientContext* context)
69{78{
70 return std::make_shared<mclm::ClientPlatformFactory>();79 MirPlatformPackage platform;
80 context->populate(platform);
81 // TODO: Actually check what platform we're using, rather than blindly
82 // hope we can distinguish them from the stuff they've put in the
83 // PlatformPackage.
84 return platform.data_items == 0 && platform.fd_items == 1;
71}85}
7286
=== modified file 'src/client/mesa/client_platform_factory.h'
--- src/client/mesa/client_platform_factory.h 2014-02-07 15:43:41 +0000
+++ src/client/mesa/client_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -28,11 +28,6 @@
28namespace mesa28namespace mesa
29{29{
3030
31class ClientPlatformFactory : public client::ClientPlatformFactory
32{
33public:
34 std::shared_ptr<ClientPlatform> create_client_platform(ClientContext* context) override;
35};
3631
37}32}
38}33}
3934
=== modified file 'src/client/mesa/mesa_native_display_container.cpp'
--- src/client/mesa/mesa_native_display_container.cpp 2014-11-24 02:16:00 +0000
+++ src/client/mesa/mesa_native_display_container.cpp 2014-11-27 07:32:44 +0000
@@ -18,7 +18,7 @@
1818
19#include "mesa_native_display_container.h"19#include "mesa_native_display_container.h"
2020
21#include "mir_toolkit/mir_client_library.h"21#include "../client_context.h"
2222
23#include <cstring>23#include <cstring>
24#include <unordered_set>24#include <unordered_set>
@@ -35,8 +35,8 @@
35static int egl_display_get_platform(MirMesaEGLNativeDisplay* display,35static int egl_display_get_platform(MirMesaEGLNativeDisplay* display,
36 MirPlatformPackage* package)36 MirPlatformPackage* package)
37{37{
38 auto connection = static_cast<MirConnection*>(display->context);38 auto context = static_cast<mcl::ClientContext*>(display->context);
39 mir_connection_get_platform(connection, package);39 context->populate(*package);
40 return MIR_MESA_TRUE;40 return MIR_MESA_TRUE;
41}41}
4242
@@ -93,11 +93,11 @@
93}93}
9494
95MirEGLNativeDisplayType95MirEGLNativeDisplayType
96mclm::MesaNativeDisplayContainer::create(MirConnection* connection)96mclm::MesaNativeDisplayContainer::create(ClientContext* context)
97{97{
98 MirMesaEGLNativeDisplay* display = new MirMesaEGLNativeDisplay();98 MirMesaEGLNativeDisplay* display = new MirMesaEGLNativeDisplay();
99 display->display_get_platform = egl_display_get_platform;99 display->display_get_platform = egl_display_get_platform;
100 display->context = connection;100 display->context = context;
101101
102 std::lock_guard<std::mutex> lg(guard);102 std::lock_guard<std::mutex> lg(guard);
103 auto egl_display = static_cast<MirEGLNativeDisplayType>(display);103 auto egl_display = static_cast<MirEGLNativeDisplayType>(display);
104104
=== modified file 'src/client/mesa/mesa_native_display_container.h'
--- src/client/mesa/mesa_native_display_container.h 2014-03-06 06:05:17 +0000
+++ src/client/mesa/mesa_native_display_container.h 2014-11-27 07:32:44 +0000
@@ -40,7 +40,7 @@
40 MesaNativeDisplayContainer();40 MesaNativeDisplayContainer();
41 virtual ~MesaNativeDisplayContainer();41 virtual ~MesaNativeDisplayContainer();
4242
43 MirEGLNativeDisplayType create(MirConnection* connection);43 MirEGLNativeDisplayType create(ClientContext* context);
44 void release(MirEGLNativeDisplayType display);44 void release(MirEGLNativeDisplayType display);
4545
46 bool validate(MirEGLNativeDisplayType display) const;46 bool validate(MirEGLNativeDisplayType display) const;
4747
=== modified file 'src/client/mesa/native_surface.cpp'
--- src/client/mesa/native_surface.cpp 2014-11-24 02:16:00 +0000
+++ src/client/mesa/native_surface.cpp 2014-11-27 07:32:44 +0000
@@ -20,7 +20,6 @@
20#include "../client_buffer.h"20#include "../client_buffer.h"
21#include "native_surface.h"21#include "native_surface.h"
2222
23#include <iostream>
24#include <boost/exception/diagnostic_information.hpp> 23#include <boost/exception/diagnostic_information.hpp>
2524
26namespace mclm=mir::client::mesa;25namespace mclm=mir::client::mesa;
2726
=== modified file 'src/client/mesa/symbols.map'
--- src/client/mesa/symbols.map 2014-11-24 02:16:00 +0000
+++ src/client/mesa/symbols.map 2014-11-27 07:32:44 +0000
@@ -1,7 +1,9 @@
1MIR_CLIENTPLATFORM_1 {1MIR_CLIENT_PLATFORM_2 {
2 global: 2 global:
3 create_client_platform_factory;3 create_client_platform;
4 is_appropriate_module;
4 # Needed by our Mesa EGL platform5 # Needed by our Mesa EGL platform
5 mir_client_mesa_egl_native_display_is_valid;6 mir_client_mesa_egl_native_display_is_valid;
6 local: *;7 local:
8 *;
7};9};
810
=== modified file 'src/client/mir_connection.cpp'
--- src/client/mir_connection.cpp 2014-11-24 02:16:00 +0000
+++ src/client/mir_connection.cpp 2014-11-27 07:32:44 +0000
@@ -95,11 +95,11 @@
95MirConnection::MirConnection(95MirConnection::MirConnection(
96 mir::client::ConnectionConfiguration& conf) :96 mir::client::ConnectionConfiguration& conf) :
97 deregisterer{this},97 deregisterer{this},
98 platform_library{conf.the_platform_library()},
99 channel(conf.the_rpc_channel()),98 channel(conf.the_rpc_channel()),
100 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),99 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),
101 debug(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),100 debug(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),
102 logger(conf.the_logger()),101 logger(conf.the_logger()),
102 connect_done{false},
103 client_platform_factory(conf.the_client_platform_factory()),103 client_platform_factory(conf.the_client_platform_factory()),
104 input_platform(conf.the_input_platform()),104 input_platform(conf.the_input_platform()),
105 display_configuration(conf.the_display_configuration()),105 display_configuration(conf.the_display_configuration()),
@@ -235,6 +235,9 @@
235 set_error_message("Connect failed");235 set_error_message("Connect failed");
236 }236 }
237 }237 }
238
239 connect_done = true;
240
238 /*241 /*
239 * We need to create the client platform after the connection has been242 * We need to create the client platform after the connection has been
240 * established, to ensure that the client platform has access to all243 * established, to ensure that the client platform has access to all
@@ -370,9 +373,9 @@
370373
371void MirConnection::populate(MirPlatformPackage& platform_package)374void MirConnection::populate(MirPlatformPackage& platform_package)
372{375{
373 std::lock_guard<decltype(mutex)> lock(mutex);376 // connect_result is write-once: once it's valid, we don't need to lock
374377 // to use it.
375 if (!connect_result.has_error() && connect_result.has_platform())378 if (connect_done && !connect_result.has_error() && connect_result.has_platform())
376 {379 {
377 auto const& platform = connect_result.platform();380 auto const& platform = connect_result.platform();
378381
@@ -428,11 +431,6 @@
428 return platform;431 return platform;
429}432}
430433
431MirConnection* MirConnection::mir_connection()
432{
433 return this;
434}
435
436EGLNativeDisplayType MirConnection::egl_native_display()434EGLNativeDisplayType MirConnection::egl_native_display()
437{435{
438 std::lock_guard<decltype(mutex)> lock(mutex);436 std::lock_guard<decltype(mutex)> lock(mutex);
439437
=== modified file 'src/client/mir_connection.h'
--- src/client/mir_connection.h 2014-11-24 02:16:00 +0000
+++ src/client/mir_connection.h 2014-11-27 07:32:44 +0000
@@ -22,6 +22,7 @@
22#include <memory>22#include <memory>
23#include <unordered_set>23#include <unordered_set>
24#include <unordered_map>24#include <unordered_map>
25#include <atomic>
2526
26#include <mutex>27#include <mutex>
2728
@@ -117,8 +118,6 @@
117118
118 static bool is_valid(MirConnection *connection);119 static bool is_valid(MirConnection *connection);
119120
120 MirConnection* mir_connection();
121
122 EGLNativeDisplayType egl_native_display();121 EGLNativeDisplayType egl_native_display();
123122
124 void on_surface_created(int id, MirSurface* surface);123 void on_surface_created(int id, MirSurface* surface);
@@ -153,6 +152,7 @@
153 std::shared_ptr<mir::logging::Logger> const logger;152 std::shared_ptr<mir::logging::Logger> const logger;
154 mir::protobuf::Void void_response;153 mir::protobuf::Void void_response;
155 mir::protobuf::Connection connect_result;154 mir::protobuf::Connection connect_result;
155 std::atomic<bool> connect_done;
156 mir::protobuf::Void ignored;156 mir::protobuf::Void ignored;
157 mir::protobuf::ConnectParameters connect_parameters;157 mir::protobuf::ConnectParameters connect_parameters;
158 mir::protobuf::DRMAuthMagicStatus drm_auth_magic_status;158 mir::protobuf::DRMAuthMagicStatus drm_auth_magic_status;
159159
=== added file 'src/client/probing_client_platform_factory.cpp'
--- src/client/probing_client_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ src/client/probing_client_platform_factory.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,38 @@
1#include "probing_client_platform_factory.h"
2
3#include <boost/exception/all.hpp>
4#include <stdexcept>
5
6namespace mcl = mir::client;
7
8mcl::ProbingClientPlatformFactory::ProbingClientPlatformFactory(std::vector<std::shared_ptr<mir::SharedLibrary>> const& modules)
9 : platform_modules{modules}
10{
11 if (modules.empty())
12 {
13 BOOST_THROW_EXCEPTION(
14 std::runtime_error{"Attempted to create a ClientPlatformFactory with no platform modules"});
15 }
16}
17
18std::shared_ptr<mcl::ClientPlatform>
19mcl::ProbingClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
20{
21 for (auto& module : platform_modules)
22 {
23 try
24 {
25 auto probe = module->load_function<mir::client::ClientPlatformProbe>("is_appropriate_module", CLIENT_PLATFORM_VERSION);
26 if (probe(context))
27 {
28 auto factory = module->load_function<mir::client::CreateClientPlatform>("create_client_platform", CLIENT_PLATFORM_VERSION);
29 return factory(context);
30 }
31 }
32 catch(std::runtime_error)
33 {
34 // We were handled a SharedLibrary that's not a client platform module?
35 }
36 }
37 BOOST_THROW_EXCEPTION(std::runtime_error{"No appropriate client platform module found"});
38}
039
=== added file 'src/client/probing_client_platform_factory.h'
--- src/client/probing_client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ src/client/probing_client_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -0,0 +1,27 @@
1#ifndef MIR_CLIENT_PROBING_CLIENT_PLATFORM_FACTORY_H_
2#define MIR_CLIENT_PROBING_CLIENT_PLATFORM_FACTORY_H_
3
4#include <vector>
5
6#include "client_platform_factory.h"
7#include "mir/shared_library.h"
8
9namespace mir
10{
11namespace client
12{
13class ProbingClientPlatformFactory : public ClientPlatformFactory
14{
15public:
16 ProbingClientPlatformFactory(std::vector<std::shared_ptr<SharedLibrary>> const& modules);
17
18 std::shared_ptr<ClientPlatform> create_client_platform(ClientContext *context) override;
19private:
20 std::vector<std::shared_ptr<SharedLibrary>> platform_modules;
21};
22
23
24}
25}
26
27#endif // MIR_CLIENT_PROBING_CLIENT_PLATFORM_FACTORY_H_
028
=== modified file 'src/common/graphics/android/mir_native_window.cpp'
--- src/common/graphics/android/mir_native_window.cpp 2014-11-24 02:16:00 +0000
+++ src/common/graphics/android/mir_native_window.cpp 2014-11-27 07:32:44 +0000
@@ -20,7 +20,6 @@
20#include "mir/graphics/android/android_driver_interpreter.h"20#include "mir/graphics/android/android_driver_interpreter.h"
21#include "mir/graphics/android/sync_fence.h"21#include "mir/graphics/android/sync_fence.h"
2222
23#include <iostream>
24#include <boost/exception/diagnostic_information.hpp> 23#include <boost/exception/diagnostic_information.hpp>
2524
26namespace mg=mir::graphics;25namespace mg=mir::graphics;
2726
=== modified file 'src/common/symbols.map'
--- src/common/symbols.map 2014-11-24 02:16:00 +0000
+++ src/common/symbols.map 2014-11-27 07:32:44 +0000
@@ -150,6 +150,7 @@
150 # but they are used by libmirplatform, libmirclient or libmirserver150 # but they are used by libmirplatform, libmirclient or libmirserver
151 mir::default_server_socket;151 mir::default_server_socket;
152 mir::input::android::Lexicon::translate*;152 mir::input::android::Lexicon::translate*;
153 mir::libraries_for_path*;
153 mir::logging::input_timestamp*;154 mir::logging::input_timestamp*;
154 mir::logging::log*;155 mir::logging::log*;
155 mir::logging::set_logger*;156 mir::logging::set_logger*;
156157
=== removed file 'src/include/platform/mir/shared_library_loader.h'
--- src/include/platform/mir/shared_library_loader.h 2014-11-24 02:16:00 +0000
+++ src/include/platform/mir/shared_library_loader.h 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */
18
19#ifndef MIR_SHARED_LIBRARY_LOADER_H_
20#define MIR_SHARED_LIBRARY_LOADER_H_
21
22#include <string>
23namespace mir
24{
25class SharedLibrary;
26SharedLibrary const* load_library(std::string const& libname);
27}
28#endif
290
=== modified file 'src/platform/CMakeLists.txt'
--- src/platform/CMakeLists.txt 2014-11-27 03:48:20 +0000
+++ src/platform/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -7,20 +7,28 @@
77
8set(MIRPLATFORM_ABI 4)8set(MIRPLATFORM_ABI 4)
99
10set(PLATFORM_DRIVER platform${MIRPLATFORM_ABI}driver)
11set(MIR_PLATFORM_DRIVER mir${PLATFORM_DRIVER})
12set(MIR_PLATFORM_DRIVER_BINARY lib${MIR_PLATFORM_DRIVER}.so
13 CACHE STRING "File name of Mir server platform drivers")
14add_definitions(-DMIR_PLATFORM_DRIVER_BINARY="${MIR_PLATFORM_DRIVER_BINARY}")
15
16set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)10set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
1711
18add_library(mirplatformobjects OBJECT12# This needs to change whenever the ABI between the platform
19 shared_library_loader.cpp13# modules and the server changes in an incompatible way.
20)14# This ABI is much smaller than the full libmirplatform ABI.
15#
16# TODO: Add an extra driver-ABI check target.
17set(SERVER_PLATFORM_VERSION "MIR_GRAPHICS_PLATFORM_1")
18set(SERVER_PLATFORM_VERSION ${SERVER_PLATFORM_VERSION} PARENT_SCOPE)
19
20set(MIR_SERVER_PLATFORM_PLUGIN_PATH
21 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/mir/server-platform
22)
23set(MIR_SERVER_PLATFORM_PLUGIN_PATH
24 ${MIR_SERVER_PLATFORM_PLUGIN_PATH}
25 PARENT_SCOPE
26)
27
28add_definitions(-DMIR_SERVER_PLATFORM_PLUGIN_PATH="${MIR_SERVER_PLATFORM_PLUGIN_PATH}")
29add_definitions(-DSERVER_PLATFORM_VERSION="${SERVER_PLATFORM_VERSION}")
2130
22set(MIR_PLATFORM_OBJECTS31set(MIR_PLATFORM_OBJECTS
23 $<TARGET_OBJECTS:mirplatformobjects>
24 $<TARGET_OBJECTS:mirplatformgraphicscommon>32 $<TARGET_OBJECTS:mirplatformgraphicscommon>
25 $<TARGET_OBJECTS:miroptions>33 $<TARGET_OBJECTS:miroptions>
26 $<TARGET_OBJECTS:mirfatal>34 $<TARGET_OBJECTS:mirfatal>
@@ -39,17 +47,19 @@
39)47)
4048
41target_link_libraries(mirplatform49target_link_libraries(mirplatform
50
42 mircommon51 mircommon
43 ${MIR_PLATFORM_REFERENCES}52 ${MIR_PLATFORM_REFERENCES}
44)53)
4554
46set_target_properties(mirplatform55set_target_properties(
56 mirplatform
57
47 PROPERTIES58 PROPERTIES
48 SOVERSION ${MIRPLATFORM_ABI}59 SOVERSION ${MIRPLATFORM_ABI}
49 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"60 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
50)61)
5162
52
53install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})63install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
5464
55add_subdirectory(graphics/)65add_subdirectory(graphics/)
5666
=== modified file 'src/platform/graphics/CMakeLists.txt'
--- src/platform/graphics/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/platform/graphics/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -12,6 +12,7 @@
12 gl_program.cpp12 gl_program.cpp
13 gl_texture.cpp13 gl_texture.cpp
14 tessellation_helpers.cpp14 tessellation_helpers.cpp
15 platform_probe.cpp
15)16)
1617
17add_library(mirplatformgraphicscommon OBJECT18add_library(mirplatformgraphicscommon OBJECT
1819
=== modified file 'src/platform/graphics/android/CMakeLists.txt'
--- src/platform/graphics/android/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/platform/graphics/android/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -36,20 +36,17 @@
36 ipc_operations.cpp36 ipc_operations.cpp
37 buffer_writer.cpp37 buffer_writer.cpp
38)38)
39
39add_library(mirplatformgraphicsandroid SHARED40add_library(mirplatformgraphicsandroid SHARED
41
40 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>42 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>
41)43)
4244
43set_target_properties(45target_link_libraries(
44 mirplatformgraphicsandroid PROPERTIES46 mirplatformgraphicsandroid
45 OUTPUT_NAME ${MIR_PLATFORM_DRIVER}
46 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
47 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
48)
4947
50target_link_libraries(mirplatformgraphicsandroid48 mirsharedandroid
51 mirplatform49 mirplatform
52 mirsharedandroid
53 ${Boost_PROGRAM_OPTIONS_LIBRARY}50 ${Boost_PROGRAM_OPTIONS_LIBRARY}
54 ${LIBHARDWARE_LIBRARIES}51 ${LIBHARDWARE_LIBRARIES}
55 ${EGL_LDFLAGS} ${EGL_LIBRARIES}52 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
@@ -57,20 +54,14 @@
57 ${ANDROID_PROPERTIES_LDFLAGS}54 ${ANDROID_PROPERTIES_LDFLAGS}
58)55)
5956
60install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${PLATFORM_DRIVER}/android)57set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
6158
62if (MIR_TEST_PLATFORM STREQUAL "android")59set_target_properties(
63 add_custom_command(TARGET mirplatformgraphicsandroid60 mirplatformgraphicsandroid PROPERTIES
64 POST_BUILD61 OUTPUT_NAME graphics-android
65 COMMAND ${CMAKE_COMMAND} -E remove ${MIR_PLATFORM_DRIVER_BINARY}62 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
66 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> ${MIR_PLATFORM_DRIVER_BINARY}63 PREFIX ""
67 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}64 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
68 )65)
6966
70 install(CODE67install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PLUGIN_PATH})
71 "execute_process(
72 COMMAND ln -sf mir/${PLATFORM_DRIVER}/android/${MIR_PLATFORM_DRIVER_BINARY}
73 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
74 )"
75 )
76endif()
7768
=== modified file 'src/platform/graphics/android/platform.cpp'
--- src/platform/graphics/android/platform.cpp 2014-11-24 02:16:00 +0000
+++ src/platform/graphics/android/platform.cpp 2014-11-27 07:32:44 +0000
@@ -170,3 +170,22 @@
170 boost::program_options::value<bool>()->default_value(false),170 boost::program_options::value<bool>()->default_value(false),
171 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");171 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");
172}172}
173
174extern "C" mg::PlatformPriority probe_platform()
175{
176 int err;
177 hw_module_t const* hw_module;
178
179 err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hw_module);
180
181 return err < 0 ? mg::PlatformPriority::unsupported : mg::PlatformPriority::best;
182}
183
184mg::ModuleProperties const description = {
185 "android"
186};
187
188extern "C" mg::ModuleProperties const* describe_module()
189{
190 return &description;
191}
173192
=== added file 'src/platform/graphics/android/symbols.map'
--- src/platform/graphics/android/symbols.map 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/android/symbols.map 2014-11-27 07:32:44 +0000
@@ -0,0 +1,8 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_platform_options;
4 create_platform;
5 create_native_platform;
6 probe_platform;
7 describe_module;
8};
09
=== modified file 'src/platform/graphics/mesa/CMakeLists.txt'
--- src/platform/graphics/mesa/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/platform/graphics/mesa/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -11,7 +11,9 @@
11string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})11string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
12add_definitions(-D__GBM__)12add_definitions(-D__GBM__)
1313
14add_library(mirplatformgraphicsmesaobjects OBJECT14add_library(
15 mirplatformgraphicsmesaobjects OBJECT
16
15 platform.cpp17 platform.cpp
16 buffer_allocator.cpp18 buffer_allocator.cpp
17 gbm_buffer.cpp19 gbm_buffer.cpp
@@ -36,18 +38,15 @@
36 nested_authentication.cpp38 nested_authentication.cpp
37)39)
3840
39add_library(mirplatformgraphicsmesa SHARED41add_library(
42 mirplatformgraphicsmesa MODULE
43
40 $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects>44 $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects>
41)45)
4246
43set_target_properties(47target_link_libraries(
44 mirplatformgraphicsmesa PROPERTIES48 mirplatformgraphicsmesa
45 OUTPUT_NAME ${MIR_PLATFORM_DRIVER}
46 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
47 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
48)
4949
50target_link_libraries(mirplatformgraphicsmesa
51 mirplatform50 mirplatform
52 ${Boost_PROGRAM_OPTIONS_LIBRARY}51 ${Boost_PROGRAM_OPTIONS_LIBRARY}
53 ${DRM_LDFLAGS} ${DRM_LIBRARIES}52 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -56,20 +55,14 @@
56 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}55 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
57)56)
5857
59install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/${PLATFORM_DRIVER}/mesa)58set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
6059
61if (MIR_TEST_PLATFORM STREQUAL "mesa")60set_target_properties(
62 add_custom_command(TARGET mirplatformgraphicsmesa61 mirplatformgraphicsmesa PROPERTIES
63 POST_BUILD62 OUTPUT_NAME graphics-mesa
64 COMMAND ${CMAKE_COMMAND} -E remove ${MIR_PLATFORM_DRIVER_BINARY}63 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
65 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> ${MIR_PLATFORM_DRIVER_BINARY}64 PREFIX ""
66 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}65 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
67 )66)
6867
69 install(CODE68install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PLUGIN_PATH})
70 "execute_process(
71 COMMAND ln -sf mir/${PLATFORM_DRIVER}/mesa/${MIR_PLATFORM_DRIVER_BINARY}
72 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
73 )"
74 )
75endif()
7669
=== modified file 'src/platform/graphics/mesa/platform.cpp'
--- src/platform/graphics/mesa/platform.cpp 2014-11-24 02:16:00 +0000
+++ src/platform/graphics/mesa/platform.cpp 2014-11-27 07:32:44 +0000
@@ -28,6 +28,7 @@
28#include "mir/options/option.h"28#include "mir/options/option.h"
29#include "mir/graphics/native_buffer.h"29#include "mir/graphics/native_buffer.h"
30#include "mir/emergency_cleanup_registry.h"30#include "mir/emergency_cleanup_registry.h"
31#include "mir/udev/wrapper.h"
3132
3233
33#include <boost/throw_exception.hpp>34#include <boost/throw_exception.hpp>
@@ -224,3 +225,30 @@
224 boost::program_options::value<bool>()->default_value(true),225 boost::program_options::value<bool>()->default_value(true),
225 "[platform-specific] utilize the bypass optimization for fullscreen surfaces.");226 "[platform-specific] utilize the bypass optimization for fullscreen surfaces.");
226}227}
228
229extern "C" mg::PlatformPriority probe_platform()
230{
231 auto udev = std::make_shared<mir::udev::Context>();
232
233 mir::udev::Enumerator drm_devices{udev};
234 drm_devices.match_subsystem("drm");
235 drm_devices.match_sysname("card[0-9]*");
236 drm_devices.scan_devices();
237
238 for(auto& device : drm_devices)
239 {
240 static_cast<void>(device);
241 return mg::PlatformPriority::best;
242 }
243
244 return mg::PlatformPriority::unsupported;
245}
246
247mg::ModuleProperties const description = {
248 "mesa"
249};
250
251extern "C" mg::ModuleProperties const* describe_module()
252{
253 return &description;
254}
227255
=== added file 'src/platform/graphics/mesa/symbols.map'
--- src/platform/graphics/mesa/symbols.map 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/mesa/symbols.map 2014-11-27 07:32:44 +0000
@@ -0,0 +1,8 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_platform_options;
4 create_platform;
5 create_native_platform;
6 probe_platform;
7 describe_module;
8};
09
=== added file 'src/platform/graphics/platform_probe.cpp'
--- src/platform/graphics/platform_probe.cpp 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/platform_probe.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,50 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include "mir/graphics/platform.h"
20#include "platform_probe.h"
21
22std::shared_ptr<mir::SharedLibrary>
23mir::graphics::module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules)
24{
25 mir::graphics::PlatformPriority best_priority_so_far = mir::graphics::unsupported;
26 std::shared_ptr<mir::SharedLibrary> best_module_so_far;
27 for(auto& module : modules)
28 {
29 try
30 {
31 auto probe = module->load_function<mir::graphics::PlatformProbe>("probe_platform",
32 SERVER_PLATFORM_VERSION);
33 auto module_priority = probe();
34 if (module_priority > best_priority_so_far)
35 {
36 best_priority_so_far = module_priority;
37 best_module_so_far = module;
38 }
39 }
40 catch (std::runtime_error)
41 {
42 // Tried to probe a SharedLibrary that isn't a platform module?
43 }
44 }
45 if (best_priority_so_far > mir::graphics::unsupported)
46 {
47 return best_module_so_far;
48 }
49 throw std::runtime_error{"Failed to find platform for current system"};
50}
051
=== added file 'src/platform/graphics/platform_probe.h'
--- src/platform/graphics/platform_probe.h 1970-01-01 00:00:00 +0000
+++ src/platform/graphics/platform_probe.h 2014-11-27 07:32:44 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_PLATFORM_PROBE_H_
20#define MIR_GRAPHICS_PLATFORM_PROBE_H_
21
22#include <vector>
23#include <memory>
24#include "mir/shared_library.h"
25
26namespace mir
27{
28namespace graphics
29{
30class Platform;
31
32std::shared_ptr<SharedLibrary> module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules);
33
34}
35}
36
37#endif // MIR_GRAPHICS_PLATFORM_PROBE_H_
038
=== modified file 'src/platform/options/default_configuration.cpp'
--- src/platform/options/default_configuration.cpp 2014-11-24 02:16:00 +0000
+++ src/platform/options/default_configuration.cpp 2014-11-27 07:32:44 +0000
@@ -17,11 +17,12 @@
17 */17 */
1818
19#include "mir/shared_library.h"19#include "mir/shared_library.h"
20#include "mir/shared_library_loader.h"
21#include "mir/options/default_configuration.h"20#include "mir/options/default_configuration.h"
22#include "mir/graphics/platform.h"21#include "mir/graphics/platform.h"
23#include "mir/default_configuration.h"22#include "mir/default_configuration.h"
24#include "mir/abnormal_exit.h"23#include "mir/abnormal_exit.h"
24#include "mir/shared_library_prober.h"
25#include "../graphics/platform_probe.h"
2526
26#include <dlfcn.h>27#include <dlfcn.h>
2728
@@ -53,12 +54,14 @@
53char const* const mo::lttng_opt_value = "lttng";54char const* const mo::lttng_opt_value = "lttng";
5455
55char const* const mo::platform_graphics_lib = "platform-graphics-lib";56char const* const mo::platform_graphics_lib = "platform-graphics-lib";
57char const* const mo::platform_graphics_path = "platform-graphics-path";
5658
57namespace59namespace
58{60{
59int const default_ipc_threads = 1;61int const default_ipc_threads = 1;
60bool const enable_input_default = true;62bool const enable_input_default = true;
61char const* const default_platform_graphics_lib = MIR_PLATFORM_DRIVER_BINARY;63
64std::shared_ptr<mir::SharedLibrary> graphics_lib;
6265
63// Hack around the way Qt loads mir:66// Hack around the way Qt loads mir:
64// platform_api and therefore Mir are loaded via dlopen(..., RTLD_LOCAL).67// platform_api and therefore Mir are loaded via dlopen(..., RTLD_LOCAL).
@@ -115,8 +118,10 @@
115 "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]")118 "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]")
116 (no_server_socket_opt, "Do not provide a socket filename for client connections")119 (no_server_socket_opt, "Do not provide a socket filename for client connections")
117 (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections")120 (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections")
118 (platform_graphics_lib, po::value<std::string>()->default_value(default_platform_graphics_lib),121 (platform_graphics_lib, po::value<std::string>(),
119 "Library to use for platform graphics support")122 "Library to use for platform graphics support (default: autodetect)")
123 (platform_graphics_path, po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PLUGIN_PATH),
124 "Library to use for platform graphics support (default: " MIR_SERVER_PLATFORM_PLUGIN_PATH ")")
120 (enable_input_opt, po::value<bool>()->default_value(enable_input_default),125 (enable_input_opt, po::value<bool>()->default_value(enable_input_default),
121 "Enable input.")126 "Enable input.")
122 (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value),127 (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value),
@@ -152,32 +157,74 @@
152 add_platform_options();157 add_platform_options();
153}158}
154159
160namespace
161{
162class NullSharedLibraryProberReport : public mir::SharedLibraryProberReport
163{
164public:
165 void probing_path(boost::filesystem::path const& /*path*/) override
166 {
167 }
168 void probing_failed(boost::filesystem::path const& /*path*/, std::exception const& /*error*/) override
169 {
170 }
171 void loading_library(boost::filesystem::path const& /*filename*/) override
172 {
173 }
174 void loading_failed(boost::filesystem::path const& /*filename*/, std::exception const& /*error*/) override
175 {
176 }
177};
178}
179
155void mo::DefaultConfiguration::add_platform_options()180void mo::DefaultConfiguration::add_platform_options()
156{181{
157 namespace po = boost::program_options;182 namespace po = boost::program_options;
158 po::options_description program_options;183 po::options_description program_options;
159 program_options.add_options()184 program_options.add_options()
160 (platform_graphics_lib,185 (platform_graphics_lib,
161 po::value<std::string>()->default_value(default_platform_graphics_lib), "");186 po::value<std::string>(), "");
187 program_options.add_options()
188 (platform_graphics_path,
189 po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PLUGIN_PATH),
190 "");
162 mo::ProgramOption options;191 mo::ProgramOption options;
163 options.parse_arguments(program_options, argc, argv);192 options.parse_arguments(program_options, argc, argv);
164193
165 std::string graphics_libname;194 ensure_loaded_with_rtld_global();
195
196 // TODO: We should just load all the platform plugins we can and present their options.
166 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");197 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");
167 if (!options.is_set(platform_graphics_lib) && env_libname)198 auto env_libpath = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_PATH");
168 {199 try
169 graphics_libname = std::string{env_libname};200 {
170 }201 if (options.is_set(platform_graphics_lib))
171 else202 {
172 {203 graphics_lib = std::make_shared<mir::SharedLibrary>(options.get<std::string>(platform_graphics_lib));
173 graphics_libname = options.get<std::string>(platform_graphics_lib);204 }
174 }205 else if (env_libname)
175206 {
176 ensure_loaded_with_rtld_global();207 graphics_lib = std::make_shared<mir::SharedLibrary>(std::string{env_libname});
177208 }
178 auto graphics_lib = load_library(graphics_libname);209 else
179 auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options"));210 {
180 add_platform_options(*this->program_options);211 auto const plugin_path = env_libpath ? env_libpath : options.get<std::string>(platform_graphics_path);
212 NullSharedLibraryProberReport nuller;
213 auto plugins = mir::libraries_for_path(plugin_path, nuller);
214 graphics_lib = mir::graphics::module_for_device(plugins);
215 }
216
217 auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options"));
218 add_platform_options(*this->program_options);
219 }
220 catch(...)
221 {
222 // We don't actually care at this point if this failed.
223 // Maybe we've been pointed at the wrong place. Maybe this platform doesn't actually
224 // *have* platform-specific options.
225 // Regardless, if we need a platform and can't find one then we'll bail later
226 // in startup with a useful error.
227 }
181}228}
182229
183boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()230boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()
184231
=== modified file 'src/platform/symbols.map'
--- src/platform/symbols.map 2014-11-27 03:48:20 +0000
+++ src/platform/symbols.map 2014-11-27 07:32:44 +0000
@@ -92,6 +92,7 @@
92 mir::graphics::InternalSurface::pixel_format*;92 mir::graphics::InternalSurface::pixel_format*;
93 mir::graphics::InternalSurface::size*;93 mir::graphics::InternalSurface::size*;
94 mir::graphics::InternalSurface::swap_buffers*;94 mir::graphics::InternalSurface::swap_buffers*;
95 mir::graphics::module_for_device*;
95 mir::graphics::NativePlatform::connection_ipc_package*;96 mir::graphics::NativePlatform::connection_ipc_package*;
96 mir::graphics::NativePlatform::create_buffer_allocator*;97 mir::graphics::NativePlatform::create_buffer_allocator*;
97 mir::graphics::NativePlatform::fill_buffer_package*;98 mir::graphics::NativePlatform::fill_buffer_package*;
@@ -147,6 +148,7 @@
147 mir::options::glog_log_dir*;148 mir::options::glog_log_dir*;
148 mir::options::glog_minloglevel*;149 mir::options::glog_minloglevel*;
149 mir::options::glog_stderrthreshold*;150 mir::options::glog_stderrthreshold*;
151 mir::options::platform_graphics_path*;
150 mir::options::host_socket_opt*;152 mir::options::host_socket_opt*;
151 mir::options::input_report_opt*;153 mir::options::input_report_opt*;
152 mir::options::legacy_input_report_opt*;154 mir::options::legacy_input_report_opt*;
153155
=== modified file 'src/server/CMakeLists.txt'
--- src/server/CMakeLists.txt 2014-11-27 03:48:20 +0000
+++ src/server/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -8,6 +8,9 @@
8 ${GLIB_INCLUDE_DIRS}8 ${GLIB_INCLUDE_DIRS}
9)9)
1010
11add_definitions(-DMIR_SERVER_PLATFORM_PLUGIN_PATH="${MIR_SERVER_PLATFORM_PLUGIN_PATH}")
12add_definitions(-DSERVER_PLATFORM_VERSION="${SERVER_PLATFORM_VERSION}")
13
11add_subdirectory(compositor/)14add_subdirectory(compositor/)
12add_subdirectory(graphics/)15add_subdirectory(graphics/)
13add_subdirectory(input/)16add_subdirectory(input/)
@@ -71,8 +74,9 @@
71)74)
7275
73target_link_libraries(mirserver LINK_PUBLIC76target_link_libraries(mirserver LINK_PUBLIC
77
78 mirclient
74 mirplatform79 mirplatform
75 mirclient
76 mircommon80 mircommon
77 mirprotobuf81 mirprotobuf
78 3rd_party82 3rd_party
7983
=== modified file 'src/server/graphics/CMakeLists.txt'
--- src/server/graphics/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ src/server/graphics/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -1,4 +1,4 @@
1include_directories(${GLESv2_INCLUDE_DIRS})1include_directories(${GLESv2_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR})
22
3add_library(3add_library(
4 mirgraphics OBJECT4 mirgraphics OBJECT
55
=== modified file 'src/server/graphics/default_configuration.cpp'
--- src/server/graphics/default_configuration.cpp 2014-11-27 03:48:20 +0000
+++ src/server/graphics/default_configuration.cpp 2014-11-27 07:32:44 +0000
@@ -28,12 +28,14 @@
2828
29#include "mir/graphics/gl_config.h"29#include "mir/graphics/gl_config.h"
30#include "mir/graphics/cursor.h"30#include "mir/graphics/cursor.h"
31#include "src/platform/graphics/platform_probe.h"
31#include "program_factory.h"32#include "program_factory.h"
3233
33#include "mir/shared_library.h"34#include "mir/shared_library.h"
34#include "mir/shared_library_loader.h"35#include "mir/shared_library_prober.h"
35#include "mir/abnormal_exit.h"36#include "mir/abnormal_exit.h"
36#include "mir/emergency_cleanup.h"37#include "mir/emergency_cleanup.h"
38#include "mir/logging/logger.h"
3739
38#include "mir_toolkit/common.h"40#include "mir_toolkit/common.h"
3941
@@ -44,6 +46,12 @@
44namespace mg = mir::graphics;46namespace mg = mir::graphics;
45namespace mgn = mir::graphics::nested;47namespace mgn = mir::graphics::nested;
4648
49namespace
50{
51// TODO: Temporary, until we actually manage module lifetimes
52static std::shared_ptr<mir::SharedLibrary> platform_library;
53}
54
47std::shared_ptr<mg::DisplayConfigurationPolicy>55std::shared_ptr<mg::DisplayConfigurationPolicy>
48mir::DefaultServerConfiguration::the_display_configuration_policy()56mir::DefaultServerConfiguration::the_display_configuration_policy()
49{57{
@@ -62,6 +70,32 @@
62 return wrapped;70 return wrapped;
63}71}
6472
73namespace
74{
75namespace ml = mir::logging;
76
77class LoggingSharedLibraryReport : public mir::SharedLibraryProberReport
78{
79public:
80 void probing_path(boost::filesystem::path const& path) override
81 {
82 ml::log(ml::Severity::informational, std::string{"Scanning for platform libraries in "} + path.c_str(), "Platform Loader");
83 }
84 void probing_failed(boost::filesystem::path const& path, std::exception const& error) override
85 {
86 ml::log(ml::Severity::warning, std::string{"Failed to scan "} + path.c_str() + ": " + error.what(), "Platform Loader");
87 }
88 void loading_library(boost::filesystem::path const& filename) override
89 {
90 ml::log(ml::Severity::informational, std::string{"Loading library "} + filename.c_str(), "Platform Loader");
91 }
92 void loading_failed(boost::filesystem::path const& filename, std::exception const& error) override
93 {
94 ml::log(ml::Severity::warning, std::string{"Failed to load "} + filename.c_str() + ": " + error.what(), "Platform Loader");
95 }
96};
97}
98
6599
66std::shared_ptr<mg::Platform> mir::DefaultServerConfiguration::the_graphics_platform()100std::shared_ptr<mg::Platform> mir::DefaultServerConfiguration::the_graphics_platform()
67{101{
@@ -71,8 +105,22 @@
71 if (!the_options()->is_set(options::host_socket_opt))105 if (!the_options()->is_set(options::host_socket_opt))
72 {106 {
73 // fallback to standalone if host socket is unset107 // fallback to standalone if host socket is unset
74 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));108 if (the_options()->is_set(options::platform_graphics_lib))
75 auto create_platform = graphics_lib->load_function<mg::CreatePlatform>("create_platform");109 {
110 platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib));
111 }
112 else
113 {
114 LoggingSharedLibraryReport report;
115 auto platforms = mir::libraries_for_path(the_options()->get<std::string>(options::platform_graphics_path), report);
116 if (platforms.empty())
117 {
118 throw std::runtime_error("Failed to find any platform plugins in: " MIR_SERVER_PLATFORM_PLUGIN_PATH);
119 }
120 platform_library = mir::graphics::module_for_device(platforms);
121 }
122 auto create_platform = platform_library->load_function<mg::CreatePlatform>("create_platform",
123 SERVER_PLATFORM_VERSION);
76 return create_platform(the_options(), the_emergency_cleanup(), the_display_report());124 return create_platform(the_options(), the_emergency_cleanup(), the_display_report());
77 }125 }
78126
@@ -121,8 +169,23 @@
121 return graphics_native_platform(169 return graphics_native_platform(
122 [this]()170 [this]()
123 {171 {
124 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));172 if (the_options()->is_set(options::platform_graphics_lib))
125 auto create_native_platform = graphics_lib->load_function<mg::CreateNativePlatform>("create_native_platform");173 {
174 platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib));
175 }
176 else
177 {
178 LoggingSharedLibraryReport report;
179 auto platforms = mir::libraries_for_path(the_options()->get<std::string>(options::platform_graphics_path), report);
180 if (platforms.empty())
181 {
182 throw std::runtime_error("Failed to find any platform plugins in: " MIR_SERVER_PLATFORM_PLUGIN_PATH);
183 }
184 platform_library = mir::graphics::module_for_device(platforms);
185 }
186 auto create_native_platform = platform_library->load_function<mg::CreateNativePlatform>("create_native_platform",
187 SERVER_PLATFORM_VERSION);
188
126 auto context = std::make_shared<MirConnectionNestedContext>(the_host_connection());189 auto context = std::make_shared<MirConnectionNestedContext>(the_host_connection());
127 return create_native_platform(the_display_report(), context);190 return create_native_platform(the_display_report(), context);
128 });191 });
129192
=== modified file 'src/server/server.cpp'
--- src/server/server.cpp 2014-11-21 09:49:05 +0000
+++ src/server/server.cpp 2014-11-27 07:32:44 +0000
@@ -186,7 +186,7 @@
186 {186 {
187 auto const graphics_lib = the_options()->get<std::string>(options::platform_graphics_lib);187 auto const graphics_lib = the_options()->get<std::string>(options::platform_graphics_lib);
188188
189 if (graphics_lib != "libmirplatformstub.so")189 if (graphics_lib.find("graphics-dummy.so") == std::string::npos)
190 return mir::DefaultServerConfiguration::the_renderer_factory();190 return mir::DefaultServerConfiguration::the_renderer_factory();
191 else191 else
192 return std::make_shared<StubRendererFactory>();192 return std::make_shared<StubRendererFactory>();
193193
=== modified file 'tests/acceptance-tests/CMakeLists.txt'
--- tests/acceptance-tests/CMakeLists.txt 2014-11-27 03:48:20 +0000
+++ tests/acceptance-tests/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -4,11 +4,6 @@
4 ${CMAKE_SOURCE_DIR}4 ${CMAKE_SOURCE_DIR}
5)5)
66
7add_definitions(
8 -DMIR_PLATFORM_DRIVER_BINARY="${MIR_PLATFORM_DRIVER_BINARY}"
9 -DMIR_CLIENT_DRIVER_BINARY="${MIR_CLIENT_DRIVER_BINARY}"
10)
11
12set(7set(
13 SOURCES8 SOURCES
149
1510
=== modified file 'tests/acceptance-tests/server_configuration_wrapping.cpp'
--- tests/acceptance-tests/server_configuration_wrapping.cpp 2014-11-06 03:56:24 +0000
+++ tests/acceptance-tests/server_configuration_wrapping.cpp 2014-11-27 07:32:44 +0000
@@ -21,11 +21,14 @@
2121
22#include "mir_test_framework/headless_test.h"22#include "mir_test_framework/headless_test.h"
2323
24#include "mir_test_framework/executable_path.h"
25
24#include <gtest/gtest.h>26#include <gtest/gtest.h>
25#include <gmock/gmock.h>27#include <gmock/gmock.h>
2628
27namespace ms = mir::scene;29namespace ms = mir::scene;
28namespace msh = mir::shell;30namespace msh = mir::shell;
31namespace mtf = mir_test_framework;
2932
30using namespace testing;33using namespace testing;
3134
3235
=== modified file 'tests/acceptance-tests/test_symbols_required_by_mesa.cpp'
--- tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2014-11-24 02:16:00 +0000
+++ tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2014-11-27 07:32:44 +0000
@@ -21,11 +21,14 @@
2121
22#include <dlfcn.h>22#include <dlfcn.h>
2323
24#include "mir_test_framework/executable_path.h"
25
24using namespace testing;26using namespace testing;
27namespace mtf = mir_test_framework;
2528
26TEST(SymbolsRequiredByMesa, are_exported_by_libmirclientplatform)29TEST(SymbolsRequiredByMesa, are_exported_by_client_platform_mesa)
27{30{
28 auto const handle = dlopen(MIR_CLIENT_DRIVER_BINARY, RTLD_LAZY);31 auto const handle = dlopen((mtf::library_path() + "/client-modules/mesa.so").c_str(), RTLD_LAZY);
29 ASSERT_THAT(handle, NotNull());32 ASSERT_THAT(handle, NotNull());
3033
31 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");34 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");
@@ -36,7 +39,7 @@
3639
37TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics)40TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics)
38{41{
39 auto const handle = dlopen(MIR_PLATFORM_DRIVER_BINARY, RTLD_LAZY);42 auto const handle = dlopen((mtf::library_path() + "/server-modules/graphics-mesa.so").c_str(), RTLD_LAZY);
40 ASSERT_THAT(handle, NotNull());43 ASSERT_THAT(handle, NotNull());
4144
42 auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid");45 auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid");
4346
=== modified file 'tests/include/mir_test_doubles/mock_android_alloc_device.h'
--- tests/include/mir_test_doubles/mock_android_alloc_device.h 2013-06-18 08:00:49 +0000
+++ tests/include/mir_test_doubles/mock_android_alloc_device.h 2014-11-27 07:32:44 +0000
@@ -19,7 +19,11 @@
19#define MIR_TEST_DOUBLES_MOCK_ANDROID_ALLOC_DEVICE_H_19#define MIR_TEST_DOUBLES_MOCK_ANDROID_ALLOC_DEVICE_H_
2020
21#include <gmock/gmock.h>21#include <gmock/gmock.h>
22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Wpedantic"
24#pragma GCC diagnostic ignored "-Wunused-parameter"
22#include <hardware/gralloc.h>25#include <hardware/gralloc.h>
26#pragma GCC diagnostic pop
2327
24namespace mir28namespace mir
25{29{
2630
=== modified file 'tests/include/mir_test_doubles/mock_client_context.h'
--- tests/include/mir_test_doubles/mock_client_context.h 2013-04-24 05:22:20 +0000
+++ tests/include/mir_test_doubles/mock_client_context.h 2014-11-27 07:32:44 +0000
@@ -33,18 +33,12 @@
33struct MockClientContext : public client::ClientContext33struct MockClientContext : public client::ClientContext
34{34{
35 MockClientContext()35 MockClientContext()
36 : connection{reinterpret_cast<MirConnection*>(0xabcdef)}
37 {36 {
38 using namespace testing;37 using namespace testing;
3938
40 ON_CALL(*this, mir_connection()).WillByDefault(Return(connection));
41 EXPECT_CALL(*this, mir_connection()).Times(AtLeast(0));
42 EXPECT_CALL(*this, populate(_)).Times(AtLeast(0));39 EXPECT_CALL(*this, populate(_)).Times(AtLeast(0));
43 }40 }
4441
45 MirConnection* connection;
46
47 MOCK_METHOD0(mir_connection, MirConnection*());
48 MOCK_METHOD1(populate, void(MirPlatformPackage&));42 MOCK_METHOD1(populate, void(MirPlatformPackage&));
49};43};
5044
5145
=== modified file 'tests/include/mir_test_doubles/mock_hwc_composer_device_1.h'
--- tests/include/mir_test_doubles/mock_hwc_composer_device_1.h 2014-03-27 06:27:59 +0000
+++ tests/include/mir_test_doubles/mock_hwc_composer_device_1.h 2014-11-27 07:32:44 +0000
@@ -19,7 +19,12 @@
19#ifndef MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_19#ifndef MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_
20#define MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_20#define MIR_TEST_DOUBLES_MOCK_HWC_COMPOSER_DEVICE_1_H_
2121
22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Wpedantic"
24#pragma GCC diagnostic ignored "-Wunused-parameter"
22#include <hardware/hwcomposer.h>25#include <hardware/hwcomposer.h>
26#pragma GCC diagnostic pop
27
23#include <gmock/gmock.h>28#include <gmock/gmock.h>
2429
25namespace mir30namespace mir
2631
=== added file 'tests/include/mir_test_framework/client_platform_factory.h'
--- tests/include/mir_test_framework/client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ tests/include/mir_test_framework/client_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_TEST_FRAMEWORK_CLIENT_PLATFORM_FACTORY_H_
20#define MIR_TEST_FRAMEWORK_CLIENT_PLATFORM_FACTORY_H_
21
22
23#include "mir/shared_library.h"
24#include "src/client/client_platform_factory.h"
25#include "executable_path.h"
26#include "mir_test_doubles/mock_client_context.h"
27
28namespace mtd = mir::test::doubles;
29
30namespace mir_test_framework
31{
32std::shared_ptr<mir::SharedLibrary> platform_library;
33
34std::shared_ptr<mir::client::ClientPlatform> create_android_client_platform()
35{
36 using namespace testing;
37 mtd::MockClientContext ctx;
38 ON_CALL(ctx, populate(_))
39 .WillByDefault(Invoke([](MirPlatformPackage& package) { ::memset(&package, 0, sizeof(package)); }));
40 platform_library = std::make_shared<mir::SharedLibrary>(library_path() + "/client-modules/android.so");
41 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
42 return platform_factory(&ctx);
43}
44
45std::shared_ptr<mir::client::ClientPlatform> create_mesa_client_platform()
46{
47 using namespace testing;
48 mtd::MockClientContext ctx;
49 ON_CALL(ctx, populate(_))
50 .WillByDefault(Invoke([](MirPlatformPackage& package)
51 {
52 ::memset(&package, 0, sizeof(package));
53 package.fd_items = 1;
54 }));
55 platform_library = std::make_shared<mir::SharedLibrary>(library_path() + "/client-modules/mesa.so");
56 auto platform_factory = platform_library->load_function<mir::client::CreateClientPlatform>("create_client_platform");
57 return platform_factory(&ctx);
58}
59
60std::shared_ptr<mir::SharedLibrary>
61get_platform_library()
62{
63 if (!platform_library)
64 {
65 throw std::logic_error{"Must call one of create_*_client_platform() before calling get_platform_library()"};
66 }
67 return platform_library;
68}
69
70}
71
72#endif // MIR_TEST_FRAMEWORK_CLIENT_PLATFORM_FACTORY_H_
073
=== added file 'tests/include/mir_test_framework/stub_client_platform_factory.h'
--- tests/include/mir_test_framework/stub_client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ tests/include/mir_test_framework/stub_client_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -0,0 +1,33 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_TEST_FRAMEWORK_STUB_CLIENT_PLATFORM_FACTORY_
20#define MIR_TEST_FRAMEWORK_STUB_CLIENT_PLATFORM_FACTORY_
21
22#include "src/client/client_platform_factory.h"
23
24namespace mir_test_framework
25{
26
27struct StubClientPlatformFactory : public mir::client::ClientPlatformFactory
28{
29 std::shared_ptr<mir::client::ClientPlatform> create_client_platform(mir::client::ClientContext* context) override;
30};
31
32}
33#endif /* MIR_TEST_FRAMEWORK_STUB_CLIENT_PLATFORM_ */
034
=== added file 'tests/include/mir_test_framework/stub_server_platform_factory.h'
--- tests/include/mir_test_framework/stub_server_platform_factory.h 1970-01-01 00:00:00 +0000
+++ tests/include/mir_test_framework/stub_server_platform_factory.h 2014-11-27 07:32:44 +0000
@@ -0,0 +1,45 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#ifndef MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_
20#define MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_
21
22#include "mir/geometry/rectangle.h"
23
24#include "mir/graphics/platform.h"
25#include <vector>
26
27namespace geom = mir::geometry;
28
29namespace mir
30{
31namespace graphics
32{
33class Platform;
34}
35}
36
37namespace mg = mir::graphics;
38
39namespace mir_test_framework
40{
41
42std::shared_ptr<mg::Platform> make_stubbed_server_graphics_platform(std::vector<geom::Rectangle> const& display_rects);
43
44}
45#endif /* MIR_TEST_FRAMEWORK_STUB_SERVER_PLATFORM_FACTORY_ */
046
=== modified file 'tests/integration-tests/CMakeLists.txt'
--- tests/integration-tests/CMakeLists.txt 2014-11-27 03:48:20 +0000
+++ tests/integration-tests/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -99,6 +99,15 @@
99 ${GTEST_BOTH_LIBRARIES}99 ${GTEST_BOTH_LIBRARIES}
100 ${GMOCK_LIBRARY}100 ${GMOCK_LIBRARY}
101 ${GMOCK_MAIN_LIBRARY}101 ${GMOCK_MAIN_LIBRARY}
102 # Mesa platform dependencies
103 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
104 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
105 # Android platform dependencies
106 ${LIBHARDWARE_LIBRARIES}
107 ${ANDROID_PROPERTIES_LIBRARIES}
108 # Shared platform dependencies
109 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
110 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
102 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.111 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
103 ${DRM_LDFLAGS} ${DRM_LIBRARIES}112 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
104 ${GBM_LDFLAGS} ${GBM_LIBRARIES}113 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
@@ -108,7 +117,7 @@
108 ${MIR_SERVER_REFERENCES}117 ${MIR_SERVER_REFERENCES}
109)118)
110119
111if (MIR_TEST_PLATFORM STREQUAL "android")120if (MIR_BUILD_PLATFORM_ANDROID)
112target_link_libraries(mir_integration_tests121target_link_libraries(mir_integration_tests
113 mirsharedandroid122 mirsharedandroid
114 ${ANDROID_PROPERTIES_LDFLAGS}123 ${ANDROID_PROPERTIES_LDFLAGS}
@@ -122,8 +131,18 @@
122 "MIR_BUILD_INTEGRATION_TESTS"131 "MIR_BUILD_INTEGRATION_TESTS"
123 OFF)132 OFF)
124133
134set (MIR_CLIENT_MODULE "client-modules/dummy.so")
135
136if (MIR_TEST_PLATFORM STREQUAL "android")
137 # Android platform integration tests have Android-specific tests
138 # requiring a real platform
139 set (MIR_CLIENT_MODULE "client-modules/android.so")
140endif()
141
125if (MIR_RUN_INTEGRATION_TESTS)142if (MIR_RUN_INTEGRATION_TESTS)
126 mir_discover_tests(mir_integration_tests)143 mir_discover_tests(mir_integration_tests
144 MIR_CLIENT_PLATFORM_LIB=${LIBRARY_OUTPUT_PATH}/${MIR_CLIENT_MODULE}
145 )
127endif (MIR_RUN_INTEGRATION_TESTS)146endif (MIR_RUN_INTEGRATION_TESTS)
128147
129install(148install(
130149
=== modified file 'tests/mir_test_doubles/CMakeLists.txt'
--- tests/mir_test_doubles/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ tests/mir_test_doubles/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -30,16 +30,19 @@
30 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gl.cpp30 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gl.cpp
31)31)
3232
33if (MIR_TEST_PLATFORM STREQUAL "mesa")33if (MIR_BUILD_PLATFORM_MESA)
34include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})34 include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
35list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS35 list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS
36 ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp36 ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp
37 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp37 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp
38)38 )
39elseif (MIR_TEST_PLATFORM STREQUAL "android")39endif()
40list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS40
41 ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp41if (MIR_BUILD_PLATFORM_ANDROID)
42)42 include_directories(${ANDROID_HEADERS_INCLUDE_DIRS})
43 list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS
44 ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp
45 )
43endif()46endif()
4447
45add_library(48add_library(
4649
=== modified file 'tests/mir_test_framework/CMakeLists.txt'
--- tests/mir_test_framework/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ tests/mir_test_framework/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -4,10 +4,11 @@
4 ${PROJECT_SOURCE_DIR}/src/include/common4 ${PROJECT_SOURCE_DIR}/src/include/common
5 ${PROJECT_SOURCE_DIR}/src/include/server5 ${PROJECT_SOURCE_DIR}/src/include/server
6 ${PROJECT_SOURCE_DIR}/src/include/client6 ${PROJECT_SOURCE_DIR}/src/include/client
7 ${Boost_INCLUDE_DIRS}7 ${Boost_INCLUDE_DIRS}
8 ${GLESv2_INCLUDE_DIRS}8 ${GLESv2_INCLUDE_DIRS}
9 ${CMAKE_SOURCE_DIR}9 ${CMAKE_SOURCE_DIR}
10 ${UMOCKDEV_INCLUDE_DIRS}10 ${UMOCKDEV_INCLUDE_DIRS}
11 ${ANDROID_HEADERS_INCLUDE_DIRS}
11)12)
1213
13set(14set(
@@ -31,6 +32,8 @@
31 display_server_test_fixture.cpp32 display_server_test_fixture.cpp
32 process.cpp33 process.cpp
33 using_stub_client_platform.cpp34 using_stub_client_platform.cpp
35 stub_client_platform_factory.cpp
36 stub_server_platform_factory.cpp
34 udev_environment.cpp37 udev_environment.cpp
35 declarative_placement_strategy.cpp38 declarative_placement_strategy.cpp
36 fake_event_hub_server_configuration.cpp39 fake_event_hub_server_configuration.cpp
@@ -55,7 +58,6 @@
55target_link_libraries(58target_link_libraries(
56 mir-test-framework59 mir-test-framework
5760
58 mirplatformstub
59 3rd_party61 3rd_party
6062
61 ${PROTOBUF_LIBRARIES}63 ${PROTOBUF_LIBRARIES}
@@ -67,6 +69,53 @@
67 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.69 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
68)70)
6971
72set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-client.map)
73
74add_library(
75 mirclientplatformstub MODULE
76
77 stub_client_platform_module.cpp
78)
79
80target_link_libraries(
81 mirclientplatformstub
82
83 mir-test-framework
84 ${UMOCKDEV_LDFLAGS} ${UMOCKDEV_LIBRARIES}
85)
86
87set_target_properties(
88 mirclientplatformstub PROPERTIES;
89 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/client-modules
90 OUTPUT_NAME dummy
91 PREFIX ""
92 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
93)
94install(TARGETS mirclientplatformstub LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
95
96set(server_symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-server.map)
97add_library(
98 mirplatformgraphicsstub MODULE
99
100 platform_graphics_dummy.cpp
101 stubbed_graphics_platform.cpp
102)
103
104target_link_libraries(
105 mirplatformgraphicsstub
106
107 mir-test-framework
108)
109
110set_target_properties(
111 mirplatformgraphicsstub PROPERTIES;
112 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/server-modules
113 OUTPUT_NAME graphics-dummy
114 PREFIX ""
115 LINK_FLAGS "-Wl,--version-script,${server_symbol_map}"
116)
117install(TARGETS mirplatformgraphicsstub LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PLUGIN_PATH})
118
70add_custom_command(TARGET mir-test-framework POST_BUILD119add_custom_command(TARGET mir-test-framework POST_BUILD
71 COMMAND ${CMAKE_COMMAND} -E copy_directory120 COMMAND ${CMAKE_COMMAND} -E copy_directory
72 ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings121 ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings
@@ -79,19 +128,3 @@
79)128)
80129
81string (REPLACE " -Wl,--no-undefined" " " CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})130string (REPLACE " -Wl,--no-undefined" " " CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
82
83add_library(
84 mirplatformstub SHARED
85 stubbed_graphics_platform.cpp
86)
87
88target_link_libraries(mirplatformstub
89 mir-test-doubles
90)
91
92set_target_properties(mirplatformstub
93 PROPERTIES
94 LINK_FLAGS "-Wl,--exclude-libs=ALL"
95)
96
97install(TARGETS mirplatformstub LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
98131
=== modified file 'tests/mir_test_framework/headless_test.cpp'
--- tests/mir_test_framework/headless_test.cpp 2014-11-25 12:05:51 +0000
+++ tests/mir_test_framework/headless_test.cpp 2014-11-27 07:32:44 +0000
@@ -25,6 +25,7 @@
25#include "mir/geometry/rectangle.h"25#include "mir/geometry/rectangle.h"
26#include "mir/options/option.h"26#include "mir/options/option.h"
27#include "mir_test_doubles/null_logger.h"27#include "mir_test_doubles/null_logger.h"
28#include "mir_test_framework/executable_path.h"
2829
29#include <boost/throw_exception.hpp>30#include <boost/throw_exception.hpp>
3031
@@ -35,15 +36,24 @@
3536
36namespace37namespace
37{38{
39<<<<<<< TREE
38const char* const mir_server_platform_graphics_lib = "MIR_SERVER_PLATFORM_GRAPHICS_LIB";40const char* const mir_server_platform_graphics_lib = "MIR_SERVER_PLATFORM_GRAPHICS_LIB";
3941
40std::chrono::seconds const timeout{10};42std::chrono::seconds const timeout{10};
43=======
44std::chrono::seconds const timeout{100000};
45>>>>>>> MERGE-SOURCE
41}46}
4247
43mtf::HeadlessTest::HeadlessTest()48mtf::HeadlessTest::HeadlessTest()
44{49{
45 configure_from_commandline(server);50 configure_from_commandline(server);
51<<<<<<< TREE
46 add_to_environment(mir_server_platform_graphics_lib, "libmirplatformstub.so");52 add_to_environment(mir_server_platform_graphics_lib, "libmirplatformstub.so");
53=======
54 add_to_environment("MIR_SERVER_PLATFORM_GRAPHICS_LIB", (mtf::library_path() + "/server-modules/graphics-dummy.so").c_str());
55 add_to_environment("MIR_CLIENT_PLATFORM_PATH", (mtf::library_path() + "/client-modules/").c_str());
56>>>>>>> MERGE-SOURCE
47 server.add_configuration_option(mtd::logging_opt, mtd::logging_descr, false);57 server.add_configuration_option(mtd::logging_opt, mtd::logging_descr, false);
48 server.override_the_logger([&]()58 server.override_the_logger([&]()
49 {59 {
5060
=== added file 'tests/mir_test_framework/platform_graphics_dummy.cpp'
--- tests/mir_test_framework/platform_graphics_dummy.cpp 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/platform_graphics_dummy.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,33 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>>
17 */
18
19#include "mir/graphics/platform.h"
20
21extern "C" mir::graphics::PlatformPriority probe_platform()
22{
23 return mir::graphics::supported;
24}
25
26mir::graphics::ModuleProperties const description {
27 "dummy"
28};
29
30extern "C" mir::graphics::ModuleProperties const* describe_module()
31{
32 return &description;
33}
034
=== added file 'tests/mir_test_framework/stub_client_platform_factory.cpp'
--- tests/mir_test_framework/stub_client_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/stub_client_platform_factory.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,147 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include "mir_test_framework/stub_client_platform_factory.h"
20#include "src/client/client_buffer_factory.h"
21#include "src/client/client_buffer.h"
22#include "src/client/client_platform.h"
23
24#include <string.h>
25
26namespace mcl = mir::client;
27namespace geom = mir::geometry;
28namespace mtf = mir_test_framework;
29
30namespace
31{
32class StubClientBuffer : public mcl::ClientBuffer
33{
34public:
35 StubClientBuffer(std::shared_ptr<MirBufferPackage> const& package)
36 {
37 static_cast<void>(package);
38#ifndef ANDROID
39 native = package;
40#endif
41 }
42
43 std::shared_ptr<mcl::MemoryRegion> secure_for_cpu_write()
44 {
45 return nullptr;
46 }
47
48 geom::Size size() const
49 {
50 return geom::Size{};
51 }
52
53 geom::Stride stride() const
54 {
55 return geom::Stride{};
56 }
57
58 MirPixelFormat pixel_format() const
59 {
60 return mir_pixel_format_abgr_8888;
61 }
62
63 uint32_t age() const
64 {
65 return 0;
66 }
67 void increment_age()
68 {
69 }
70 void mark_as_submitted()
71 {
72 }
73 std::shared_ptr<mir::graphics::NativeBuffer> native_buffer_handle() const
74 {
75#ifdef ANDROID
76 return nullptr;
77#else
78 return native;
79#endif
80 }
81 void update_from(MirBufferPackage const& package) override
82 {
83 static_cast<void>(package);
84#ifndef ANDROID
85 ::memcpy(native.get(), &package, sizeof(package));
86#endif
87 }
88private:
89#ifndef ANDROID
90 std::shared_ptr<mir::graphics::NativeBuffer> native;
91#endif
92
93 virtual void fill_update_msg(MirBufferPackage& /*message*/) override
94 {
95 }
96};
97
98struct StubClientBufferFactory : public mcl::ClientBufferFactory
99{
100 std::shared_ptr<mcl::ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package,
101 geom::Size, MirPixelFormat)
102 {
103 return std::make_shared<StubClientBuffer>(package);
104 }
105};
106
107struct StubClientPlatform : public mcl::ClientPlatform
108{
109 MirPlatformType platform_type() const
110 {
111 return mir_platform_type_gbm;
112 }
113
114 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
115 {
116 return std::make_shared<StubClientBufferFactory>();
117 }
118
119 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*)
120 {
121 auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678lu);
122 return std::make_shared<EGLNativeWindowType>(fake_window);
123 }
124
125 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display()
126 {
127 auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678lu);
128 return std::make_shared<EGLNativeDisplayType>(fake_display);
129 }
130
131 MirNativeBuffer* convert_native_buffer(mir::graphics::NativeBuffer* buf) const
132 {
133 static_cast<void>(buf);
134#ifndef ANDROID
135 return buf;
136#else
137 return nullptr;
138#endif
139 }
140};
141}
142
143std::shared_ptr<mcl::ClientPlatform>
144mtf::StubClientPlatformFactory::create_client_platform(mcl::ClientContext*)
145{
146 return std::make_shared<StubClientPlatform>();
147}
0148
=== added file 'tests/mir_test_framework/stub_client_platform_module.cpp'
--- tests/mir_test_framework/stub_client_platform_module.cpp 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/stub_client_platform_module.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,35 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>>
17 */
18
19#include "src/client/client_platform_factory.h"
20
21#include "mir_test_framework/stub_client_platform_factory.h"
22#include <memory>
23
24namespace mtf = mir_test_framework;
25namespace mcl = mir::client;
26
27extern "C" std::shared_ptr<mcl::ClientPlatform> create_client_platform(mcl::ClientContext* context)
28{
29 return mtf::StubClientPlatformFactory{}.create_client_platform(context);
30}
31
32extern "C" bool is_appropriate_module(mcl::ClientContext* /*context*/)
33{
34 return true;
35}
036
=== added file 'tests/mir_test_framework/stub_server_platform_factory.cpp'
--- tests/mir_test_framework/stub_server_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/stub_server_platform_factory.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,54 @@
1
2/*
3 * Copyright © 2014 Canonical Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 3,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
18 */
19
20#include "mir/shared_library.h"
21
22#include "mir/geometry/rectangle.h"
23
24#include "mir_test_framework/executable_path.h"
25#include "mir_test_framework/stub_server_platform_factory.h"
26
27#include <vector>
28
29namespace geom = mir::geometry;
30namespace mg = mir::graphics;
31namespace mtf = mir_test_framework;
32
33namespace
34{
35// NOTE: Raw pointer, deliberately leaked to bypass all the fun
36// issues around global destructor ordering.
37mir::SharedLibrary* platform_lib{nullptr};
38
39void ensure_platform_library()
40{
41 if (!platform_lib)
42 {
43 platform_lib = new mir::SharedLibrary{mtf::library_path() + "/server-modules/graphics-dummy.so"};
44 }
45}
46}
47
48std::shared_ptr<mg::Platform> mtf::make_stubbed_server_graphics_platform(std::vector<geom::Rectangle> const& display_rects)
49{
50 ensure_platform_library();
51 auto factory = platform_lib->load_function<std::shared_ptr<mg::Platform>(*)(std::vector<geom::Rectangle> const&)>("create_stub_platform");
52
53 return factory(display_rects);
54}
055
=== modified file 'tests/mir_test_framework/stubbed_graphics_platform.cpp'
--- tests/mir_test_framework/stubbed_graphics_platform.cpp 2014-11-25 12:05:51 +0000
+++ tests/mir_test_framework/stubbed_graphics_platform.cpp 2014-11-27 07:32:44 +0000
@@ -191,16 +191,25 @@
191 return std::make_shared<NullWriter>();191 return std::make_shared<NullWriter>();
192}192}
193193
194<<<<<<< TREE
194namespace195namespace
195{196{
196std::unique_ptr<std::vector<geom::Rectangle>> chosen_display_rects;197std::unique_ptr<std::vector<geom::Rectangle>> chosen_display_rects;
197}198}
198199
200=======
201extern "C" std::shared_ptr<mg::Platform> create_stub_platform(std::vector<geom::Rectangle> const& display_rects)
202{
203 return std::make_shared<mtf::StubGraphicPlatform>(display_rects);
204}
205
206>>>>>>> MERGE-SOURCE
199extern "C" std::shared_ptr<mg::Platform> create_platform(207extern "C" std::shared_ptr<mg::Platform> create_platform(
200 std::shared_ptr<mo::Option> const& /*options*/,208 std::shared_ptr<mo::Option> const& /*options*/,
201 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,209 std::shared_ptr<mir::EmergencyCleanupRegistry> const& /*emergency_cleanup_registry*/,
202 std::shared_ptr<mg::DisplayReport> const& /*report*/)210 std::shared_ptr<mg::DisplayReport> const& /*report*/)
203{211{
212<<<<<<< TREE
204 if (auto const display_rects = std::move(chosen_display_rects))213 if (auto const display_rects = std::move(chosen_display_rects))
205 {214 {
206 return std::make_shared<mtf::StubGraphicPlatform>(*display_rects);215 return std::make_shared<mtf::StubGraphicPlatform>(*display_rects);
@@ -210,6 +219,10 @@
210 static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};219 static std::vector<geom::Rectangle> const default_display_rects{geom::Rectangle{{0,0},{1600,1600}}};
211 return std::make_shared<mtf::StubGraphicPlatform>(default_display_rects);220 return std::make_shared<mtf::StubGraphicPlatform>(default_display_rects);
212 }221 }
222=======
223 static std::vector<geom::Rectangle> const display_rects{geom::Rectangle{{0,0},{1600,1600}}};
224 return create_stub_platform(display_rects);
225>>>>>>> MERGE-SOURCE
213}226}
214227
215extern "C" void add_platform_options(228extern "C" void add_platform_options(
216229
=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
--- tests/mir_test_framework/stubbed_server_configuration.cpp 2014-11-24 02:16:00 +0000
+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2014-11-27 07:32:44 +0000
@@ -19,7 +19,7 @@
19#include "mir_test_framework/stubbed_server_configuration.h"19#include "mir_test_framework/stubbed_server_configuration.h"
20#include "mir_test_framework/command_line_server_configuration.h"20#include "mir_test_framework/command_line_server_configuration.h"
2121
22#include "stubbed_graphics_platform.h"22#include "mir_test_framework/stub_server_platform_factory.h"
2323
24#include "mir/options/default_configuration.h"24#include "mir/options/default_configuration.h"
25#include "mir/graphics/cursor.h"25#include "mir/graphics/cursor.h"
@@ -92,7 +92,7 @@
92{92{
93 if (!graphics_platform)93 if (!graphics_platform)
94 {94 {
95 graphics_platform = std::make_shared<StubGraphicPlatform>(display_rects);95 graphics_platform = mtf::make_stubbed_server_graphics_platform(display_rects);
96 }96 }
9797
98 return graphics_platform;98 return graphics_platform;
9999
=== added file 'tests/mir_test_framework/symbols-client.map'
--- tests/mir_test_framework/symbols-client.map 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/symbols-client.map 2014-11-27 07:32:44 +0000
@@ -0,0 +1,7 @@
1MIR_CLIENT_PLATFORM_2 {
2 global:
3 create_client_platform;
4 is_appropriate_module;
5 local:
6 *;
7};
08
=== added file 'tests/mir_test_framework/symbols-server.map'
--- tests/mir_test_framework/symbols-server.map 1970-01-01 00:00:00 +0000
+++ tests/mir_test_framework/symbols-server.map 2014-11-27 07:32:44 +0000
@@ -0,0 +1,8 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_platform_options;
4 create_platform;
5 create_native_platform;
6 probe_platform;
7 describe_module;
8};
09
=== modified file 'tests/mir_test_framework/testing_client_options.cpp'
--- tests/mir_test_framework/testing_client_options.cpp 2014-11-27 03:48:20 +0000
+++ tests/mir_test_framework/testing_client_options.cpp 2014-11-27 07:32:44 +0000
@@ -16,18 +16,17 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#include "mir_test_framework/testing_client_configuration.h"
20#include "mir_test_framework/stub_client_connection_configuration.h"19#include "mir_test_framework/stub_client_connection_configuration.h"
20<<<<<<< TREE
21#include "mir_test_doubles/stub_client_buffer_factory.h"21#include "mir_test_doubles/stub_client_buffer_factory.h"
22#include "mir/options/program_option.h"22#include "mir/options/program_option.h"
23=======
24>>>>>>> MERGE-SOURCE
23#include "src/client/default_connection_configuration.h"25#include "src/client/default_connection_configuration.h"
24#include "src/client/client_platform_factory.h"26#include "mir_test_framework/stub_client_platform_factory.h"
25#include "src/client/client_buffer_factory.h"
26#include "src/client/client_buffer.h"
27#include "src/client/client_platform.h"
28#include "src/client/mir_connection.h"
2927
30namespace mcl = mir::client;28namespace mcl = mir::client;
29<<<<<<< TREE
31namespace mtf=mir_test_framework;30namespace mtf=mir_test_framework;
32namespace geom = mir::geometry;31namespace geom = mir::geometry;
33namespace mtd = mir::test::doubles;32namespace mtd = mir::test::doubles;
@@ -73,6 +72,9 @@
73};72};
7473
75}74}
75=======
76namespace mtf = mir_test_framework;
77>>>>>>> MERGE-SOURCE
7678
77mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)79mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)
78 : DefaultConnectionConfiguration(socket_file)80 : DefaultConnectionConfiguration(socket_file)
7981
=== modified file 'tests/unit-tests/CMakeLists.txt'
--- tests/unit-tests/CMakeLists.txt 2014-11-27 03:48:20 +0000
+++ tests/unit-tests/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -1,7 +1,23 @@
1include(CMakeDependentOption)1include(CMakeDependentOption)
22
3add_definitions(-DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/")
4
5if (MIR_BUILD_PLATFORM_ANDROID)
6 add_definitions(-DMIR_BUILD_PLATFORM_ANDROID)
7endif()
8
9if (MIR_BUILD_PLATFORM_MESA)
10 add_definitions(-DMIR_BUILD_PLATFORM_MESA)
11endif()
12
3include_directories(13include_directories(
4 ${CMAKE_SOURCE_DIR}14 ${CMAKE_SOURCE_DIR}
15
16 ${ANDROID_HEADERS_INCLUDE_DIRS}
17 ${DRM_INCLUDE_DIRS}
18 ${GBM_INCLUDE_DIRS}
19 ${UMOCKDEV_INCLUDE_DIRS}
20
5 ${PROJECT_SOURCE_DIR}/src/include/platform21 ${PROJECT_SOURCE_DIR}/src/include/platform
6 ${PROJECT_SOURCE_DIR}/src/include/server22 ${PROJECT_SOURCE_DIR}/src/include/server
7 ${PROJECT_SOURCE_DIR}/src/include/client23 ${PROJECT_SOURCE_DIR}/src/include/client
@@ -9,12 +25,6 @@
9 ${GLIB_INCLUDE_DIRS}25 ${GLIB_INCLUDE_DIRS}
10)26)
1127
12add_definitions(
13 -DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/"
14 -DMIR_CLIENT_DRIVER_BINARY="${MIR_CLIENT_DRIVER_BINARY}"
15)
16
17include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${UMOCKDEV_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
18# TODO: Aim to remove28# TODO: Aim to remove
19include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES})29include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES})
2030
@@ -79,9 +89,9 @@
79 demo-shell89 demo-shell
8090
81 mir-test91 mir-test
92 mir-test-framework
82 mir-test-doubles93 mir-test-doubles
83 mir-test-doubles-platform94 mir-test-doubles-platform
84 mir-test-framework
8595
86 3rd_party96 3rd_party
8797
@@ -91,6 +101,15 @@
91 ${GMOCK_MAIN_LIBRARY}101 ${GMOCK_MAIN_LIBRARY}
92 ${Boost_LIBRARIES}102 ${Boost_LIBRARIES}
93 ${UMOCKDEV_LIBRARIES}103 ${UMOCKDEV_LIBRARIES}
104 # Mesa platform dependencies
105 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
106 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
107 # Android platform dependencies
108 ${LIBHARDWARE_LIBRARIES}
109 ${ANDROID_PROPERTIES_LIBRARIES}
110 # Shared platform dependencies
111 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
112 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
94 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.113 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
95 ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES}114 ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES}
96 ${DRM_LDFLAGS} ${DRM_LIBRARIES}115 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -99,7 +118,7 @@
99 ${MIR_SERVER_REFERENCES}118 ${MIR_SERVER_REFERENCES}
100)119)
101120
102if (MIR_TEST_PLATFORM STREQUAL "android")121if (MIR_BUILD_PLATFORM_ANDROID)
103target_link_libraries(mir_unit_tests 122target_link_libraries(mir_unit_tests
104 mirsharedandroid123 mirsharedandroid
105 ${ANDROID_PROPERTIES_LDFLAGS}124 ${ANDROID_PROPERTIES_LDFLAGS}
@@ -114,7 +133,10 @@
114 OFF)133 OFF)
115134
116if (MIR_RUN_UNIT_TESTS)135if (MIR_RUN_UNIT_TESTS)
117 mir_discover_tests(mir_unit_tests LD_PRELOAD=libumockdev-preload.so.0 G_SLICE=always-malloc G_DEBUG=gc-friendly)136 mir_discover_tests(mir_unit_tests
137 LD_PRELOAD=libumockdev-preload.so.0
138 G_SLICE=always-malloc
139 G_DEBUG=gc-friendly)
118endif (MIR_RUN_UNIT_TESTS)140endif (MIR_RUN_UNIT_TESTS)
119141
120install(142install(
121143
=== modified file 'tests/unit-tests/client/CMakeLists.txt'
--- tests/unit-tests/client/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ tests/unit-tests/client/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -12,6 +12,7 @@
12 ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_rpc_channel.cpp12 ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_rpc_channel.cpp
13 ${CMAKE_CURRENT_SOURCE_DIR}/test_mir_prompt_session.cpp13 ${CMAKE_CURRENT_SOURCE_DIR}/test_mir_prompt_session.cpp
14 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_distributor.cpp14 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_distributor.cpp
15 ${CMAKE_CURRENT_SOURCE_DIR}/test_probing_client_platform_factory.cpp
15 ${CMAKE_CURRENT_SOURCE_DIR}/test_periodic_perf_report.cpp16 ${CMAKE_CURRENT_SOURCE_DIR}/test_periodic_perf_report.cpp
16)17)
1718
1819
=== modified file 'tests/unit-tests/client/android/test_android_client_platform.cpp'
--- tests/unit-tests/client/android/test_android_client_platform.cpp 2014-03-06 06:05:17 +0000
+++ tests/unit-tests/client/android/test_android_client_platform.cpp 2014-11-27 07:32:44 +0000
@@ -17,9 +17,9 @@
17 */17 */
1818
19#include "src/client/client_platform.h"19#include "src/client/client_platform.h"
20#include "src/client/android/client_platform_factory.h"
21#include "mir_test_doubles/mock_client_context.h"20#include "mir_test_doubles/mock_client_context.h"
22#include "mir_test_doubles/mock_client_surface.h"21#include "mir_test_doubles/mock_client_surface.h"
22#include "mir_test_framework/client_platform_factory.h"
2323
24#include <EGL/egl.h>24#include <EGL/egl.h>
2525
@@ -28,13 +28,12 @@
28namespace mcl = mir::client;28namespace mcl = mir::client;
29namespace mt = mir::test;29namespace mt = mir::test;
30namespace mtd = mt::doubles;30namespace mtd = mt::doubles;
31namespace mtf = mir_test_framework;
3132
32TEST(AndroidClientPlatformTest, egl_native_display_is_egl_default_display)33TEST(AndroidClientPlatformTest, egl_native_display_is_egl_default_display)
33{34{
34 mtd::MockClientContext context;
35 mcl::android::ClientPlatformFactory factory;
36 mtd::MockClientSurface surface;35 mtd::MockClientSurface surface;
37 auto platform = factory.create_client_platform(&context);36 auto platform = mtf::create_android_client_platform();
38 auto mock_client_surface = std::make_shared<mtd::MockClientSurface>();37 auto mock_client_surface = std::make_shared<mtd::MockClientSurface>();
39 auto native_display = platform->create_egl_native_display();38 auto native_display = platform->create_egl_native_display();
40 EXPECT_EQ(EGL_DEFAULT_DISPLAY, *native_display);39 EXPECT_EQ(EGL_DEFAULT_DISPLAY, *native_display);
@@ -42,10 +41,8 @@
4241
43TEST(AndroidClientPlatformTest, egl_native_window_is_set)42TEST(AndroidClientPlatformTest, egl_native_window_is_set)
44{43{
45 mtd::MockClientContext context;
46 mcl::android::ClientPlatformFactory factory;
47 mtd::MockClientSurface surface;44 mtd::MockClientSurface surface;
48 auto platform = factory.create_client_platform(&context);45 auto platform = mtf::create_android_client_platform();
49 auto mock_client_surface = std::make_shared<mtd::MockClientSurface>();46 auto mock_client_surface = std::make_shared<mtd::MockClientSurface>();
50 auto egl_native_window = platform->create_egl_native_window(&surface);47 auto egl_native_window = platform->create_egl_native_window(&surface);
51 EXPECT_NE(nullptr, egl_native_window);48 EXPECT_NE(nullptr, egl_native_window);
5249
=== modified file 'tests/unit-tests/client/mesa/test_client_platform.cpp'
--- tests/unit-tests/client/mesa/test_client_platform.cpp 2014-03-06 06:05:17 +0000
+++ tests/unit-tests/client/mesa/test_client_platform.cpp 2014-11-27 07:32:44 +0000
@@ -17,9 +17,9 @@
17 */17 */
1818
19#include "src/client/client_platform.h"19#include "src/client/client_platform.h"
20#include "src/client/mesa/client_platform_factory.h"20#include "mir/shared_library.h"
21#include "src/client/mesa/mesa_native_display_container.h"21#include "src/client/mesa/mesa_native_display_container.h"
22#include "mir_test_doubles/mock_client_context.h"22#include "mir_test_framework/client_platform_factory.h"
23#include "mir_test_doubles/mock_client_surface.h"23#include "mir_test_doubles/mock_client_surface.h"
2424
25#include "mir_toolkit/mesa/native_display.h"25#include "mir_toolkit/mesa/native_display.h"
@@ -30,19 +30,20 @@
30namespace mclm = mir::client::mesa;30namespace mclm = mir::client::mesa;
31namespace mt = mir::test;31namespace mt = mir::test;
32namespace mtd = mir::test::doubles;32namespace mtd = mir::test::doubles;
33namespace mtf = mir_test_framework;
3334
34TEST(MesaClientPlatformTest, egl_native_display_is_valid_until_released)35TEST(MesaClientPlatformTest, egl_native_display_is_valid_until_released)
35{36{
36 mtd::MockClientContext context;37 auto platform = mtf::create_mesa_client_platform();
37 mclm::ClientPlatformFactory factory;38 auto platform_lib = mtf::get_platform_library();
38 auto platform = factory.create_client_platform(&context);
3939
40 MirMesaEGLNativeDisplay* nd;40 MirMesaEGLNativeDisplay* nd;
41 {41 {
42 std::shared_ptr<EGLNativeDisplayType> native_display = platform->create_egl_native_display();42 std::shared_ptr<EGLNativeDisplayType> native_display = platform->create_egl_native_display();
4343
44 nd = reinterpret_cast<MirMesaEGLNativeDisplay*>(*native_display);44 nd = reinterpret_cast<MirMesaEGLNativeDisplay*>(*native_display);
45 EXPECT_EQ(MIR_MESA_TRUE, mclm::mir_client_mesa_egl_native_display_is_valid(nd));45 auto validate = platform_lib->load_function<MirBool(*)(MirMesaEGLNativeDisplay*)>("mir_client_mesa_egl_native_display_is_valid");
46 EXPECT_EQ(MIR_MESA_TRUE, validate(nd));
46 }47 }
47 EXPECT_EQ(MIR_MESA_FALSE, mclm::mir_client_mesa_egl_native_display_is_valid(nd));48 EXPECT_EQ(MIR_MESA_FALSE, mclm::mir_client_mesa_egl_native_display_is_valid(nd));
48}49}
4950
=== modified file 'tests/unit-tests/client/mesa/test_mesa_native_display_container.cpp'
--- tests/unit-tests/client/mesa/test_mesa_native_display_container.cpp 2014-03-06 06:05:17 +0000
+++ tests/unit-tests/client/mesa/test_mesa_native_display_container.cpp 2014-11-27 07:32:44 +0000
@@ -40,7 +40,7 @@
40 }40 }
4141
42 std::shared_ptr<mclg::MesaNativeDisplayContainer> const container;42 std::shared_ptr<mclg::MesaNativeDisplayContainer> const container;
43 MirConnection* connection;43 mir::client::ClientContext* connection;
44};44};
4545
46}46}
4747
=== modified file 'tests/unit-tests/client/test_client_platform.cpp'
--- tests/unit-tests/client/test_client_platform.cpp 2014-03-06 06:05:17 +0000
+++ tests/unit-tests/client/test_client_platform.cpp 2014-11-27 07:32:44 +0000
@@ -20,60 +20,140 @@
20#include "src/client/mir_client_surface.h"20#include "src/client/mir_client_surface.h"
21#include "mir_test_doubles/mock_client_context.h"21#include "mir_test_doubles/mock_client_context.h"
22#include "mir_test_doubles/mock_client_surface.h"22#include "mir_test_doubles/mock_client_surface.h"
23#include "mir_test_framework/executable_path.h"
2324
24#ifdef ANDROID25#ifdef MIR_BUILD_PLATFORM_ANDROID
25#include "mir_test_doubles/mock_android_hw.h"26#include "mir_test_doubles/mock_android_hw.h"
26#include "src/client/android/client_platform_factory.h"
27#else
28#include "src/client/mesa/client_platform_factory.h"
29#endif27#endif
3028
29#include "src/client/client_platform_factory.h"
30
31#include "mir/shared_library.h"
32
31#include <gmock/gmock.h>33#include <gmock/gmock.h>
32#include <gtest/gtest.h>34#include <gtest/gtest.h>
3335
34namespace mcl=mir::client;36namespace mcl=mir::client;
35namespace mtd = mir::test::doubles;37namespace mtd = mir::test::doubles;
3638namespace mtf = mir_test_framework;
37struct ClientPlatformTest : public ::testing::Test39
38{40namespace
41{
42struct ClientPlatformTraits
43{
44 ClientPlatformTraits(std::string const& library,
45 std::function<void(MirPlatformPackage&)> populator,
46 MirPlatformType type)
47 : platform_library_name{library},
48 populate_package_for{populator},
49 platform_type{type}
50 {
51 }
52
53 std::string const platform_library_name;
54 std::function<void(MirPlatformPackage&)> const populate_package_for;
55 MirPlatformType const platform_type;
56};
57
58struct ClientPlatformTest : public ::testing::TestWithParam<ClientPlatformTraits const*>
59{
60 ClientPlatformTest()
61 : platform_library{mtf::library_path() + "/" + GetParam()->platform_library_name},
62 create_client_platform{platform_library.load_function<mcl::CreateClientPlatform>("create_client_platform")},
63 probe{platform_library.load_function<mcl::ClientPlatformProbe>("is_appropriate_module")}
64 {
65 using namespace testing;
66 ON_CALL(context, populate(_))
67 .WillByDefault(Invoke(GetParam()->populate_package_for));
68 }
69
39 mtd::MockClientContext context;70 mtd::MockClientContext context;
40#ifdef ANDROID71#ifdef MIR_BUILD_PLATFORM_ANDROID
41 testing::NiceMock<mtd::HardwareAccessMock> hw_access_mock;72 testing::NiceMock<mtd::HardwareAccessMock> hw_access_mock;
42 mcl::android::ClientPlatformFactory factory;
43#else
44 mcl::mesa::ClientPlatformFactory factory;
45#endif73#endif
74 mir::SharedLibrary platform_library;
75 mcl::CreateClientPlatform const create_client_platform;
76 mcl::ClientPlatformProbe const probe;
46};77};
4778
48TEST_F(ClientPlatformTest, platform_name)79#ifdef MIR_BUILD_PLATFORM_ANDROID
49{80ClientPlatformTraits const android_platform{"/client-modules/android.so",
50 auto platform = factory.create_client_platform(&context);81 [](MirPlatformPackage& pkg)
51#ifdef ANDROID82 {
52 auto type = mir_platform_type_android;83 ::memset(&pkg, 0, sizeof(pkg));
53#else84 },
54 auto type = mir_platform_type_gbm;85 mir_platform_type_android
55#endif86 };
56 EXPECT_EQ(type, platform->platform_type());87
57}88INSTANTIATE_TEST_CASE_P(Android,
5889 ClientPlatformTest,
59TEST_F(ClientPlatformTest, platform_creates)90 ::testing::Values(&android_platform));
60{91
61 auto platform = factory.create_client_platform(&context);92#endif
93
94#ifdef MIR_BUILD_PLATFORM_MESA
95ClientPlatformTraits const mesa_platform{"/client-modules/mesa.so",
96 [](MirPlatformPackage& pkg)
97 {
98 ::memset(&pkg, 0, sizeof(pkg));
99 pkg.fd_items = 1;
100 },
101 mir_platform_type_gbm
102 };
103
104INSTANTIATE_TEST_CASE_P(Mesa,
105 ClientPlatformTest,
106 ::testing::Values(&mesa_platform));
107
108#endif
109}
110
111TEST_P(ClientPlatformTest, platform_name)
112{
113 auto platform = create_client_platform(&context);
114
115 EXPECT_EQ(GetParam()->platform_type, platform->platform_type());
116}
117
118TEST_P(ClientPlatformTest, platform_creates)
119{
120 auto platform = create_client_platform(&context);
62 auto buffer_factory = platform->create_buffer_factory();121 auto buffer_factory = platform->create_buffer_factory();
63 EXPECT_NE(buffer_factory.get(), (mcl::ClientBufferFactory*) NULL);122 EXPECT_NE(buffer_factory.get(), (mcl::ClientBufferFactory*) NULL);
64}123}
65124
66TEST_F(ClientPlatformTest, platform_creates_native_window)125TEST_P(ClientPlatformTest, platform_creates_native_window)
67{126{
68 auto platform = factory.create_client_platform(&context);127 auto platform = create_client_platform(&context);
69 auto mock_client_surface = std::make_shared<mtd::MockClientSurface>();128 auto mock_client_surface = std::make_shared<mtd::MockClientSurface>();
70 auto native_window = platform->create_egl_native_window(mock_client_surface.get());129 auto native_window = platform->create_egl_native_window(mock_client_surface.get());
71 EXPECT_NE(*native_window, (EGLNativeWindowType) NULL);130 EXPECT_NE(*native_window, (EGLNativeWindowType) NULL);
72}131}
73132
74TEST_F(ClientPlatformTest, platform_creates_egl_native_display)133TEST_P(ClientPlatformTest, platform_creates_egl_native_display)
75{134{
76 auto platform = factory.create_client_platform(&context);135 auto platform = create_client_platform(&context);
77 auto native_display = platform->create_egl_native_display();136 auto native_display = platform->create_egl_native_display();
78 EXPECT_NE(nullptr, native_display.get());137 EXPECT_NE(nullptr, native_display.get());
79}138}
139
140TEST_P(ClientPlatformTest, platform_probe_returns_success_when_matching)
141{
142 EXPECT_TRUE(probe(&context));
143}
144
145TEST_P(ClientPlatformTest, platform_probe_returns_false_when_not_matching)
146{
147 using namespace testing;
148 ON_CALL(context, populate(_))
149 .WillByDefault(Invoke([](MirPlatformPackage& pkg)
150 {
151 //Mock up something that hopefully looks nothing like
152 //what the platform is expecting...
153 ::memset(&pkg, 0, sizeof(pkg));
154 pkg.data_items = 0xdeadbeef;
155 pkg.fd_items = -23;
156 }));
157
158 EXPECT_FALSE(probe(&context));
159}
80160
=== added file 'tests/unit-tests/client/test_probing_client_platform_factory.cpp'
--- tests/unit-tests/client/test_probing_client_platform_factory.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit-tests/client/test_probing_client_platform_factory.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,141 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include "src/client/client_platform.h"
20#include "src/client/probing_client_platform_factory.h"
21
22#include "mir_test_doubles/mock_client_context.h"
23#include "mir_test_framework/executable_path.h"
24
25#include <gmock/gmock.h>
26#include <gtest/gtest.h>
27
28namespace mtf = mir_test_framework;
29namespace mtd = mir::test::doubles;
30
31namespace
32{
33std::vector<std::shared_ptr<mir::SharedLibrary>>
34all_available_modules()
35{
36 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;
37#ifdef MIR_BUILD_PLATFORM_MESA
38 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/mesa.so"));
39#endif
40#ifdef MIR_BUILD_PLATFORM_ANDROID
41 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/android.so"));
42#endif
43 return modules;
44}
45}
46
47TEST(ProbingClientPlatformFactory, ThrowsErrorWhenConstructedWithNoPlatforms)
48{
49 std::vector<std::shared_ptr<mir::SharedLibrary>> empty_modules;
50 EXPECT_THROW(mir::client::ProbingClientPlatformFactory{empty_modules},
51 std::runtime_error);
52}
53
54TEST(ProbingClientPlatformFactory, ThrowsErrorWhenNoPlatformPluginProbesSuccessfully)
55{
56 using namespace testing;
57
58 mir::client::ProbingClientPlatformFactory factory{all_available_modules()};
59
60 mtd::MockClientContext context;
61 ON_CALL(context, populate(_))
62 .WillByDefault(Invoke([](MirPlatformPackage& pkg)
63 {
64 ::memset(&pkg, 0, sizeof(MirPlatformPackage));
65 // Mock up a platform package that looks nothing like
66 // either an Android or Mesa package
67 pkg.fd_items = 0xdeadbeef;
68 pkg.data_items = -23;
69 }));
70
71 EXPECT_THROW(factory.create_client_platform(&context),
72 std::runtime_error);
73}
74
75#ifdef MIR_BUILD_PLATFORM_MESA
76TEST(ProbingClientPlatformFactory, CreatesMesaPlatformWhenAppropriate)
77{
78 using namespace testing;
79
80 mir::client::ProbingClientPlatformFactory factory{all_available_modules()};
81
82 mtd::MockClientContext context;
83 ON_CALL(context, populate(_))
84 .WillByDefault(Invoke([](MirPlatformPackage& pkg)
85 {
86 ::memset(&pkg, 0, sizeof(MirPlatformPackage));
87 // Mock up something that looks like a GBM platform package,
88 // until we send the actual platform type over the wire!
89 pkg.fd_items = 1;
90 pkg.fd[0] = 23;
91 }));
92 auto platform = factory.create_client_platform(&context);
93 EXPECT_EQ(mir_platform_type_gbm, platform->platform_type());
94}
95#endif
96
97#ifdef MIR_BUILD_PLATFORM_ANDROID
98TEST(ProbingClientPlatformFactory, CreatesAndroidPlatformWhenAppropriate)
99{
100 using namespace testing;
101
102 mir::client::ProbingClientPlatformFactory factory{all_available_modules()};
103
104 mtd::MockClientContext context;
105 ON_CALL(context, populate(_))
106 .WillByDefault(Invoke([](MirPlatformPackage& pkg)
107 {
108 // Mock up something that looks like a Android platform package,
109 // until we send the actual platform type over the wire!
110 ::memset(&pkg, 0, sizeof(MirPlatformPackage));
111 }));
112
113 auto platform = factory.create_client_platform(&context);
114 EXPECT_EQ(mir_platform_type_android, platform->platform_type());
115}
116#endif
117
118TEST(ProbingClientPlatformFactory, IgnoresNonClientPlatformModules)
119{
120 using namespace testing;
121
122 auto modules = all_available_modules();
123 // NOTE: For minimum fuss, load something that has minimal side-effects...
124 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/server-modules/graphics-dummy.so"));
125 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-modules/dummy.so"));
126
127 mir::client::ProbingClientPlatformFactory factory{modules};
128
129 mtd::MockClientContext context;
130 ON_CALL(context, populate(_))
131 .WillByDefault(Invoke([](MirPlatformPackage& pkg)
132 {
133 // Mock up something that looks like a Dummy platform package,
134 // until we send the actual platform type over the wire!
135 ::memset(&pkg, 0, sizeof(MirPlatformPackage));
136 pkg.data_items = 20;
137 strcpy(reinterpret_cast<char*>(pkg.data), "Dummy platform");
138 }));
139
140 auto platform = factory.create_client_platform(&context);
141}
0142
=== modified file 'tests/unit-tests/graphics/CMakeLists.txt'
--- tests/unit-tests/graphics/CMakeLists.txt 2014-11-24 02:16:00 +0000
+++ tests/unit-tests/graphics/CMakeLists.txt 2014-11-27 07:32:44 +0000
@@ -10,6 +10,7 @@
10 ${CMAKE_CURRENT_SOURCE_DIR}/test_surfaceless_egl_context.cpp10 ${CMAKE_CURRENT_SOURCE_DIR}/test_surfaceless_egl_context.cpp
11 ${CMAKE_CURRENT_SOURCE_DIR}/test_overlapping_output_grouping.cpp11 ${CMAKE_CURRENT_SOURCE_DIR}/test_overlapping_output_grouping.cpp
12 ${CMAKE_CURRENT_SOURCE_DIR}/test_program_factory.cpp12 ${CMAKE_CURRENT_SOURCE_DIR}/test_program_factory.cpp
13 ${CMAKE_CURRENT_SOURCE_DIR}/test_platform_prober.cpp
13)14)
1415
15add_subdirectory(nested/)16add_subdirectory(nested/)
1617
=== modified file 'tests/unit-tests/graphics/android/test_platform.cpp'
--- tests/unit-tests/graphics/android/test_platform.cpp 2014-11-24 02:16:00 +0000
+++ tests/unit-tests/graphics/android/test_platform.cpp 2014-11-27 07:32:44 +0000
@@ -29,6 +29,8 @@
29#include "mir_test_doubles/fd_matcher.h"29#include "mir_test_doubles/fd_matcher.h"
30#include "mir_test/fake_shared.h"30#include "mir_test/fake_shared.h"
31#include "mir_test_doubles/mock_android_native_buffer.h"31#include "mir_test_doubles/mock_android_native_buffer.h"
32#include "mir_test_framework/executable_path.h"
33#include "mir/shared_library.h"
32#include <system/window.h>34#include <system/window.h>
33#include <gtest/gtest.h>35#include <gtest/gtest.h>
3436
@@ -39,6 +41,7 @@
39namespace mr=mir::report;41namespace mr=mir::report;
40namespace geom=mir::geometry;42namespace geom=mir::geometry;
41namespace mo=mir::options;43namespace mo=mir::options;
44namespace mtf=mir_test_framework;
4245
43class PlatformBufferIPCPackaging : public ::testing::Test46class PlatformBufferIPCPackaging : public ::testing::Test
44{47{
@@ -228,6 +231,27 @@
228 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());231 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());
229}232}
230233
234TEST(AndroidGraphicsPlatform, probe_returns_unsupported_when_no_hwaccess)
235{
236 using namespace testing;
237 NiceMock<mtd::HardwareAccessMock> hwaccess;
238
239 ON_CALL(hwaccess, hw_get_module(_,_)).WillByDefault(Return(-1));
240
241 mir::SharedLibrary platform_lib{mtf::library_path() + "/server-modules/graphics-android.so"};
242 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
243 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
244}
245
246TEST(AndroidGraphicsPlatform, probe_returns_best_when_hwaccess_succeeds)
247{
248 testing::NiceMock<mtd::HardwareAccessMock> hwaccess;
249
250 mir::SharedLibrary platform_lib{mtf::library_path() + "/server-modules/graphics-android.so"};
251 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
252 EXPECT_EQ(mg::PlatformPriority::best, probe());
253}
254
231TEST(NestedPlatformCreation, doesnt_access_display_hardware)255TEST(NestedPlatformCreation, doesnt_access_display_hardware)
232{256{
233 using namespace testing;257 using namespace testing;
234258
=== modified file 'tests/unit-tests/graphics/mesa/test_platform.cpp'
--- tests/unit-tests/graphics/mesa/test_platform.cpp 2014-11-24 02:16:00 +0000
+++ tests/unit-tests/graphics/mesa/test_platform.cpp 2014-11-27 07:32:44 +0000
@@ -22,6 +22,7 @@
22#include "src/platform/graphics/mesa/platform.h"22#include "src/platform/graphics/mesa/platform.h"
23#include "src/server/report/null_report_factory.h"23#include "src/server/report/null_report_factory.h"
24#include "mir/emergency_cleanup_registry.h"24#include "mir/emergency_cleanup_registry.h"
25#include "mir/shared_library.h"
2526
26#include "mir_test_doubles/mock_buffer.h"27#include "mir_test_doubles/mock_buffer.h"
27#include "mir_test_doubles/mock_buffer_ipc_message.h"28#include "mir_test_doubles/mock_buffer_ipc_message.h"
@@ -32,6 +33,7 @@
32#include <gtest/gtest.h>33#include <gtest/gtest.h>
3334
34#include "mir_test_framework/udev_environment.h"35#include "mir_test_framework/udev_environment.h"
36#include "mir_test_framework/executable_path.h"
35#include "mir_test/pipe.h"37#include "mir_test/pipe.h"
3638
37#include "mir_test_doubles/mock_drm.h"39#include "mir_test_doubles/mock_drm.h"
@@ -332,3 +334,23 @@
332334
333 Mock::VerifyAndClearExpectations(&mock_drm);335 Mock::VerifyAndClearExpectations(&mock_drm);
334}336}
337
338TEST_F(MesaGraphicsPlatform, probe_returns_unsupported_when_no_drm_udev_devices)
339{
340 mtf::UdevEnvironment udev_environment;
341
342 mir::SharedLibrary platform_lib{mtf::library_path() + "/server-modules/graphics-mesa.so"};
343 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
344 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
345}
346
347TEST_F(MesaGraphicsPlatform, probe_returns_best_when_drm_devices_exist)
348{
349 mtf::UdevEnvironment udev_environment;
350
351 udev_environment.add_standard_device("standard-drm-devices");
352
353 mir::SharedLibrary platform_lib{mtf::library_path() + "/server-modules/graphics-mesa.so"};
354 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
355 EXPECT_EQ(mg::PlatformPriority::best, probe());
356}
335357
=== added file 'tests/unit-tests/graphics/test_platform_prober.cpp'
--- tests/unit-tests/graphics/test_platform_prober.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit-tests/graphics/test_platform_prober.cpp 2014-11-27 07:32:44 +0000
@@ -0,0 +1,214 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include <gtest/gtest.h>
20
21#include "src/platform/graphics/platform_probe.h"
22#include "mir/graphics/platform.h"
23
24#include "mir/raii.h"
25
26#ifdef MIR_BUILD_PLATFORM_MESA
27#include "mir_test_doubles/mock_drm.h"
28#include "mir_test_doubles/mock_gbm.h"
29#endif
30
31#ifdef MIR_BUILD_PLATFORM_ANDROID
32#include "mir_test_doubles/mock_android_hw.h"
33#endif
34
35#include "mir_test_framework/udev_environment.h"
36#include "mir_test_framework/executable_path.h"
37
38namespace mtf = mir_test_framework;
39namespace mtd = mir::test::doubles;
40
41namespace
42{
43std::vector<std::shared_ptr<mir::SharedLibrary>> available_platforms()
44{
45 std::vector<std::shared_ptr<mir::SharedLibrary>> modules;
46
47#ifdef MIR_BUILD_PLATFORM_MESA
48 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/server-modules/graphics-mesa.so"));
49#endif
50#ifdef MIR_BUILD_PLATFORM_ANDROID
51 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/server-modules/graphics-android.so"));
52#endif
53 return modules;
54}
55
56void add_dummy_platform(std::vector<std::shared_ptr<mir::SharedLibrary>>& modules)
57{
58 modules.insert(modules.begin(), std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/server-modules/graphics-dummy.so"));
59}
60
61std::shared_ptr<void> ensure_android_probing_fails()
62{
63#ifdef MIR_BUILD_PLATFORM_ANDROID
64 using namespace testing;
65 auto mock_android = std::make_shared<NiceMock<mtd::HardwareAccessMock>>();
66 ON_CALL(*mock_android, hw_get_module(_, _))
67 .WillByDefault(Return(-1));
68 return mock_android;
69#else
70 return std::shared_ptr<void>{};
71#endif
72}
73
74std::shared_ptr<void> ensure_mesa_probing_fails()
75{
76 return std::make_shared<mtf::UdevEnvironment>();
77}
78
79std::shared_ptr<void> ensure_mesa_probing_succeeds()
80{
81 auto udev = std::make_shared<mtf::UdevEnvironment>();
82
83 udev->add_standard_device("standard-drm-devices");
84
85 return udev;
86}
87
88std::shared_ptr<void> ensure_android_probing_succeeds()
89{
90#ifdef MIR_BUILD_PLATFORM_ANDROID
91 using namespace testing;
92 auto mock_android = std::make_shared<NiceMock<mtd::HardwareAccessMock>>();
93 ON_CALL(*mock_android, hw_get_module(_, _))
94 .WillByDefault(Return(0));
95 return mock_android;
96#else
97 return std::shared_ptr<void>{};
98#endif
99}
100}
101
102TEST(ServerPlatformProbe, ConstructingWithNoModulesIsAnError)
103{
104 std::vector<std::shared_ptr<mir::SharedLibrary>> empty_modules;
105 EXPECT_THROW(mir::graphics::module_for_device(empty_modules),
106 std::runtime_error);
107}
108
109#ifdef MIR_BUILD_PLATFORM_MESA
110TEST(ServerPlatformProbe, LoadsMesaPlatformWhenDrmDevicePresent)
111{
112 using namespace testing;
113 auto block_android = ensure_android_probing_fails();
114 auto fake_mesa = ensure_mesa_probing_succeeds();
115
116 auto modules = available_platforms();
117
118 auto module = mir::graphics::module_for_device(modules);
119 ASSERT_NE(nullptr, module);
120
121 auto descriptor = module->load_function<mir::graphics::DescribeModule>("describe_module");
122 auto description = descriptor();
123
124 EXPECT_THAT(description->name, HasSubstr("mesa"));
125}
126#endif
127
128#ifdef MIR_BUILD_PLATFORM_ANDROID
129TEST(ServerPlatformProbe, LoadsAndroidPlatformWhenHwaccessSucceeds)
130{
131 using namespace testing;
132
133 auto block_mesa = ensure_mesa_probing_fails();
134 auto fake_android = ensure_android_probing_succeeds();
135
136 auto modules = available_platforms();
137
138 auto module = mir::graphics::module_for_device(modules);
139 ASSERT_NE(nullptr, module);
140
141 auto descriptor = module->load_function<mir::graphics::DescribeModule>("describe_module");
142 auto description = descriptor();
143
144 EXPECT_THAT(description->name, HasSubstr("android"));
145}
146#endif
147
148TEST(ServerPlatformProbe, ThrowsExceptionWhenNothingProbesSuccessfully)
149{
150 using namespace testing;
151 auto block_android = ensure_android_probing_fails();
152 auto block_mesa = ensure_mesa_probing_fails();
153
154
155 EXPECT_THROW(mir::graphics::module_for_device(available_platforms()),
156 std::runtime_error);
157}
158
159TEST(ServerPlatformProbe, LoadsSupportedModuleWhenNoBestModule)
160{
161 using namespace testing;
162 auto block_android = ensure_android_probing_fails();
163 auto block_mesa = ensure_mesa_probing_fails();
164
165 auto modules = available_platforms();
166 add_dummy_platform(modules);
167
168 auto module = mir::graphics::module_for_device(modules);
169 ASSERT_NE(nullptr, module);
170
171 auto descriptor = module->load_function<mir::graphics::DescribeModule>("describe_module");
172 auto description = descriptor();
173
174 EXPECT_THAT(description->name, HasSubstr("dummy"));
175}
176
177TEST(ServerPlatformProbe, LoadsMesaOrAndroidInPreferenceToDummy)
178{
179 using namespace testing;
180
181 auto ensure_mesa = ensure_mesa_probing_succeeds();
182 auto ensure_android = ensure_android_probing_succeeds();
183
184 auto modules = available_platforms();
185 add_dummy_platform(modules);
186
187 auto module = mir::graphics::module_for_device(modules);
188 ASSERT_NE(nullptr, module);
189
190 auto descriptor = module->load_function<mir::graphics::DescribeModule>("describe_module");
191 auto description = descriptor();
192
193 EXPECT_THAT(description->name, Not(HasSubstr("dummy")));
194}
195
196TEST(ServerPlatformProbe, IgnoresNonPlatformModules)
197{
198 using namespace testing;
199
200 auto ensure_mesa = ensure_mesa_probing_succeeds();
201 auto ensure_android = ensure_android_probing_succeeds();
202
203 auto modules = available_platforms();
204 add_dummy_platform(modules);
205
206 // NOTE: We want to load something that doesn't link with libmirplatform,
207 // due to protobuf throwing a screaming hissy fit if it gets loaded twice.
208 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() +
209 "/client-modules/dummy.so"));
210
211
212 auto module = mir::graphics::module_for_device(modules);
213 EXPECT_NE(nullptr, module);
214}
0215
=== modified file 'tests/unit-tests/shared_library_test.cpp'
--- tests/unit-tests/shared_library_test.cpp 2014-11-24 02:16:00 +0000
+++ tests/unit-tests/shared_library_test.cpp 2014-11-27 07:32:44 +0000
@@ -59,10 +59,10 @@
59public:59public:
60 SharedLibrary()60 SharedLibrary()
61 : nonexistent_library{"imma_totally_not_a_library"},61 : nonexistent_library{"imma_totally_not_a_library"},
62 existing_library{mtf::library_path() + "/" MIR_CLIENT_DRIVER_BINARY},62 existing_library{mtf::library_path() + "/client-modules/mesa.so"},
63 nonexistent_function{"yo_dawg"},63 nonexistent_function{"yo_dawg"},
64 existing_function{"create_client_platform_factory"},64 existing_function{"create_client_platform"},
65 existent_version{"MIR_CLIENTPLATFORM_1"},65 existent_version{"MIR_CLIENT_PLATFORM_2"},
66 nonexistent_version{"GOATS_ON_THE_GREEN"}66 nonexistent_version{"GOATS_ON_THE_GREEN"}
67 {67 {
68 }68 }
6969
=== modified file 'tests/unit-tests/test_shared_library_prober.cpp'
--- tests/unit-tests/test_shared_library_prober.cpp 2014-11-24 02:16:00 +0000
+++ tests/unit-tests/test_shared_library_prober.cpp 2014-11-27 07:32:44 +0000
@@ -26,6 +26,7 @@
26#include <cstring>26#include <cstring>
2727
28#include <system_error>28#include <system_error>
29
29#include <gtest/gtest.h>30#include <gtest/gtest.h>
30#include <gmock/gmock.h>31#include <gmock/gmock.h>
3132
3233
=== modified file 'tools/install_on_android.sh'
--- tools/install_on_android.sh 2014-11-24 02:16:00 +0000
+++ tools/install_on_android.sh 2014-11-27 07:32:44 +0000
@@ -32,11 +32,12 @@
32 lib/libmirclient.so.* \32 lib/libmirclient.so.* \
33 lib/libmircommon.so.* \33 lib/libmircommon.so.* \
34 lib/libmirplatform.so.* \34 lib/libmirplatform.so.* \
35 lib/libmirplatform*driver.so \35 lib/platform-graphics-dummy.so \
36 lib/libmirclient*driver.so \36 lib/client-platform-dummy.so \
37 lib/client-modules/* \
38 lib/server-modules/* \
37 lib/libmirprotobuf.so.* \39 lib/libmirprotobuf.so.* \
38 lib/libmirclient-debug-extension.so.* \40 lib/libmirclient-debug-extension.so.* \
39 lib/libmirplatformstub.so \
40 lib/libmirserver.so.*41 lib/libmirserver.so.*
41 do42 do
42 adb push $x ${RUN_DIR}43 adb push $x ${RUN_DIR}
4344
=== modified file 'tools/valgrind_suppressions_armhf'
--- tools/valgrind_suppressions_armhf 2014-11-24 02:16:00 +0000
+++ tools/valgrind_suppressions_armhf 2014-11-27 07:32:44 +0000
@@ -127,6 +127,15 @@
127# memory errors.127# memory errors.
128128
129{129{
130 spurious_strlen_addr4
131 Memcheck:Addr4
132 ...
133 fun:dlsym
134 ...
135 fun:_ZN50SharedLibrary_load_nonexistent_function_fails_Test8TestBodyEv
136}
137
138{
130 mir_sharedlibrary_cond139 mir_sharedlibrary_cond
131 Memcheck:Cond140 Memcheck:Cond
132 fun:_ZN3mir13SharedLibraryC1EPKc141 fun:_ZN3mir13SharedLibraryC1EPKc

Subscribers

People subscribed via source and target branches