~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to src/platform/graphics/platform_probe.cpp

  • Committer: Package Import Robot
  • Author(s): CI Train Bot
  • Date: 2015-05-12 13:12:55 UTC
  • mto: This revision was merged to the branch mainline in revision 96.
  • Revision ID: package-import@ubuntu.com-20150512131255-y7z12i8n4pbvo70x
Tags: upstream-0.13.0+15.10.20150512
ImportĀ upstreamĀ versionĀ 0.13.0+15.10.20150512

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
17
17
 */
18
18
 
19
 
#include "mir/logging/logger.h"
 
19
#include "mir/log.h"
20
20
#include "mir/graphics/platform.h"
21
21
#include "mir/graphics/platform_probe.h"
22
22
 
23
 
#include <string>
24
23
#include <boost/throw_exception.hpp>
25
24
 
26
 
namespace ml = mir::logging;
27
 
 
28
25
std::shared_ptr<mir::SharedLibrary>
29
26
mir::graphics::module_for_device(std::vector<std::shared_ptr<SharedLibrary>> const& modules)
30
27
{
34
31
    {
35
32
        try
36
33
        {
37
 
            auto probe = module->load_function<mir::graphics::PlatformProbe>("probe_graphics_platform",
38
 
                                                                             MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
 
34
            auto probe = module->load_function<PlatformProbe>(
 
35
                 "probe_graphics_platform",
 
36
                 MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
 
37
 
39
38
            auto module_priority = probe();
40
39
            if (module_priority > best_priority_so_far)
41
40
            {
42
41
                best_priority_so_far = module_priority;
43
42
                best_module_so_far = module;
44
43
            }
 
44
 
 
45
            auto describe = module->load_function<DescribeModule>(
 
46
                "describe_graphics_module",
 
47
                MIR_SERVER_GRAPHICS_PLATFORM_VERSION);
 
48
            auto desc = describe();
 
49
            mir::log_info("Found graphics driver: %s", desc->name);
45
50
        }
46
 
        catch (std::runtime_error const& err)
 
51
        catch (std::runtime_error const&)
47
52
        {
48
 
            // Tried to probe a SharedLibrary that isn't a platform module?
49
 
            ml::log(ml::Severity::warning,
50
 
                    std::string{"Failed to probe module. Not a platform library or incorrect ABI version? Error: "} + err.what(),
51
 
                    "Platform Probing");
52
53
        }
53
54
    }
54
55
    if (best_priority_so_far > mir::graphics::unsupported)