Mir

Merge lp://staging/~vanvugt/mir/disable-early-release into lp://staging/mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3441
Proposed branch: lp://staging/~vanvugt/mir/disable-early-release
Merge into: lp://staging/mir
Diff against target: 277 lines (+83/-13)
10 files modified
src/server/compositor/buffer_bundle.h (+8/-0)
src/server/compositor/buffer_queue.cpp (+10/-1)
src/server/compositor/buffer_queue.h (+2/-0)
src/server/compositor/multi_monitor_arbiter.h (+1/-7)
tests/acceptance-tests/test_latency.cpp (+1/-5)
tests/include/mir/test/doubles/mock_buffer_bundle.h (+1/-0)
tests/integration-tests/test_buffer_scheduling.cpp (+27/-0)
tests/integration-tests/test_exchange_buffer.cpp (+1/-0)
tests/unit-tests/compositor/test_buffer_queue.cpp (+31/-0)
tests/unit-tests/compositor/test_temporary_buffers.cpp (+1/-0)
To merge this branch: bzr merge lp://staging/~vanvugt/mir/disable-early-release
Reviewer Review Type Date Requested Status
Cemil Azizoglu (community) Approve
Kevin DuBois (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+290414@code.staging.launchpad.net

Commit message

Disable the 'early release optimization' in BufferQueue, and add more
tests to verify it's really disabled (and the equivalent in NBS too).

The purpose of 'early release' (AKA single_monitor_fast in NBS) was to
reduce the chance of frame skipping when the number of buffers is reduced.
However now it seems unlikely we will ever reduce the number of buffers
to two.

'early release' has the side-effect of increasing buffer lag by one
frame. And that would have been canceled out by switching to double
buffering, but now it won't be. So in terms of latency we're one frame
better off not using 'early release'.

NBS's equivalent mode 'single_monitor_fast' is already disabled by
default (LP: #1561418), so no change required there.

The new 'mirvanity' tool also confirms that this branch measurably reduces
latency by about 17ms (one frame).

That all said, Unity8 was never affected by the 'early release' lag
because (a) its QtMir compositor does not early-release; and (b) the
system compositor generally uses bypass/overlays that prevents the
possibility of early release anyway. But at least now BufferQueue and
NBS have the same default mode, and it is the lowest latency mode.

The branch incidentally also provides a basis for fixing LP: #1561418.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

When it was introduced in the nbs code, MultMonitorMode was criticized for not being very descriptive about what the benefits/tradeoffs are. If we don't need the mode anymore, could it just be removed? Since it still remains an internal interface (and is not exposed over protocol or command line options), that's a non-blocking concern.

>The purpose of 'early release' (AKA single_monitor_fast in NBS) was to
>reduce the chance of frame skipping when the number of buffers is reduced.
>However now it seems unlikely we will ever reduce the number of buffers
>to two.

The other thought I had was that we have info about reducing latency, but no info on the effect on throughput. The other thing 'early release' does is return the buffer to the client sooner so it can start to work on it sooner.

If its a good throughput/latency tradeoff, +1, but I guess needs info for now.

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

Yes I remember asking you to go round in circles coming up with the name MultiMonitorMode (sorry). It's still not ideal, but I intentionally want to separate renaming discussions from this just being a minor fix.

As for deleting the setting completely, I did consider that but recommend against it right now because:
  * The diff would be much larger, and require changes to NBS; and
  * It's a stable well-tested feature we might want to re-enable at some point in future.

Normally the argument is to remove unused code because it can always be restored easily. But that's not true for buffering-related features because we tend to break things enough that not having it permanently under test makes it very difficult to work back in in future (think of double buffering support which is in the same boat and I've progressively had to reinforce the test suite as we kept breaking it while it was unused). So I'd rather keep the feature and its tests for now.

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

> Yes I remember asking you to go round in circles coming up with the name
> MultiMonitorMode (sorry). It's still not ideal, but I intentionally want to
> separate renaming discussions from this just being a minor fix.

I should have said it was "rightly criticized". It still is a unintuitive and needs some comment-reading to figure out what the mode is doing. I probably would object if it leaked out to the command line options, server API or client API, but as its still internal, I don't mind its internal scope increase.

> As for deleting the setting completely, I did consider that but recommend
> against it right now because:
> * The diff would be much larger, and require changes to NBS; and
> * It's a stable well-tested feature we might want to re-enable at some point
> in future.
>
> Normally the argument is to remove unused code because it can always be
> restored easily. But that's not true for buffering-related features because we
> tend to break things enough that not having it permanently under test makes it
> very difficult to work back in in future (think of double buffering support
> which is in the same boat and I've progressively had to reinforce the test
> suite as we kept breaking it while it was unused). So I'd rather keep the
> feature and its tests for now.

Fair enough, although eventually, I think things should be removed just so we don't get bogged down by 'features' that we don't need.

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

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

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

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

I do have some better naming ideas on this subject, but won't raise them here. Keeping the same name/type makes this a babystep and nice small diff.

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

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

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

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

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

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

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

The comment starting this line will need to be fixed, as well.

55 * The "early release" optimisation: Note "single_compositor" above

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

^ That comment in buffer_queue.cpp is correct and does not need changing.

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

I poked around The throughput with the demo servers, so appreciable difference.

Seemingly, set_mode is unused (so, we're probably not going to need it).
As long as the name gets improved before any more "scope elevation" (becoming present in an option/environment variable, ipc, server API), then I'm okay with the change, +1

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

Huh I should have my eyes checked.... Sorry about that.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches