Mir

Merge lp:~alan-griffiths/mir/tidy-code into lp:mir

Proposed by Alan Griffiths on 2017-07-20
Status: Merged
Approved by: Brandon Schaefer on 2017-07-20
Approved revision: no longer in the source branch.
Merged at revision: 4210
Proposed branch: lp:~alan-griffiths/mir/tidy-code
Merge into: lp:mir
Diff against target: 63 lines (+7/-7)
2 files modified
src/platforms/mesa/server/kms/cursor.cpp (+5/-5)
src/platforms/mesa/server/kms/real_kms_output.cpp (+2/-2)
To merge this branch: bzr merge lp:~alan-griffiths/mir/tidy-code
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) 2017-07-20 Approve on 2017-07-20
Mir CI Bot continuous-integration Approve on 2017-07-20
Review via email: mp+327795@code.launchpad.net

Commit message

Tidy up some code touched while investigating lp:1705417

Description of the change

Use ints where ints are expected, set member data before calling functions that might (but currently don't) use it. Fix whitespace.

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

PASSED: Continuous integration, rev:4210
https://mir-jenkins.ubuntu.com/job/mir-ci/3499/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4784
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4958
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/4947
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/4947
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4947
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=artful/4821/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4821/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=artful/4821/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/4821/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4821/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=artful/4821/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/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=mesa,release=zesty/4821/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4821
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/4821/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Brandon Schaefer (brandontschaefer) wrote :

lgtm

review: Approve
lp:~alan-griffiths/mir/tidy-code updated on 2017-07-20
4210. By Alan Griffiths on 2017-07-20

Tidy up some code touched while investigating lp:1705417.

Approved by Brandon Schaefer, mir-ci-bot.

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/cursor.cpp'
2--- src/platforms/mesa/server/kms/cursor.cpp 2017-06-09 10:22:15 +0000
3+++ src/platforms/mesa/server/kms/cursor.cpp 2017-07-20 14:14:51 +0000
4@@ -71,7 +71,7 @@
5 {
6 // on some older hardware drm incorrectly reports the cursor size
7 bool const force_64x64_cursor = getenv(mir_drm_cursor_64x64);
8-
9+
10 uint64_t height = fallback_cursor_size;
11 if (!force_64x64_cursor)
12 drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &height);
13@@ -82,7 +82,7 @@
14 {
15 // on some older hardware drm incorrectly reports the cursor size
16 bool const force_64x64_cursor = getenv(mir_drm_cursor_64x64);
17-
18+
19 uint64_t width = fallback_cursor_size;
20 if (!force_64x64_cursor)
21 drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &width);
22@@ -233,6 +233,7 @@
23
24 auto const& size = cursor_image.size();
25
26+ hotspot = cursor_image.hotspot();
27 {
28 auto locked_buffers = buffers.lock();
29 for (auto& pair : *locked_buffers)
30@@ -249,8 +250,7 @@
31 }
32 }
33 }
34- hotspot = cursor_image.hotspot();
35-
36+
37 // Writing the data could throw an exception so lets
38 // hold off on setting visible until after we have succeeded.
39 visible = true;
40@@ -334,7 +334,7 @@
41 if (output_rect.contains(position))
42 {
43 auto dp = transform(output_rect, position - output_rect.top_left, orientation);
44-
45+
46 // It's a little strange that we implement hotspot this way as there is
47 // drmModeSetCursor2 with hotspot support. However it appears to not actually
48 // work on radeon and intel. There also seems to be precedent in weston for
49
50=== modified file 'src/platforms/mesa/server/kms/real_kms_output.cpp'
51--- src/platforms/mesa/server/kms/real_kms_output.cpp 2017-05-08 03:04:26 +0000
52+++ src/platforms/mesa/server/kms/real_kms_output.cpp 2017-07-20 14:14:51 +0000
53@@ -272,8 +272,8 @@
54 if (current_crtc)
55 {
56 if (auto result = drmModeMoveCursor(drm_fd_, current_crtc->crtc_id,
57- destination.x.as_uint32_t(),
58- destination.y.as_uint32_t()))
59+ destination.x.as_int(),
60+ destination.y.as_int()))
61 {
62 mir::log_warning("move_cursor: drmModeMoveCursor failed (%s)",
63 strerror(-result));

Subscribers

People subscribed via source and target branches