Mir

Merge lp:~vanvugt/mir/fix-1528082 into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3218
Proposed branch: lp:~vanvugt/mir/fix-1528082
Merge into: lp:mir
Diff against target: 61 lines (+39/-1)
2 files modified
src/platforms/mesa/server/kms/platform_symbols.cpp (+19/-1)
tests/unit-tests/graphics/mesa/kms/test_platform.cpp (+20/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1528082
Reviewer Review Type Date Requested Status
Andreas Pokorny (community) Needs Information
Kevin DuBois (community) Approve
Cemil Azizoglu (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+281075@code.launchpad.net

Commit message

Avoid choosing graphics-dummy (or no driver at all) over mesa-kms on a
desktop with DRM/Intel graphics. (LP: #1528082)

The right choice is obviously mesa-kms even if it fails to initialize
DRM/VT things. If however mesa-x11 or another driver can be used instead,
it will be.

Description of the change

Warning: If testing this manually, you may get confusing silence. That's bug 1528135 which can be dealt with separately.

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
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3219
http://jenkins.qa.ubuntu.com/job/mir-ci/5912/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5403
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4310
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5356
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/227/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/238
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/238/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/238
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/238/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5353
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5353/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/7861
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/26308
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/223
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/223/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/81/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/26311

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/5912/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Ok

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

lgtm, although curious if this was tested with the u8 desktop stack (where the recent problems started cropping up in 0.18 release). Also as you note, I agree that the system of selection we have is confusing and needs improvement.

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

ah this is an interesting approach. This should solve the nested case, while the host case just fails later. So should we remove the test for nested in the lines above? I am not sure which workaround is better....

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

kdub: Well, our platform priority logic has been /obviously wrong/ leading up to this. It's not like we've had any seriously tricky bugs, but just dumb code and not enough pairs of eyes looking at it. I have not done full stack testing on this, but bug 1528082 describes a simple test case.

anpok: Good point about the nested case. However I think that section of code is probably correct. One good reason why I have not touched it here; we can discuss that separately another day.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/mesa/server/kms/platform_symbols.cpp'
2--- src/platforms/mesa/server/kms/platform_symbols.cpp 2015-12-17 17:13:23 +0000
3+++ src/platforms/mesa/server/kms/platform_symbols.cpp 2015-12-22 03:32:54 +0000
4@@ -190,7 +190,25 @@
5 if (platform_option_used)
6 return mg::PlatformPriority::best;
7
8- return mg::PlatformPriority::unsupported;
9+ /* We failed to set mastership. However, still on most systems mesa-kms
10+ * is the right driver to choose. Landing here just means the user did
11+ * not specify --vt or is running from ssh. Still in most cases mesa-kms
12+ * is the correct option so give it a go. Better to fail trying to switch
13+ * VTs (and tell the user that) than to refuse to load the correct
14+ * driver at all. (LP: #1528082)
15+ *
16+ * Just make sure we are below PlatformPriority::supported in case
17+ * mesa-x11 or android can be used instead.
18+ *
19+ * TODO: Revisit the priority terminology. having a range of values between
20+ * "supported" and "unsupported" is potentially confusing.
21+ * TODO: Revisit the return code of this function. We document that
22+ * integer values outside the enum are allowed but C++ disallows it
23+ * without a cast. So we should return an int or typedef to int
24+ * instead.
25+ */
26+ return static_cast<mg::PlatformPriority>(
27+ mg::PlatformPriority::supported - 1);
28 }
29
30 mir::ModuleProperties const description = {
31
32=== modified file 'tests/unit-tests/graphics/mesa/kms/test_platform.cpp'
33--- tests/unit-tests/graphics/mesa/kms/test_platform.cpp 2015-12-17 17:13:23 +0000
34+++ tests/unit-tests/graphics/mesa/kms/test_platform.cpp 2015-12-22 03:32:54 +0000
35@@ -332,6 +332,26 @@
36 EXPECT_EQ(mg::PlatformPriority::best, probe(options));
37 }
38
39+TEST_F(MesaGraphicsPlatform, probe_returns_in_between_when_cant_set_master)
40+{ // Regression test for LP: #1528082
41+ using namespace testing;
42+
43+ mtf::UdevEnvironment udev_environment;
44+ boost::program_options::options_description po;
45+ mir::options::ProgramOption options;
46+
47+ udev_environment.add_standard_device("standard-drm-devices");
48+
49+ EXPECT_CALL(mock_drm, drmSetMaster(_))
50+ .WillOnce(Return(-1));
51+
52+ mir::SharedLibrary platform_lib{mtf::server_platform("graphics-mesa-kms")};
53+ auto probe = platform_lib.load_function<mg::PlatformProbe>(probe_platform);
54+ auto prio = probe(options);
55+ EXPECT_THAT(prio, Gt(mg::PlatformPriority::unsupported));
56+ EXPECT_THAT(prio, Lt(mg::PlatformPriority::supported));
57+}
58+
59 TEST_F(MesaGraphicsPlatform, probe_returns_best_when_drm_devices_vt_option_exist)
60 {
61 mtf::UdevEnvironment udev_environment;

Subscribers

People subscribed via source and target branches