Mir

Merge lp:~raof/mir/better-eglstream-detection into lp:mir

Proposed by Chris Halse Rogers on 2017-05-25
Status: Merged
Approved by: Alan Griffiths on 2017-05-25
Approved revision: 4182
Merged at revision: 4176
Proposed branch: lp:~raof/mir/better-eglstream-detection
Merge into: lp:mir
Prerequisite: lp:~raof/mir/remove-never-used-code
Diff against target: 57 lines (+31/-3)
1 file modified
src/platforms/eglstream-kms/server/platform_symbols.cpp (+31/-3)
To merge this branch: bzr merge lp:~raof/mir/better-eglstream-detection
Reviewer Review Type Date Requested Status
Alan Griffiths 2017-05-25 Approve on 2017-05-25
Mir CI Bot continuous-integration Approve on 2017-05-25
Review via email: mp+324597@code.launchpad.net

Commit message

platform-eglstream: Return “unsupported” when we can't claim DRM master.

This matches what mesa-kms does.

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4182
https://mir-jenkins.ubuntu.com/job/mir-ci/3411/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4639
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4771
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4760
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4760
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4671
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4671/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4671
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4671/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4671
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4671/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4671
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4671/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4671
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4671/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3411/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

Sure

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/eglstream-kms/server/platform_symbols.cpp'
2--- src/platforms/eglstream-kms/server/platform_symbols.cpp 2017-05-08 03:04:26 +0000
3+++ src/platforms/eglstream-kms/server/platform_symbols.cpp 2017-05-25 06:24:14 +0000
4@@ -105,6 +105,19 @@
5 mir::assert_entry_point_signature<mg::AddPlatformOptions>(&add_graphics_platform_options);
6 }
7
8+namespace
9+{
10+char const* drm_node_for_device(EGLDeviceEXT device)
11+{
12+ auto const device_path = eglQueryDeviceStringEXT(device, EGL_DRM_DEVICE_FILE_EXT);
13+ if (!device_path)
14+ {
15+ BOOST_THROW_EXCEPTION(mg::egl_error("Failed to determine DRM device node path from EGLDevice"));
16+ }
17+ return device_path;
18+}
19+}
20+
21 mg::PlatformPriority probe_graphics_platform(mo::ProgramOption const& /*options*/)
22 {
23 mir::assert_entry_point_signature<mg::PlatformProbe>(&probe_graphics_platform);
24@@ -158,7 +171,22 @@
25 {
26 mir::log_debug("Found EGLDeviceEXT with device extensions: %s",
27 device_extensions);
28- return strstr(device_extensions, "EGL_EXT_device_drm") != NULL;
29+ // TODO: This test is not strictly correct (will incorrectly match
30+ // EGL_EXT_device_drmish_but_not_drm)
31+ if (strstr(device_extensions, "EGL_EXT_device_drm") != NULL)
32+ {
33+ // Check if we can acquire DRM master
34+ int const drm_fd = open(drm_node_for_device(device), O_RDWR | O_CLOEXEC);
35+ if (drmSetMaster(drm_fd))
36+ {
37+ mir::log_debug(
38+ "EGL_EXT_device_drm found, but can't acquire DRM master.");
39+ return false;
40+ }
41+ drmDropMaster(drm_fd);
42+ return true;
43+ }
44+ return false;
45 }
46 else
47 {
48@@ -167,8 +195,8 @@
49 }
50 }))
51 {
52- mir::log_debug("EGLDeviceEXTs found, but none support required "
53- "EGL_EXT_device_drm extension");
54+ mir::log_debug(
55+ "EGLDeviceEXTs found, but none are suitable for Mir");
56 return mg::PlatformPriority::unsupported;
57 }
58

Subscribers

People subscribed via source and target branches