Mir

Merge lp:~raof/mir/privatise-all-the-things into lp:mir

Proposed by Chris Halse Rogers
Status: Superseded
Proposed branch: lp:~raof/mir/privatise-all-the-things
Merge into: lp:mir
Diff against target: 5047 lines (+2580/-573) (has conflicts)
123 files modified
CMakeLists.txt (+4/-2)
client-ABI-sha1sums (+1/-1)
common-ABI-sha1sums (+5/-1)
debian/control (+7/-12)
debian/create_postinst_prerm_scripts.sh (+0/-39)
debian/install_ld_so_conf.sh (+0/-26)
debian/mir-client-platform-android-1.install (+1/-1)
debian/mir-client-platform-mesa-1.install (+1/-1)
debian/mir-platform-graphics-android-1.install (+1/-1)
debian/mir-platform-graphics-mesa-1.install (+1/-1)
debian/rules (+0/-11)
debian/update-alternatives.postinst.in (+0/-18)
debian/update-alternatives.prerm.in (+0/-16)
include/platform/mir/graphics/platform.h (+36/-0)
include/platform/mir/options/configuration.h (+2/-0)
include/platform/mir/shared_library_loader.h (+0/-28)
include/server/mir/default_server_configuration.h (+3/-0)
include/shared/mir/logging/null_shared_library_prober_report.h (+49/-0)
include/shared/mir/logging/shared_library_prober_report.h (+48/-0)
include/shared/mir/shared_library_prober.h (+36/-0)
include/shared/mir/shared_library_prober_report.h (+44/-0)
include/shared/mir_toolkit/mesa/native_display.h (+3/-3)
include/test/mir_test_doubles/mock_android_alloc_device.h (+5/-0)
include/test/mir_test_doubles/mock_android_hw.h (+5/-0)
include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+5/-0)
include/test/mir_test_framework/client_platform_factory.h (+72/-0)
include/test/mir_test_framework/executable_path.h (+2/-0)
include/test/mir_test_framework/stub_client_platform_factory.h (+33/-0)
platform-ABI-sha1sums (+7/-4)
server-ABI-sha1sums (+8/-5)
src/client/CMakeLists.txt (+14/-11)
src/client/android/CMakeLists.txt (+6/-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 (+2/-1)
src/client/client_platform_factory.h (+5/-2)
src/client/default_connection_configuration.cpp (+51/-0)
src/client/default_connection_configuration.h (+7/-0)
src/client/egl_native_display_container.h (+3/-1)
src/client/lttng/CMakeLists.txt (+1/-0)
src/client/lttng/shared_library_prober_report.cpp (+50/-0)
src/client/lttng/shared_library_prober_report.h (+55/-0)
src/client/lttng/shared_library_prober_report_tp.h (+85/-0)
src/client/mesa/CMakeLists.txt (+5/-22)
src/client/mesa/client_platform.cpp (+1/-1)
src/client/mesa/client_platform_factory.cpp (+20/-6)
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 (+4/-2)
src/client/mir_connection.cpp (+7/-3)
src/client/mir_connection.h (+3/-1)
src/client/probing_client_platform_factory.cpp (+29/-0)
src/client/probing_client_platform_factory.h (+27/-0)
src/platform/CMakeLists.txt (+17/-6)
src/platform/graphics/CMakeLists.txt (+1/-0)
src/platform/graphics/android/CMakeLists.txt (+15/-25)
src/platform/graphics/android/android_platform.cpp (+23/-0)
src/platform/graphics/android/symbols.map (+8/-0)
src/platform/graphics/mesa/CMakeLists.txt (+18/-27)
src/platform/graphics/mesa/platform.cpp (+28/-0)
src/platform/graphics/mesa/symbols.map (+8/-0)
src/platform/graphics/platform_probe.cpp (+42/-0)
src/platform/graphics/platform_probe.h (+37/-0)
src/platform/options/default_configuration.cpp (+67/-17)
src/platform/shared_library_loader.cpp (+0/-38)
src/platform/symbols.map (+3/-0)
src/server/CMakeLists.txt (+4/-1)
src/server/graphics/CMakeLists.txt (+1/-1)
src/server/graphics/default_configuration.cpp (+37/-6)
src/server/logging/CMakeLists.txt (+0/-1)
src/server/report/default_server_configuration.cpp (+9/-0)
src/server/report/logging/CMakeLists.txt (+0/-1)
src/server/report/logging/logging_report_factory.cpp (+5/-1)
src/server/report/logging_report_factory.h (+2/-0)
src/server/report/lttng/CMakeLists.txt (+1/-0)
src/server/report/lttng/lttng_report_factory.cpp (+5/-0)
src/server/report/lttng/shared_library_prober_report.cpp (+48/-0)
src/server/report/lttng/shared_library_prober_report.h (+52/-0)
src/server/report/lttng/shared_library_prober_report_tp.h (+71/-0)
src/server/report/lttng_report_factory.h (+1/-0)
src/server/report/null/CMakeLists.txt (+1/-0)
src/server/report/null/null_report_factory.cpp (+11/-0)
src/server/report/null/shared_library_prober_report.cpp (+35/-0)
src/server/report/null/shared_library_prober_report.h (+43/-0)
src/server/report/null_report_factory.h (+2/-1)
src/server/report/report_factory.h (+3/-0)
src/shared/graphics/android/mir_native_window.cpp (+0/-1)
src/shared/logging/CMakeLists.txt (+2/-1)
src/shared/logging/shared_library_prober_report.cpp (+58/-0)
src/shared/sharedlibrary/CMakeLists.txt (+5/-1)
src/shared/sharedlibrary/shared_library_prober.cpp (+63/-0)
src/shared/symbols.map (+9/-0)
tests/acceptance-tests/CMakeLists.txt (+3/-1)
tests/acceptance-tests/test_symbols_required_by_mesa.cpp (+3/-3)
tests/integration-tests/CMakeLists.txt (+21/-2)
tests/mir_test_doubles/CMakeLists.txt (+13/-10)
tests/mir_test_framework/CMakeLists.txt (+38/-0)
tests/mir_test_framework/executable_path.cpp (+5/-0)
tests/mir_test_framework/platform_graphics_dummy.cpp (+33/-0)
tests/mir_test_framework/stub_client_platform_factory.cpp (+143/-0)
tests/mir_test_framework/stub_client_platform_module.cpp (+35/-0)
tests/mir_test_framework/symbols-client.map (+7/-0)
tests/mir_test_framework/symbols-server.map (+10/-0)
tests/mir_test_framework/testing_client_options.cpp (+2/-102)
tests/unit-tests/CMakeLists.txt (+42/-3)
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 (+116/-0)
tests/unit-tests/graphics/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_android_platform.cpp (+24/-0)
tests/unit-tests/graphics/android/test_output_builder.cpp (+2/-1)
tests/unit-tests/graphics/mesa/test_platform.cpp (+22/-0)
tests/unit-tests/graphics/test_platform_prober.cpp (+194/-0)
tests/unit-tests/shared_library_test.cpp (+28/-11)
tests/unit-tests/test_shared_library_prober.cpp (+165/-0)
tools/valgrind_suppressions_armhf (+9/-0)
Text conflict in src/client/default_connection_configuration.cpp
Text conflict in src/client/default_connection_configuration.h
To merge this branch: bzr merge lp:~raof/mir/privatise-all-the-things
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Resubmitting
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Abstain
Alexandros Frantzis (community) Abstain
Kevin DuBois (community) Needs Information
Review via email: mp+228796@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-29.

Commit message

Move the platform plugins into a private directory, versioned with the relevant ABI.

Together with Alan's versioning of libmirplatform, makes different versions of Mir parallel installable again.

Fixes: https://bugs.launchpad.net/mir/+bug/1293944

Description of the change

Move the platform plugins into a private directory, versioned with the relevant ABI.

There are some obvious TODOs here, but none seem super-urgent:
*) Actually managing the lifetime of our platform plugins rather than just keeping them around indefinitely
*) Defining an ABI we expose to platform plugins and then sticking them in an unversioned directory.
*) Loading the specific version of the ABI we expect via dlvsym.

Things that I'll do as an immediate follow-on branch:
*) Logging for platform module probing

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

How does removing libmirplatform fits with our "platform" story?

AIUI libmirplatform is the LGPL foundation (establishing common interfaces & types) that both a propitiatory platform implementation and the GPL libmirserver link against.

How is that seen to work after these changes?

review: Needs Information
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Besides the conflicts:

42 +Package: libmirplatformgraphics-mesa-24

Debian packaging guidelines mandate lib<name><version>, so e.g. libmirclientplatform-mesa8 for the package names. The extra dash before the version is only used if the name ends with a number.

225 -override_dh_install:
231 -override_dh_installdeb:
787 + // TODO: Some sort of probe so we have some guarantee that

We need to check if removing alternatives support breaks the emulator use case (which was the driving force behing it). In general, until we have a smart enough probe, we either need to allow setting a sensible system-wide default (that's what the current alternatives system does), or disallow installing the mesa/android packages at the same time (which somewhat defeats the purpose of this MP).

2173 +std::list<std::shared_ptr<mir::SharedLibrary>>

Prefer vector<> by default (not that it will makes any performance different in this case).

review: Needs Fixing
Revision history for this message
Kevin DuBois (kdub) wrote :

the define MIR_SERVER_PLATFORM_PLUGIN_PATH makes me a little leary (esp with the various cross compiling methods floating around. Could we use a some default paths instead?

review: Needs Information
Revision history for this message
Chris Halse Rogers (raof) wrote :

> How does removing libmirplatform fits with our "platform" story?
>
> AIUI libmirplatform is the LGPL foundation (establishing common interfaces &
> types) that both a propitiatory platform implementation and the GPL
> libmirserver link against.
>
> How is that seen to work after these changes?

Roughly the same as it was working before these changes - if, for example, you check out libmirplatform in trunk then you'll see it exports a single symbol - mir::load_library - which I removed and then noticed that nothing was actually linked against libmirplatform (because we pass the linker flag to only link against things that we use symbols from).

Thinking of which, have we checked with our lawyers and/or NVIDIA's/AMD's lawyers about this? The situation is more like loadable modules in the kernel rather than traditional dynamic linking, and it'd be nice to be clearer about our expectations than the kernel is.

> Besides the conflicts:
>
> 42 +Package: libmirplatformgraphics-mesa-24
>
> Debian packaging guidelines mandate lib<name><version>, so e.g.
> libmirclientplatform-mesa8 for the package names. The extra dash before the
> version is only used if the name ends with a number.

Ah, yeah. I'll actually go the other way - this isn't a shared library, it's a module, so I'll rename it mir-platform-graphics-mesa-24 (see also: Xserver versioning)

> 787 + // TODO: Some sort of probe so we have some guarantee that
>
> We need to check if removing alternatives support breaks the emulator use case
> (which was the driving force behing it). In general, until we have a smart
> enough probe, we either need to allow setting a sensible system-wide default
> (that's what the current alternatives system does), or disallow installing the
> mesa/android packages at the same time (which somewhat defeats the purpose of
> this MP).

It shouldn't be too hard to get a basic probe up and running. I'll do so.

>
> 2173 +std::list<std::shared_ptr<mir::SharedLibrary>>
>
> Prefer vector<> by default (not that it will makes any performance different
> in this case).

Ah, yeah. This was a holdover of trying to use raw mir::SharedLibrary which isn't default-constructible.

> the define MIR_SERVER_PLATFORM_PLUGIN_PATH makes me a little leary (esp with
> the various cross compiling methods floating around. Could we use a some
> default paths instead?

I'm not entirely clear what you're concerned about here. Is your concern about testability? That should be mitigated by the MIR_CLIENT_PLATFORM_LIBRARY and MIR_SERVER_PLATFORM_LIBRARY environment overrides, which we need to use in the tests anyway?

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

> > How does removing libmirplatform fits with our "platform" story?
> >
> > AIUI libmirplatform is the LGPL foundation (establishing common interfaces &
> > types) that both a propitiatory platform implementation and the GPL
> > libmirserver link against.
> >
> > How is that seen to work after these changes?
>
> Roughly the same as it was working before these changes - if, for example, you
> check out libmirplatform in trunk then you'll see it exports a single symbol -
> mir::load_library - which I removed and then noticed that nothing was actually
> linked against libmirplatform (because we pass the linker flag to only link
> against things that we use symbols from).
>
> Thinking of which, have we checked with our lawyers and/or NVIDIA's/AMD's
> lawyers about this? The situation is more like loadable modules in the kernel
> rather than traditional dynamic linking, and it'd be nice to be clearer about
> our expectations than the kernel is.

I wasn't party to the conversations with lawyers, I'm going on what kgunn told us.

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

> Roughly the same as it was working before these changes - if, for example, you
> check out libmirplatform in trunk then you'll see it exports a single symbol -
> mir::load_library - which I removed and then noticed that nothing was actually
> linked against libmirplatform (because we pass the linker flag to only link
> against things that we use symbols from).

That bug and has been fixed on development-branch (-r 1786)

Revision history for this message
Chris Halse Rogers (raof) wrote :

Moving to WIP: probing is taking a little longer than expected. Hah!

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

Interesting approach. Not a complete review but:

1607 +#include <iostream>

Not needed

~~~~

3961 -#ifdef ANDROID
3962 #include "mir_test_doubles/mock_android_hw.h"
3963 -#include "src/client/android/client_platform_factory.h"

Causes FTBFS for me on desktop:

include/test/mir_test_doubles/mock_android_alloc_device.h:26:30: fatal error: hardware/gralloc.h: No such file or directory
 #include <hardware/gralloc.h>
                              ^
compilation terminated.

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

Fix the build and the tests when not building the Andorid platform

1828. By Chris Halse Rogers

Add a --platform-graphics-path option.

This makes it easier to test the full stack without installing it, and
is the sort of thing people are going to reasonable expect in a configuration
file.

1829. By Chris Halse Rogers

Drop noexcept from create_platform declaration.

Since we're returning a std::shared_ptr<> we're pretty much guaranteed that both sides
of this call are actually C++, and can deal with exceptions.

This means we need to expose all the necessary symbols for exception propagation and
so on, so drop the local: catch-all clause from the modules' symbols.map

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

Merge trunk

1831. By Chris Halse Rogers

Fix licensing for server → platform move of platform_probe.*

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

Include <iostream> less

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

Babysit Google Test a bit.

Apparently ::testing::Values() is confused by being handed a list of objects,
resulting in Valgrind errors. Fix this by constructing a list of
ClientPlatformTraits* pointing to the globals instead.

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

Suppress just a little more armhf valgrind wackiness

1835. By Chris Halse Rogers

Probe client platform modules before attempting to create a ClientPlatform

Exceptions aren't flow-control constructs, this will allow platforms to *actually* throw
an exception if ClientPlatform construction unexpectedly fails, and resolves a weird
leak found by valgrind that's probably to do with exception throwing across DSOs without
appropriate symbol exports.

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

Merge trunk, resolve conflicts

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

Also add is_appropriate_module to stub client platform

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

Didn't get a chance to review properly.

1838. By Chris Halse Rogers

Merge trunk

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

Be smarter about the client platform tests.

We can instantiate the parametrised multiple times, so do it individually for Mesa and Android
if they're built, rather than testing the dummy for each platform not built. The dummy platform
is not yet sufficiently dummy to work properly here.

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

> [ RUN ] SurfaceLoop.all_created_buffers_are_destroyed
> Build timed out (after 60 minutes). Marking the build as failed.

Sometimes tests hang. Sometimes CI is this slow. Who knows?!

~~~~

1204 +std::shared_ptr<mcl::ProbingClientPlatformFactory> the_platform_prober;

Having recently tracked down several problems caused by namespace scoped objects with state I'm concerned that this may be fragile.

~~~~

Triggering rebuild to see if it it gets through CI - will come back for a closer look later.

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1840. By Chris Halse Rogers

Merge trunk

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

Update SHAsums

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

Select the right client platform for integration tests.

The Android integration tests have some Android-specific tests that need a real client platform,
so give it to them.

Conversely, the Mesa client platform cannot load in the integration test environment, as they need
a real platform package.

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

Default to logging our choice of platform library.

This is both so I can see what the hell's happening in CI, but is also
a reasonable default¹. Who wants to receive bug reports where we don't know
what platform libraries are being loaded?

¹: For the server, certainly. Less reasonable for the client, until we make
the client log hookable.

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

Merge trunk

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

Minor suggestion: Try reverting all the blank line changes. That will get the diff size down to below the 5000 line limit so Launchpad will display it all.

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

Revert the switch to logging by default.

They're not currently as useful as I thought; I'll switch them back on
in the follow-up branch where they *are* more useful ☺

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

Merge trunk

1847. By Chris Halse Rogers

Add new entries to mircommon symbols.map

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

Ok. I don't know what's going on with CI.

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

I suggest trying to shrink the diff down to 5000 lines so LP will not truncate it. Also resubmit because the above CI madness is making things confusing.

review: Needs Resubmitting
1848. By Chris Halse Rogers

Merge trunk

1849. By Chris Halse Rogers

Merge library-prober as a prerequisite

1850. By Chris Halse Rogers

Update sha1sums

1851. By Chris Halse Rogers

Remerge prerequisite

1852. By Chris Halse Rogers

♪ Merge merge merge your prereq gently down the stream ♫

1853. By Chris Halse Rogers

Stub client library doesn't need to link to mir-test-framework

Fixes failure to build on i386-android-cross-compile

1854. By Chris Halse Rogers

Merge versioned-shared-library work

1855. By Chris Halse Rogers

Make ProbingClientFactory ignore non-client-platform modules.

You shouldn't be installing non-client platform modules in the client platform path,
but that's no reason not to be robust against it

1856. By Chris Halse Rogers

Remove some detritus

1857. By Chris Halse Rogers

Define CLIENT_PLATFORM_API instead of the client module path

1858. By Chris Halse Rogers

Also make module_for_device ignore non-server-platform modules.

Again, there's no reason not to be robust against this

1859. By Chris Halse Rogers

Load the specific platform version we're expecting.

There's no particular reason not to do this now, and it's a bit of safety for when we
*do* have a different platform ABI

1860. By Chris Halse Rogers

Merge prereq

1861. By Chris Halse Rogers

Merge prereq

1862. By Chris Halse Rogers

Merged versioned-loader into private-library-loading.

1863. By Chris Halse Rogers

Merged versioned-loader into private-library-loading.

1864. By Chris Halse Rogers

Use a dummy library rather than something that might actually have side-effects

1865. By Chris Halse Rogers

Merged versioned-loader into private-library-loading.

1866. By Chris Halse Rogers

Timeouts for everyone!

This was reliably timing out for me under valgrind. 50 seconds should be enough for everyone!

1867. By Chris Halse Rogers

Merge trunk. Conflicts!

1868. By Chris Halse Rogers

Fix cross-building of client-platform-dummy

1869. By Chris Halse Rogers

Aww, yeah. Don't load libmirplatform twice

1870. By Chris Halse Rogers

Merge trunk, reverting version-drivers branch as this subsumes it

1871. By Chris Halse Rogers

Merge trunk, resolving conflicts

1872. By Chris Halse Rogers

Merge trunk

1873. By Chris Halse Rogers

Merge trunk

1874. By Chris Halse Rogers

Drop numbering from driver packages.

Looking through what's involved in that ABI, we haven't changed anything in there for a while.

We should be able to handle not breaking the driver interface, and when we do we should
be able to invest the effort to handle backwards compatibility.

1875. By Chris Halse Rogers

Use MIR_CLIENT_PLATFORM_2.

We load the platform libraries from an entirely new path, so it's not actually
necessary for the purposes of disambiguation, but it's also harmless.

1876. By Chris Halse Rogers

Install and load platform libraries in unadorned path.

1877. By Chris Halse Rogers

Merge trunk

1878. By Chris Halse Rogers

Drop duplicated prefixes from platform libraries

1879. By Chris Halse Rogers

Merge trunk

1880. By Chris Halse Rogers

Remove resolved hw_get_module question-comment

1881. By Chris Halse Rogers

Remove spurious whitespace changes

1882. By Chris Halse Rogers

Use BOOST_THROW_EXCEPTION to decorate the exceptions

1883. By Chris Halse Rogers

Clarify MIR_GRAPHICS_PLATFORM_1 CMake comment

1884. By Chris Halse Rogers

Fix android platform module install

1885. By Chris Halse Rogers

Merge trunk

1886. By Chris Halse Rogers

Fix android graphics platform linking post-merge

1887. By Chris Halse Rogers

Link Mesa platform graphics module against libmirplatform, to pick up symbol versions

1888. By Chris Halse Rogers

Move client and server modules into an appropriate directory in the build tree

1889. By Chris Halse Rogers

Fix remaining Android module load failure in tests

1890. By Chris Halse Rogers

Merge trunk

1891. By Chris Halse Rogers

Turn libplatformstub into platform-graphics-dummy.so and fix the tests

1892. By Chris Halse Rogers

Add a set of helpers to find the various platform plugins

1893. By Chris Halse Rogers

Don't throw exception pointers; just throw the exception.

1894. By Chris Halse Rogers

Fix name for platform-graphics-dummy.so

1895. By Chris Halse Rogers

Coalesce all hardcoded platform module strings into {client,server}_platform_() calls

1896. By Chris Halse Rogers

Rename, and install client & server stub platforms into mir-test-tools

1897. By Chris Halse Rogers

Merge trunk, updating the RendererFactory cludge for graphics-stub.so

1898. By Chris Halse Rogers

Fix random tab character

1899. By Chris Halse Rogers

Fix stub server platform build on armhf

1900. By Chris Halse Rogers

Fix unnecessary symbol leakage from server platform modules

1901. By Chris Halse Rogers

Merge trunk

Unmerged revisions

1901. By Chris Halse Rogers

Merge trunk

1900. By Chris Halse Rogers

Fix unnecessary symbol leakage from server platform modules

1899. By Chris Halse Rogers

Fix stub server platform build on armhf

1898. By Chris Halse Rogers

Fix random tab character

1897. By Chris Halse Rogers

Merge trunk, updating the RendererFactory cludge for graphics-stub.so

1896. By Chris Halse Rogers

Rename, and install client & server stub platforms into mir-test-tools

1895. By Chris Halse Rogers

Coalesce all hardcoded platform module strings into {client,server}_platform_() calls

1894. By Chris Halse Rogers

Fix name for platform-graphics-dummy.so

1893. By Chris Halse Rogers

Don't throw exception pointers; just throw the exception.

1892. By Chris Halse Rogers

Add a set of helpers to find the various platform plugins

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-08-21 13:18:01 +0000
+++ CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -107,7 +107,7 @@
107include_directories(include/shared)107include_directories(include/shared)
108108
109# Check for boost109# Check for boost
110find_package(Boost 1.48.0 COMPONENTS date_time system program_options iostreams REQUIRED)110find_package(Boost 1.48.0 COMPONENTS date_time system program_options iostreams filesystem REQUIRED)
111include_directories (111include_directories (
112 ${Boost_INCLUDE_DIRS}112 ${Boost_INCLUDE_DIRS}
113)113)
@@ -159,13 +159,15 @@
159include_directories (${EGL_INCLUDE_DIRS})159include_directories (${EGL_INCLUDE_DIRS})
160include_directories (${GLM_INCLUDE_DIRS})160include_directories (${GLM_INCLUDE_DIRS})
161161
162find_package( PkgConfig )
163
162if (MIR_BUILD_PLATFORM_ANDROID)164if (MIR_BUILD_PLATFORM_ANDROID)
163 find_package(AndroidProperties REQUIRED)165 find_package(AndroidProperties REQUIRED)
164 find_package(LibHardware REQUIRED)166 find_package(LibHardware REQUIRED)
167 pkg_check_modules( ANDROID_HEADERS REQUIRED android-headers )
165endif()168endif()
166169
167if (MIR_BUILD_PLATFORM_MESA)170if (MIR_BUILD_PLATFORM_MESA)
168 find_package( PkgConfig )
169 pkg_check_modules( GBM REQUIRED gbm>=9.0.0)171 pkg_check_modules( GBM REQUIRED gbm>=9.0.0)
170 pkg_check_modules( DRM REQUIRED libdrm )172 pkg_check_modules( DRM REQUIRED libdrm )
171endif()173endif()
172174
=== modified file 'client-ABI-sha1sums'
--- client-ABI-sha1sums 2014-08-04 16:01:56 +0000
+++ client-ABI-sha1sums 2014-08-29 01:18:58 +0000
@@ -12,5 +12,5 @@
12183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h12183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h
13fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h13fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h
14bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h14bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h
1599ef5f3bf548508fae24c60f74be1dea018a6e8c include/shared/mir_toolkit/mesa/native_display.h154975998aa1056ed0d39dcc538127453e516ad8e9 include/shared/mir_toolkit/mesa/native_display.h
16101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h16101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h
1717
=== modified file 'common-ABI-sha1sums'
--- common-ABI-sha1sums 2014-08-26 16:23:10 +0000
+++ common-ABI-sha1sums 2014-08-29 01:18:58 +0000
@@ -28,18 +28,22 @@
282319b60bf87801a93af636d3bbfbae420f6776a4 include/shared/mir/logging/dumb_console_logger.h282319b60bf87801a93af636d3bbfbae420f6776a4 include/shared/mir/logging/dumb_console_logger.h
2952cb642982f7f4fa623cf041b11eca126a3df0f4 include/shared/mir/logging/input_timestamp.h2952cb642982f7f4fa623cf041b11eca126a3df0f4 include/shared/mir/logging/input_timestamp.h
3072e20902d70588af73bea7a524337264b853bf0a include/shared/mir/logging/logger.h3072e20902d70588af73bea7a524337264b853bf0a include/shared/mir/logging/logger.h
312697f3edce3b3120983b402d383bbdead10f5487 include/shared/mir/logging/null_shared_library_prober_report.h
32e9e5f22fe9deb8965946be0f85ea3d255baca740 include/shared/mir/logging/shared_library_prober_report.h
31f199066a30882b22be901de0c4e6aa62e320e593 include/shared/mir/protobuf/google_protobuf_guard.h33f199066a30882b22be901de0c4e6aa62e320e593 include/shared/mir/protobuf/google_protobuf_guard.h
324b4b8d7ae1cd870aeec6399afd6dbd56205c80b2 include/shared/mir/raii.h344b4b8d7ae1cd870aeec6399afd6dbd56205c80b2 include/shared/mir/raii.h
33bb27ec04b2861d128f420698491941f71e1aefc0 include/shared/mir/recursive_read_write_mutex.h35bb27ec04b2861d128f420698491941f71e1aefc0 include/shared/mir/recursive_read_write_mutex.h
34903210453b98267e47c03ab2920c1db047ba0457 include/shared/mir/report/lttng/mir_tracepoint.h36903210453b98267e47c03ab2920c1db047ba0457 include/shared/mir/report/lttng/mir_tracepoint.h
3552b6b60543a361e91dbeaa2549114239f57b6b4e include/shared/mir/report/lttng/tracepoint_provider.h3752b6b60543a361e91dbeaa2549114239f57b6b4e include/shared/mir/report/lttng/tracepoint_provider.h
36dc80f8a57f133276dd5a72f4d0360a7b71154d16 include/shared/mir/shared_library.h38dc80f8a57f133276dd5a72f4d0360a7b71154d16 include/shared/mir/shared_library.h
394d80544bf59ef452979b934d664ac592aff58c82 include/shared/mir/shared_library_prober.h
4053e4159f2a0b564cb39a7785b4e229f6f7424779 include/shared/mir/shared_library_prober_report.h
37b4e96264b9a57a1f2ceceb700c5379658905ded7 include/shared/mir/thread_name.h41b4e96264b9a57a1f2ceceb700c5379658905ded7 include/shared/mir/thread_name.h
389907751d046e4aea81881cf19e5df52c7a6a813e include/shared/mir_toolkit/client_types.h429907751d046e4aea81881cf19e5df52c7a6a813e include/shared/mir_toolkit/client_types.h
39183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h43183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h
40fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h44fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h
41bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h45bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h
4299ef5f3bf548508fae24c60f74be1dea018a6e8c include/shared/mir_toolkit/mesa/native_display.h464975998aa1056ed0d39dcc538127453e516ad8e9 include/shared/mir_toolkit/mesa/native_display.h
43101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h47101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h
449f646fa12eaca5fc3b7a8fde6208673c071c8ef3 include/shared/mir/udev/wrapper.h489f646fa12eaca5fc3b7a8fde6208673c071c8ef3 include/shared/mir/udev/wrapper.h
459fd77ab693cc4c9a200e44804f5493733528a674 include/shared/mir/variable_length_array.h499fd77ab693cc4c9a200e44804f5493733528a674 include/shared/mir/variable_length_array.h
4650
=== modified file 'debian/control'
--- debian/control 2014-08-26 09:27:49 +0000
+++ debian/control 2014-08-29 01:18:58 +0000
@@ -19,6 +19,7 @@
19 libboost-program-options-dev,19 libboost-program-options-dev,
20 libboost-system-dev,20 libboost-system-dev,
21 libboost-iostreams-dev,21 libboost-iostreams-dev,
22 libboost-filesystem-dev,
22 protobuf-compiler,23 protobuf-compiler,
23 libdrm-dev,24 libdrm-dev,
24 libegl1-mesa-dev,25 libegl1-mesa-dev,
@@ -51,8 +52,7 @@
51Pre-Depends: ${misc:Pre-Depends}52Pre-Depends: ${misc:Pre-Depends}
52Depends: ${misc:Depends},53Depends: ${misc:Depends},
53 ${shlibs:Depends},54 ${shlibs:Depends},
54 libmirplatformgraphics-mesa (= ${binary:Version}) |55 mir-platform-graphics-mesa-1 | mir-platform-graphics-android-1,
55 libmirplatformgraphics-android (= ${binary:Version}),
56Description: Display server for Ubuntu - server library56Description: Display server for Ubuntu - server library
57 Mir is a display server running on linux systems, with a focus on efficiency,57 Mir is a display server running on linux systems, with a focus on efficiency,
58 robust operation and a well-defined driver model.58 robust operation and a well-defined driver model.
@@ -73,14 +73,13 @@
73 Contains the shared libraries required for the Mir server to interact with73 Contains the shared libraries required for the Mir server to interact with
74 the underlying hardware platform.74 the underlying hardware platform.
7575
76Package: libmirplatformgraphics-mesa76Package: mir-platform-graphics-mesa-1
77Section: libs77Section: libs
78Architecture: i386 amd64 armhf arm6478Architecture: i386 amd64 armhf arm64
79Multi-Arch: same79Multi-Arch: same
80Pre-Depends: ${misc:Pre-Depends}80Pre-Depends: ${misc:Pre-Depends}
81Depends: ${misc:Depends},81Depends: ${misc:Depends},
82 ${shlibs:Depends},82 ${shlibs:Depends},
83 libmirplatform2 (= ${binary:Version}),
84Description: Display server for Ubuntu - platform library for Mesa83Description: Display server for Ubuntu - platform library for Mesa
85 Mir is a display server running on linux systems, with a focus on efficiency,84 Mir is a display server running on linux systems, with a focus on efficiency,
86 robust operation and a well-defined driver model.85 robust operation and a well-defined driver model.
@@ -88,14 +87,13 @@
88 Contains the shared libraries required for the Mir server to interact with87 Contains the shared libraries required for the Mir server to interact with
89 the hardware platform using the Mesa drivers.88 the hardware platform using the Mesa drivers.
9089
91Package: libmirplatformgraphics-android90Package: mir-platform-graphics-android-1
92Section: libs91Section: libs
93Architecture: i386 amd64 armhf92Architecture: i386 amd64 armhf
94Multi-Arch: same93Multi-Arch: same
95Pre-Depends: ${misc:Pre-Depends}94Pre-Depends: ${misc:Pre-Depends}
96Depends: ${misc:Depends},95Depends: ${misc:Depends},
97 ${shlibs:Depends},96 ${shlibs:Depends},
98 libmirplatform2 (= ${binary:Version}),
99Description: Display server for Ubuntu - platform library for Android97Description: Display server for Ubuntu - platform library for Android
100 Mir is a display server running on linux systems, with a focus on efficiency,98 Mir is a display server running on linux systems, with a focus on efficiency,
101 robust operation and a well-defined driver model.99 robust operation and a well-defined driver model.
@@ -159,8 +157,7 @@
159Pre-Depends: ${misc:Pre-Depends}157Pre-Depends: ${misc:Pre-Depends}
160Depends: ${misc:Depends},158Depends: ${misc:Depends},
161 ${shlibs:Depends},159 ${shlibs:Depends},
162 libmirclientplatform-mesa (= ${binary:Version}) |160 mir-client-platform-mesa-1 | mir-client-platform-android-1,
163 libmirclientplatform-android (= ${binary:Version}),
164Description: Display server for Ubuntu - client library161Description: Display server for Ubuntu - client library
165 Mir is a display server running on linux systems, with a focus on efficiency,162 Mir is a display server running on linux systems, with a focus on efficiency,
166 robust operation and a well-defined driver model.163 robust operation and a well-defined driver model.
@@ -182,14 +179,13 @@
182 .179 .
183 Contains header files required to develop against Mir.180 Contains header files required to develop against Mir.
184181
185Package: libmirclientplatform-mesa182Package: mir-client-platform-mesa-1
186Section: libs183Section: libs
187Architecture: i386 amd64 armhf arm64184Architecture: i386 amd64 armhf arm64
188Multi-Arch: same185Multi-Arch: same
189Pre-Depends: ${misc:Pre-Depends}186Pre-Depends: ${misc:Pre-Depends}
190Depends: ${misc:Depends},187Depends: ${misc:Depends},
191 ${shlibs:Depends}188 ${shlibs:Depends}
192Replaces: libmirclientplatform
193Description: Display server for Ubuntu - client platform library for Mesa189Description: Display server for Ubuntu - client platform library for Mesa
194 Mir is a display server running on linux systems, with a focus on efficiency,190 Mir is a display server running on linux systems, with a focus on efficiency,
195 robust operation and a well-defined driver model.191 robust operation and a well-defined driver model.
@@ -197,14 +193,13 @@
197 Contains the shared libraries required for the Mir clients to interact with193 Contains the shared libraries required for the Mir clients to interact with
198 the underlying hardware platform using the Mesa drivers.194 the underlying hardware platform using the Mesa drivers.
199195
200Package: libmirclientplatform-android196Package: mir-client-platform-android-1
201Section: libs197Section: libs
202Architecture: i386 amd64 armhf198Architecture: i386 amd64 armhf
203Multi-Arch: same199Multi-Arch: same
204Pre-Depends: ${misc:Pre-Depends}200Pre-Depends: ${misc:Pre-Depends}
205Depends: ${misc:Depends},201Depends: ${misc:Depends},
206 ${shlibs:Depends}202 ${shlibs:Depends}
207Replaces: libmirclientplatform
208Description: Display server for Ubuntu - client platform library for Android203Description: Display server for Ubuntu - client platform library for Android
209 Mir is a display server running on linux systems, with a focus on efficiency,204 Mir is a display server running on linux systems, with a focus on efficiency,
210 robust operation and a well-defined driver model.205 robust operation and a well-defined driver model.
211206
=== removed file 'debian/create_postinst_prerm_scripts.sh'
--- debian/create_postinst_prerm_scripts.sh 2014-04-15 15:02:05 +0000
+++ debian/create_postinst_prerm_scripts.sh 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
1#!/bin/sh
2
3set -e
4
5dpkg_alternatives_priority=500
6deb_host_arch=$1
7deb_host_multiarch=$2
8
9mir_platform_types="platformgraphics clientplatform"
10case $deb_host_arch in
11 arm64)
12 mir_platforms="mesa"
13 ;;
14 *)
15 mir_platforms="android mesa"
16 ;;
17esac
18
19create_script()
20{
21 local script=$1
22 local platform_type=$2
23 local platform=$3
24
25 sed -e "s/@DEB_HOST_MULTIARCH@/$deb_host_multiarch/" \
26 -e "s/@MIR_PLATFORM_TYPE@/$platform_type/" \
27 -e "s/@MIR_PLATFORM@/$platform/" \
28 -e "s/@DPKG_ALTERNATIVES_PRIORITY@/$dpkg_alternatives_priority/" \
29 debian/update-alternatives.${script}.in > debian/libmir$platform_type-$platform.${script}
30}
31
32for platform_type in $mir_platform_types;
33do
34 for platform in $mir_platforms;
35 do
36 create_script postinst $platform_type $platform
37 create_script prerm $platform_type $platform
38 done
39done
400
=== removed file 'debian/install_ld_so_conf.sh'
--- debian/install_ld_so_conf.sh 2014-04-15 15:02:05 +0000
+++ debian/install_ld_so_conf.sh 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
1#!/bin/sh
2
3set -e
4
5DEB_HOST_ARCH=$1
6DEB_HOST_MULTIARCH=$2
7
8mir_platform_types="platformgraphics clientplatform"
9case $DEB_HOST_ARCH in
10 arm64)
11 mir_platforms="mesa"
12 ;;
13 *)
14 mir_platforms="android mesa"
15 ;;
16esac
17
18for platform_type in $mir_platform_types;
19do
20 for platform in $mir_platforms;
21 do
22 platform_dir="/usr/lib/$DEB_HOST_MULTIARCH/mir/$platform_type/$platform"
23 package_dir="debian/libmir$platform_type-$platform/$platform_dir"
24 echo "$platform_dir" > $package_dir/ld.so.conf
25 done
26done
270
=== renamed file 'debian/libmirclientplatform-android.install' => 'debian/mir-client-platform-android-1.install'
--- debian/libmirclientplatform-android.install 2014-02-14 08:43:47 +0000
+++ debian/mir-client-platform-android-1.install 2014-08-29 01:18:58 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/clientplatform/android/*1usr/lib/*/mir/client-platform-1/client-platform-android.so
22
=== renamed file 'debian/libmirclientplatform-mesa.install' => 'debian/mir-client-platform-mesa-1.install'
--- debian/libmirclientplatform-mesa.install 2014-02-14 08:43:47 +0000
+++ debian/mir-client-platform-mesa-1.install 2014-08-29 01:18:58 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/clientplatform/mesa/*1usr/lib/*/mir/client-platform-1/client-platform-mesa.so
22
=== renamed file 'debian/libmirplatformgraphics-android.install' => 'debian/mir-platform-graphics-android-1.install'
--- debian/libmirplatformgraphics-android.install 2014-02-14 08:43:47 +0000
+++ debian/mir-platform-graphics-android-1.install 2014-08-29 01:18:58 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/platformgraphics/android/*1usr/lib/*/mir/server-platform-1/platform-graphics-android.so
22
=== renamed file 'debian/libmirplatformgraphics-mesa.install' => 'debian/mir-platform-graphics-mesa-1.install'
--- debian/libmirplatformgraphics-mesa.install 2014-02-14 08:43:47 +0000
+++ debian/mir-platform-graphics-mesa-1.install 2014-08-29 01:18:58 +0000
@@ -1,1 +1,1 @@
1usr/lib/*/mir/platformgraphics/mesa/*1usr/lib/*/mir/server-platform-1/platform-graphics-mesa.so
22
=== modified file 'debian/rules'
--- debian/rules 2014-08-15 08:04:46 +0000
+++ debian/rules 2014-08-29 01:18:58 +0000
@@ -46,14 +46,3 @@
46# TODO: we'll use a symbol file once mir is abi stable46# TODO: we'll use a symbol file once mir is abi stable
47override_dh_makeshlibs:47override_dh_makeshlibs:
48 dh_makeshlibs -V48 dh_makeshlibs -V
49
50override_dh_install:
51 dh_install --fail-missing \
52 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmirplatformgraphics.so \
53 -Xusr/lib/$(DEB_HOST_MULTIARCH)/libmirclientplatform.so
54 sh debian/install_ld_so_conf.sh $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
55
56override_dh_installdeb:
57 sh debian/create_postinst_prerm_scripts.sh \
58 $(DEB_HOST_ARCH) $(DEB_HOST_MULTIARCH)
59 dh_installdeb
6049
=== removed file 'debian/update-alternatives.postinst.in'
--- debian/update-alternatives.postinst.in 2014-02-14 09:20:28 +0000
+++ debian/update-alternatives.postinst.in 1970-01-01 00:00:00 +0000
@@ -1,18 +0,0 @@
1#!/bin/sh
2
3set -e
4
5if [ "$1" = "configure" ];
6then
7 update-alternatives --force --install \
8 /etc/ld.so.conf.d/@DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@.conf \
9 @DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@_conf \
10 /usr/lib/@DEB_HOST_MULTIARCH@/mir/@MIR_PLATFORM_TYPE@/@MIR_PLATFORM@/ld.so.conf \
11 @DPKG_ALTERNATIVES_PRIORITY@
12
13 LDCONFIG_NOTRIGGER=y ldconfig
14fi
15
16#DEBHELPER#
17
18exit 0
190
=== removed file 'debian/update-alternatives.prerm.in'
--- debian/update-alternatives.prerm.in 2014-02-14 09:20:28 +0000
+++ debian/update-alternatives.prerm.in 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1#!/bin/sh
2
3set -e
4
5if [ "$1" = "remove" ];
6then
7 update-alternatives --remove \
8 @DEB_HOST_MULTIARCH@_mir@MIR_PLATFORM_TYPE@_conf \
9 /usr/lib/@DEB_HOST_MULTIARCH@/mir/@MIR_PLATFORM_TYPE@/@MIR_PLATFORM@/ld.so.conf
10
11 ldconfig
12fi
13
14#DEBHELPER#
15
16exit 0
170
=== modified file 'include/platform/mir/graphics/platform.h'
--- include/platform/mir/graphics/platform.h 2014-07-02 06:29:24 +0000
+++ include/platform/mir/graphics/platform.h 2014-08-29 01:18:58 +0000
@@ -126,6 +126,33 @@
126};126};
127127
128/**128/**
129 * A measure of how good this module is at supporting the current device
130 *
131 * \note This is compared as an integer; best + 1 is a valid PlatformPriority that
132 * will be used in preference to a module that reports best.
133 * Platform modules distributed with Mir will never use a priority higher
134 * than best.
135 */
136enum PlatformPriority : uint32_t
137{
138 unsupported = 0, /**< Unable to function at all on this device */
139 supported = 128, /**< Capable of providing a functioning Platform on this device,
140 * possibly with degraded performance or features.
141 */
142 best = 256 /**< Capable of providing a Platform with the best features and
143 * performance this device is capable of.
144 */
145};
146
147/**
148 * Describes a platform module
149 */
150struct ModuleProperties
151{
152 char const* name;
153};
154
155/**
129 * Function prototype used to return a new graphics platform.156 * Function prototype used to return a new graphics platform.
130 *157 *
131 * \param [in] options options to use for this platform158 * \param [in] options options to use for this platform
@@ -148,6 +175,15 @@
148 boost::program_options::options_description& config);175 boost::program_options::options_description& config);
149extern "C" void add_platform_options(176extern "C" void add_platform_options(
150 boost::program_options::options_description& config);177 boost::program_options::options_description& config);
178
179// TODO: We actually need to be more granular here; on a device with more
180// than one graphics system we may need a different platform per GPU,
181// so we should be associating platforms with graphics devices in some way
182extern "C" typedef PlatformPriority(*PlatformProbe)();
183extern "C" PlatformPriority probe_platform();
184
185extern "C" typedef ModuleProperties const*(*DescribeModule)();
186extern "C" ModuleProperties const* describe_module();
151}187}
152}188}
153189
154190
=== modified file 'include/platform/mir/options/configuration.h'
--- include/platform/mir/options/configuration.h 2014-08-05 14:19:29 +0000
+++ include/platform/mir/options/configuration.h 2014-08-29 01:18:58 +0000
@@ -39,6 +39,7 @@
39extern char const* const connector_report_opt;39extern char const* const connector_report_opt;
40extern char const* const scene_report_opt;40extern char const* const scene_report_opt;
41extern char const* const input_report_opt;41extern char const* const input_report_opt;
42extern char const* const shared_library_prober_report_opt;
42extern char const* const host_socket_opt;43extern char const* const host_socket_opt;
43extern char const* const frontend_threads_opt;44extern char const* const frontend_threads_opt;
44extern char const* const fatal_abort_opt;45extern char const* const fatal_abort_opt;
@@ -56,6 +57,7 @@
56extern char const* const lttng_opt_value;57extern char const* const lttng_opt_value;
5758
58extern char const* const platform_graphics_lib;59extern char const* const platform_graphics_lib;
60extern char const* const platform_graphics_path;
5961
60class Configuration62class Configuration
61{63{
6264
=== removed file 'include/platform/mir/shared_library_loader.h'
--- include/platform/mir/shared_library_loader.h 2014-03-19 17:57:45 +0000
+++ 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 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2014-08-07 10:27:18 +0000
+++ include/server/mir/default_server_configuration.h 2014-08-29 01:18:58 +0000
@@ -35,6 +35,7 @@
35namespace mir35namespace mir
36{36{
37class ServerActionQueue;37class ServerActionQueue;
38class SharedLibraryProberReport;
3839
39namespace compositor40namespace compositor
40{41{
@@ -307,6 +308,7 @@
307308
308 virtual std::shared_ptr<time::Clock> the_clock();309 virtual std::shared_ptr<time::Clock> the_clock();
309 virtual std::shared_ptr<ServerActionQueue> the_server_action_queue();310 virtual std::shared_ptr<ServerActionQueue> the_server_action_queue();
311 virtual std::shared_ptr<SharedLibraryProberReport> the_shared_library_prober_report();
310312
311protected:313protected:
312 std::shared_ptr<options::Option> the_options() const;314 std::shared_ptr<options::Option> the_options() const;
@@ -407,6 +409,7 @@
407 CachedPtr<scene::SessionCoordinator> session_coordinator;409 CachedPtr<scene::SessionCoordinator> session_coordinator;
408 CachedPtr<EmergencyCleanup> emergency_cleanup;410 CachedPtr<EmergencyCleanup> emergency_cleanup;
409 CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener;411 CachedPtr<shell::HostLifecycleEventListener> host_lifecycle_event_listener;
412 CachedPtr<SharedLibraryProberReport> shared_library_prober_report;
410413
411private:414private:
412 std::shared_ptr<options::Configuration> const configuration_options;415 std::shared_ptr<options::Configuration> const configuration_options;
413416
=== added file 'include/shared/mir/logging/null_shared_library_prober_report.h'
--- include/shared/mir/logging/null_shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir/logging/null_shared_library_prober_report.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 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_LOGGING_NULL_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_LOGGING_NULL_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include "mir/shared_library_prober_report.h"
23
24namespace mir
25{
26namespace logging
27{
28
29class NullSharedLibraryProberReport : public mir::SharedLibraryProberReport
30{
31public:
32 void probing_path(boost::filesystem::path const& /*path*/) override
33 {
34 }
35 void probing_failed(boost::filesystem::path const& /*path*/, std::exception const& /*error*/) override
36 {
37 }
38 void loading_library(boost::filesystem::path const& /*filename*/) override
39 {
40 }
41 void loading_failed(boost::filesystem::path const& /*filename*/, std::exception const& /*error*/) override
42 {
43 }
44};
45
46}
47}
48
49#endif /* MIR_LOGGING_NULL_SHARED_LIBRARY_PROBER_REPORT_H_ */
050
=== added file 'include/shared/mir/logging/shared_library_prober_report.h'
--- include/shared/mir/logging/shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir/logging/shared_library_prober_report.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 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_LOGGING_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_LOGGING_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include "mir/shared_library_prober_report.h"
23#include <memory>
24
25namespace mir
26{
27namespace logging
28{
29class Logger;
30
31class SharedLibraryProberReport : public mir::SharedLibraryProberReport
32{
33public:
34 SharedLibraryProberReport(std::shared_ptr<Logger> const& logger);
35
36 void probing_path(boost::filesystem::path const& path) override;
37 void probing_failed(boost::filesystem::path const& path, std::exception const& error) override;
38 void loading_library(boost::filesystem::path const& filename) override;
39 void loading_failed(boost::filesystem::path const& filename, std::exception const& error) override;
40
41private:
42 std::shared_ptr<Logger> const logger;
43};
44
45}
46}
47
48#endif /* MIR_LOGGING_SHARED_LIBRARY_PROBER_REPORT_H_ */
049
=== added file 'include/shared/mir/shared_library_prober.h'
--- include/shared/mir/shared_library_prober.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir/shared_library_prober.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,36 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU 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_SHARED_LIBRARY_PROBER_H_
20#define MIR_SHARED_LIBRARY_PROBER_H_
21
22#include "shared_library_prober_report.h"
23
24#include <string>
25#include <vector>
26#include <memory>
27
28namespace mir
29{
30class SharedLibrary;
31
32std::vector<std::shared_ptr<SharedLibrary>> libraries_for_path(std::string const& path, SharedLibraryProberReport& report);
33}
34
35
36#endif /* MIR_SHARED_LIBRARY_PROBER_H_ */
037
=== added file 'include/shared/mir/shared_library_prober_report.h'
--- include/shared/mir/shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir/shared_library_prober_report.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,44 @@
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_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include <boost/filesystem.hpp>
23
24namespace mir
25{
26class SharedLibraryProberReport
27{
28public:
29 virtual ~SharedLibraryProberReport() = default;
30
31 virtual void probing_path(boost::filesystem::path const& path) = 0;
32 virtual void probing_failed(boost::filesystem::path const& path, std::exception const& error) = 0;
33 virtual void loading_library(boost::filesystem::path const& filename) = 0;
34 virtual void loading_failed(boost::filesystem::path const& filename, std::exception const& error) = 0;
35
36protected:
37 SharedLibraryProberReport() = default;
38 SharedLibraryProberReport(SharedLibraryProberReport const&) = delete;
39 SharedLibraryProberReport& operator=(SharedLibraryProberReport const&) = delete;
40};
41}
42
43
44#endif /* MIR_SHARED_LIBRARY_PROBER_REPORT_H_ */
045
=== modified file 'include/shared/mir_toolkit/mesa/native_display.h'
--- include/shared/mir_toolkit/mesa/native_display.h 2013-08-28 03:41:48 +0000
+++ include/shared/mir_toolkit/mesa/native_display.h 2014-08-29 01:18:58 +0000
@@ -39,7 +39,7 @@
39struct MirMesaEGLNativeDisplay39struct MirMesaEGLNativeDisplay
40{40{
41 int (*display_get_platform)(MirMesaEGLNativeDisplay* display,41 int (*display_get_platform)(MirMesaEGLNativeDisplay* display,
42 MirPlatformPackage* package);42 MirPlatformPackage* package);
43 void *context;43 void *context;
44};44};
4545
@@ -47,9 +47,9 @@
47{47{
48 int (*surface_set_swapinterval)(MirMesaEGLNativeSurface* surface, int interval);48 int (*surface_set_swapinterval)(MirMesaEGLNativeSurface* surface, int interval);
49 int (*surface_advance_buffer)(MirMesaEGLNativeSurface* surface,49 int (*surface_advance_buffer)(MirMesaEGLNativeSurface* surface,
50 MirBufferPackage* buffer_package);50 MirBufferPackage* buffer_package);
51 int (*surface_get_parameters)(MirMesaEGLNativeSurface* surface,51 int (*surface_get_parameters)(MirMesaEGLNativeSurface* surface,
52 MirSurfaceParameters* surface_parameters);52 MirSurfaceParameters* surface_parameters);
53};53};
5454
55typedef int (*MirMesaEGLNativeDisplayIsValidFunc)(MirMesaEGLNativeDisplay* display);55typedef int (*MirMesaEGLNativeDisplayIsValidFunc)(MirMesaEGLNativeDisplay* display);
5656
=== modified file 'include/test/mir_test_doubles/mock_android_alloc_device.h'
--- include/test/mir_test_doubles/mock_android_alloc_device.h 2013-06-18 08:00:49 +0000
+++ include/test/mir_test_doubles/mock_android_alloc_device.h 2014-08-29 01:18:58 +0000
@@ -19,7 +19,12 @@
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
23#pragma GCC diagnostic push
24#pragma GCC diagnostic ignored "-Wpedantic"
25#pragma GCC diagnostic ignored "-Wunused-parameter"
22#include <hardware/gralloc.h>26#include <hardware/gralloc.h>
27#pragma GCC diagnostic pop
2328
24namespace mir29namespace mir
25{30{
2631
=== modified file 'include/test/mir_test_doubles/mock_android_hw.h'
--- include/test/mir_test_doubles/mock_android_hw.h 2013-05-20 15:55:48 +0000
+++ include/test/mir_test_doubles/mock_android_hw.h 2014-08-29 01:18:58 +0000
@@ -21,7 +21,12 @@
21#include "mir_test_doubles/mock_android_alloc_device.h"21#include "mir_test_doubles/mock_android_alloc_device.h"
22#include "mir_test_doubles/mock_hwc_composer_device_1.h"22#include "mir_test_doubles/mock_hwc_composer_device_1.h"
2323
24#pragma GCC diagnostic push
25#pragma GCC diagnostic ignored "-Wpedantic"
26#pragma GCC diagnostic ignored "-Wunused-parameter"
24#include <hardware/hardware.h>27#include <hardware/hardware.h>
28#pragma GCC diagnostic pop
29
25#include <gmock/gmock.h>30#include <gmock/gmock.h>
26#include <memory>31#include <memory>
2732
2833
=== modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h'
--- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-03-26 05:48:59 +0000
+++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2014-08-29 01:18:58 +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 'include/test/mir_test_framework/client_platform_factory.h'
--- include/test/mir_test_framework/client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_framework/client_platform_factory.h 2014-08-29 01:18:58 +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-platform-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-platform-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
=== modified file 'include/test/mir_test_framework/executable_path.h'
--- include/test/mir_test_framework/executable_path.h 2014-07-29 12:28:04 +0000
+++ include/test/mir_test_framework/executable_path.h 2014-08-29 01:18:58 +0000
@@ -24,5 +24,7 @@
24namespace mir_test_framework24namespace mir_test_framework
25{25{
26std::string executable_path();26std::string executable_path();
27
28std::string library_path();
27}29}
28#endif /* MIR_TEST_FRAMEWORK_EXECUTABLE_PATH_H_ */30#endif /* MIR_TEST_FRAMEWORK_EXECUTABLE_PATH_H_ */
2931
=== added file 'include/test/mir_test_framework/stub_client_platform_factory.h'
--- include/test/mir_test_framework/stub_client_platform_factory.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_framework/stub_client_platform_factory.h 2014-08-29 01:18:58 +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
=== modified file 'platform-ABI-sha1sums'
--- platform-ABI-sha1sums 2014-08-26 20:03:10 +0000
+++ platform-ABI-sha1sums 2014-08-29 01:18:58 +0000
@@ -33,15 +33,14 @@
33590572a9d86a9481b4531ad44414c6f76352fe7a include/platform/mir/graphics/nested_context.h33590572a9d86a9481b4531ad44414c6f76352fe7a include/platform/mir/graphics/nested_context.h
3427807b8ba288590f3749cfb32512eda4d0de6c7d include/platform/mir/graphics/overlapping_output_grouping.h3427807b8ba288590f3749cfb32512eda4d0de6c7d include/platform/mir/graphics/overlapping_output_grouping.h
3532c70ee44b8dc9372dec0c54471aa8d831adcb1c include/platform/mir/graphics/pixel_format_utils.h3532c70ee44b8dc9372dec0c54471aa8d831adcb1c include/platform/mir/graphics/pixel_format_utils.h
36656a7e1ae3b246930431a6174526fbdc2c76649e include/platform/mir/graphics/platform.h36e317f93ccaf160d507908b92a91745e61e550793 include/platform/mir/graphics/platform.h
379c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h379c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
3815f201741a465de33e55ffc1ea775b507a5be950 include/platform/mir/graphics/renderable.h3815f201741a465de33e55ffc1ea775b507a5be950 include/platform/mir/graphics/renderable.h
394b640ec72b04cc2de7671afd7c78942fb9e775a7 include/platform/mir/graphics/tessellation_helpers.h394b640ec72b04cc2de7671afd7c78942fb9e775a7 include/platform/mir/graphics/tessellation_helpers.h
408f172d1449f9aa7bbcb1eebb463b0cab4cab38fe include/platform/mir/options/configuration.h40d84a16fe115bdc37b2177aa1dbf078da78ba08ac include/platform/mir/options/configuration.h
413a961c5e85b0b9d20eadddd938677776288c06c6 include/platform/mir/options/default_configuration.h413a961c5e85b0b9d20eadddd938677776288c06c6 include/platform/mir/options/default_configuration.h
42b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h42b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
431133726e66a246bd3988616e205e186278a64731 include/platform/mir/options/program_option.h431133726e66a246bd3988616e205e186278a64731 include/platform/mir/options/program_option.h
445d0213652adc4821a2a180ced74808ca0bbf2c45 include/platform/mir/shared_library_loader.h
456ad1f35928df9ffd917fbf17cbcdd533a8b5b27d include/shared/mir/basic_observers.h446ad1f35928df9ffd917fbf17cbcdd533a8b5b27d include/shared/mir/basic_observers.h
463329ada91412ded2f127aee9a92f065e57b81cb2 include/shared/mir/cached_ptr.h453329ada91412ded2f127aee9a92f065e57b81cb2 include/shared/mir/cached_ptr.h
47691278e8b89265fa7f11db78dc8a9b530cef6e99 include/shared/mir/default_configuration.h46691278e8b89265fa7f11db78dc8a9b530cef6e99 include/shared/mir/default_configuration.h
@@ -72,18 +71,22 @@
722319b60bf87801a93af636d3bbfbae420f6776a4 include/shared/mir/logging/dumb_console_logger.h712319b60bf87801a93af636d3bbfbae420f6776a4 include/shared/mir/logging/dumb_console_logger.h
7352cb642982f7f4fa623cf041b11eca126a3df0f4 include/shared/mir/logging/input_timestamp.h7252cb642982f7f4fa623cf041b11eca126a3df0f4 include/shared/mir/logging/input_timestamp.h
7472e20902d70588af73bea7a524337264b853bf0a include/shared/mir/logging/logger.h7372e20902d70588af73bea7a524337264b853bf0a include/shared/mir/logging/logger.h
742697f3edce3b3120983b402d383bbdead10f5487 include/shared/mir/logging/null_shared_library_prober_report.h
75e9e5f22fe9deb8965946be0f85ea3d255baca740 include/shared/mir/logging/shared_library_prober_report.h
75f199066a30882b22be901de0c4e6aa62e320e593 include/shared/mir/protobuf/google_protobuf_guard.h76f199066a30882b22be901de0c4e6aa62e320e593 include/shared/mir/protobuf/google_protobuf_guard.h
764b4b8d7ae1cd870aeec6399afd6dbd56205c80b2 include/shared/mir/raii.h774b4b8d7ae1cd870aeec6399afd6dbd56205c80b2 include/shared/mir/raii.h
77bb27ec04b2861d128f420698491941f71e1aefc0 include/shared/mir/recursive_read_write_mutex.h78bb27ec04b2861d128f420698491941f71e1aefc0 include/shared/mir/recursive_read_write_mutex.h
78903210453b98267e47c03ab2920c1db047ba0457 include/shared/mir/report/lttng/mir_tracepoint.h79903210453b98267e47c03ab2920c1db047ba0457 include/shared/mir/report/lttng/mir_tracepoint.h
7952b6b60543a361e91dbeaa2549114239f57b6b4e include/shared/mir/report/lttng/tracepoint_provider.h8052b6b60543a361e91dbeaa2549114239f57b6b4e include/shared/mir/report/lttng/tracepoint_provider.h
80dc80f8a57f133276dd5a72f4d0360a7b71154d16 include/shared/mir/shared_library.h81dc80f8a57f133276dd5a72f4d0360a7b71154d16 include/shared/mir/shared_library.h
824d80544bf59ef452979b934d664ac592aff58c82 include/shared/mir/shared_library_prober.h
8353e4159f2a0b564cb39a7785b4e229f6f7424779 include/shared/mir/shared_library_prober_report.h
81b4e96264b9a57a1f2ceceb700c5379658905ded7 include/shared/mir/thread_name.h84b4e96264b9a57a1f2ceceb700c5379658905ded7 include/shared/mir/thread_name.h
829907751d046e4aea81881cf19e5df52c7a6a813e include/shared/mir_toolkit/client_types.h859907751d046e4aea81881cf19e5df52c7a6a813e include/shared/mir_toolkit/client_types.h
83183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h86183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h
84fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h87fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h
85bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h88bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h
8699ef5f3bf548508fae24c60f74be1dea018a6e8c include/shared/mir_toolkit/mesa/native_display.h894975998aa1056ed0d39dcc538127453e516ad8e9 include/shared/mir_toolkit/mesa/native_display.h
87101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h90101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h
889f646fa12eaca5fc3b7a8fde6208673c071c8ef3 include/shared/mir/udev/wrapper.h919f646fa12eaca5fc3b7a8fde6208673c071c8ef3 include/shared/mir/udev/wrapper.h
899fd77ab693cc4c9a200e44804f5493733528a674 include/shared/mir/variable_length_array.h929fd77ab693cc4c9a200e44804f5493733528a674 include/shared/mir/variable_length_array.h
9093
=== modified file 'server-ABI-sha1sums'
--- server-ABI-sha1sums 2014-08-26 20:03:10 +0000
+++ server-ABI-sha1sums 2014-08-29 01:18:58 +0000
@@ -33,15 +33,14 @@
33590572a9d86a9481b4531ad44414c6f76352fe7a include/platform/mir/graphics/nested_context.h33590572a9d86a9481b4531ad44414c6f76352fe7a include/platform/mir/graphics/nested_context.h
3427807b8ba288590f3749cfb32512eda4d0de6c7d include/platform/mir/graphics/overlapping_output_grouping.h3427807b8ba288590f3749cfb32512eda4d0de6c7d include/platform/mir/graphics/overlapping_output_grouping.h
3532c70ee44b8dc9372dec0c54471aa8d831adcb1c include/platform/mir/graphics/pixel_format_utils.h3532c70ee44b8dc9372dec0c54471aa8d831adcb1c include/platform/mir/graphics/pixel_format_utils.h
36656a7e1ae3b246930431a6174526fbdc2c76649e include/platform/mir/graphics/platform.h36e317f93ccaf160d507908b92a91745e61e550793 include/platform/mir/graphics/platform.h
379c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h379c7712af84b6fde1970ff802ad2ea78f892c7b7e include/platform/mir/graphics/platform_ipc_package.h
3815f201741a465de33e55ffc1ea775b507a5be950 include/platform/mir/graphics/renderable.h3815f201741a465de33e55ffc1ea775b507a5be950 include/platform/mir/graphics/renderable.h
394b640ec72b04cc2de7671afd7c78942fb9e775a7 include/platform/mir/graphics/tessellation_helpers.h394b640ec72b04cc2de7671afd7c78942fb9e775a7 include/platform/mir/graphics/tessellation_helpers.h
408f172d1449f9aa7bbcb1eebb463b0cab4cab38fe include/platform/mir/options/configuration.h40d84a16fe115bdc37b2177aa1dbf078da78ba08ac include/platform/mir/options/configuration.h
413a961c5e85b0b9d20eadddd938677776288c06c6 include/platform/mir/options/default_configuration.h413a961c5e85b0b9d20eadddd938677776288c06c6 include/platform/mir/options/default_configuration.h
42b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h42b45f14082c4f8b29efaa1b13de795dcb29deb738 include/platform/mir/options/option.h
431133726e66a246bd3988616e205e186278a64731 include/platform/mir/options/program_option.h431133726e66a246bd3988616e205e186278a64731 include/platform/mir/options/program_option.h
445d0213652adc4821a2a180ced74808ca0bbf2c45 include/platform/mir/shared_library_loader.h
45505444aeb61d0f55893a7ba0998b25c2041f76c4 include/server/mir/asio_main_loop.h44505444aeb61d0f55893a7ba0998b25c2041f76c4 include/server/mir/asio_main_loop.h
46a4c8f0b0c30784ea6930a8ee6651f1d6efa47231 include/server/mir/compositor/buffer_stream.h45a4c8f0b0c30784ea6930a8ee6651f1d6efa47231 include/server/mir/compositor/buffer_stream.h
47f4030e400baf8baa9c38e7c6ec6b4a5ad7134aeb include/server/mir/compositor/compositor.h46f4030e400baf8baa9c38e7c6ec6b4a5ad7134aeb include/server/mir/compositor/compositor.h
@@ -58,7 +57,7 @@
5851391bd29f7499f8cbb89e4ba33acf2b72d93592 include/server/mir/compositor/renderer.h5751391bd29f7499f8cbb89e4ba33acf2b72d93592 include/server/mir/compositor/renderer.h
59686a839fd0cd5fa469344dc49190ff9d578efc25 include/server/mir/compositor/scene_element.h58686a839fd0cd5fa469344dc49190ff9d578efc25 include/server/mir/compositor/scene_element.h
604fcf34e424128b87ddc76733594e32e09ebbd486 include/server/mir/compositor/scene.h594fcf34e424128b87ddc76733594e32e09ebbd486 include/server/mir/compositor/scene.h
61f102d38fd8afd63b636d76005f9b80f3adda0858 include/server/mir/default_server_configuration.h60d69ff1401221ffa9adce7f8d85074a6f8b234baf include/server/mir/default_server_configuration.h
62bbb15c910dbc8d7c9a4cc982890486b7e16197e4 include/server/mir/default_server_status_listener.h61bbb15c910dbc8d7c9a4cc982890486b7e16197e4 include/server/mir/default_server_status_listener.h
63215f6cf88826381cd3ec37a6d2179a70093c0bc5 include/server/mir/display_changer.h62215f6cf88826381cd3ec37a6d2179a70093c0bc5 include/server/mir/display_changer.h
64af1ff0714be973ac76d56006a2e5991f68cd1dec include/server/mir/display_server.h63af1ff0714be973ac76d56006a2e5991f68cd1dec include/server/mir/display_server.h
@@ -181,18 +180,22 @@
1812319b60bf87801a93af636d3bbfbae420f6776a4 include/shared/mir/logging/dumb_console_logger.h1802319b60bf87801a93af636d3bbfbae420f6776a4 include/shared/mir/logging/dumb_console_logger.h
18252cb642982f7f4fa623cf041b11eca126a3df0f4 include/shared/mir/logging/input_timestamp.h18152cb642982f7f4fa623cf041b11eca126a3df0f4 include/shared/mir/logging/input_timestamp.h
18372e20902d70588af73bea7a524337264b853bf0a include/shared/mir/logging/logger.h18272e20902d70588af73bea7a524337264b853bf0a include/shared/mir/logging/logger.h
1832697f3edce3b3120983b402d383bbdead10f5487 include/shared/mir/logging/null_shared_library_prober_report.h
184e9e5f22fe9deb8965946be0f85ea3d255baca740 include/shared/mir/logging/shared_library_prober_report.h
184f199066a30882b22be901de0c4e6aa62e320e593 include/shared/mir/protobuf/google_protobuf_guard.h185f199066a30882b22be901de0c4e6aa62e320e593 include/shared/mir/protobuf/google_protobuf_guard.h
1854b4b8d7ae1cd870aeec6399afd6dbd56205c80b2 include/shared/mir/raii.h1864b4b8d7ae1cd870aeec6399afd6dbd56205c80b2 include/shared/mir/raii.h
186bb27ec04b2861d128f420698491941f71e1aefc0 include/shared/mir/recursive_read_write_mutex.h187bb27ec04b2861d128f420698491941f71e1aefc0 include/shared/mir/recursive_read_write_mutex.h
187903210453b98267e47c03ab2920c1db047ba0457 include/shared/mir/report/lttng/mir_tracepoint.h188903210453b98267e47c03ab2920c1db047ba0457 include/shared/mir/report/lttng/mir_tracepoint.h
18852b6b60543a361e91dbeaa2549114239f57b6b4e include/shared/mir/report/lttng/tracepoint_provider.h18952b6b60543a361e91dbeaa2549114239f57b6b4e include/shared/mir/report/lttng/tracepoint_provider.h
189dc80f8a57f133276dd5a72f4d0360a7b71154d16 include/shared/mir/shared_library.h190dc80f8a57f133276dd5a72f4d0360a7b71154d16 include/shared/mir/shared_library.h
1914d80544bf59ef452979b934d664ac592aff58c82 include/shared/mir/shared_library_prober.h
19253e4159f2a0b564cb39a7785b4e229f6f7424779 include/shared/mir/shared_library_prober_report.h
190b4e96264b9a57a1f2ceceb700c5379658905ded7 include/shared/mir/thread_name.h193b4e96264b9a57a1f2ceceb700c5379658905ded7 include/shared/mir/thread_name.h
1919907751d046e4aea81881cf19e5df52c7a6a813e include/shared/mir_toolkit/client_types.h1949907751d046e4aea81881cf19e5df52c7a6a813e include/shared/mir_toolkit/client_types.h
192183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h195183d9e5e6cfe48b3d9145a28541dd4202ff6137b include/shared/mir_toolkit/common.h
193fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h196fce4c1a9e0d037244f7e9e96ea2d8eaab4fc404c include/shared/mir_toolkit/cursors.h
194bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h197bdaceadd56e41d2cb708f7c4da97acf84dfc75b7 include/shared/mir_toolkit/event.h
19599ef5f3bf548508fae24c60f74be1dea018a6e8c include/shared/mir_toolkit/mesa/native_display.h1984975998aa1056ed0d39dcc538127453e516ad8e9 include/shared/mir_toolkit/mesa/native_display.h
196101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h199101017c17714a57db57d79b7b5e7df40a3568236 include/shared/mir_toolkit/mir_native_buffer.h
1979f646fa12eaca5fc3b7a8fde6208673c071c8ef3 include/shared/mir/udev/wrapper.h2009f646fa12eaca5fc3b7a8fde6208673c071c8ef3 include/shared/mir/udev/wrapper.h
1989fd77ab693cc4c9a200e44804f5493733528a674 include/shared/mir/variable_length_array.h2019fd77ab693cc4c9a200e44804f5493733528a674 include/shared/mir/variable_length_array.h
199202
=== modified file 'src/client/CMakeLists.txt'
--- src/client/CMakeLists.txt 2014-08-25 03:11:01 +0000
+++ src/client/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -16,6 +16,16 @@
16 ${DRM_INCLUDE_DIRS}16 ${DRM_INCLUDE_DIRS}
17)17)
1818
19set(MIRCLIENT_ABI 8)
20set(MIRCLIENT_PLATFORM_ABI 1)
21set(symbol_map ${CMAKE_SOURCE_DIR}/src/client/symbols.map)
22
23set(MIR_CLIENT_PLATFORM_PATH
24 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/mir/client-platform-${MIRCLIENT_PLATFORM_ABI}
25)
26
27add_definitions(-DMIR_CLIENT_PLATFORM_PATH="${MIR_CLIENT_PLATFORM_PATH}/")
28
19add_subdirectory(rpc/)29add_subdirectory(rpc/)
20add_subdirectory(lttng/)30add_subdirectory(lttng/)
2131
@@ -54,6 +64,7 @@
54 mir_prompt_session.cpp64 mir_prompt_session.cpp
55 mir_prompt_session_api.cpp65 mir_prompt_session_api.cpp
56 mir_event_distributor.cpp66 mir_event_distributor.cpp
67 probing_client_platform_factory.cpp
57)68)
5869
59add_library(70add_library(
@@ -62,9 +73,6 @@
62 $<TARGET_OBJECTS:mirclientobjects>73 $<TARGET_OBJECTS:mirclientobjects>
63)74)
6475
65set(MIRCLIENT_ABI 8)
66set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
67
68set_target_properties(76set_target_properties(
69 mirclient77 mirclient
7078
@@ -73,8 +81,9 @@
73 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"81 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
74)82)
7583
76set(84target_link_libraries(
77 MIR_CLIENT_LIBRARIES85 mirclient
86
78 mirclientrpc87 mirclientrpc
79 mirclientlttngstatic88 mirclientlttngstatic
80 mircommon89 mircommon
@@ -84,12 +93,6 @@
84 ${XKBCOMMON_LIBRARIES}93 ${XKBCOMMON_LIBRARIES}
85)94)
8695
87target_link_libraries(
88 mirclient
89
90 ${MIR_CLIENT_LIBRARIES}
91)
92
93install(96install(
94 TARGETS mirclient97 TARGETS mirclient
95 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}98 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
9699
=== modified file 'src/client/android/CMakeLists.txt'
--- src/client/android/CMakeLists.txt 2014-08-26 09:27:49 +0000
+++ src/client/android/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -15,17 +15,17 @@
15)15)
1616
17add_library(17add_library(
18 mirclientplatformandroid SHARED18 mirclientplatformandroid MODULE
19 19
20 $<TARGET_OBJECTS:mirclientplatformandroidobjects>20 $<TARGET_OBJECTS:mirclientplatformandroidobjects>
21 $<TARGET_OBJECTS:mirclient_platformimpl>21 $<TARGET_OBJECTS:mirclient_platformimpl>
22)22)
2323
24set_target_properties(24set_target_properties(
25 mirclientplatformandroid PROPERTIES25 mirclientplatformandroid PROPERTIES
26 OUTPUT_NAME mirclientplatform26 OUTPUT_NAME client-platform-android
27 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android27 PREFIX ""
28 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"28 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
29)29)
3030
31target_link_libraries(31target_link_libraries(
@@ -35,20 +35,4 @@
35 ${LIBHARDWARE_LIBRARIES}35 ${LIBHARDWARE_LIBRARIES}
36)36)
3737
38install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/android)38install(TARGETS mirclientplatformandroid LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
39
40if (MIR_TEST_PLATFORM STREQUAL "android")
41 add_custom_command(TARGET mirclientplatformandroid
42 POST_BUILD
43 COMMAND ${CMAKE_COMMAND} -E remove libmirclientplatform.so
44 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirclientplatformandroid> libmirclientplatform.so
45 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
46 )
47
48 install(CODE
49 "execute_process(
50 COMMAND ln -sf mir/clientplatform/android/libmirclientplatform.so
51 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
52 )"
53 )
54endif()
5539
=== modified file 'src/client/android/android_native_display_container.cpp'
--- src/client/android/android_native_display_container.cpp 2014-07-17 13:56:20 +0000
+++ src/client/android/android_native_display_container.cpp 2014-08-29 01:18:58 +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-08-29 01:18:58 +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-08-29 01:18:58 +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-08-29 01:18:58 +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-08-25 03:11:01 +0000
+++ src/client/android/symbols.map 2014-08-29 01:18:58 +0000
@@ -1,5 +1,6 @@
1MIR_CLIENTPLATFORM_1 {1MIR_CLIENTPLATFORM_1 {
2 global: 2 global:
3 create_client_platform_factory;3 create_client_platform;
4 is_appropriate_module;
4 local: *;5 local: *;
5};6};
6\ No newline at end of file7\ No newline at end of file
78
=== 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-08-29 01:18:58 +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/default_connection_configuration.cpp'
--- src/client/default_connection_configuration.cpp 2014-08-26 13:38:23 +0000
+++ src/client/default_connection_configuration.cpp 2014-08-29 01:18:58 +0000
@@ -26,13 +26,18 @@
26#include "mir/input/null_input_receiver_report.h"26#include "mir/input/null_input_receiver_report.h"
27#include "logging/rpc_report.h"27#include "logging/rpc_report.h"
28#include "logging/input_receiver_report.h"28#include "logging/input_receiver_report.h"
29#include "mir/logging/shared_library_prober_report.h"
30#include "mir/logging/null_shared_library_prober_report.h"
29#include "lttng/rpc_report.h"31#include "lttng/rpc_report.h"
30#include "lttng/input_receiver_report.h"32#include "lttng/input_receiver_report.h"
33#include "lttng/shared_library_prober_report.h"
31#include "connection_surface_map.h"34#include "connection_surface_map.h"
32#include "lifecycle_control.h"35#include "lifecycle_control.h"
33#include "mir/shared_library.h"36#include "mir/shared_library.h"
34#include "client_platform_factory.h"37#include "client_platform_factory.h"
38#include "probing_client_platform_factory.h"
35#include "mir_event_distributor.h"39#include "mir_event_distributor.h"
40#include "mir/shared_library_prober.h"
3641
37namespace mcl = mir::client;42namespace mcl = mir::client;
3843
@@ -41,7 +46,14 @@
41std::string const off_opt_val{"off"};46std::string const off_opt_val{"off"};
42std::string const log_opt_val{"log"};47std::string const log_opt_val{"log"};
43std::string const lttng_opt_val{"lttng"};48std::string const lttng_opt_val{"lttng"};
49<<<<<<< TREE
44std::string const default_platform_lib{"libmirclientplatform.so"};50std::string const default_platform_lib{"libmirclientplatform.so"};
51=======
52
53// Shove this here until we properly manage the lifetime of our
54// loadable modules
55std::shared_ptr<mcl::ProbingClientPlatformFactory> the_platform_prober;
56>>>>>>> MERGE-SOURCE
45}57}
4658
47mcl::DefaultConnectionConfiguration::DefaultConnectionConfiguration(59mcl::DefaultConnectionConfiguration::DefaultConnectionConfiguration(
@@ -86,11 +98,30 @@
86 return client_platform_factory(98 return client_platform_factory(
87 [this]99 [this]
88 {100 {
101<<<<<<< TREE
89 auto const create_client_platform_factory =102 auto const create_client_platform_factory =
90 the_platform_library()->load_function<mcl::CreateClientPlatformFactory>(103 the_platform_library()->load_function<mcl::CreateClientPlatformFactory>(
91 "create_client_platform_factory");104 "create_client_platform_factory");
92105
93 return create_client_platform_factory();106 return create_client_platform_factory();
107=======
108 auto const platform_override = getenv("MIR_CLIENT_PLATFORM_LIB");
109 std::vector<std::shared_ptr<mir::SharedLibrary>> platform_plugins;
110 if (platform_override)
111 {
112 platform_plugins.push_back(std::make_shared<mir::SharedLibrary>(platform_override));
113 }
114 else
115 {
116 auto const platform_path_override = getenv("MIR_CLIENT_PLATFORM_PATH");
117 auto const platform_path = platform_path_override ? platform_path_override : MIR_CLIENT_PLATFORM_PATH;
118 platform_plugins = mir::libraries_for_path(platform_path, *the_shared_library_prober_report());
119 }
120
121 the_platform_prober = std::make_shared<mcl::ProbingClientPlatformFactory>(platform_plugins);
122
123 return the_platform_prober;
124>>>>>>> MERGE-SOURCE
94 });125 });
95}126}
96127
@@ -181,6 +212,7 @@
181 return std::make_shared<MirEventDistributor>();212 return std::make_shared<MirEventDistributor>();
182 });213 });
183}214}
215<<<<<<< TREE
184216
185std::shared_ptr<mir::SharedLibrary> mcl::DefaultConnectionConfiguration::the_platform_library()217std::shared_ptr<mir::SharedLibrary> mcl::DefaultConnectionConfiguration::the_platform_library()
186{218{
@@ -193,3 +225,22 @@
193225
194 return platform_library;226 return platform_library;
195}227}
228=======
229
230std::shared_ptr<mir::SharedLibraryProberReport> mir::client::DefaultConnectionConfiguration::the_shared_library_prober_report()
231{
232 return shared_library_prober_report(
233 [this] () -> std::shared_ptr<mir::SharedLibraryProberReport>
234 {
235 auto val_raw = getenv("MIR_CLIENT_SHARED_LIBRARY_PROBER_REPORT");
236 std::string const val{val_raw ? val_raw : off_opt_val};
237
238 if (val == log_opt_val)
239 return std::make_shared<mir::logging::SharedLibraryProberReport>(the_logger());
240 else if (val == lttng_opt_val)
241 return std::make_shared<mcl::lttng::SharedLibraryProberReport>();
242 else
243 return std::make_shared<mir::logging::NullSharedLibraryProberReport>();
244 });
245}
246>>>>>>> MERGE-SOURCE
196247
=== modified file 'src/client/default_connection_configuration.h'
--- src/client/default_connection_configuration.h 2014-08-26 13:38:23 +0000
+++ src/client/default_connection_configuration.h 2014-08-29 01:18:58 +0000
@@ -27,6 +27,8 @@
2727
28namespace mir28namespace mir
29{29{
30class SharedLibraryProberReport;
31
30namespace input32namespace input
31{33{
32namespace receiver34namespace receiver
@@ -57,7 +59,11 @@
57 std::shared_ptr<LifecycleControl> the_lifecycle_control();59 std::shared_ptr<LifecycleControl> the_lifecycle_control();
58 std::shared_ptr<EventSink> the_event_sink();60 std::shared_ptr<EventSink> the_event_sink();
59 std::shared_ptr<EventHandlerRegister> the_event_handler_register();61 std::shared_ptr<EventHandlerRegister> the_event_handler_register();
62<<<<<<< TREE
60 std::shared_ptr<SharedLibrary> the_platform_library() override;63 std::shared_ptr<SharedLibrary> the_platform_library() override;
64=======
65 std::shared_ptr<mir::SharedLibraryProberReport> the_shared_library_prober_report();
66>>>>>>> MERGE-SOURCE
6167
62 virtual std::string the_socket_file();68 virtual std::string the_socket_file();
63 virtual std::shared_ptr<rpc::RpcReport> the_rpc_report();69 virtual std::shared_ptr<rpc::RpcReport> the_rpc_report();
@@ -78,6 +84,7 @@
7884
79 CachedPtr<rpc::RpcReport> rpc_report;85 CachedPtr<rpc::RpcReport> rpc_report;
80 CachedPtr<input::receiver::InputReceiverReport> input_receiver_report;86 CachedPtr<input::receiver::InputReceiverReport> input_receiver_report;
87 CachedPtr<mir::SharedLibraryProberReport> shared_library_prober_report;
8188
82private:89private:
83 std::string const socket_file;90 std::string const socket_file;
8491
=== 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-08-29 01:18:58 +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/lttng/CMakeLists.txt'
--- src/client/lttng/CMakeLists.txt 2014-08-22 02:56:00 +0000
+++ src/client/lttng/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -6,6 +6,7 @@
6 client_tracepoint_provider.cpp6 client_tracepoint_provider.cpp
7 rpc_report.cpp7 rpc_report.cpp
8 input_receiver_report.cpp8 input_receiver_report.cpp
9 shared_library_prober_report.cpp
9)10)
1011
11add_library(mirclientlttng SHARED tracepoints.c)12add_library(mirclientlttng SHARED tracepoints.c)
1213
=== added file 'src/client/lttng/shared_library_prober_report.cpp'
--- src/client/lttng/shared_library_prober_report.cpp 1970-01-01 00:00:00 +0000
+++ src/client/lttng/shared_library_prober_report.cpp 2014-08-29 01:18:58 +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
5 * it under the terms of the GNU Lesser 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 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 "shared_library_prober_report.h"
20#include "mir/report/lttng/mir_tracepoint.h"
21
22#define TRACEPOINT_DEFINE
23#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
24#include "shared_library_prober_report_tp.h"
25
26namespace mcl = mir::client;
27
28void mcl::lttng::SharedLibraryProberReport::probing_path(boost::filesystem::path const& path)
29{
30 mir_tracepoint(mir_client_shared_library_prober, probing_path,
31 path.string().c_str());
32}
33
34void mcl::lttng::SharedLibraryProberReport::probing_failed(boost::filesystem::path const& path, std::exception const& error)
35{
36 mir_tracepoint(mir_client_shared_library_prober, probing_failed,
37 path.string().c_str(), error.what());
38}
39
40void mcl::lttng::SharedLibraryProberReport::loading_library(boost::filesystem::path const& filename)
41{
42 mir_tracepoint(mir_client_shared_library_prober, loading_library,
43 filename.string().c_str());
44}
45
46void mcl::lttng::SharedLibraryProberReport::loading_failed(boost::filesystem::path const& filename, std::exception const& error)
47{
48 mir_tracepoint(mir_client_shared_library_prober, loading_failed,
49 filename.string().c_str(), error.what());
50}
051
=== added file 'src/client/lttng/shared_library_prober_report.h'
--- src/client/lttng/shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ src/client/lttng/shared_library_prober_report.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,55 @@
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 Lesser 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 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_CLIENT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_CLIENT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include "mir/shared_library_prober_report.h"
23#include "client_tracepoint_provider.h"
24
25namespace mir
26{
27namespace client
28{
29namespace lttng
30{
31
32class SharedLibraryProberReport : public mir::SharedLibraryProberReport
33{
34public:
35 void probing_path(boost::filesystem::path const& path) override;
36 void probing_failed(boost::filesystem::path const& path, std::exception const& error) override;
37 void loading_library(boost::filesystem::path const& filename) override;
38 void loading_failed(boost::filesystem::path const& filename, std::exception const& error) override;
39
40private:
41 ClientTracepointProvider tp_provider;
42};
43
44}
45}
46}
47
48#endif /* MIR_CLIENT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_ */
49
50
51#ifndef SHARED_LIBRARY_PROBER_REPORT_H
52#define SHARED_LIBRARY_PROBER_REPORT_H
53
54
55#endif // SHARED_LIBRARY_PROBER_REPORT_H
056
=== added file 'src/client/lttng/shared_library_prober_report_tp.h'
--- src/client/lttng/shared_library_prober_report_tp.h 1970-01-01 00:00:00 +0000
+++ src/client/lttng/shared_library_prober_report_tp.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,85 @@
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 Lesser 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 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#undef TRACEPOINT_PROVIDER
20#define TRACEPOINT_PROVIDER mir_client_shared_library_prober
21
22#undef TRACEPOINT_INCLUDE
23#define TRACEPOINT_INCLUDE "./shared_library_prober_report_tp.h"
24
25#if !defined(MIR_CLIENT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ)
26#define MIR_CLIENT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_
27
28#include <lttng/tracepoint.h>
29#include <stdint.h>
30
31#ifdef __clang__
32/*
33 * TRACEPOINT_EVENT defines functions; since we disable tracepoints under clang
34 * these functions are unused and so generate fatal warnings.
35 * (see mir_tracepoint.h and http://sourceware.org/bugzilla/show_bug.cgi?id=13974)
36 */
37#pragma clang diagnostic push
38#pragma clang diagnostic warning "-Wunused-function"
39#endif
40
41TRACEPOINT_EVENT(
42 mir_client_shared_library_prober,
43 probing_path,
44 TP_ARGS(const char*, path),
45 TP_FIELDS(
46 ctf_string(path, path)
47 )
48)
49
50TRACEPOINT_EVENT(
51 mir_client_shared_library_prober,
52 probing_failed,
53 TP_ARGS(const char*, path, const char*, message),
54 TP_FIELDS(
55 ctf_string(path, path)
56 ctf_string(message, message)
57 )
58)
59
60TRACEPOINT_EVENT(
61 mir_client_shared_library_prober,
62 loading_library,
63 TP_ARGS(const char*, path),
64 TP_FIELDS(
65 ctf_string(path, path)
66 )
67)
68
69TRACEPOINT_EVENT(
70 mir_client_shared_library_prober,
71 loading_failed,
72 TP_ARGS(const char*, path, const char*, message),
73 TP_FIELDS(
74 ctf_string(path, path)
75 ctf_string(message, message)
76 )
77)
78
79#ifdef __clang__
80#pragma clang diagnostic pop
81#endif
82
83#endif /* MIR_CLIENT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_ */
84
85#include <lttng/tracepoint-event.h>
086
=== modified file 'src/client/mesa/CMakeLists.txt'
--- src/client/mesa/CMakeLists.txt 2014-08-26 09:27:49 +0000
+++ src/client/mesa/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -17,7 +17,7 @@
17)17)
1818
19add_library(19add_library(
20 mirclientplatformmesa SHARED20 mirclientplatformmesa MODULE
2121
22 $<TARGET_OBJECTS:mirclientplatformmesaobjects>22 $<TARGET_OBJECTS:mirclientplatformmesaobjects>
23 $<TARGET_OBJECTS:mirclient_platformimpl>23 $<TARGET_OBJECTS:mirclient_platformimpl>
@@ -25,9 +25,9 @@
2525
26set_target_properties(26set_target_properties(
27 mirclientplatformmesa PROPERTIES27 mirclientplatformmesa PROPERTIES
28 OUTPUT_NAME mirclientplatform28 OUTPUT_NAME client-platform-mesa
29 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa29 PREFIX ""
30 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"30 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
31)31)
3232
33target_link_libraries(33target_link_libraries(
@@ -36,21 +36,4 @@
36 ${DRM_LDFLAGS} ${DRM_LIBRARIES}36 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
37)37)
3838
39install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/clientplatform/mesa)39install(TARGETS mirclientplatformmesa LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH})
40
41if (MIR_TEST_PLATFORM STREQUAL "mesa")
42 add_custom_command(TARGET mirclientplatformmesa
43 POST_BUILD
44 COMMAND ${CMAKE_COMMAND} -E remove libmirclientplatform.so
45 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirclientplatformmesa> libmirclientplatform.so
46 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
47 )
48
49 install(CODE
50 "execute_process(
51 COMMAND ln -sf mir/clientplatform/mesa/libmirclientplatform.so
52 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
53 )"
54 )
55endif()
56
5740
=== 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-08-29 01:18:58 +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-08-29 01:18:58 +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{
63 auto buffer_file_ops = std::make_shared<RealBufferFileOps>();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 }
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-08-29 01:18:58 +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-07-17 12:32:21 +0000
+++ src/client/mesa/mesa_native_display_container.cpp 2014-08-29 01:18:58 +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-08-29 01:18:58 +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-08-05 07:09:05 +0000
+++ src/client/mesa/native_surface.cpp 2014-08-29 01:18:58 +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-08-25 03:11:01 +0000
+++ src/client/mesa/symbols.map 2014-08-29 01:18:58 +0000
@@ -1,7 +1,9 @@
1MIR_CLIENTPLATFORM_1 {1MIR_CLIENTPLATFORM_1 {
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-08-26 13:38:23 +0000
+++ src/client/mir_connection.cpp 2014-08-29 01:18:58 +0000
@@ -98,6 +98,7 @@
98 channel(conf.the_rpc_channel()),98 channel(conf.the_rpc_channel()),
99 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),99 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),
100 logger(conf.the_logger()),100 logger(conf.the_logger()),
101 connect_done{false},
101 client_platform_factory(conf.the_client_platform_factory()),102 client_platform_factory(conf.the_client_platform_factory()),
102 input_platform(conf.the_input_platform()),103 input_platform(conf.the_input_platform()),
103 display_configuration(conf.the_display_configuration()),104 display_configuration(conf.the_display_configuration()),
@@ -249,6 +250,9 @@
249 set_error_message("Connect failed");250 set_error_message("Connect failed");
250 }251 }
251 }252 }
253
254 connect_done = true;
255
252 /*256 /*
253 * We need to create the client platform after the connection has been257 * We need to create the client platform after the connection has been
254 * established, to ensure that the client platform has access to all258 * established, to ensure that the client platform has access to all
@@ -353,9 +357,9 @@
353357
354void MirConnection::populate(MirPlatformPackage& platform_package)358void MirConnection::populate(MirPlatformPackage& platform_package)
355{359{
356 std::lock_guard<decltype(mutex)> lock(mutex);360 // connect_result is write-once: once it's valid, we don't need to lock
357361 // to use it.
358 if (!connect_result.has_error() && connect_result.has_platform())362 if (connect_done && !connect_result.has_error() && connect_result.has_platform())
359 {363 {
360 auto const& platform = connect_result.platform();364 auto const& platform = connect_result.platform();
361365
362366
=== modified file 'src/client/mir_connection.h'
--- src/client/mir_connection.h 2014-08-26 13:38:23 +0000
+++ src/client/mir_connection.h 2014-08-29 01:18:58 +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
@@ -149,8 +150,9 @@
149 std::shared_ptr<google::protobuf::RpcChannel> const channel;150 std::shared_ptr<google::protobuf::RpcChannel> const channel;
150 mir::protobuf::DisplayServer::Stub server;151 mir::protobuf::DisplayServer::Stub server;
151 std::shared_ptr<mir::logging::Logger> const logger;152 std::shared_ptr<mir::logging::Logger> const logger;
152 mir::protobuf::Void void_response;153 mir::protobuf::Void void_response;
153 mir::protobuf::Connection connect_result;154 mir::protobuf::Connection connect_result;
155 std::atomic<bool> connect_done;
154 mir::protobuf::Void ignored;156 mir::protobuf::Void ignored;
155 mir::protobuf::ConnectParameters connect_parameters;157 mir::protobuf::ConnectParameters connect_parameters;
156 mir::protobuf::DRMAuthMagicStatus drm_auth_magic_status;158 mir::protobuf::DRMAuthMagicStatus drm_auth_magic_status;
157159
=== 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-08-29 01:18:58 +0000
@@ -0,0 +1,29 @@
1#include "probing_client_platform_factory.h"
2
3#include <stdexcept>
4
5namespace mcl = mir::client;
6
7mcl::ProbingClientPlatformFactory::ProbingClientPlatformFactory(std::vector<std::shared_ptr<mir::SharedLibrary>> const& modules)
8 : platform_modules{modules}
9{
10 if (modules.empty())
11 {
12 throw std::runtime_error{"Attempted to create a ClientPlatformFactory with no platform modules"};
13 }
14}
15
16std::shared_ptr<mcl::ClientPlatform>
17mcl::ProbingClientPlatformFactory::create_client_platform(mcl::ClientContext* context)
18{
19 for (auto& module : platform_modules)
20 {
21 auto probe = module->load_function<mir::client::ClientPlatformProbe>("is_appropriate_module");
22 if (probe(context))
23 {
24 auto factory = module->load_function<mir::client::CreateClientPlatform>("create_client_platform");
25 return factory(context);
26 }
27 }
28 throw std::runtime_error{"No appropriate client platform module found"};
29}
030
=== 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-08-29 01:18:58 +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/platform/CMakeLists.txt'
--- src/platform/CMakeLists.txt 2014-08-26 09:27:49 +0000
+++ src/platform/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -4,12 +4,21 @@
44
5set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)5set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
66
7add_library(mirplatformobjects OBJECT7# This needs to change whenever the much smaller ABI between the platform
8 shared_library_loader.cpp8# modules and the server changes in an incompatible way.
9)9set(MIR_PLATFORM_PLUGIN_ABI 1)
10
11set(MIR_SERVER_PLATFORM_PLUGIN_PATH
12 ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/mir/server-platform-${MIR_PLATFORM_PLUGIN_ABI}
13)
14set(MIR_SERVER_PLATFORM_PLUGIN_PATH
15 ${MIR_SERVER_PLATFORM_PLUGIN_PATH}
16 PARENT_SCOPE
17)
18
19add_definitions(-DMIR_SERVER_PLATFORM_PLUGIN_PATH="${MIR_SERVER_PLATFORM_PLUGIN_PATH}")
1020
11set(MIR_PLATFORM_OBJECTS21set(MIR_PLATFORM_OBJECTS
12 $<TARGET_OBJECTS:mirplatformobjects>
13 $<TARGET_OBJECTS:mirplatformgraphicscommon>22 $<TARGET_OBJECTS:mirplatformgraphicscommon>
14 $<TARGET_OBJECTS:miroptions>23 $<TARGET_OBJECTS:miroptions>
15 $<TARGET_OBJECTS:mirfatal>24 $<TARGET_OBJECTS:mirfatal>
@@ -28,17 +37,19 @@
28)37)
2938
30target_link_libraries(mirplatform39target_link_libraries(mirplatform
40
31 mircommon41 mircommon
32 ${MIR_PLATFORM_REFERENCES}42 ${MIR_PLATFORM_REFERENCES}
33)43)
3444
35set_target_properties(mirplatform45set_target_properties(
46 mirplatform
47
36 PROPERTIES48 PROPERTIES
37 SOVERSION ${MIRPLATFORM_ABI}49 SOVERSION ${MIRPLATFORM_ABI}
38 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"50 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
39)51)
4052
41
42install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})53install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
4354
44add_subdirectory(graphics/)55add_subdirectory(graphics/)
4556
=== modified file 'src/platform/graphics/CMakeLists.txt'
--- src/platform/graphics/CMakeLists.txt 2014-08-04 08:58:40 +0000
+++ src/platform/graphics/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -14,6 +14,7 @@
14 gl_program.cpp14 gl_program.cpp
15 gl_texture.cpp15 gl_texture.cpp
16 tessellation_helpers.cpp16 tessellation_helpers.cpp
17 platform_probe.cpp
17)18)
1819
19add_library(mirplatformgraphicscommon OBJECT20add_library(mirplatformgraphicscommon OBJECT
2021
=== modified file 'src/platform/graphics/android/CMakeLists.txt'
--- src/platform/graphics/android/CMakeLists.txt 2014-08-26 09:27:49 +0000
+++ src/platform/graphics/android/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -8,7 +8,9 @@
8set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")8set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
9add_definitions( -DANDROID )9add_definitions( -DANDROID )
1010
11add_library(mirplatformgraphicsandroidobjects OBJECT11add_library(
12 mirplatformgraphicsandroidobjects OBJECT
13
12 android_platform.cpp14 android_platform.cpp
13 android_buffer_allocator.cpp15 android_buffer_allocator.cpp
14 buffer.cpp16 buffer.cpp
@@ -36,17 +38,12 @@
36 real_hwc_wrapper.cpp38 real_hwc_wrapper.cpp
37 hwc_fallback_gl_renderer.cpp39 hwc_fallback_gl_renderer.cpp
38)40)
41
39add_library(mirplatformgraphicsandroid SHARED42add_library(mirplatformgraphicsandroid SHARED
43
40 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>44 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>
41)45)
4246
43set_target_properties(
44 mirplatformgraphicsandroid PROPERTIES
45 OUTPUT_NAME mirplatformgraphics
46 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/android
47 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
48)
49
50target_link_libraries(47target_link_libraries(
51 mirplatformgraphicsandroid48 mirplatformgraphicsandroid
5249
@@ -59,20 +56,13 @@
59 ${ANDROID_PROPERTIES_LDFLAGS}56 ${ANDROID_PROPERTIES_LDFLAGS}
60)57)
6158
62install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/android)59set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
6360
64if (MIR_TEST_PLATFORM STREQUAL "android")61set_target_properties(
65 add_custom_command(TARGET mirplatformgraphicsandroid62 mirplatformgraphicsandroid PROPERTIES
66 POST_BUILD63 OUTPUT_NAME platform-graphics-android
67 COMMAND ${CMAKE_COMMAND} -E remove libmirplatformgraphics.so64 PREFIX ""
68 COMMAND ${CMAKE_COMMAND} -E create_symlink android/$<TARGET_FILE_NAME:mirplatformgraphicsandroid> libmirplatformgraphics.so65 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
69 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}66)
70 )67
7168install(TARGETS mirplatformgraphicsandroid LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PLUGIN_PATH})
72 install(CODE
73 "execute_process(
74 COMMAND ln -sf mir/platformgraphics/android/libmirplatformgraphics.so
75 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
76 )"
77 )
78endif()
7969
=== modified file 'src/platform/graphics/android/android_platform.cpp'
--- src/platform/graphics/android/android_platform.cpp 2014-08-07 13:22:53 +0000
+++ src/platform/graphics/android/android_platform.cpp 2014-08-29 01:18:58 +0000
@@ -187,3 +187,26 @@
187 boost::program_options::value<bool>()->default_value(true), //TODO: switch default to false 187 boost::program_options::value<bool>()->default_value(true), //TODO: switch default to false
188 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");188 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");
189}189}
190
191extern "C" mg::PlatformPriority probe_platform()
192{
193 int err;
194 hw_module_t const* hw_module;
195
196 err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hw_module);
197
198 // TODO: Yo! kdub! Is this totally insane?
199 // It *looks* like the hw_module_t is global, so we don't leak by
200 // not doing anything with it?
201
202 return err < 0 ? mg::PlatformPriority::unsupported : mg::PlatformPriority::best;
203}
204
205mg::ModuleProperties const description = {
206 "android"
207};
208
209extern "C" mg::ModuleProperties const* describe_module()
210{
211 return &description;
212}
190213
=== 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-08-29 01:18:58 +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-08-26 09:27:49 +0000
+++ src/platform/graphics/mesa/CMakeLists.txt 2014-08-29 01:18:58 +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
@@ -35,18 +37,14 @@
35 bypass.cpp37 bypass.cpp
36)38)
3739
38add_library(mirplatformgraphicsmesa SHARED40add_library(
41 mirplatformgraphicsmesa MODULE
42
39 $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects>43 $<TARGET_OBJECTS:mirplatformgraphicsmesaobjects>
40)44)
4145
42set_target_properties(46target_link_libraries(
43 mirplatformgraphicsmesa PROPERTIES47 mirplatformgraphicsmesa
44 OUTPUT_NAME mirplatformgraphics
45 LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}/mesa
46 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
47)
48
49target_link_libraries(mirplatformgraphicsmesa
5048
51 ${Boost_PROGRAM_OPTIONS_LIBRARY}49 ${Boost_PROGRAM_OPTIONS_LIBRARY}
52 ${DRM_LDFLAGS} ${DRM_LIBRARIES}50 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -55,20 +53,13 @@
55 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}53 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
56)54)
5755
58install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mir/platformgraphics/mesa)56set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols.map)
5957
60if (MIR_TEST_PLATFORM STREQUAL "mesa")58set_target_properties(
61 add_custom_command(TARGET mirplatformgraphicsmesa59 mirplatformgraphicsmesa PROPERTIES
62 POST_BUILD60 OUTPUT_NAME platform-graphics-mesa
63 COMMAND ${CMAKE_COMMAND} -E remove libmirplatformgraphics.so61 PREFIX ""
64 COMMAND ${CMAKE_COMMAND} -E create_symlink mesa/$<TARGET_FILE_NAME:mirplatformgraphicsmesa> libmirplatformgraphics.so62 LINK_FLAGS "-Wl,--exclude-libs=ALL -Wl,--version-script,${symbol_map}"
65 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}63)
66 )64
6765install(TARGETS mirplatformgraphicsmesa LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PLUGIN_PATH})
68 install(CODE
69 "execute_process(
70 COMMAND ln -sf mir/platformgraphics/mesa/libmirplatformgraphics.so
71 WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
72 )"
73 )
74endif()
7566
=== modified file 'src/platform/graphics/mesa/platform.cpp'
--- src/platform/graphics/mesa/platform.cpp 2014-08-07 13:22:53 +0000
+++ src/platform/graphics/mesa/platform.cpp 2014-08-29 01:18:58 +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
32#include "drm_close_threadsafe.h"33#include "drm_close_threadsafe.h"
3334
@@ -269,3 +270,30 @@
269 boost::program_options::value<bool>()->default_value(true),270 boost::program_options::value<bool>()->default_value(true),
270 "[platform-specific] utilize the bypass optimization for fullscreen surfaces.");271 "[platform-specific] utilize the bypass optimization for fullscreen surfaces.");
271}272}
273
274extern "C" mg::PlatformPriority probe_platform()
275{
276 auto udev = std::make_shared<mir::udev::Context>();
277
278 mir::udev::Enumerator drm_devices{udev};
279 drm_devices.match_subsystem("drm");
280 drm_devices.match_sysname("card[0-9]*");
281 drm_devices.scan_devices();
282
283 for(auto& device : drm_devices)
284 {
285 static_cast<void>(device);
286 return mg::PlatformPriority::best;
287 }
288
289 return mg::PlatformPriority::unsupported;
290}
291
292mg::ModuleProperties const description = {
293 "mesa"
294};
295
296extern "C" mg::ModuleProperties const* describe_module()
297{
298 return &description;
299}
272300
=== 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-08-29 01:18:58 +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-08-29 01:18:58 +0000
@@ -0,0 +1,42 @@
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 auto probe = module->load_function<mir::graphics::PlatformProbe>("probe_platform");
30 auto module_priority = probe();
31 if (module_priority > best_priority_so_far)
32 {
33 best_priority_so_far = module_priority;
34 best_module_so_far = module;
35 }
36 }
37 if (best_priority_so_far > mir::graphics::unsupported)
38 {
39 return best_module_so_far;
40 }
41 throw std::runtime_error{"Failed to find platform for current system"};
42}
043
=== 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-08-29 01:18:58 +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-08-07 09:48:53 +0000
+++ src/platform/options/default_configuration.cpp 2014-08-29 01:18:58 +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
26namespace mo = mir::options;27namespace mo = mir::options;
2728
@@ -37,6 +38,7 @@
37char const* const mo::connector_report_opt = "connector-report";38char const* const mo::connector_report_opt = "connector-report";
38char const* const mo::scene_report_opt = "scene-report";39char const* const mo::scene_report_opt = "scene-report";
39char const* const mo::input_report_opt = "input-report";40char const* const mo::input_report_opt = "input-report";
41char const* const mo::shared_library_prober_report_opt = "shared-library-prober-report";
40char const* const mo::host_socket_opt = "host-socket";42char const* const mo::host_socket_opt = "host-socket";
41char const* const mo::frontend_threads_opt = "ipc-thread-pool";43char const* const mo::frontend_threads_opt = "ipc-thread-pool";
42char const* const mo::name_opt = "name";44char const* const mo::name_opt = "name";
@@ -53,6 +55,7 @@
53char const* const mo::lttng_opt_value = "lttng";55char const* const mo::lttng_opt_value = "lttng";
5456
55char const* const mo::platform_graphics_lib = "platform-graphics-lib";57char const* const mo::platform_graphics_lib = "platform-graphics-lib";
58char const* const mo::platform_graphics_path = "platform-graphics-path";
5659
57namespace60namespace
58{61{
@@ -61,7 +64,8 @@
61int const glog_minloglevel_default = 0;64int const glog_minloglevel_default = 0;
62char const* const glog_log_dir_default = "";65char const* const glog_log_dir_default = "";
63bool const enable_input_default = true;66bool const enable_input_default = true;
64char const* const default_platform_graphics_lib = "libmirplatformgraphics.so";67
68std::shared_ptr<mir::SharedLibrary> graphics_lib;
65}69}
6670
67mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :71mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :
@@ -102,8 +106,10 @@
102 "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]")106 "Socket filename [string:default=$XDG_RUNTIME_DIR/mir_socket or /tmp/mir_socket]")
103 (no_server_socket_opt, "Do not provide a socket filename for client connections")107 (no_server_socket_opt, "Do not provide a socket filename for client connections")
104 (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections")108 (prompt_socket_opt, "Provide a \"..._trusted\" filename for prompt helper connections")
105 (platform_graphics_lib, po::value<std::string>()->default_value(default_platform_graphics_lib),109 (platform_graphics_lib, po::value<std::string>(),
106 "Library to use for platform graphics support")110 "Library to use for platform graphics support (default: autodetect)")
111 (platform_graphics_path, po::value<std::string>()->default_value(MIR_SERVER_PLATFORM_PLUGIN_PATH),
112 "Library to use for platform graphics support (default: " MIR_SERVER_PLATFORM_PLUGIN_PATH ")")
107 (enable_input_opt, po::value<bool>()->default_value(enable_input_default),113 (enable_input_opt, po::value<bool>()->default_value(enable_input_default),
108 "Enable input.")114 "Enable input.")
109 (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value),115 (compositor_report_opt, po::value<std::string>()->default_value(off_opt_value),
@@ -122,6 +128,8 @@
122 "How to handle the MessageProcessor report. [{log,lttng,off}]")128 "How to handle the MessageProcessor report. [{log,lttng,off}]")
123 (scene_report_opt, po::value<std::string>()->default_value(off_opt_value),129 (scene_report_opt, po::value<std::string>()->default_value(off_opt_value),
124 "How to handle the scene report. [{log,lttng,off}]")130 "How to handle the scene report. [{log,lttng,off}]")
131 (shared_library_prober_report_opt, po::value<std::string>()->default_value(off_opt_value),
132 "How to handle the shared library prober report. [{log,lttng,off}]")
125 (glog,133 (glog,
126 "Use google::GLog for logging")134 "Use google::GLog for logging")
127 (glog_stderrthreshold, po::value<int>()->default_value(glog_stderrthreshold_default),135 (glog_stderrthreshold, po::value<int>()->default_value(glog_stderrthreshold_default),
@@ -149,30 +157,72 @@
149 add_platform_options();157 add_platform_options();
150}158}
151159
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
152void mo::DefaultConfiguration::add_platform_options()180void mo::DefaultConfiguration::add_platform_options()
153{181{
154 namespace po = boost::program_options;182 namespace po = boost::program_options;
155 po::options_description program_options;183 po::options_description program_options;
156 program_options.add_options()184 program_options.add_options()
157 (platform_graphics_lib,185 (platform_graphics_lib,
158 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 "");
159 mo::ProgramOption options;191 mo::ProgramOption options;
160 options.parse_arguments(program_options, argc, argv);192 options.parse_arguments(program_options, argc, argv);
161193
162 std::string graphics_libname;194 // TODO: We should just load all the platform plugins we can and present their options.
163 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");195 auto env_libname = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_LIB");
164 if (!options.is_set(platform_graphics_lib) && env_libname)196 auto env_libpath = ::getenv("MIR_SERVER_PLATFORM_GRAPHICS_PATH");
165 {197 try
166 graphics_libname = std::string{env_libname};198 {
167 }199 if (options.is_set(platform_graphics_lib))
168 else200 {
169 {201 graphics_lib = std::make_shared<mir::SharedLibrary>(options.get<std::string>(platform_graphics_lib));
170 graphics_libname = options.get<std::string>(platform_graphics_lib);202 }
171 }203 else if (env_libname)
204 {
205 graphics_lib = std::make_shared<mir::SharedLibrary>(std::string{env_libname});
206 }
207 else
208 {
209 auto const plugin_path = env_libpath ? env_libpath : options.get<std::string>(platform_graphics_path);
210 NullSharedLibraryProberReport nuller;
211 auto plugins = mir::libraries_for_path(plugin_path, nuller);
212 graphics_lib = mir::graphics::module_for_device(plugins);
213 }
172214
173 auto graphics_lib = load_library(graphics_libname);215 auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options"));
174 auto add_platform_options = graphics_lib->load_function<mir::graphics::AddPlatformOptions>(std::string("add_platform_options"));216 add_platform_options(*this->program_options);
175 add_platform_options(*this->program_options);217 }
218 catch(...)
219 {
220 // We don't actually care at this point if this failed.
221 // Maybe we've been pointed at the wrong place. Maybe this platform doesn't actually
222 // *have* platform-specific options.
223 // Regardless, if we need a platform and can't find one then we'll bail later
224 // in startup with a useful error.
225 }
176}226}
177227
178boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()228boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()
179229
=== removed file 'src/platform/shared_library_loader.cpp'
--- src/platform/shared_library_loader.cpp 2014-03-20 16:49:52 +0000
+++ src/platform/shared_library_loader.cpp 1970-01-01 00:00:00 +0000
@@ -1,38 +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#include "mir/shared_library_loader.h"
20#include "mir/shared_library.h"
21#include <memory>
22#include <map>
23
24mir::SharedLibrary const* mir::load_library(std::string const& libname)
25{
26 // There's no point in loading twice, and it isn't safe to unload...
27 static std::map<std::string, std::shared_ptr<mir::SharedLibrary>> libraries_cache;
28
29 if (auto& ptr = libraries_cache[libname])
30 {
31 return ptr.get();
32 }
33 else
34 {
35 ptr = std::make_shared<mir::SharedLibrary>(libname);
36 return ptr.get();
37 }
38}
390
=== modified file 'src/platform/symbols.map'
--- src/platform/symbols.map 2014-08-25 03:11:01 +0000
+++ src/platform/symbols.map 2014-08-29 01:18:58 +0000
@@ -155,6 +155,7 @@
155 mir::graphics::InternalSurface::pixel_format*;155 mir::graphics::InternalSurface::pixel_format*;
156 mir::graphics::InternalSurface::size*;156 mir::graphics::InternalSurface::size*;
157 mir::graphics::InternalSurface::swap_buffers*;157 mir::graphics::InternalSurface::swap_buffers*;
158 mir::graphics::module_for_device*;
158 mir::graphics::NativePlatform::create_buffer_allocator*;159 mir::graphics::NativePlatform::create_buffer_allocator*;
159 mir::graphics::NativePlatform::create_internal_client*;160 mir::graphics::NativePlatform::create_internal_client*;
160 mir::graphics::NativePlatform::fill_buffer_package*;161 mir::graphics::NativePlatform::fill_buffer_package*;
@@ -225,6 +226,7 @@
225 mir::options::glog_log_dir*;226 mir::options::glog_log_dir*;
226 mir::options::glog_minloglevel*;227 mir::options::glog_minloglevel*;
227 mir::options::glog_stderrthreshold*;228 mir::options::glog_stderrthreshold*;
229 mir::options::platform_graphics_path*;
228 mir::options::host_socket_opt*;230 mir::options::host_socket_opt*;
229 mir::options::input_report_opt*;231 mir::options::input_report_opt*;
230 mir::options::legacy_input_report_opt*;232 mir::options::legacy_input_report_opt*;
@@ -252,6 +254,7 @@
252 mir::options::scene_report_opt*;254 mir::options::scene_report_opt*;
253 mir::options::server_socket_opt*;255 mir::options::server_socket_opt*;
254 mir::options::session_mediator_report_opt*;256 mir::options::session_mediator_report_opt*;
257 mir::options::shared_library_prober_report_opt*;
255 typeinfo?for?mir::AbnormalExit;258 typeinfo?for?mir::AbnormalExit;
256 typeinfo?for?mir::EmergencyCleanupRegistry;259 typeinfo?for?mir::EmergencyCleanupRegistry;
257 typeinfo?for?mir::FatalErrorStrategy;260 typeinfo?for?mir::FatalErrorStrategy;
258261
=== modified file 'src/server/CMakeLists.txt'
--- src/server/CMakeLists.txt 2014-08-18 09:05:55 +0000
+++ src/server/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -2,6 +2,8 @@
2 ${PROJECT_SOURCE_DIR}/include/platform2 ${PROJECT_SOURCE_DIR}/include/platform
3 ${PROJECT_SOURCE_DIR}/include/server)3 ${PROJECT_SOURCE_DIR}/include/server)
44
5add_definitions(-DMIR_SERVER_PLATFORM_PLUGIN_PATH="${MIR_SERVER_PLATFORM_PLUGIN_PATH}")
6
5add_subdirectory(compositor/)7add_subdirectory(compositor/)
6add_subdirectory(graphics/)8add_subdirectory(graphics/)
7add_subdirectory(input/)9add_subdirectory(input/)
@@ -65,8 +67,9 @@
65)67)
6668
67target_link_libraries(mirserver LINK_PUBLIC69target_link_libraries(mirserver LINK_PUBLIC
70
71 mirclient
68 mirplatform72 mirplatform
69 mirclient
70 mircommon73 mircommon
71 3rd_party74 3rd_party
72 xcursorloader75 xcursorloader
7376
=== modified file 'src/server/graphics/CMakeLists.txt'
--- src/server/graphics/CMakeLists.txt 2014-08-06 12:22:34 +0000
+++ src/server/graphics/CMakeLists.txt 2014-08-29 01:18:58 +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-07-30 15:25:54 +0000
+++ src/server/graphics/default_configuration.cpp 2014-08-29 01:18:58 +0000
@@ -28,10 +28,11 @@
28#include "mir/graphics/buffer_initializer.h"28#include "mir/graphics/buffer_initializer.h"
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"
3738
@@ -43,6 +44,12 @@
4344
44namespace mg = mir::graphics;45namespace mg = mir::graphics;
4546
47namespace
48{
49// TODO: Temporary, until we actually manage module lifetimes
50static std::shared_ptr<mir::SharedLibrary> platform_library;
51}
52
46std::shared_ptr<mg::BufferInitializer>53std::shared_ptr<mg::BufferInitializer>
47mir::DefaultServerConfiguration::the_buffer_initializer()54mir::DefaultServerConfiguration::the_buffer_initializer()
48{55{
@@ -71,14 +78,26 @@
71 if (!the_options()->is_set(options::host_socket_opt))78 if (!the_options()->is_set(options::host_socket_opt))
72 {79 {
73 // fallback to standalone if host socket is unset80 // fallback to standalone if host socket is unset
74 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));81 if (the_options()->is_set(options::platform_graphics_lib))
75 auto create_platform = graphics_lib->load_function<mg::CreatePlatform>("create_platform");82 {
83 platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib));
84 }
85 else
86 {
87 auto platforms = mir::libraries_for_path(the_options()->get<std::string>(options::platform_graphics_path), *the_shared_library_prober_report());
88 if (platforms.empty())
89 {
90 throw std::runtime_error("Failed to find any platform plugins in: " MIR_SERVER_PLATFORM_PLUGIN_PATH);
91 }
92 platform_library = mir::graphics::module_for_device(platforms);
93 }
94 auto create_platform = platform_library->load_function<mg::CreatePlatform>("create_platform");
76 return create_platform(the_options(), the_emergency_cleanup(), the_display_report());95 return create_platform(the_options(), the_emergency_cleanup(), the_display_report());
77 }96 }
7897
79 return std::make_shared<mir::graphics::nested::NestedPlatform>(98 return std::make_shared<mir::graphics::nested::NestedPlatform>(
80 the_host_connection(),99 the_host_connection(),
81 the_input_dispatcher(),100 the_input_dispatcher(),
82 the_display_report(),101 the_display_report(),
83 the_graphics_native_platform());102 the_graphics_native_platform());
84 });103 });
@@ -89,8 +108,20 @@
89 return graphics_native_platform(108 return graphics_native_platform(
90 [this]()109 [this]()
91 {110 {
92 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));111 if (the_options()->is_set(options::platform_graphics_lib))
93 auto create_native_platform = graphics_lib->load_function<mg::CreateNativePlatform>("create_native_platform");112 {
113 platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib));
114 }
115 else
116 {
117 auto platforms = mir::libraries_for_path(the_options()->get<std::string>(options::platform_graphics_path), *the_shared_library_prober_report());
118 if (platforms.empty())
119 {
120 throw std::runtime_error("Failed to find any platform plugins in: " MIR_SERVER_PLATFORM_PLUGIN_PATH);
121 }
122 platform_library = mir::graphics::module_for_device(platforms);
123 }
124 auto create_native_platform = platform_library->load_function<mg::CreateNativePlatform>("create_native_platform");
94125
95 return create_native_platform(the_display_report());126 return create_native_platform(the_display_report());
96 });127 });
97128
=== modified file 'src/server/logging/CMakeLists.txt'
--- src/server/logging/CMakeLists.txt 2014-08-06 12:36:12 +0000
+++ src/server/logging/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -12,4 +12,3 @@
1212
13 ${LOGGING_SOURCES}13 ${LOGGING_SOURCES}
14)14)
15
1615
=== modified file 'src/server/report/default_server_configuration.cpp'
--- src/server/report/default_server_configuration.cpp 2014-03-06 06:05:17 +0000
+++ src/server/report/default_server_configuration.cpp 2014-08-29 01:18:58 +0000
@@ -117,3 +117,12 @@
117 return report_factory(options::scene_report_opt)->create_scene_report();117 return report_factory(options::scene_report_opt)->create_scene_report();
118 });118 });
119}119}
120
121auto mir::DefaultServerConfiguration::the_shared_library_prober_report() -> std::shared_ptr<SharedLibraryProberReport>
122{
123 return shared_library_prober_report(
124 [this]()->std::shared_ptr<SharedLibraryProberReport>
125 {
126 return report_factory(options::shared_library_prober_report_opt)->create_shared_library_prober_report();
127 });
128}
120129
=== modified file 'src/server/report/logging/CMakeLists.txt'
--- src/server/report/logging/CMakeLists.txt 2014-08-06 12:22:34 +0000
+++ src/server/report/logging/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -18,4 +18,3 @@
1818
19 ${LOGGING_SOURCES}19 ${LOGGING_SOURCES}
20)20)
21
2221
=== modified file 'src/server/report/logging/logging_report_factory.cpp'
--- src/server/report/logging/logging_report_factory.cpp 2014-02-11 15:18:07 +0000
+++ src/server/report/logging/logging_report_factory.cpp 2014-08-29 01:18:58 +0000
@@ -25,6 +25,7 @@
25#include "scene_report.h"25#include "scene_report.h"
26#include "session_mediator_report.h"26#include "session_mediator_report.h"
27#include "input_report.h"27#include "input_report.h"
28#include "mir/logging/shared_library_prober_report.h"
2829
29#include "mir/default_server_configuration.h"30#include "mir/default_server_configuration.h"
3031
@@ -72,4 +73,7 @@
72 return std::make_shared<logging::InputReport>(logger);73 return std::make_shared<logging::InputReport>(logger);
73}74}
7475
7576std::shared_ptr<mir::SharedLibraryProberReport> mr::LoggingReportFactory::create_shared_library_prober_report()
77{
78 return std::make_shared<mir::logging::SharedLibraryProberReport>(logger);
79}
7680
=== modified file 'src/server/report/logging_report_factory.h'
--- src/server/report/logging_report_factory.h 2014-02-11 15:18:07 +0000
+++ src/server/report/logging_report_factory.h 2014-08-29 01:18:58 +0000
@@ -47,6 +47,8 @@
47 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;47 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
48 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;48 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
49 std::shared_ptr<input::InputReport> create_input_report() override;49 std::shared_ptr<input::InputReport> create_input_report() override;
50 std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() override;
51
5052
51private:53private:
52 std::shared_ptr<mir::logging::Logger> const logger;54 std::shared_ptr<mir::logging::Logger> const logger;
5355
=== modified file 'src/server/report/lttng/CMakeLists.txt'
--- src/server/report/lttng/CMakeLists.txt 2014-08-06 12:22:34 +0000
+++ src/server/report/lttng/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -17,6 +17,7 @@
17 session_mediator_report.cpp17 session_mediator_report.cpp
18 scene_report.cpp18 scene_report.cpp
19 server_tracepoint_provider.cpp19 server_tracepoint_provider.cpp
20 shared_library_prober_report.cpp
20)21)
2122
22add_library(23add_library(
2324
=== modified file 'src/server/report/lttng/lttng_report_factory.cpp'
--- src/server/report/lttng/lttng_report_factory.cpp 2014-02-11 15:18:07 +0000
+++ src/server/report/lttng/lttng_report_factory.cpp 2014-08-29 01:18:58 +0000
@@ -25,6 +25,7 @@
25#include "message_processor_report.h"25#include "message_processor_report.h"
26#include "scene_report.h"26#include "scene_report.h"
27#include "session_mediator_report.h"27#include "session_mediator_report.h"
28#include "shared_library_prober_report.h"
2829
29std::shared_ptr<mir::compositor::CompositorReport> mir::report::LttngReportFactory::create_compositor_report()30std::shared_ptr<mir::compositor::CompositorReport> mir::report::LttngReportFactory::create_compositor_report()
30{31{
@@ -61,4 +62,8 @@
61 return std::make_shared<lttng::InputReport>();62 return std::make_shared<lttng::InputReport>();
62}63}
6364
65std::shared_ptr<mir::SharedLibraryProberReport> mir::report::LttngReportFactory::create_shared_library_prober_report()
66{
67 return std::make_shared<lttng::SharedLibraryProberReport>();
68}
6469
6570
=== added file 'src/server/report/lttng/shared_library_prober_report.cpp'
--- src/server/report/lttng/shared_library_prober_report.cpp 1970-01-01 00:00:00 +0000
+++ src/server/report/lttng/shared_library_prober_report.cpp 2014-08-29 01:18:58 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17 */
18
19#include "shared_library_prober_report.h"
20#include "mir/report/lttng/mir_tracepoint.h"
21
22#define TRACEPOINT_DEFINE
23#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
24#include "shared_library_prober_report_tp.h"
25
26void mir::report::lttng::SharedLibraryProberReport::probing_path(boost::filesystem::path const& path)
27{
28 mir_tracepoint(mir_server_shared_library_prober, probing_path,
29 path.string().c_str());
30}
31
32void mir::report::lttng::SharedLibraryProberReport::probing_failed(boost::filesystem::path const& path, std::exception const& error)
33{
34 mir_tracepoint(mir_server_shared_library_prober, probing_failed,
35 path.string().c_str(), error.what());
36}
37
38void mir::report::lttng::SharedLibraryProberReport::loading_library(boost::filesystem::path const& filename)
39{
40 mir_tracepoint(mir_server_shared_library_prober, loading_library,
41 filename.string().c_str());
42}
43
44void mir::report::lttng::SharedLibraryProberReport::loading_failed(boost::filesystem::path const& filename, std::exception const& error)
45{
46 mir_tracepoint(mir_server_shared_library_prober, loading_failed,
47 filename.string().c_str(), error.what());
48}
049
=== added file 'src/server/report/lttng/shared_library_prober_report.h'
--- src/server/report/lttng/shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ src/server/report/lttng/shared_library_prober_report.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify 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_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include "server_tracepoint_provider.h"
23
24#include "mir/shared_library_prober_report.h"
25
26#include <stdexcept>
27#include <string>
28
29namespace mir
30{
31namespace report
32{
33namespace lttng
34{
35
36class SharedLibraryProberReport : public mir::SharedLibraryProberReport
37{
38public:
39 void probing_path(boost::filesystem::path const& path) override;
40 void probing_failed(boost::filesystem::path const& path, std::exception const& error) override;
41 void loading_library(boost::filesystem::path const& filename) override;
42 void loading_failed(boost::filesystem::path const& filename, std::exception const& error) override;
43
44private:
45 ServerTracepointProvider tp_provider;
46};
47
48}
49}
50}
51
52#endif // MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_H_
053
=== added file 'src/server/report/lttng/shared_library_prober_report_tp.h'
--- src/server/report/lttng/shared_library_prober_report_tp.h 1970-01-01 00:00:00 +0000
+++ src/server/report/lttng/shared_library_prober_report_tp.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,71 @@
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#undef TRACEPOINT_PROVIDER
20#define TRACEPOINT_PROVIDER mir_server_shared_library_prober
21
22#undef TRACEPOINT_INCLUDE
23#define TRACEPOINT_INCLUDE "./shared_library_prober_report_tp.h"
24
25#if !defined(MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ)
26#define MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_
27
28#include <lttng/tracepoint.h>
29#include <stdint.h>
30
31TRACEPOINT_EVENT(
32 mir_server_shared_library_prober,
33 probing_path,
34 TP_ARGS(const char*, path),
35 TP_FIELDS(
36 ctf_string(path, path)
37 )
38)
39
40TRACEPOINT_EVENT(
41 mir_server_shared_library_prober,
42 probing_failed,
43 TP_ARGS(const char*, path, const char*, message),
44 TP_FIELDS(
45 ctf_string(path, path)
46 ctf_string(message, message)
47 )
48)
49
50TRACEPOINT_EVENT(
51 mir_server_shared_library_prober,
52 loading_library,
53 TP_ARGS(const char*, path),
54 TP_FIELDS(
55 ctf_string(path, path)
56 )
57)
58
59TRACEPOINT_EVENT(
60 mir_server_shared_library_prober,
61 loading_failed,
62 TP_ARGS(const char*, path, const char*, message),
63 TP_FIELDS(
64 ctf_string(path, path)
65 ctf_string(message, message)
66 )
67)
68
69#endif /* MIR_REPORT_LTTNG_SHARED_LIBRARY_PROBER_REPORT_TP_H_ */
70
71#include <lttng/tracepoint-event.h>
072
=== modified file 'src/server/report/lttng_report_factory.h'
--- src/server/report/lttng_report_factory.h 2014-02-11 15:18:07 +0000
+++ src/server/report/lttng_report_factory.h 2014-08-29 01:18:58 +0000
@@ -35,6 +35,7 @@
35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
37 std::shared_ptr<input::InputReport> create_input_report() override;37 std::shared_ptr<input::InputReport> create_input_report() override;
38 std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() override;
38};39};
39}40}
40}41}
4142
=== modified file 'src/server/report/null/CMakeLists.txt'
--- src/server/report/null/CMakeLists.txt 2014-08-06 12:22:34 +0000
+++ src/server/report/null/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -9,4 +9,5 @@
9 null_report_factory.cpp9 null_report_factory.cpp
10 scene_report.cpp10 scene_report.cpp
11 session_mediator_report.cpp11 session_mediator_report.cpp
12 shared_library_prober_report.cpp
12 )13 )
1314
=== modified file 'src/server/report/null/null_report_factory.cpp'
--- src/server/report/null/null_report_factory.cpp 2014-02-17 22:35:23 +0000
+++ src/server/report/null/null_report_factory.cpp 2014-08-29 01:18:58 +0000
@@ -25,6 +25,7 @@
25#include "display_report.h"25#include "display_report.h"
26#include "input_report.h"26#include "input_report.h"
27#include "scene_report.h"27#include "scene_report.h"
28#include "shared_library_prober_report.h"
2829
29std::shared_ptr<mir::compositor::CompositorReport> mir::report::NullReportFactory::create_compositor_report()30std::shared_ptr<mir::compositor::CompositorReport> mir::report::NullReportFactory::create_compositor_report()
30{31{
@@ -61,6 +62,11 @@
61 return std::make_shared<null::InputReport>();62 return std::make_shared<null::InputReport>();
62}63}
6364
65std::shared_ptr<mir::SharedLibraryProberReport> mir::report::NullReportFactory::create_shared_library_prober_report()
66{
67 return std::make_shared<null::SharedLibraryProberReport>();
68}
69
64std::shared_ptr<mir::compositor::CompositorReport> mir::report::null_compositor_report()70std::shared_ptr<mir::compositor::CompositorReport> mir::report::null_compositor_report()
65{71{
66 return NullReportFactory{}.create_compositor_report();72 return NullReportFactory{}.create_compositor_report();
@@ -90,3 +96,8 @@
90{96{
91 return NullReportFactory{}.create_input_report();97 return NullReportFactory{}.create_input_report();
92}98}
99
100std::shared_ptr<mir::SharedLibraryProberReport> mir::report::null_shared_library_prober_report()
101{
102 return NullReportFactory{}.create_shared_library_prober_report();
103}
93104
=== added file 'src/server/report/null/shared_library_prober_report.cpp'
--- src/server/report/null/shared_library_prober_report.cpp 1970-01-01 00:00:00 +0000
+++ src/server/report/null/shared_library_prober_report.cpp 2014-08-29 01:18:58 +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 "shared_library_prober_report.h"
20
21void mir::report::null::SharedLibraryProberReport::probing_path(boost::filesystem::path const& /*path*/)
22{
23}
24
25void mir::report::null::SharedLibraryProberReport::probing_failed(boost::filesystem::path const& /*path*/, std::exception const& /*error*/)
26{
27}
28
29void mir::report::null::SharedLibraryProberReport::loading_library(boost::filesystem::path const& /*filename*/)
30{
31}
32
33void mir::report::null::SharedLibraryProberReport::loading_failed(boost::filesystem::path const& /*filename*/, std::exception const& /*error*/)
34{
35}
036
=== added file 'src/server/report/null/shared_library_prober_report.h'
--- src/server/report/null/shared_library_prober_report.h 1970-01-01 00:00:00 +0000
+++ src/server/report/null/shared_library_prober_report.h 2014-08-29 01:18:58 +0000
@@ -0,0 +1,43 @@
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_REPORT_NULL_SHARED_LIBRARY_PROBER_REPORT_H_
20#define MIR_REPORT_NULL_SHARED_LIBRARY_PROBER_REPORT_H_
21
22#include "mir/shared_library_prober_report.h"
23
24namespace mir
25{
26namespace report
27{
28namespace null
29{
30class SharedLibraryProberReport : public mir::SharedLibraryProberReport
31{
32public:
33 void probing_path(boost::filesystem::path const& path);
34 void probing_failed(boost::filesystem::path const& path, std::exception const& error);
35 void loading_library(boost::filesystem::path const& filename);
36 void loading_failed(boost::filesystem::path const& filename, std::exception const& error);
37};
38
39}
40}
41}
42
43#endif // MIR_REPORT_NULL_SHARED_LIBRARY_PROBER_REPORT_H_
044
=== modified file 'src/server/report/null_report_factory.h'
--- src/server/report/null_report_factory.h 2014-02-17 22:35:23 +0000
+++ src/server/report/null_report_factory.h 2014-08-29 01:18:58 +0000
@@ -35,6 +35,7 @@
35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;35 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;36 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
37 std::shared_ptr<input::InputReport> create_input_report() override;37 std::shared_ptr<input::InputReport> create_input_report() override;
38 std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() override;
38};39};
3940
40std::shared_ptr<compositor::CompositorReport> null_compositor_report();41std::shared_ptr<compositor::CompositorReport> null_compositor_report();
@@ -44,7 +45,7 @@
44std::shared_ptr<frontend::SessionMediatorReport> null_session_mediator_report();45std::shared_ptr<frontend::SessionMediatorReport> null_session_mediator_report();
45std::shared_ptr<frontend::MessageProcessorReport> null_message_processor_report();46std::shared_ptr<frontend::MessageProcessorReport> null_message_processor_report();
46std::shared_ptr<input::InputReport> null_input_report();47std::shared_ptr<input::InputReport> null_input_report();
4748std::shared_ptr<SharedLibraryProberReport> null_shared_library_prober_report();
48}49}
49}50}
5051
5152
=== modified file 'src/server/report/report_factory.h'
--- src/server/report/report_factory.h 2014-02-11 15:18:07 +0000
+++ src/server/report/report_factory.h 2014-08-29 01:18:58 +0000
@@ -23,6 +23,8 @@
2323
24namespace mir24namespace mir
25{25{
26
27class SharedLibraryProberReport;
26namespace compositor28namespace compositor
27{29{
28class CompositorReport;30class CompositorReport;
@@ -59,6 +61,7 @@
59 virtual std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() = 0;61 virtual std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() = 0;
60 virtual std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() = 0;62 virtual std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() = 0;
61 virtual std::shared_ptr<input::InputReport> create_input_report() = 0;63 virtual std::shared_ptr<input::InputReport> create_input_report() = 0;
64 virtual std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() = 0;
6265
63protected:66protected:
64 ReportFactory() = default;67 ReportFactory() = default;
6568
=== modified file 'src/shared/graphics/android/mir_native_window.cpp'
--- src/shared/graphics/android/mir_native_window.cpp 2014-08-20 23:58:45 +0000
+++ src/shared/graphics/android/mir_native_window.cpp 2014-08-29 01:18:58 +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/shared/logging/CMakeLists.txt'
--- src/shared/logging/CMakeLists.txt 2014-07-24 11:30:35 +0000
+++ src/shared/logging/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -17,7 +17,8 @@
17add_library(mirsharedlogging OBJECT17add_library(mirsharedlogging OBJECT
18 dumb_console_logger.cpp18 dumb_console_logger.cpp
19 input_timestamp.cpp19 input_timestamp.cpp
20)20 shared_library_prober_report.cpp
21)
2122
22list(APPEND MIR_COMMON_SOURCES23list(APPEND MIR_COMMON_SOURCES
23 $<TARGET_OBJECTS:mirsharedlogging>24 $<TARGET_OBJECTS:mirsharedlogging>
2425
=== added file 'src/shared/logging/shared_library_prober_report.cpp'
--- src/shared/logging/shared_library_prober_report.cpp 1970-01-01 00:00:00 +0000
+++ src/shared/logging/shared_library_prober_report.cpp 2014-08-29 01:18:58 +0000
@@ -0,0 +1,58 @@
1
2/*
3 * Copyright © 2014 Canonical Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License version 3 as
7 * 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 Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser 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/logging/shared_library_prober_report.h"
21#include "mir/logging/logger.h"
22
23namespace ml = mir::logging;
24
25ml::SharedLibraryProberReport::SharedLibraryProberReport(std::shared_ptr<Logger> const& logger)
26 : logger{logger}
27{
28}
29
30void ml::SharedLibraryProberReport::probing_path(boost::filesystem::path const& path)
31{
32 logger->log(ml::Logger::Severity::informational,
33 std::string("Loading modules from: ") + path.string(),
34 "Loader");
35}
36
37void ml::SharedLibraryProberReport::probing_failed(boost::filesystem::path const& path, std::exception const& error)
38{
39 logger->log(ml::Logger::Severity::error,
40 std::string("Failed to load libraries from path: ") + path.string() +
41 " (error was:" + error.what() + ")",
42 "Loader");
43}
44
45void ml::SharedLibraryProberReport::loading_library(boost::filesystem::path const& filename)
46{
47 logger->log(ml::Logger::Severity::informational,
48 std::string("Loading module: ") + filename.string(),
49 "Loader");
50}
51
52void ml::SharedLibraryProberReport::loading_failed(boost::filesystem::path const& filename, std::exception const& error)
53{
54 logger->log(ml::Logger::Severity::warning,
55 std::string("Failed to load module: ") + filename.string() +
56 " (error was:" + error.what() + ")",
57 "Loader");
58}
059
=== modified file 'src/shared/sharedlibrary/CMakeLists.txt'
--- src/shared/sharedlibrary/CMakeLists.txt 2014-07-24 11:30:35 +0000
+++ src/shared/sharedlibrary/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -16,13 +16,17 @@
1616
17add_library(mirsharedsharedlibrary OBJECT17add_library(mirsharedsharedlibrary OBJECT
18 shared_library.cpp18 shared_library.cpp
19 shared_library_prober.cpp
19)20)
2021
21list(APPEND MIR_COMMON_SOURCES22list(APPEND MIR_COMMON_SOURCES
22 $<TARGET_OBJECTS:mirsharedsharedlibrary>23 $<TARGET_OBJECTS:mirsharedsharedlibrary>
23)24)
2425
25list(APPEND MIR_COMMON_REFERENCES dl)26list(APPEND MIR_COMMON_REFERENCES
27 dl
28 ${Boost_LIBRARIES}
29)
2630
27set(MIR_COMMON_SOURCES ${MIR_COMMON_SOURCES} PARENT_SCOPE)31set(MIR_COMMON_SOURCES ${MIR_COMMON_SOURCES} PARENT_SCOPE)
28set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)32set(MIR_COMMON_REFERENCES ${MIR_COMMON_REFERENCES} PARENT_SCOPE)
2933
=== added file 'src/shared/sharedlibrary/shared_library_prober.cpp'
--- src/shared/sharedlibrary/shared_library_prober.cpp 1970-01-01 00:00:00 +0000
+++ src/shared/sharedlibrary/shared_library_prober.cpp 2014-08-29 01:18:58 +0000
@@ -0,0 +1,63 @@
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/shared_library_prober.h"
20#include "mir/shared_library.h"
21
22#include <system_error>
23#include <boost/filesystem.hpp>
24
25std::vector<std::shared_ptr<mir::SharedLibrary>>
26mir::libraries_for_path(std::string const& path, mir::SharedLibraryProberReport& report)
27{
28 report.probing_path(path);
29 // We use the error_code overload because we want to throw a std::system_error
30 boost::system::error_code ec;
31 boost::filesystem::directory_iterator iterator{path, ec};
32 if (ec)
33 {
34 // *Of course* there's no good way to go from a boost::error_code to a std::error_code
35 if (ec.category() == boost::system::system_category())
36 {
37 std::system_error error{ec.value(), std::system_category()};
38 report.probing_failed(path, error);
39 throw error;
40 }
41 else
42 {
43 throw std::runtime_error{"Boost error from unknown category"};
44 }
45 }
46 std::vector<std::shared_ptr<mir::SharedLibrary>> libraries;
47 for (; iterator != boost::filesystem::directory_iterator() ; ++iterator)
48 {
49 if (iterator->path().extension().string() == ".so")
50 {
51 try
52 {
53 report.loading_library(iterator->path());
54 libraries.emplace_back(std::make_shared<mir::SharedLibrary>(iterator->path().string()));
55 }
56 catch (std::runtime_error const& err)
57 {
58 report.loading_failed(iterator->path(), err);
59 }
60 }
61 }
62 return libraries;
63}
064
=== modified file 'src/shared/symbols.map'
--- src/shared/symbols.map 2014-08-25 11:03:32 +0000
+++ src/shared/symbols.map 2014-08-29 01:18:58 +0000
@@ -130,12 +130,19 @@
130 mir::input::receiver::XKBMapper::update_state_and_map_event*;130 mir::input::receiver::XKBMapper::update_state_and_map_event*;
131 mir::input::receiver::XKBMapper::?XKBMapper*;131 mir::input::receiver::XKBMapper::?XKBMapper*;
132 mir::input::receiver::XKBMapper::XKBMapper*;132 mir::input::receiver::XKBMapper::XKBMapper*;
133 mir::libraries_for_path*;
133 mir::logging::DumbConsoleLogger::log*;134 mir::logging::DumbConsoleLogger::log*;
134 mir::logging::input_timestamp*;135 mir::logging::input_timestamp*;
135 mir::logging::Logger::log*;136 mir::logging::Logger::log*;
136 mir::logging::Logger::?Logger*;137 mir::logging::Logger::?Logger*;
137 mir::logging::Logger::Logger*;138 mir::logging::Logger::Logger*;
138 mir::logging::Logger::operator*;139 mir::logging::Logger::operator*;
140 mir::logging::SharedLibraryProberReport::?SharedLibraryProberReport*;
141 mir::logging::SharedLibraryProberReport::SharedLibraryProberReport*;
142 mir::logging::SharedLibraryProberReport::probing_path*;
143 mir::logging::SharedLibraryProberReport::probing_failed*;
144 mir::logging::SharedLibraryProberReport::loading_library*;
145 mir::logging::SharedLibraryProberReport::loading_failed*;
139 mir_omnidirectional_resize_cursor_name*;146 mir_omnidirectional_resize_cursor_name*;
140 mir_open_hand_cursor_name*;147 mir_open_hand_cursor_name*;
141 mir_pointing_hand_cursor_name*;148 mir_pointing_hand_cursor_name*;
@@ -807,6 +814,7 @@
807 typeinfo?for?MirKeyEvent;814 typeinfo?for?MirKeyEvent;
808 typeinfo?for?mir::logging::DumbConsoleLogger;815 typeinfo?for?mir::logging::DumbConsoleLogger;
809 typeinfo?for?mir::logging::Logger;816 typeinfo?for?mir::logging::Logger;
817 typeinfo?for?mir::logging::SharedLibraryProberReport;
810 typeinfo?for?MirMesaEGLNativeDisplay;818 typeinfo?for?MirMesaEGLNativeDisplay;
811 typeinfo?for?MirMesaEGLNativeSurface;819 typeinfo?for?MirMesaEGLNativeSurface;
812 typeinfo?for?MirMotionEvent;820 typeinfo?for?MirMotionEvent;
@@ -899,6 +907,7 @@
899 vtable?for?MirKeyEvent;907 vtable?for?MirKeyEvent;
900 vtable?for?mir::logging::DumbConsoleLogger;908 vtable?for?mir::logging::DumbConsoleLogger;
901 vtable?for?mir::logging::Logger;909 vtable?for?mir::logging::Logger;
910 vtable?for?mir::logging::SharedLibraryProberReport;
902 vtable?for?MirMesaEGLNativeDisplay;911 vtable?for?MirMesaEGLNativeDisplay;
903 vtable?for?MirMesaEGLNativeSurface;912 vtable?for?MirMesaEGLNativeSurface;
904 vtable?for?MirMotionEvent;913 vtable?for?MirMotionEvent;
905914
=== modified file 'tests/acceptance-tests/CMakeLists.txt'
--- tests/acceptance-tests/CMakeLists.txt 2014-08-06 15:15:35 +0000
+++ tests/acceptance-tests/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -90,8 +90,10 @@
90 "MIR_BUILD_ACCEPTANCE_TESTS"90 "MIR_BUILD_ACCEPTANCE_TESTS"
91 OFF)91 OFF)
9292
93set (MIR_CLIENT_PLATFORM client-platform-dummy.so)
94
93if (MIR_RUN_ACCEPTANCE_TESTS)95if (MIR_RUN_ACCEPTANCE_TESTS)
94 mir_discover_tests(mir_acceptance_tests)96 mir_discover_tests(mir_acceptance_tests MIR_CLIENT_PLATFORM_LIB=${LIBRARY_OUTPUT_PATH}/${MIR_CLIENT_PLATFORM})
95endif (MIR_RUN_ACCEPTANCE_TESTS)97endif (MIR_RUN_ACCEPTANCE_TESTS)
9698
97install(99install(
98100
=== modified file 'tests/acceptance-tests/test_symbols_required_by_mesa.cpp'
--- tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2014-07-30 13:19:36 +0000
+++ tests/acceptance-tests/test_symbols_required_by_mesa.cpp 2014-08-29 01:18:58 +0000
@@ -23,9 +23,9 @@
2323
24using namespace testing;24using namespace testing;
2525
26TEST(SymbolsRequiredByMesa, are_exported_by_libmirclientplatform)26TEST(SymbolsRequiredByMesa, are_exported_by_client_platform_mesa)
27{27{
28 auto const handle = dlopen("libmirclientplatform.so", RTLD_LAZY);28 auto const handle = dlopen("client-platform-mesa.so", RTLD_LAZY);
29 ASSERT_THAT(handle, NotNull());29 ASSERT_THAT(handle, NotNull());
3030
31 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");31 auto const sym = dlsym(handle, "mir_client_mesa_egl_native_display_is_valid");
@@ -36,7 +36,7 @@
3636
37TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics)37TEST(SymbolsRequiredByMesa, are_exported_by_libmirplatformgraphics)
38{38{
39 auto const handle = dlopen("libmirplatformgraphics.so", RTLD_LAZY);39 auto const handle = dlopen("platform-graphics-mesa.so", RTLD_LAZY);
40 ASSERT_THAT(handle, NotNull());40 ASSERT_THAT(handle, NotNull());
4141
42 auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid");42 auto const sym = dlsym(handle, "mir_server_mesa_egl_native_display_is_valid");
4343
=== modified file 'tests/integration-tests/CMakeLists.txt'
--- tests/integration-tests/CMakeLists.txt 2014-08-26 09:27:49 +0000
+++ tests/integration-tests/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -71,6 +71,15 @@
71 ${GTEST_BOTH_LIBRARIES}71 ${GTEST_BOTH_LIBRARIES}
72 ${GMOCK_LIBRARY}72 ${GMOCK_LIBRARY}
73 ${GMOCK_MAIN_LIBRARY}73 ${GMOCK_MAIN_LIBRARY}
74 # Mesa platform dependencies
75 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
76 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
77 # Android platform dependencies
78 ${LIBHARDWARE_LIBRARIES}
79 ${ANDROID_PROPERTIES_LIBRARIES}
80 # Shared platform dependencies
81 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
82 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
74 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.83 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
75 ${DRM_LDFLAGS} ${DRM_LIBRARIES}84 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
76 ${GBM_LDFLAGS} ${GBM_LIBRARIES}85 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
@@ -79,7 +88,7 @@
79 ${MIR_SERVER_REFERENCES}88 ${MIR_SERVER_REFERENCES}
80)89)
8190
82if (MIR_TEST_PLATFORM STREQUAL "android")91if (MIR_BUILD_PLATFORM_ANDROID)
83target_link_libraries(mir_integration_tests92target_link_libraries(mir_integration_tests
84 mirsharedandroid93 mirsharedandroid
85 ${ANDROID_PROPERTIES_LDFLAGS}94 ${ANDROID_PROPERTIES_LDFLAGS}
@@ -93,8 +102,18 @@
93 "MIR_BUILD_INTEGRATION_TESTS"102 "MIR_BUILD_INTEGRATION_TESTS"
94 OFF)103 OFF)
95104
105set (MIR_CLIENT_MODULE "client-platform-dummy.so")
106
107if (MIR_TEST_PLATFORM STREQUAL "android")
108 # Android platform integration tests have Android-specific tests
109 # requiring a real platform
110 set (MIR_CLIENT_MODULE "client-platform-android.so")
111endif()
112
96if (MIR_RUN_INTEGRATION_TESTS)113if (MIR_RUN_INTEGRATION_TESTS)
97 mir_discover_tests(mir_integration_tests)114 mir_discover_tests(mir_integration_tests
115 MIR_CLIENT_PLATFORM_LIB=${LIBRARY_OUTPUT_PATH}/${MIR_CLIENT_MODULE}
116 )
98endif (MIR_RUN_INTEGRATION_TESTS)117endif (MIR_RUN_INTEGRATION_TESTS)
99118
100install(119install(
101120
=== modified file 'tests/mir_test_doubles/CMakeLists.txt'
--- tests/mir_test_doubles/CMakeLists.txt 2014-08-15 15:04:40 +0000
+++ tests/mir_test_doubles/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -23,16 +23,19 @@
23 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gl.cpp23 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gl.cpp
24)24)
2525
26if (MIR_TEST_PLATFORM STREQUAL "mesa")26if (MIR_BUILD_PLATFORM_MESA)
27include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})27 include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
28list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS28 list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS
29 ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp29 ${CMAKE_CURRENT_SOURCE_DIR}/mock_drm.cpp
30 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp30 ${CMAKE_CURRENT_SOURCE_DIR}/mock_gbm.cpp
31)31 )
32elseif (MIR_TEST_PLATFORM STREQUAL "android")32endif()
33list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS33
34 ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp34if (MIR_BUILD_PLATFORM_ANDROID)
35)35 include_directories(${ANDROID_HEADERS_INCLUDE_DIRS})
36 list(APPEND MIR_TEST_DOUBLES_PLATFORM_SRCS
37 ${CMAKE_CURRENT_SOURCE_DIR}/mock_android_hw.cpp
38 )
36endif()39endif()
3740
38add_library(41add_library(
3942
=== modified file 'tests/mir_test_framework/CMakeLists.txt'
--- tests/mir_test_framework/CMakeLists.txt 2014-08-15 15:04:40 +0000
+++ tests/mir_test_framework/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -3,6 +3,7 @@
3 ${GLESv2_INCLUDE_DIRS}3 ${GLESv2_INCLUDE_DIRS}
4 ${CMAKE_SOURCE_DIR}4 ${CMAKE_SOURCE_DIR}
5 ${UMOCKDEV_INCLUDE_DIRS}5 ${UMOCKDEV_INCLUDE_DIRS}
6 ${ANDROID_HEADERS_INCLUDE_DIRS}
6)7)
78
8set(9set(
@@ -23,6 +24,7 @@
23 using_stub_client_platform.cpp24 using_stub_client_platform.cpp
24 udev_environment.cpp25 udev_environment.cpp
25 declarative_placement_strategy.cpp26 declarative_placement_strategy.cpp
27 stub_client_platform_factory.cpp
26)28)
2729
28list(APPEND TEST_FRAMEWORK_SRCS30list(APPEND TEST_FRAMEWORK_SRCS
@@ -52,6 +54,42 @@
52 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.54 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
53)55)
5456
57set(symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-client.map)
58
59add_library(
60 mirclientplatformstub MODULE
61
62 stub_client_platform_module.cpp
63)
64
65target_link_libraries(
66 mirclientplatformstub
67
68 mir-test-framework
69)
70
71set_target_properties(
72 mirclientplatformstub PROPERTIES;
73 OUTPUT_NAME client-platform-dummy
74 PREFIX ""
75 LINK_FLAGS "-Wl,--version-script,${symbol_map}"
76)
77
78set(server_symbol_map ${CMAKE_CURRENT_SOURCE_DIR}/symbols-server.map)
79add_library(
80 mirplatformgraphicsstub MODULE
81
82 platform_graphics_dummy.cpp
83)
84
85set_target_properties(
86 mirplatformgraphicsstub PROPERTIES;
87 OUTPUT_NAME platform-graphics-dummy
88 PREFIX ""
89 LINK_FLAGS "-Wl,--version-script,${server_symbol_map}"
90)
91
92
55add_custom_command(TARGET mir-test-framework POST_BUILD93add_custom_command(TARGET mir-test-framework POST_BUILD
56 COMMAND ${CMAKE_COMMAND} -E copy_directory94 COMMAND ${CMAKE_COMMAND} -E copy_directory
57 ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings95 ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_BINARY_DIR}/bin/udev_recordings
5896
=== modified file 'tests/mir_test_framework/executable_path.cpp'
--- tests/mir_test_framework/executable_path.cpp 2014-07-29 12:28:04 +0000
+++ tests/mir_test_framework/executable_path.cpp 2014-08-29 01:18:58 +0000
@@ -38,3 +38,8 @@
38 buf[tmp] = '\0';38 buf[tmp] = '\0';
39 return dirname(buf);39 return dirname(buf);
40}40}
41
42std::string mir_test_framework::library_path()
43{
44 return executable_path() + "/../lib";
45}
4146
=== 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-08-29 01:18:58 +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-08-29 01:18:58 +0000
@@ -0,0 +1,143 @@
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
94struct StubClientBufferFactory : public mcl::ClientBufferFactory
95{
96 std::shared_ptr<mcl::ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const& package,
97 geom::Size, MirPixelFormat)
98 {
99 return std::make_shared<StubClientBuffer>(package);
100 }
101};
102
103struct StubClientPlatform : public mcl::ClientPlatform
104{
105 MirPlatformType platform_type() const
106 {
107 return mir_platform_type_gbm;
108 }
109
110 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
111 {
112 return std::make_shared<StubClientBufferFactory>();
113 }
114
115 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*)
116 {
117 auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678lu);
118 return std::make_shared<EGLNativeWindowType>(fake_window);
119 }
120
121 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display()
122 {
123 auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678lu);
124 return std::make_shared<EGLNativeDisplayType>(fake_display);
125 }
126
127 MirNativeBuffer* convert_native_buffer(mir::graphics::NativeBuffer* buf) const
128 {
129 static_cast<void>(buf);
130#ifndef ANDROID
131 return buf;
132#else
133 return nullptr;
134#endif
135 }
136};
137}
138
139std::shared_ptr<mcl::ClientPlatform>
140mtf::StubClientPlatformFactory::create_client_platform(mcl::ClientContext*)
141{
142 return std::make_shared<StubClientPlatform>();
143}
0144
=== 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-08-29 01:18:58 +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/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-08-29 01:18:58 +0000
@@ -0,0 +1,7 @@
1MIR_CLIENTPLATFORM_1 {
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-08-29 01:18:58 +0000
@@ -0,0 +1,10 @@
1MIR_GRAPHICS_PLATFORM_1 {
2 global:
3 add_platform_options;
4 create_platform;
5 create_native_platform;
6 probe_platform;
7 describe_module;
8 local:
9 *;
10};
011
=== modified file 'tests/mir_test_framework/testing_client_options.cpp'
--- tests/mir_test_framework/testing_client_options.cpp 2014-07-14 06:49:52 +0000
+++ tests/mir_test_framework/testing_client_options.cpp 2014-08-29 01:18:58 +0000
@@ -16,112 +16,12 @@
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17 */17 */
1818
19#include "mir_test_framework/testing_client_configuration.h"
20#include "mir_test_framework/stub_client_connection_configuration.h"19#include "mir_test_framework/stub_client_connection_configuration.h"
21#include "mir/options/program_option.h"
22#include "src/client/default_connection_configuration.h"20#include "src/client/default_connection_configuration.h"
23#include "src/client/client_platform_factory.h"21#include "mir_test_framework/stub_client_platform_factory.h"
24#include "src/client/client_buffer_factory.h"
25#include "src/client/client_buffer.h"
26#include "src/client/client_platform.h"
27#include "src/client/mir_connection.h"
2822
29namespace mcl = mir::client;23namespace mcl = mir::client;
30namespace mtf=mir_test_framework;24namespace mtf = mir_test_framework;
31namespace geom = mir::geometry;
32
33
34namespace
35{
36class StubClientBuffer : public mcl::ClientBuffer
37{
38 std::shared_ptr<mcl::MemoryRegion> secure_for_cpu_write()
39 {
40 return nullptr;
41 }
42
43 geom::Size size() const
44 {
45 return geom::Size{};
46 }
47
48 geom::Stride stride() const
49 {
50 return geom::Stride{};
51 }
52
53 MirPixelFormat pixel_format() const
54 {
55 return mir_pixel_format_abgr_8888;
56 }
57
58 uint32_t age() const
59 {
60 return 0;
61 }
62 void increment_age()
63 {
64 }
65 void mark_as_submitted()
66 {
67 }
68 std::shared_ptr<mir::graphics::NativeBuffer> native_buffer_handle() const
69 {
70 return nullptr;
71 }
72 void update_from(MirBufferPackage const&) override
73 {
74 }
75};
76
77struct StubClientBufferFactory : public mcl::ClientBufferFactory
78{
79 std::shared_ptr<mcl::ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const&,
80 geom::Size, MirPixelFormat)
81 {
82 return std::make_shared<StubClientBuffer>();
83 }
84};
85
86struct StubClientPlatform : public mcl::ClientPlatform
87{
88 MirPlatformType platform_type() const
89 {
90 return mir_platform_type_gbm;
91 }
92
93 std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
94 {
95 return std::make_shared<StubClientBufferFactory>();
96 }
97
98 std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*)
99 {
100 auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678lu);
101 return std::make_shared<EGLNativeWindowType>(fake_window);
102 }
103
104 std::shared_ptr<EGLNativeDisplayType> create_egl_native_display()
105 {
106 auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678lu);
107 return std::make_shared<EGLNativeDisplayType>(fake_display);
108 }
109
110 MirNativeBuffer* convert_native_buffer(mir::graphics::NativeBuffer*) const
111 {
112 return nullptr;
113 }
114};
115
116struct StubClientPlatformFactory : public mcl::ClientPlatformFactory
117{
118 std::shared_ptr<mcl::ClientPlatform> create_client_platform(mcl::ClientContext*)
119 {
120 return std::make_shared<StubClientPlatform>();
121 }
122};
123
124}
12525
126mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)26mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)
127 : DefaultConnectionConfiguration(socket_file)27 : DefaultConnectionConfiguration(socket_file)
12828
=== modified file 'tests/unit-tests/CMakeLists.txt'
--- tests/unit-tests/CMakeLists.txt 2014-08-26 09:27:49 +0000
+++ tests/unit-tests/CMakeLists.txt 2014-08-29 01:18:58 +0000
@@ -2,7 +2,23 @@
22
3add_definitions(-DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/")3add_definitions(-DTEST_RECORDINGS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/input_recordings/")
44
5include_directories(${DRM_INCLUDE_DIRS} ${GBM_INCLUDE_DIRS} ${UMOCKDEV_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})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
13set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
14
15include_directories(
16 ${ANDROID_HEADERS_INCLUDE_DIRS}
17 ${DRM_INCLUDE_DIRS}
18 ${GBM_INCLUDE_DIRS}
19 ${UMOCKDEV_INCLUDE_DIRS}
20 ${CMAKE_SOURCE_DIR}
21)
6# TODO: Aim to remove22# TODO: Aim to remove
7include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES})23include_directories(${MIR_XCURSOR_INCLUDE_DIRECTORIES})
824
@@ -19,8 +35,10 @@
19 test_thread_name.cpp35 test_thread_name.cpp
20 test_default_emergency_cleanup.cpp36 test_default_emergency_cleanup.cpp
21 test_basic_observers.cpp37 test_basic_observers.cpp
38 test_shared_library_prober.cpp
22 test_fatal.cpp39 test_fatal.cpp
23 test_fd.cpp40 test_fd.cpp
41 test_shared_library_prober.cpp
24)42)
2543
26add_subdirectory(options/)44add_subdirectory(options/)
@@ -71,6 +89,15 @@
71 ${GMOCK_MAIN_LIBRARY}89 ${GMOCK_MAIN_LIBRARY}
72 ${Boost_LIBRARIES}90 ${Boost_LIBRARIES}
73 ${UMOCKDEV_LIBRARIES}91 ${UMOCKDEV_LIBRARIES}
92 # Mesa platform dependencies
93 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
94 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
95 # Android platform dependencies
96 ${LIBHARDWARE_LIBRARIES}
97 ${ANDROID_PROPERTIES_LIBRARIES}
98 # Shared platform dependencies
99 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
100 ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
74 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.101 ${CMAKE_THREAD_LIBS_INIT} # Link in pthread.
75 ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES}102 ${LIBHARDWARE_LDFLAGS} ${LIBHARDWARE_LIBRARIES}
76 ${DRM_LDFLAGS} ${DRM_LIBRARIES}103 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
@@ -79,7 +106,7 @@
79 ${MIR_SERVER_REFERENCES}106 ${MIR_SERVER_REFERENCES}
80)107)
81108
82if (MIR_TEST_PLATFORM STREQUAL "android")109if (MIR_BUILD_PLATFORM_ANDROID)
83target_link_libraries(mir_unit_tests 110target_link_libraries(mir_unit_tests
84 mirsharedandroid111 mirsharedandroid
85 ${ANDROID_PROPERTIES_LDFLAGS}112 ${ANDROID_PROPERTIES_LDFLAGS}
@@ -96,11 +123,23 @@
96 "MIR_BUILD_UNIT_TESTS"123 "MIR_BUILD_UNIT_TESTS"
97 OFF)124 OFF)
98125
126set (MIR_CLIENT_PLATFORM client-platform-dummy.so)
127
99if (MIR_RUN_UNIT_TESTS)128if (MIR_RUN_UNIT_TESTS)
100 mir_discover_tests(mir_unit_tests LD_PRELOAD=libumockdev-preload.so.0 G_SLICE=always-malloc G_DEBUG=gc-friendly)129 mir_discover_tests(mir_unit_tests
130 LD_PRELOAD=libumockdev-preload.so.0
131 G_SLICE=always-malloc
132 G_DEBUG=gc-friendly
133 MIR_CLIENT_PLATFORM_LIB=${LIBRARY_OUTPUT_PATH}/${MIR_CLIENT_PLATFORM})
101endif (MIR_RUN_UNIT_TESTS)134endif (MIR_RUN_UNIT_TESTS)
102135
103install(136install(
104 TARGETS mir_unit_tests137 TARGETS mir_unit_tests
105 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}138 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
106)139)
140
141add_custom_command(TARGET mir_unit_tests POST_BUILD
142 COMMAND ${CMAKE_COMMAND} -E copy_directory
143 ${CMAKE_CURRENT_SOURCE_DIR}/test_data ${CMAKE_BINARY_DIR}/bin/test_data
144 COMMENT "Copying test data to build dir..."
145)
107146
=== modified file 'tests/unit-tests/client/CMakeLists.txt'
--- tests/unit-tests/client/CMakeLists.txt 2014-07-30 15:25:54 +0000
+++ tests/unit-tests/client/CMakeLists.txt 2014-08-29 01:18:58 +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)16)
1617
17if(MIR_TEST_PLATFORM STREQUAL "android")18if(MIR_TEST_PLATFORM STREQUAL "android")
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-08-29 01:18:58 +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-08-29 01:18:58 +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-08-29 01:18:58 +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-08-29 01:18:58 +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-platform-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-platform-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-08-29 01:18:58 +0000
@@ -0,0 +1,116 @@
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-platform-mesa.so"));
39#endif
40#ifdef MIR_BUILD_PLATFORM_ANDROID
41 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/client-platform-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
0117
=== modified file 'tests/unit-tests/graphics/CMakeLists.txt'
--- tests/unit-tests/graphics/CMakeLists.txt 2014-07-02 06:29:24 +0000
+++ tests/unit-tests/graphics/CMakeLists.txt 2014-08-29 01:18:58 +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_android_platform.cpp'
--- tests/unit-tests/graphics/android/test_android_platform.cpp 2014-08-07 13:22:53 +0000
+++ tests/unit-tests/graphics/android/test_android_platform.cpp 2014-08-29 01:18:58 +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{
@@ -154,6 +157,27 @@
154 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());157 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());
155}158}
156159
160TEST(AndroidGraphicsPlatform, probe_returns_unsupported_when_no_hwaccess)
161{
162 using namespace testing;
163 NiceMock<mtd::HardwareAccessMock> hwaccess;
164
165 ON_CALL(hwaccess, hw_get_module(_,_)).WillByDefault(Return(-1));
166
167 mir::SharedLibrary platform_lib{mtf::library_path() + "/platform-graphics-android.so"};
168 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
169 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
170}
171
172TEST(AndroidGraphicsPlatform, probe_returns_best_when_hwaccess_succeeds)
173{
174 testing::NiceMock<mtd::HardwareAccessMock> hwaccess;
175
176 mir::SharedLibrary platform_lib{mtf::library_path() + "/platform-graphics-android.so"};
177 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
178 EXPECT_EQ(mg::PlatformPriority::best, probe());
179}
180
157TEST(NestedPlatformCreation, doesnt_access_display_hardware)181TEST(NestedPlatformCreation, doesnt_access_display_hardware)
158{182{
159 using namespace testing;183 using namespace testing;
160184
=== modified file 'tests/unit-tests/graphics/android/test_output_builder.cpp'
--- tests/unit-tests/graphics/android/test_output_builder.cpp 2014-07-02 06:29:24 +0000
+++ tests/unit-tests/graphics/android/test_output_builder.cpp 2014-08-29 01:18:58 +0000
@@ -108,9 +108,10 @@
108 mtd::StubGLConfig stub_gl_config;108 mtd::StubGLConfig stub_gl_config;
109 mga::PbufferGLContext gl_context{109 mga::PbufferGLContext gl_context{
110 mga::to_mir_format(mock_egl.fake_visual_id), stub_gl_config, mock_display_report};110 mga::to_mir_format(mock_egl.fake_visual_id), stub_gl_config, mock_display_report};
111 mtd::StubGLProgramFactory const stub_program_factory;111 mtd::StubGLProgramFactory stub_program_factory;
112};112};
113}113}
114
114TEST_F(OutputBuilder, hwc_version_10_success)115TEST_F(OutputBuilder, hwc_version_10_success)
115{116{
116 using namespace testing;117 using namespace testing;
117118
=== modified file 'tests/unit-tests/graphics/mesa/test_platform.cpp'
--- tests/unit-tests/graphics/mesa/test_platform.cpp 2014-08-07 13:22:53 +0000
+++ tests/unit-tests/graphics/mesa/test_platform.cpp 2014-08-29 01:18:58 +0000
@@ -23,6 +23,7 @@
23#include "src/platform/graphics/mesa/internal_client.h"23#include "src/platform/graphics/mesa/internal_client.h"
24#include "src/server/report/null_report_factory.h"24#include "src/server/report/null_report_factory.h"
25#include "mir/emergency_cleanup_registry.h"25#include "mir/emergency_cleanup_registry.h"
26#include "mir/shared_library.h"
2627
27#include "mir_test_doubles/mock_buffer.h"28#include "mir_test_doubles/mock_buffer.h"
28#include "mir_test_doubles/mock_buffer_packer.h"29#include "mir_test_doubles/mock_buffer_packer.h"
@@ -33,6 +34,7 @@
33#include <gtest/gtest.h>34#include <gtest/gtest.h>
3435
35#include "mir_test_framework/udev_environment.h"36#include "mir_test_framework/udev_environment.h"
37#include "mir_test_framework/executable_path.h"
36#include "mir_test/pipe.h"38#include "mir_test/pipe.h"
3739
38#include "mir_test_doubles/mock_drm.h"40#include "mir_test_doubles/mock_drm.h"
@@ -384,3 +386,23 @@
384386
385 Mock::VerifyAndClearExpectations(&mock_drm);387 Mock::VerifyAndClearExpectations(&mock_drm);
386}388}
389
390TEST_F(MesaGraphicsPlatform, probe_returns_unsupported_when_no_drm_udev_devices)
391{
392 mtf::UdevEnvironment udev_environment;
393
394 mir::SharedLibrary platform_lib{mtf::library_path() + "/platform-graphics-mesa.so"};
395 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
396 EXPECT_EQ(mg::PlatformPriority::unsupported, probe());
397}
398
399TEST_F(MesaGraphicsPlatform, probe_returns_best_when_drm_devices_exist)
400{
401 mtf::UdevEnvironment udev_environment;
402
403 udev_environment.add_standard_device("standard-drm-devices");
404
405 mir::SharedLibrary platform_lib{mtf::library_path() + "/platform-graphics-mesa.so"};
406 auto probe = platform_lib.load_function<mg::PlatformProbe>("probe_platform");
407 EXPECT_EQ(mg::PlatformPriority::best, probe());
408}
387409
=== 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-08-29 01:18:58 +0000
@@ -0,0 +1,194 @@
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() + "/platform-graphics-mesa.so"));
49#endif
50#ifdef MIR_BUILD_PLATFORM_ANDROID
51 modules.push_back(std::make_shared<mir::SharedLibrary>(mtf::library_path() + "/platform-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() + "/platform-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}
0195
=== modified file 'tests/unit-tests/shared_library_test.cpp'
--- tests/unit-tests/shared_library_test.cpp 2013-06-21 12:08:34 +0000
+++ tests/unit-tests/shared_library_test.cpp 2014-08-29 01:18:58 +0000
@@ -21,15 +21,19 @@
21#include <gtest/gtest.h>21#include <gtest/gtest.h>
2222
23#include <boost/exception/diagnostic_information.hpp>23#include <boost/exception/diagnostic_information.hpp>
24
25#include <stdexcept>24#include <stdexcept>
2625
26#include "mir_test_framework/executable_path.h"
27
28namespace mtf = mir_test_framework;
29
27namespace30namespace
28{31{
29class HasSubstring32class HasSubstring
30{33{
31public:34public:
32 HasSubstring(char const* substring) : substring(substring) {}35 HasSubstring(char const* substring) : substring(substring) {}
36 HasSubstring(std::string const& substring) : substring{substring.c_str()} {}
3337
34 friend::testing::AssertionResult operator,(std::string const& target, HasSubstring const& match)38 friend::testing::AssertionResult operator,(std::string const& target, HasSubstring const& match)
35 {39 {
@@ -50,18 +54,31 @@
5054
51#define EXPECT_THAT(target, condition) EXPECT_TRUE((target, condition))55#define EXPECT_THAT(target, condition) EXPECT_TRUE((target, condition))
5256
53char const* const nonexistent_library = "nonexistent_library";57class SharedLibrary : public testing::Test
54char const* const existing_library = "libmirplatformgraphics.so";58{
55char const* const nonexistent_function = "nonexistent_library";59public:
56char const* const existing_function = "create_platform";60 SharedLibrary()
61 : nonexistent_library{"imma_totally_not_a_library"},
62 existing_library{mtf::library_path() + "/client-platform-mesa.so"},
63 nonexistent_function{"yo_dawg"},
64 existing_function{"create_client_platform"}
65 {
66 }
67
68 std::string const nonexistent_library;
69 std::string const existing_library;
70 std::string const nonexistent_function;
71 std::string const existing_function;
72};
73
57}74}
5875
59TEST(SharedLibrary, load_nonexistent_library_fails)76TEST_F(SharedLibrary, load_nonexistent_library_fails)
60{77{
61 EXPECT_THROW({ mir::SharedLibrary nonexistent(nonexistent_library); }, std::runtime_error);78 EXPECT_THROW({ mir::SharedLibrary nonexistent(nonexistent_library); }, std::runtime_error);
62}79}
6380
64TEST(SharedLibrary, load_nonexistent_library_fails_with_useful_info)81TEST_F(SharedLibrary, load_nonexistent_library_fails_with_useful_info)
65{82{
66 try83 try
67 {84 {
@@ -76,19 +93,19 @@
76 }93 }
77}94}
7895
79TEST(SharedLibrary, load_valid_library_works)96TEST_F(SharedLibrary, load_valid_library_works)
80{97{
81 mir::SharedLibrary existing(existing_library);98 mir::SharedLibrary existing(existing_library);
82}99}
83100
84TEST(SharedLibrary, load_nonexistent_function_fails)101TEST_F(SharedLibrary, load_nonexistent_function_fails)
85{102{
86 mir::SharedLibrary existing(existing_library);103 mir::SharedLibrary existing(existing_library);
87104
88 EXPECT_THROW({ existing.load_function<void(*)()>(nonexistent_function); }, std::runtime_error);105 EXPECT_THROW({ existing.load_function<void(*)()>(nonexistent_function); }, std::runtime_error);
89}106}
90107
91TEST(SharedLibrary, load_nonexistent_function_fails_with_useful_info)108TEST_F(SharedLibrary, load_nonexistent_function_fails_with_useful_info)
92{109{
93 mir::SharedLibrary existing(existing_library);110 mir::SharedLibrary existing(existing_library);
94111
@@ -106,7 +123,7 @@
106 }123 }
107}124}
108125
109TEST(SharedLibrary, load_valid_function_works)126TEST_F(SharedLibrary, load_valid_function_works)
110{127{
111 mir::SharedLibrary existing(existing_library);128 mir::SharedLibrary existing(existing_library);
112 existing.load_function<void(*)()>(existing_function);129 existing.load_function<void(*)()>(existing_function);
113130
=== added directory 'tests/unit-tests/test_data'
=== added file 'tests/unit-tests/test_data/libamd64.so'
114Binary files tests/unit-tests/test_data/libamd64.so 1970-01-01 00:00:00 +0000 and tests/unit-tests/test_data/libamd64.so 2014-08-29 01:18:58 +0000 differ131Binary files tests/unit-tests/test_data/libamd64.so 1970-01-01 00:00:00 +0000 and tests/unit-tests/test_data/libamd64.so 2014-08-29 01:18:58 +0000 differ
=== added file 'tests/unit-tests/test_data/libarmhf.so'
115Binary files tests/unit-tests/test_data/libarmhf.so 1970-01-01 00:00:00 +0000 and tests/unit-tests/test_data/libarmhf.so 2014-08-29 01:18:58 +0000 differ132Binary files tests/unit-tests/test_data/libarmhf.so 1970-01-01 00:00:00 +0000 and tests/unit-tests/test_data/libarmhf.so 2014-08-29 01:18:58 +0000 differ
=== added file 'tests/unit-tests/test_shared_library_prober.cpp'
--- tests/unit-tests/test_shared_library_prober.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit-tests/test_shared_library_prober.cpp 2014-08-29 01:18:58 +0000
@@ -0,0 +1,165 @@
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/shared_library_prober.h"
20
21#include "mir_test_framework/executable_path.h"
22
23#include <system_error>
24
25#include <gtest/gtest.h>
26#include <gmock/gmock.h>
27
28namespace mtf = mir_test_framework;
29
30namespace
31{
32
33class MockSharedLibraryProberReport : public mir::SharedLibraryProberReport
34{
35public:
36 MOCK_METHOD1(probing_path, void(boost::filesystem::path const&));
37 MOCK_METHOD2(probing_failed, void(boost::filesystem::path const&, std::exception const&));
38 MOCK_METHOD1(loading_library, void(boost::filesystem::path const&));
39 MOCK_METHOD2(loading_failed, void(boost::filesystem::path const&, std::exception const&));
40};
41
42class SharedLibraryProber : public testing::Test
43{
44public:
45 SharedLibraryProber()
46 : library_path{mtf::executable_path() + "/test_data"}
47 {
48 }
49
50 std::string const library_path;
51 testing::NiceMock<MockSharedLibraryProberReport> null_report;
52};
53
54}
55
56TEST_F(SharedLibraryProber, ReturnsNonEmptyListForPathContainingLibraries)
57{
58 auto libraries = mir::libraries_for_path(library_path, null_report);
59 EXPECT_GE(libraries.size(), 1);
60}
61
62TEST_F(SharedLibraryProber, RaisesExceptionForNonexistentPath)
63{
64 EXPECT_THROW(mir::libraries_for_path("/a/path/that/certainly/doesnt/exist", null_report),
65 std::system_error);
66}
67
68TEST_F(SharedLibraryProber, NonExistentPathRaisesENOENTError)
69{
70 try
71 {
72 mir::libraries_for_path("/a/path/that/certainly/doesnt/exist", null_report);
73 }
74 catch (std::system_error &err)
75 {
76 EXPECT_EQ(err.code(), std::error_code(ENOENT, std::system_category()));
77 }
78}
79
80TEST_F(SharedLibraryProber, PathWithNoSharedLibrariesReturnsEmptyList)
81{
82 // /usr is guaranteed to exist, and shouldn't contain any libraries
83 auto libraries = mir::libraries_for_path("/usr", null_report);
84 EXPECT_EQ(0, libraries.size());
85}
86
87TEST_F(SharedLibraryProber, LogsStartOfProbe)
88{
89 using namespace testing;
90 testing::NiceMock<MockSharedLibraryProberReport> report;
91
92 EXPECT_CALL(report, probing_path(testing::Eq(library_path)));
93
94 mir::libraries_for_path(library_path, report);
95}
96
97TEST_F(SharedLibraryProber, LogsForNonexistentPath)
98{
99 using namespace testing;
100 NiceMock<MockSharedLibraryProberReport> report;
101
102 EXPECT_CALL(report, probing_path(testing::Eq("/yo/dawg/I/heard/you/liked/slashes")));
103
104 EXPECT_THROW(mir::libraries_for_path("/yo/dawg/I/heard/you/liked/slashes", report),
105 std::runtime_error);
106}
107
108TEST_F(SharedLibraryProber, LogsFailureForNonexistentPath)
109{
110 using namespace testing;
111 NiceMock<MockSharedLibraryProberReport> report;
112
113 EXPECT_CALL(report, probing_failed(Eq("/yo/dawg/I/heard/you/liked/slashes"), _));
114
115 EXPECT_THROW(mir::libraries_for_path("/yo/dawg/I/heard/you/liked/slashes", report),
116 std::runtime_error);
117
118}
119
120TEST_F(SharedLibraryProber, LogsNoLibrariesForPathWithoutLibraries)
121{
122 using namespace testing;
123 NiceMock<MockSharedLibraryProberReport> report;
124
125 EXPECT_CALL(report, loading_library(_)).Times(0);
126
127 mir::libraries_for_path("/usr", report);
128}
129
130namespace
131{
132MATCHER_P(FilenameMatches, path, "")
133{
134 *result_listener << "where the path is " << arg;
135 return boost::filesystem::path(path).filename() == arg.filename();
136}
137}
138
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches