Mir

Merge lp:~cemil-azizoglu/mir/use-options-during-probe into lp:mir

Proposed by Cemil Azizoglu
Status: Work in progress
Proposed branch: lp:~cemil-azizoglu/mir/use-options-during-probe
Merge into: lp:mir
Diff against target: 96 lines (+46/-1) (has conflicts)
4 files modified
include/platform/mir/graphics/platform.h (+2/-0)
src/platforms/mesa/server/kms/platform.cpp (+7/-0)
tests/mir_test_framework/platform_graphics_dummy.cpp (+1/-1)
tests/unit-tests/graphics/mesa/kms/test_platform.cpp (+36/-0)
Text conflict in src/platforms/mesa/server/kms/platform.cpp
Text conflict in tests/unit-tests/graphics/mesa/kms/test_platform.cpp
To merge this branch: bzr merge lp:~cemil-azizoglu/mir/use-options-during-probe
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+265021@code.launchpad.net

Commit message

Use command line options during platform probe.

Introduce a new PlatformPriority value (better) which is higher than what dummy uses (supported). Return best when a platform-specific option is passed in. This will help in differentiating between Mesa and X11 platforms when the server is launched from an xterm depending on the presence of the "--vt" option.

Description of the change

Use command line options during platform probe.

Introduce a new PlatformPriority value (better) which is higher than what dummy uses (supported). Return best when a platform-specific option is passed in. This will help in differentiating between Mesa and X11 platforms when the server is launched from an xterm depending on the presence of the "--vt" option.

To post a comment you must log in.

Unmerged revisions

2750. By Cemil Azizoglu

Introduce a new priority level.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/platform/mir/graphics/platform.h'
2--- include/platform/mir/graphics/platform.h 2015-07-16 06:17:56 +0000
3+++ include/platform/mir/graphics/platform.h 2015-07-16 16:35:39 +0000
4@@ -108,6 +108,8 @@
5 supported = 128, /**< Capable of providing a functioning Platform on this device,
6 * possibly with degraded performance or features.
7 */
8+ better = 192, /**< Capable of providing a functioning Platform on this device.
9+ */
10 best = 256 /**< Capable of providing a Platform with the best features and
11 * performance this device is capable of.
12 */
13
14=== modified file 'src/platforms/mesa/server/kms/platform.cpp'
15--- src/platforms/mesa/server/kms/platform.cpp 2015-07-16 06:17:56 +0000
16+++ src/platforms/mesa/server/kms/platform.cpp 2015-07-16 16:35:39 +0000
17@@ -224,7 +224,14 @@
18 for (auto& device : drm_devices)
19 {
20 static_cast<void>(device);
21+<<<<<<< TREE
22 return mg::PlatformPriority::best;
23+=======
24+ if (platform_option_used)
25+ return mg::PlatformPriority::best;
26+ else
27+ return mg::PlatformPriority::better;
28+>>>>>>> MERGE-SOURCE
29 }
30
31 return mg::PlatformPriority::unsupported;
32
33=== modified file 'tests/mir_test_framework/platform_graphics_dummy.cpp'
34--- tests/mir_test_framework/platform_graphics_dummy.cpp 2015-07-16 06:17:56 +0000
35+++ tests/mir_test_framework/platform_graphics_dummy.cpp 2015-07-16 16:35:39 +0000
36@@ -20,7 +20,7 @@
37
38 mir::graphics::PlatformPriority probe_graphics_platform()
39 {
40- return mir::graphics::supported;
41+ return mir::graphics::PlatformPriority::supported;
42 }
43
44 mir::ModuleProperties const description {
45
46=== modified file 'tests/unit-tests/graphics/mesa/kms/test_platform.cpp'
47--- tests/unit-tests/graphics/mesa/kms/test_platform.cpp 2015-07-16 02:00:15 +0000
48+++ tests/unit-tests/graphics/mesa/kms/test_platform.cpp 2015-07-16 16:35:39 +0000
49@@ -303,6 +303,7 @@
50 TEST_F(MesaGraphicsPlatform, probe_returns_unsupported_when_no_drm_udev_devices)
51 {
52 mtf::UdevEnvironment udev_environment;
53+<<<<<<< TREE
54
55 mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa-kms")};
56 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
57@@ -318,4 +319,39 @@
58 mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa-kms")};
59 auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
60 EXPECT_EQ(mg::PlatformPriority::best, probe());
61+=======
62+ mir::options::ProgramOption options;
63+
64+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa-kms")};
65+ auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
66+ EXPECT_EQ(mg::PlatformPriority::unsupported, probe(options));
67+}
68+
69+TEST_F(MesaGraphicsPlatform, probe_returns_better_when_drm_devices_exist)
70+{
71+ mtf::UdevEnvironment udev_environment;
72+ boost::program_options::options_description po;
73+ mir::options::ProgramOption options;
74+
75+ udev_environment.add_standard_device("standard-drm-devices");
76+
77+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa-kms")};
78+ auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
79+ EXPECT_EQ(mg::PlatformPriority::better, probe(options));
80+}
81+
82+TEST_F(MesaGraphicsPlatform, probe_returns_best_when_drm_devices_vt_option_exist)
83+{
84+ mtf::UdevEnvironment udev_environment;
85+ boost::program_options::options_description po;
86+ mir::options::ProgramOption options;
87+ const char *argv[] = {"dummy", "--vt"};
88+ options.parse_arguments(po, 2, argv);
89+
90+ udev_environment.add_standard_device("standard-drm-devices");
91+
92+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa-kms")};
93+ auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
94+ EXPECT_EQ(mg::PlatformPriority::best, probe(options));
95+>>>>>>> MERGE-SOURCE
96 }

Subscribers

People subscribed via source and target branches