Mir

Merge lp:~vanvugt/mir/output-model 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: 3882
Proposed branch: lp:~vanvugt/mir/output-model
Merge into: lp:mir
Diff against target: 538 lines (+404/-0)
13 files modified
include/client/mir_toolkit/mir_display_configuration.h (+12/-0)
src/client/display_configuration_api.cpp (+25/-0)
src/client/symbols.map (+1/-0)
src/common/CMakeLists.txt (+1/-0)
src/common/edid.cpp (+67/-0)
src/common/symbols.map (+7/-0)
src/include/common/mir/graphics/edid.h (+111/-0)
src/protobuf/mir_protobuf.proto (+1/-0)
src/server/report/logging/display_configuration_report.cpp (+17/-0)
src/utils/out.c (+4/-0)
tests/acceptance-tests/test_new_display_configuration.cpp (+84/-0)
tests/unit-tests/CMakeLists.txt (+1/-0)
tests/unit-tests/test_edid.cpp (+73/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/output-model
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Alan Griffiths Needs Fixing
Cemil Azizoglu (community) Approve
Mir development team Pending
Review via email: mp+312880@code.launchpad.net

This proposal supersedes a proposal from 2016-12-01.

Commit message

Add descriptive strings for the connected monitor, if available.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:3864
https://mir-jenkins.ubuntu.com/job/mir-ci/2299/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2992
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3057
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3049
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3049
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3049
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3021
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3021/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/3021
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3021/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3021
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3021/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3021
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3021/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3021
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3021/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/3021
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3021/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:3865
https://mir-jenkins.ubuntu.com/job/mir-ci/2300/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2993
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3058
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3050
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3050
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3050
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3022
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3022/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/3022
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3022/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3022
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3022/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3022
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3022/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3022
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3022/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/3022
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3022/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Hmm, I might have gone overboard with the fallback logic. That's needed apparently on laptops and tablets which don't provide a nice "monitor name". There's a risk though that the fallback vendor and product codes are just confusing to people. Although they're useful to me as someone who likes to modify/fix laptop screens, that's not a user-friendly activity.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote : Posted in a previous version of this proposal

Looks good other than the typo ('nul' instead of 'null')

+ * \returns A nul-terminated string or NULL if none available. This string

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

That's not a typo. "nul" refers to character '\0' to distinguish it from "NULL" which is a pointer.

  https://en.wikipedia.org/wiki/Null_character

Although Google suggests the industry has changed in recent years and often likes to spell it as "null" these days. I don't mind too much either way but "nul" with a single L is historically the more accurate term when referring to character zero.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

Mild "needs fixing" for the magic numbers (in particular there's a relationship between 13 and 14 that ought to be explicit).

review: Needs Fixing
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote : Posted in a previous version of this proposal

> That's not a typo. "nul" refers to character '\0' to distinguish it from
> "NULL" which is a pointer.
>
> https://en.wikipedia.org/wiki/Null_character
>
> Although Google suggests the industry has changed in recent years and often
> likes to spell it as "null" these days. I don't mind too much either way but
> "nul" with a single L is historically the more accurate term when referring to
> character zero.

Didn't know that. Thanks.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:3868
https://mir-jenkins.ubuntu.com/job/mir-ci/2341/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3055/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3121
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3113
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3113
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3113
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3084/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/3084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3084/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3084/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3084/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3084/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/3084
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3084/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:3869
https://mir-jenkins.ubuntu.com/job/mir-ci/2345/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3059
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3125
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3117
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3117
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3117
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3088
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3088/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/3088
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3088/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3088
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3088/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3088
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3088/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3088
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3088/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/3088
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3088/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

54 and 4 are still "magic"

review: Abstain
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3886
https://mir-jenkins.ubuntu.com/job/mir-ci/2354/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3069/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3135
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3127
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3127
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3127
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3098/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3098
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3098/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3098
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3098/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3098
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3098/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3098
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3098/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/3098
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3098/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3887
https://mir-jenkins.ubuntu.com/job/mir-ci/2356/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3071
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3137
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3129
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3129
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3129
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3100
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3100/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/3100
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3100/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3100
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3100/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3100
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3100/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3100
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3100/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/3100
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3100/artifact/output/*zip*/output.zip

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

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

Lots of fields

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

+struct EDID

1. I don't see any advantage to having the implementation inline. Can we put it in a .cpp file?

2. Having an UPPERCASE name is potentially confusing - we use that for MACROS.

review: Needs Fixing
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3889
https://mir-jenkins.ubuntu.com/job/mir-ci/2368/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3085
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3152
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3144
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3144
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3144
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3114/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/3114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3114/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3114/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/3114
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3114/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3890
https://mir-jenkins.ubuntu.com/job/mir-ci/2369/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3087
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3154
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3146
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3146
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3146
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3116/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/3116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3116/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/3116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3116/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

*Needs Discussion*

Should Edid belong in namespace mir::graphics in preference to namespace mir?

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

I think the graphics namespace is a bit pointless (or at least needs a better name). The whole project is about graphics so saying something is in the "graphics" namespace does not really contribute to an understanding of the code, or to namespace safety.

Generally I think mir::graphics:: should be abolished unless someone can think of a better name that justifies its existence.

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

> I think the graphics namespace is a bit pointless (or at least needs a better
> name). The whole project is about graphics so saying something is in the
> "graphics" namespace does not really contribute to an understanding of the
> code, or to namespace safety.
>
> Generally I think mir::graphics:: should be abolished unless someone can think
> of a better name that justifies its existence.

Changing our long standing namespaces isn't part of this MP.

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

I suppose that edid fits in the graphics namespace of mir better than any other namespace. mir:: is more for common stuff, and it doesn't fit in input, frontend, shell, compositor, etc

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

+1 on mir::graphics being the sensible spot for it.

213 + enum { minimum_size = 128 };
This would be more idiomatic as static constexpr, but that's non-blocking.

Either here, or in future work, it would make sense to validate the checksum on the EDID. This could be done in a static “constructor” in Edid::. Which would also be nice, rather than have the expectation that you reinterpret_cast<> a bunch of bytes into a mg::Edid.

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

I considered header and checksum validation and decided intentionally that would be a bad idea. Buggy hardware exists, and we should support it as well as we can, even when they fail to checksum their EDID correctly.

This is based on seeing many logs over the years in which users' displays provided invalid EDIDs. We can't fix all hardware, so we should go best effort instead of assuming that no EDID is better than a badly formed EDID.

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

Also I intentionally wrote this code to deal with any form or badly formed EDID already.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3892
https://mir-jenkins.ubuntu.com/job/mir-ci/2390/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/3116
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3183
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3175
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3175
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3175
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3145
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3145/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/3145
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3145/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3145
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3145/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3145
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3145/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3145
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3145/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/3145
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3145/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Alright... two weeks later. I've now resolved all the stylistic complaints raised. That's enough. Trying to land it now.

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

I don't mean fail to parse the EDID on checksum failures, but to expose that the EDID is broken. For some things (particularly modes) a broken EDID *is* worse than no EDID.

Sometimes the checksum fails because the manufacturer failed to compute the checksum correctly. More often it's broken because the EDID, or the DDC pins, or something is actually broken and should be trusted less.

Hm. While I think of it, checking that all the strings we return are printable ascii is probably a sensible thing to do, particularly if we're going to accept known-bad EDIDs

Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/client/mir_toolkit/mir_display_configuration.h'
--- include/client/mir_toolkit/mir_display_configuration.h 2016-12-08 04:08:06 +0000
+++ include/client/mir_toolkit/mir_display_configuration.h 2016-12-14 04:10:39 +0000
@@ -373,6 +373,18 @@
373void mir_output_disable(MirOutput* output);373void mir_output_disable(MirOutput* output);
374374
375/**375/**
376 * Get a descriptive manufacturer/model string for the connected display.
377 * The format of this string is arbitrary and driver-specific but should be
378 * human-readable and helpful for someone to identify which physical display
379 * this is. Note this function is not called get_name because that would imply
380 * the returned value is different for each output, whereas it may not be.
381 *
382 * \returns A nul-terminated string or NULL if none available. This string
383 * remains valid for the lifetime of the MirOutput object.
384 */
385char const* mir_output_get_model(MirOutput const* output);
386
387/**
376 * Get the physical width of the connected display, in millimetres.388 * Get the physical width of the connected display, in millimetres.
377 *389 *
378 * A best-effort report of the physical width of the display connected to this390 * A best-effort report of the physical width of the display connected to this
379391
=== modified file 'src/client/display_configuration_api.cpp'
--- src/client/display_configuration_api.cpp 2016-12-08 04:08:06 +0000
+++ src/client/display_configuration_api.cpp 2016-12-14 04:10:39 +0000
@@ -21,6 +21,7 @@
21#include "mir/output_type_names.h"21#include "mir/output_type_names.h"
22#include "display_configuration.h"22#include "display_configuration.h"
23#include "mir/uncaught.h"23#include "mir/uncaught.h"
24#include "mir/graphics/edid.h"
2425
25namespace mcl = mir::client;26namespace mcl = mir::client;
26namespace mp = mir::protobuf;27namespace mp = mir::protobuf;
@@ -86,6 +87,30 @@
86 output->set_used(0);87 output->set_used(0);
87}88}
8889
90char const* mir_output_get_model(MirOutput const* output)
91{
92 // In future this might be provided by the server itself...
93 if (output->has_model())
94 return output->model().c_str();
95
96 // But if not we use the same member for caching our EDID probe...
97 using mir::graphics::Edid;
98 if (mir_output_get_edid_size(output) >= Edid::minimum_size)
99 {
100 auto edid = reinterpret_cast<Edid const*>(mir_output_get_edid(output));
101 Edid::MonitorName name;
102 if (!edid->get_monitor_name(name))
103 {
104 auto len = edid->get_manufacturer(name);
105 snprintf(name+len, sizeof(name)-len, " %hu", edid->product_code());
106 }
107 const_cast<MirOutput*>(output)->set_model(name);
108 return output->model().c_str();
109 }
110
111 return nullptr;
112}
113
89int mir_display_config_get_max_simultaneous_outputs(MirDisplayConfig const* config)114int mir_display_config_get_max_simultaneous_outputs(MirDisplayConfig const* config)
90{115{
91 return config->display_card(0).max_simultaneous_outputs();116 return config->display_card(0).max_simultaneous_outputs();
92117
=== modified file 'src/client/symbols.map'
--- src/client/symbols.map 2016-12-13 02:50:57 +0000
+++ src/client/symbols.map 2016-12-14 04:10:39 +0000
@@ -502,4 +502,5 @@
502 mir_touchpad_configuration_set_middle_mouse_button_emulation;502 mir_touchpad_configuration_set_middle_mouse_button_emulation;
503 mir_touchpad_configuration_set_scroll_modes;503 mir_touchpad_configuration_set_scroll_modes;
504 mir_touchpad_configuration_set_tap_to_click;504 mir_touchpad_configuration_set_tap_to_click;
505 mir_output_get_model;
505} MIR_CLIENT_0.25;506} MIR_CLIENT_0.25;
506507
=== modified file 'src/common/CMakeLists.txt'
--- src/common/CMakeLists.txt 2016-11-15 23:48:01 +0000
+++ src/common/CMakeLists.txt 2016-12-14 04:10:39 +0000
@@ -22,6 +22,7 @@
22 ${CMAKE_CURRENT_SOURCE_DIR}/libname.cpp ${PROJECT_SOURCE_DIR}/include/common/mir/libname.h22 ${CMAKE_CURRENT_SOURCE_DIR}/libname.cpp ${PROJECT_SOURCE_DIR}/include/common/mir/libname.h
23 ${PROJECT_SOURCE_DIR}/include/common/mir/posix_rw_mutex.h23 ${PROJECT_SOURCE_DIR}/include/common/mir/posix_rw_mutex.h
24 posix_rw_mutex.cpp24 posix_rw_mutex.cpp
25 edid.cpp
25)26)
2627
27set(PREFIX "${CMAKE_INSTALL_PREFIX}")28set(PREFIX "${CMAKE_INSTALL_PREFIX}")
2829
=== added file 'src/common/edid.cpp'
--- src/common/edid.cpp 1970-01-01 00:00:00 +0000
+++ src/common/edid.cpp 2016-12-14 04:10:39 +0000
@@ -0,0 +1,67 @@
1/*
2 * Copyright © 2016 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: Daniel van Vugt <daniel.van.vugt@canonical.com>
17 */
18
19#include "mir/graphics/edid.h"
20#include <endian.h>
21#include <cstring>
22
23using mir::graphics::Edid;
24
25size_t Edid::get_monitor_name(MonitorName str) const
26{
27 size_t len = get_string(string_monitor_name, str);
28 if (char* pad = strchr(str, '\n'))
29 {
30 *pad = '\0';
31 len = pad - str;
32 }
33 return len;
34}
35
36size_t Edid::get_manufacturer(Manufacturer str) const
37{
38 // Confusingly this field is more like big endian. Others are little.
39 auto man = static_cast<uint16_t>(manufacturer[0]) << 8 | manufacturer[1];
40 str[0] = ((man >> 10) & 31) + 'A' - 1;
41 str[1] = ((man >> 5) & 31) + 'A' - 1;
42 str[2] = (man & 31) + 'A' - 1;
43 str[3] = '\0';
44 return 3;
45}
46
47uint16_t Edid::product_code() const
48{
49 return le16toh(product_code_le);
50}
51
52size_t Edid::get_string(StringDescriptorType type, char str[14]) const
53{
54 size_t len = 0;
55 for (int d = 0; d < 4; ++d)
56 {
57 auto& desc = descriptor[d];
58 if (!desc.other.zero0 && desc.other.type == type)
59 {
60 len = sizeof desc.other.text;
61 memcpy(str, desc.other.text, len);
62 break;
63 }
64 }
65 str[len] = '\0';
66 return len;
67}
068
=== modified file 'src/common/symbols.map'
--- src/common/symbols.map 2016-11-15 23:48:01 +0000
+++ src/common/symbols.map 2016-12-14 04:10:39 +0000
@@ -403,3 +403,10 @@
403 mir::PosixRWMutex::unlock_shared*;403 mir::PosixRWMutex::unlock_shared*;
404 };404 };
405} MIR_COMMON_0.25;405} MIR_COMMON_0.25;
406
407MIR_COMMON_0.26 {
408 global:
409 extern "C++" {
410 mir::graphics::Edid::*;
411 };
412} MIR_COMMON_0.25;
406413
=== added directory 'src/include/common/mir/graphics'
=== added file 'src/include/common/mir/graphics/edid.h'
--- src/include/common/mir/graphics/edid.h 1970-01-01 00:00:00 +0000
+++ src/include/common/mir/graphics/edid.h 2016-12-14 04:10:39 +0000
@@ -0,0 +1,111 @@
1/*
2 * Copyright © 2016 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: Daniel van Vugt <daniel.van.vugt@canonical.com>
17 */
18
19#ifndef MIR_GRAPHICS_EDID_H_
20#define MIR_GRAPHICS_EDID_H_
21
22#include <cstdint>
23#include <cstddef>
24
25namespace mir { namespace graphics {
26
27struct Edid
28{
29 Edid() = delete;
30 Edid(Edid const&) = delete;
31 Edid(Edid const&&) = delete;
32
33 enum { minimum_size = 128 };
34 typedef char MonitorName[14]; // up to 13 characters
35 typedef char Manufacturer[4]; // always 3 characters
36
37 size_t get_monitor_name(MonitorName str) const;
38 size_t get_manufacturer(Manufacturer str) const;
39 uint16_t product_code() const;
40
41private:
42 /* Pretty much every field in an EDID requires some kind of conversion
43 and reinterpretation. So keep those details private... */
44
45 enum StringDescriptorType
46 {
47 string_monitor_serial_number = 0xff,
48 string_unspecified_text = 0xfe,
49 string_monitor_name = 0xfc,
50 };
51
52 size_t get_string(StringDescriptorType type, char str[14]) const;
53
54 union Descriptor
55 {
56 struct
57 {
58 uint16_t pixel_clock_le;
59 uint8_t todo[16];
60 } detailed_timing;
61 struct
62 {
63 uint16_t zero0;
64 uint8_t zero2;
65 uint8_t type;
66 uint8_t zero4;
67 uint8_t text[13];
68 } other;
69 };
70
71#ifdef __clang__
72#pragma clang diagnostic push
73#pragma clang diagnostic ignored "-Wunused-private-field"
74#endif
75 /* 0x00 */ uint8_t header[8];
76 /* 0x08 */ uint8_t manufacturer[2];
77 /* 0x0a */ uint16_t product_code_le;
78 /* 0x0c */ uint32_t serial_number_le;
79 /* 0x10 */ uint8_t week_of_manufacture;
80 /* 0x11 */ uint8_t year_of_manufacture;
81 /* 0x12 */ uint8_t edid_version;
82 /* 0x13 */ uint8_t edid_revision;
83 /* 0x14 */ uint8_t input_bitmap;
84 /* 0x15 */ uint8_t max_horz_cm;
85 /* 0x16 */ uint8_t max_vert_cm;
86 /* 0x17 */ uint8_t gamma;
87 /* 0x18 */ uint8_t features_bitmap;
88 /* 0x19 */ uint8_t red_green_bits_1to0;
89 /* 0x1a */ uint8_t blue_white_bits_1to0;
90 /* 0x1b */ uint8_t red_x_bits_9to2;
91 /* 0x1c */ uint8_t red_y_bits_9to2;
92 /* 0x1d */ uint8_t green_x_bits_9to2;
93 /* 0x1e */ uint8_t green_y_bits_9to2;
94 /* 0x1f */ uint8_t blue_x_bits_9to2;
95 /* 0x20 */ uint8_t blue_y_bits_9to2;
96 /* 0x21 */ uint8_t white_x_bits_9to2;
97 /* 0x22 */ uint8_t white_y_bits_9to2;
98 /* 0x23 */ uint8_t established_timings[2];
99 /* 0x25 */ uint8_t reserved_timings;
100 /* 0x26 */ uint8_t standard_timings[2][8];
101 /* 0x36 */ Descriptor descriptor[4];
102 /* 0x7e */ uint8_t num_extensions; /* each is another 128-byte block */
103 /* 0x7f */ uint8_t checksum;
104#ifdef __clang__
105#pragma clang diagnostic pop
106#endif
107};
108
109} } // namespace mir::graphics
110
111#endif // MIR_GRAPHICS_EDID_H_
0112
=== modified file 'src/protobuf/mir_protobuf.proto'
--- src/protobuf/mir_protobuf.proto 2016-12-08 04:08:06 +0000
+++ src/protobuf/mir_protobuf.proto 2016-12-14 04:10:39 +0000
@@ -241,6 +241,7 @@
241 optional bytes gamma_blue = 22;241 optional bytes gamma_blue = 22;
242 optional uint32 gamma_supported = 23;242 optional uint32 gamma_supported = 23;
243 optional bytes edid = 24;243 optional bytes edid = 24;
244 optional string model = 25;
244}245}
245246
246message Connection {247message Connection {
247248
=== modified file 'src/server/report/logging/display_configuration_report.cpp'
--- src/server/report/logging/display_configuration_report.cpp 2016-11-30 03:00:24 +0000
+++ src/server/report/logging/display_configuration_report.cpp 2016-12-14 04:10:39 +0000
@@ -20,6 +20,7 @@
20#include "mir/graphics/display_configuration.h"20#include "mir/graphics/display_configuration.h"
21#include "mir/output_type_names.h"21#include "mir/output_type_names.h"
22#include "mir/logging/logger.h"22#include "mir/logging/logger.h"
23#include "mir/graphics/edid.h"
2324
24#include <boost/exception/diagnostic_information.hpp>25#include <boost/exception/diagnostic_information.hpp>
25#include <cmath>26#include <cmath>
@@ -93,6 +94,22 @@
93 );94 );
94 if (out.connected)95 if (out.connected)
95 {96 {
97 using mir::graphics::Edid;
98 if (out.edid.size() >= Edid::minimum_size)
99 {
100 auto edid = reinterpret_cast<Edid const*>(out.edid.data());
101 Edid::MonitorName name;
102 if (edid->get_monitor_name(name))
103 logger->log(component, severity,
104 "%sEDID monitor name: %s", indent, name);
105 Edid::Manufacturer man;
106 edid->get_manufacturer(man);
107 logger->log(component, severity,
108 "%sEDID manufacturer: %s", indent, man);
109 logger->log(component, severity,
110 "%sEDID product code: %hu", indent, edid->product_code());
111 }
112
96 int width_mm = out.physical_size_mm.width.as_int();113 int width_mm = out.physical_size_mm.width.as_int();
97 int height_mm = out.physical_size_mm.height.as_int();114 int height_mm = out.physical_size_mm.height.as_int();
98 float inches =115 float inches =
99116
=== modified file 'src/utils/out.c'
--- src/utils/out.c 2016-12-08 04:08:06 +0000
+++ src/utils/out.c 2016-12-14 04:10:39 +0000
@@ -426,6 +426,10 @@
426426
427 if (state == mir_output_connection_state_connected)427 if (state == mir_output_connection_state_connected)
428 {428 {
429 char const* model = mir_output_get_model(out);
430 if (model)
431 printf(", \"%s\"", model);
432
429 MirOutputMode const* current_mode =433 MirOutputMode const* current_mode =
430 mir_output_get_current_mode(out);434 mir_output_get_current_mode(out);
431 if (current_mode)435 if (current_mode)
432436
=== modified file 'tests/acceptance-tests/test_new_display_configuration.cpp'
--- tests/acceptance-tests/test_new_display_configuration.cpp 2016-12-08 04:08:06 +0000
+++ tests/acceptance-tests/test_new_display_configuration.cpp 2016-12-14 04:10:39 +0000
@@ -1085,6 +1085,90 @@
1085 client.disconnect();1085 client.disconnect();
1086}1086}
10871087
1088TEST_F(DisplayConfigurationTest, client_receives_model_string_from_edid)
1089{
1090 static unsigned char const edid[] =
1091 "\x00\xff\xff\xff\xff\xff\xff\x00\x10\xac\x46\xf0\x4c\x4a\x31\x41"
1092 "\x05\x19\x01\x04\xb5\x34\x20\x78\x3a\x1d\xf5\xae\x4f\x35\xb3\x25"
1093 "\x0d\x50\x54\xa5\x4b\x00\x81\x80\xa9\x40\xd1\x00\x71\x4f\x01\x01"
1094 "\x01\x01\x01\x01\x01\x01\x28\x3c\x80\xa0\x70\xb0\x23\x40\x30\x20"
1095 "\x36\x00\x06\x44\x21\x00\x00\x1a\x00\x00\x00\xff\x00\x59\x43\x4d"
1096 "\x30\x46\x35\x31\x52\x41\x31\x4a\x4c\x0a\x00\x00\x00\xfc\x00\x44"
1097 "\x45\x4c\x4c\x20\x55\x32\x34\x31\x33\x0a\x20\x20\x00\x00\x00\xfd"
1098 "\x00\x38\x4c\x1e\x51\x11\x00\x0a\x20\x20\x20\x20\x20\x20\x01\x42"
1099 "\x02\x03\x1d\xf1\x50\x90\x05\x04\x03\x02\x07\x16\x01\x1f\x12\x13"
1100 "\x14\x20\x15\x11\x06\x23\x09\x1f\x07\x83\x01\x00\x00\x02\x3a\x80"
1101 "\x18\x71\x38\x2d\x40\x58\x2c\x45\x00\x06\x44\x21\x00\x00\x1e\x01"
1102 "\x1d\x80\x18\x71\x1c\x16\x20\x58\x2c\x25\x00\x06\x44\x21\x00\x00"
1103 "\x9e\x01\x1d\x00\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\x06\x44\x21"
1104 "\x00\x00\x1e\x8c\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\x06"
1105 "\x44\x21\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1106 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09";
1107
1108 mtd::StubDisplayConfigurationOutput monitor{
1109 mg::DisplayConfigurationOutputId{48},
1110 {{{1920, 1200}, 60.0}},
1111 {mir_pixel_format_abgr_8888}};
1112 monitor.edid.assign(edid, edid+sizeof(edid)-1);
1113
1114 auto config = std::make_shared<mtd::StubDisplayConfig>(
1115 std::vector<mg::DisplayConfigurationOutput>{monitor});
1116
1117 apply_config_change_and_wait_for_propagation(config);
1118
1119 DisplayClient client{new_connection()};
1120 client.connect();
1121
1122 auto base_config = client.get_base_config();
1123 auto output = mir_display_config_get_output(base_config.get(), 0);
1124
1125 EXPECT_STREQ("DELL U2413", mir_output_get_model(output));
1126
1127 client.disconnect();
1128}
1129
1130TEST_F(DisplayConfigurationTest, client_receives_fallback_string_from_edid)
1131{
1132 static unsigned char const edid[] =
1133 "\x00\xff\xff\xff\xff\xff\xff\x00\x10\xac\x46\xf0\x4c\x4a\x31\x41"
1134 "\x05\x19\x01\x04\xb5\x34\x20\x78\x3a\x1d\xf5\xae\x4f\x35\xb3\x25"
1135 "\x0d\x50\x54\xa5\x4b\x00\x81\x80\xa9\x40\xd1\x00\x71\x4f\x01\x01"
1136 "\x01\x01\x01\x01\x01\x01\x28\x3c\x80\xa0\x70\xb0\x23\x40\x30\x20"
1137 "\x36\x00\x06\x44\x21\x00\x00\x1a\x00\x00\x00\xff\x00\x59\x43\x4d"
1138 "\x30\x46\x35\x31\x52\x41\x31\x4a\x4c\x0a\x00\x00\x00\x11\x00\x44"
1139 "\x45\x4c\x4c\x20\x55\x32\x34\x31\x33\x0a\x20\x20\x00\x00\x00\xfd"
1140 "\x00\x38\x4c\x1e\x51\x11\x00\x0a\x20\x20\x20\x20\x20\x20\x01\x42"
1141 "\x02\x03\x1d\xf1\x50\x90\x05\x04\x03\x02\x07\x16\x01\x1f\x12\x13"
1142 "\x14\x20\x15\x11\x06\x23\x09\x1f\x07\x83\x01\x00\x00\x02\x3a\x80"
1143 "\x18\x71\x38\x2d\x40\x58\x2c\x45\x00\x06\x44\x21\x00\x00\x1e\x01"
1144 "\x1d\x80\x18\x71\x1c\x16\x20\x58\x2c\x25\x00\x06\x44\x21\x00\x00"
1145 "\x9e\x01\x1d\x00\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\x06\x44\x21"
1146 "\x00\x00\x1e\x8c\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\x06"
1147 "\x44\x21\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1148 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09";
1149
1150 mtd::StubDisplayConfigurationOutput monitor{
1151 mg::DisplayConfigurationOutputId{2},
1152 {{{3210, 2800}, 60.0}},
1153 {mir_pixel_format_abgr_8888}};
1154 monitor.edid.assign(edid, edid+sizeof(edid)-1);
1155
1156 auto config = std::make_shared<mtd::StubDisplayConfig>(
1157 std::vector<mg::DisplayConfigurationOutput>{monitor});
1158
1159 apply_config_change_and_wait_for_propagation(config);
1160
1161 DisplayClient client{new_connection()};
1162 client.connect();
1163
1164 auto base_config = client.get_base_config();
1165 auto output = mir_display_config_get_output(base_config.get(), 0);
1166
1167 EXPECT_STREQ("DEL 61510", mir_output_get_model(output));
1168
1169 client.disconnect();
1170}
1171
1088namespace1172namespace
1089{1173{
1090MATCHER_P(IsSameModeAs, mode, "")1174MATCHER_P(IsSameModeAs, mode, "")
10911175
=== modified file 'tests/unit-tests/CMakeLists.txt'
--- tests/unit-tests/CMakeLists.txt 2016-11-15 23:48:01 +0000
+++ tests/unit-tests/CMakeLists.txt 2016-12-14 04:10:39 +0000
@@ -82,6 +82,7 @@
82 test_posix_rw_mutex.cpp82 test_posix_rw_mutex.cpp
83 test_posix_timestamp.cpp83 test_posix_timestamp.cpp
84 test_observer_multiplexer.cpp84 test_observer_multiplexer.cpp
85 test_edid.cpp
85)86)
8687
87CMAKE_DEPENDENT_OPTION(88CMAKE_DEPENDENT_OPTION(
8889
=== added file 'tests/unit-tests/test_edid.cpp'
--- tests/unit-tests/test_edid.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit-tests/test_edid.cpp 2016-12-14 04:10:39 +0000
@@ -0,0 +1,73 @@
1/*
2 * Copyright © 2016 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 * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
17 */
18
19#include "mir/graphics/edid.h"
20#include <gtest/gtest.h>
21
22using mir::graphics::Edid;
23
24namespace
25{
26unsigned char const dell_u2413_edid[] =
27 "\x00\xff\xff\xff\xff\xff\xff\x00\x10\xac\x46\xf0\x4c\x4a\x31\x41"
28 "\x05\x19\x01\x04\xb5\x34\x20\x78\x3a\x1d\xf5\xae\x4f\x35\xb3\x25"
29 "\x0d\x50\x54\xa5\x4b\x00\x81\x80\xa9\x40\xd1\x00\x71\x4f\x01\x01"
30 "\x01\x01\x01\x01\x01\x01\x28\x3c\x80\xa0\x70\xb0\x23\x40\x30\x20"
31 "\x36\x00\x06\x44\x21\x00\x00\x1a\x00\x00\x00\xff\x00\x59\x43\x4d"
32 "\x30\x46\x35\x31\x52\x41\x31\x4a\x4c\x0a\x00\x00\x00\xfc\x00\x44"
33 "\x45\x4c\x4c\x20\x55\x32\x34\x31\x33\x0a\x20\x20\x00\x00\x00\xfd"
34 "\x00\x38\x4c\x1e\x51\x11\x00\x0a\x20\x20\x20\x20\x20\x20\x01\x42"
35 "\x02\x03\x1d\xf1\x50\x90\x05\x04\x03\x02\x07\x16\x01\x1f\x12\x13"
36 "\x14\x20\x15\x11\x06\x23\x09\x1f\x07\x83\x01\x00\x00\x02\x3a\x80"
37 "\x18\x71\x38\x2d\x40\x58\x2c\x45\x00\x06\x44\x21\x00\x00\x1e\x01"
38 "\x1d\x80\x18\x71\x1c\x16\x20\x58\x2c\x25\x00\x06\x44\x21\x00\x00"
39 "\x9e\x01\x1d\x00\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\x06\x44\x21"
40 "\x00\x00\x1e\x8c\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\x06"
41 "\x44\x21\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
42 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x09";
43} // namespace
44
45TEST(EDID, has_correct_size)
46{
47 EXPECT_EQ(128u, sizeof(Edid));
48 EXPECT_EQ(128u, Edid::minimum_size);
49}
50
51TEST(EDID, can_get_name)
52{
53 auto edid = reinterpret_cast<Edid const*>(dell_u2413_edid);
54 Edid::MonitorName name;
55 int len = edid->get_monitor_name(name);
56 EXPECT_EQ(10, len);
57 EXPECT_STREQ("DELL U2413", name);
58}
59
60TEST(EDID, can_get_manufacturer)
61{
62 auto edid = reinterpret_cast<Edid const*>(dell_u2413_edid);
63 Edid::Manufacturer man;
64 int len = edid->get_manufacturer(man);
65 EXPECT_EQ(3, len);
66 EXPECT_STREQ("DEL", man);
67}
68
69TEST(EDID, can_get_product_code)
70{
71 auto edid = reinterpret_cast<Edid const*>(dell_u2413_edid);
72 EXPECT_EQ(61510u, edid->product_code());
73}

Subscribers

People subscribed via source and target branches