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
=== modified file 'src/client/frame_clock.cpp'
--- src/client/frame_clock.cpp 2016-11-29 08:00:45 +0000
+++ src/client/frame_clock.cpp 2017-02-27 08:17:57 +0000
@@ -103,7 +103,7 @@
103 * Crucially this is not required on most frames, so that even if it is103 * Crucially this is not required on most frames, so that even if it is
104 * implemented as a round trip to the server, that won't happen often.104 * implemented as a round trip to the server, that won't happen often.
105 */105 */
106 if (missed_frames > 1 || config_changed)106 if (missed_frames > 1 || config_changed || demerits > 0)
107 {107 {
108 lock.unlock();108 lock.unlock();
109 auto const server_frame = resync_callback();109 auto const server_frame = resync_callback();
@@ -151,6 +151,12 @@
151 // FIXME? Missing += operator151 // FIXME? Missing += operator
152 target = target + missed_frames * period;152 target = target + missed_frames * period;
153 }153 }
154 else
155 {
156 demerits = 0;
157 }
158
159 demerits += missed_frames;
154160
155 return target;161 return target;
156}162}
157163
=== modified file 'src/client/frame_clock.h'
--- src/client/frame_clock.h 2016-12-15 08:15:54 +0000
+++ src/client/frame_clock.h 2017-02-27 08:17:57 +0000
@@ -66,6 +66,7 @@
66 mutable bool config_changed;66 mutable bool config_changed;
67 std::chrono::nanoseconds period;67 std::chrono::nanoseconds period;
68 ResyncCallback resync_callback;68 ResyncCallback resync_callback;
69 mutable long demerits = 0;
69};70};
7071
71}} // namespace mir::client72}} // namespace mir::client
7273
=== modified file 'tests/unit-tests/client/test_frame_clock.cpp'
--- tests/unit-tests/client/test_frame_clock.cpp 2016-11-29 08:17:27 +0000
+++ tests/unit-tests/client/test_frame_clock.cpp 2017-02-27 08:17:57 +0000
@@ -395,6 +395,94 @@
395 EXPECT_EQ(one_frame, e - d); // No frame skipped. We have recovered.395 EXPECT_EQ(one_frame, e - d); // No frame skipped. We have recovered.
396}396}
397397
398TEST_F(FrameClockTest, repeatedly_missing_frame_deadline_targets_the_future)
399{ // Regression test for LP: #1665802
400 FrameClock clock(with_fake_time);
401 clock.set_period(one_frame);
402
403 PosixTimestamp a;
404 auto b = clock.next_frame_after(a);
405
406 fake_sleep_until(b);
407 fake_sleep_for(one_frame * 3 / 2); // Render time: 1.5 frames
408
409 auto c = clock.next_frame_after(b);
410 ASSERT_EQ(one_frame, c - b); // No frame skipped
411
412 fake_sleep_until(c);
413 fake_sleep_for(one_frame * 8 / 5); // Render time: 1.6 frames
414
415 auto d = clock.next_frame_after(c);
416 ASSERT_EQ(2*one_frame, d - c); // One frame skipped
417
418 /*
419 * Ensure that a client repeatedly missing the frame deadline does not
420 * repeatedly try to catch up, which may saturate the GPU (as found
421 * on Adreno) when using a sub-par driver (like Freedreno/Gallium drivers),
422 * starving the server of GPU time. (LP: #1665802)
423 */
424 for (int slow_frame = 0; slow_frame < 100; ++slow_frame)
425 {
426 fake_sleep_for(one_frame * 8 / 5); // Render time: 1.6 frames
427 c = d;
428 d = clock.next_frame_after(d);
429 auto& now = fake_time[d.clock_id];
430 ASSERT_GT(d, now) << "slow frame #" << slow_frame;
431 ASSERT_EQ(2*one_frame, d - c) << "slow frame #" << slow_frame;
432 fake_sleep_until(d);
433 }
434
435 auto e = d;
436
437 /*
438 * If the client speeds up, we should quickly allow it to regain full
439 * frame rate:
440 */
441 for (int fast_frame = 0; fast_frame < 100; ++fast_frame)
442 {
443 fake_sleep_for(one_frame/4); // Short render time, immediate recovery
444 e = clock.next_frame_after(d);
445 ASSERT_EQ(one_frame, e - d) << "fast frame #" << fast_frame;
446 fake_sleep_until(e);
447 d = e;
448 }
449
450 auto f = e;
451
452 /*
453 * In the original bug report the Adreno could only sustain 15 FPS without
454 * saturating the GPU. When it was trying to catch up and maintain
455 * 20-30 FPS, that was enough to saturate the GPU and the server couldn't
456 * display anything...
457 */
458 for (int really_slow_frame = 0; really_slow_frame < 100; ++really_slow_frame)
459 {
460 fake_sleep_for(one_frame * 17 / 5); // Render time: 3.4 frames
461 f = clock.next_frame_after(e);
462 auto& now = fake_time[f.clock_id];
463 ASSERT_GT(f, now) << "really slow frame #" << really_slow_frame;
464 ASSERT_EQ(4*one_frame, f - e) << "really slow frame #" << really_slow_frame;
465 fake_sleep_until(f);
466 e = f;
467 }
468
469 auto g = f;
470
471 /*
472 * If the client speeds up, we should quickly allow it to regain full
473 * frame rate:
474 */
475 for (int fast_frame = 0; fast_frame < 100; ++fast_frame)
476 {
477 fake_sleep_for(one_frame/4); // Short render time, immediate recovery
478 g = clock.next_frame_after(f);
479 ASSERT_EQ(one_frame, g - f) << "fast frame #" << fast_frame;
480 fake_sleep_until(g);
481 f = g;
482 }
483
484}
485
398TEST_F(FrameClockTest, nesting_adds_zero_lag)486TEST_F(FrameClockTest, nesting_adds_zero_lag)
399{487{
400 FrameClock inner(with_fake_time);488 FrameClock inner(with_fake_time);

Subscribers

People subscribed via source and target branches