Mir

Merge lp:~vanvugt/mir/testfix-1665802 into lp:mir

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~vanvugt/mir/testfix-1665802
Merge into: lp:mir
Diff against target: 136 lines (+96/-1)
3 files modified
src/client/frame_clock.cpp (+7/-1)
src/client/frame_clock.h (+1/-0)
tests/unit-tests/client/test_frame_clock.cpp (+88/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/testfix-1665802
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing
Daniel van Vugt Disapprove
Review via email: mp+318084@code.launchpad.net

Commit message

Proof of concept test-fix for LP: #1665802

DO NOT APPROVE

Alberto please try this on the dragonboard. It's not a fix I like but if
it works then that's at least useful information.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Disapprove
lp:~vanvugt/mir/testfix-1665802 updated
4052. By Daniel van Vugt

Tidy up and strengthen the test

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

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

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

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

^^^
Bug 1646558 and also:

11:02:37 I: The following clients failed to execute successfully:
11:02:37 I: mir_demo_client_camera
11:02:37 I: Smoke testing complete with returncode -1

lp:~vanvugt/mir/testfix-1665802 updated
4053. By Daniel van Vugt

Try again

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

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

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

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

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

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

review: Approve (continuous-integration)
lp:~vanvugt/mir/testfix-1665802 updated
4054. By Daniel van Vugt

Merge latest trunk

4055. By Daniel van Vugt

A better test

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

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

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

review: Needs Fixing (continuous-integration)
lp:~vanvugt/mir/testfix-1665802 updated
4056. By Daniel van Vugt

Merge latest trunk

4057. By Daniel van Vugt

Much better regression test

4058. By Daniel van Vugt

Much better test

Unmerged revisions

4058. By Daniel van Vugt

Much better test

4057. By Daniel van Vugt

Much better regression test

4056. By Daniel van Vugt

Merge latest trunk

4055. By Daniel van Vugt

A better test

4054. By Daniel van Vugt

Merge latest trunk

4053. By Daniel van Vugt

Try again

4052. By Daniel van Vugt

Tidy up and strengthen the test

4051. By Daniel van Vugt

First hack of a regression test and an ugly fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/frame_clock.cpp'
2--- src/client/frame_clock.cpp 2016-11-29 08:00:45 +0000
3+++ src/client/frame_clock.cpp 2017-02-27 08:17:57 +0000
4@@ -103,7 +103,7 @@
5 * Crucially this is not required on most frames, so that even if it is
6 * implemented as a round trip to the server, that won't happen often.
7 */
8- if (missed_frames > 1 || config_changed)
9+ if (missed_frames > 1 || config_changed || demerits > 0)
10 {
11 lock.unlock();
12 auto const server_frame = resync_callback();
13@@ -151,6 +151,12 @@
14 // FIXME? Missing += operator
15 target = target + missed_frames * period;
16 }
17+ else
18+ {
19+ demerits = 0;
20+ }
21+
22+ demerits += missed_frames;
23
24 return target;
25 }
26
27=== modified file 'src/client/frame_clock.h'
28--- src/client/frame_clock.h 2016-12-15 08:15:54 +0000
29+++ src/client/frame_clock.h 2017-02-27 08:17:57 +0000
30@@ -66,6 +66,7 @@
31 mutable bool config_changed;
32 std::chrono::nanoseconds period;
33 ResyncCallback resync_callback;
34+ mutable long demerits = 0;
35 };
36
37 }} // namespace mir::client
38
39=== modified file 'tests/unit-tests/client/test_frame_clock.cpp'
40--- tests/unit-tests/client/test_frame_clock.cpp 2016-11-29 08:17:27 +0000
41+++ tests/unit-tests/client/test_frame_clock.cpp 2017-02-27 08:17:57 +0000
42@@ -395,6 +395,94 @@
43 EXPECT_EQ(one_frame, e - d); // No frame skipped. We have recovered.
44 }
45
46+TEST_F(FrameClockTest, repeatedly_missing_frame_deadline_targets_the_future)
47+{ // Regression test for LP: #1665802
48+ FrameClock clock(with_fake_time);
49+ clock.set_period(one_frame);
50+
51+ PosixTimestamp a;
52+ auto b = clock.next_frame_after(a);
53+
54+ fake_sleep_until(b);
55+ fake_sleep_for(one_frame * 3 / 2); // Render time: 1.5 frames
56+
57+ auto c = clock.next_frame_after(b);
58+ ASSERT_EQ(one_frame, c - b); // No frame skipped
59+
60+ fake_sleep_until(c);
61+ fake_sleep_for(one_frame * 8 / 5); // Render time: 1.6 frames
62+
63+ auto d = clock.next_frame_after(c);
64+ ASSERT_EQ(2*one_frame, d - c); // One frame skipped
65+
66+ /*
67+ * Ensure that a client repeatedly missing the frame deadline does not
68+ * repeatedly try to catch up, which may saturate the GPU (as found
69+ * on Adreno) when using a sub-par driver (like Freedreno/Gallium drivers),
70+ * starving the server of GPU time. (LP: #1665802)
71+ */
72+ for (int slow_frame = 0; slow_frame < 100; ++slow_frame)
73+ {
74+ fake_sleep_for(one_frame * 8 / 5); // Render time: 1.6 frames
75+ c = d;
76+ d = clock.next_frame_after(d);
77+ auto& now = fake_time[d.clock_id];
78+ ASSERT_GT(d, now) << "slow frame #" << slow_frame;
79+ ASSERT_EQ(2*one_frame, d - c) << "slow frame #" << slow_frame;
80+ fake_sleep_until(d);
81+ }
82+
83+ auto e = d;
84+
85+ /*
86+ * If the client speeds up, we should quickly allow it to regain full
87+ * frame rate:
88+ */
89+ for (int fast_frame = 0; fast_frame < 100; ++fast_frame)
90+ {
91+ fake_sleep_for(one_frame/4); // Short render time, immediate recovery
92+ e = clock.next_frame_after(d);
93+ ASSERT_EQ(one_frame, e - d) << "fast frame #" << fast_frame;
94+ fake_sleep_until(e);
95+ d = e;
96+ }
97+
98+ auto f = e;
99+
100+ /*
101+ * In the original bug report the Adreno could only sustain 15 FPS without
102+ * saturating the GPU. When it was trying to catch up and maintain
103+ * 20-30 FPS, that was enough to saturate the GPU and the server couldn't
104+ * display anything...
105+ */
106+ for (int really_slow_frame = 0; really_slow_frame < 100; ++really_slow_frame)
107+ {
108+ fake_sleep_for(one_frame * 17 / 5); // Render time: 3.4 frames
109+ f = clock.next_frame_after(e);
110+ auto& now = fake_time[f.clock_id];
111+ ASSERT_GT(f, now) << "really slow frame #" << really_slow_frame;
112+ ASSERT_EQ(4*one_frame, f - e) << "really slow frame #" << really_slow_frame;
113+ fake_sleep_until(f);
114+ e = f;
115+ }
116+
117+ auto g = f;
118+
119+ /*
120+ * If the client speeds up, we should quickly allow it to regain full
121+ * frame rate:
122+ */
123+ for (int fast_frame = 0; fast_frame < 100; ++fast_frame)
124+ {
125+ fake_sleep_for(one_frame/4); // Short render time, immediate recovery
126+ g = clock.next_frame_after(f);
127+ ASSERT_EQ(one_frame, g - f) << "fast frame #" << fast_frame;
128+ fake_sleep_until(g);
129+ f = g;
130+ }
131+
132+}
133+
134 TEST_F(FrameClockTest, nesting_adds_zero_lag)
135 {
136 FrameClock inner(with_fake_time);

Subscribers

People subscribed via source and target branches