Mir

Fullscreen bypassed clients stutter with double buffers when other clients are running

Bug #1447896 reported by Daniel van Vugt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Fix Released
Medium
Daniel van Vugt
mir (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Fullscreen bypassed clients stutter with double buffers when other clients are running.

1. mir_demo_server_minimal --nbuffers=2
2. mir_demo_client_egltriangle -q &
3. mir_demo_client_egltriangle -f

Expected: A fullscreen triangle rendering smoothly.
Observed: A fullscreen triangle stuttering.

Strangely the problem only occurs with multiple clients. Like the extra load is causing a delay in the return of buffers to the fullscreen client. It doesn't happen if you only have one client running.

Workarounds:
(A) Move/resize the fullscreen surface (Alt+drag) so that it is not using bypass any more; or
(B) --nbuffers=3
(C) --bypass=off

Tags: performance

Related branches

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

Attached another branch 'predictive-bypass' that solves the problem. Presumably that works because it defers and shortens the bypass buffer hold duration.

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

I can reproduce this bug trivially on both high-end intel graphics and low-end radeon. So it is indeed just a timing problem and not GPU-specific.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.13.0

Changed in mir:
status: Triaged → Fix Committed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Not fixed by the triple-again branch landing. That's just a workaround.

Changed in mir:
status: Fix Committed → In Progress
milestone: none → 0.13.0
Revision history for this message
Kevin DuBois (kdub) wrote :

Stuttering on my system is very slight, but the mentioned workarounds do seem to smooth out the rendering.

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

Turning bypass off, and also switching to triple buffers averts the stutter.

Changed in mir:
milestone: 0.13.0 → 0.14.0
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I found the root cause of the issue when working on the attached 'ddouble' branch...

We've always known that bypass/overlays holds each buffer for the whole frame duration to feed the scanout/overlay hardware. So that's a minimum 16.6ms. What's less obvious is what happens if you have other clients running in the background. In that case those background clients will be keeping the compositor awake also, and they'll be out of phase with the fullscreen bypassed client. So you have background clients triggering new frames almost immediately as one is completed. Our compositors are unfortunately dumb and render immediately, during which they hold compositor buffers. So in the case of a fullscreen bypass client its buffer is acquired almost a frame before we page flip AND held for a whole frame after that. Hence almost 32ms the bypass buffer is held, and that's correct. So triple buffers are required to keep up with that.

In future the 'predictive-bypass' branch will alleviate the problem as it changes:
   "buffer is acquired almost a frame before we page flip AND held for a whole frame after that"
into:
   "buffer is acquired 1-5ms before we page flip AND held for a whole frame after that"

In the shorter term we're staying in triple-buffering to work around it, so hopefully you'll never experience the problem again.

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

Note this bug is only Medium importance and may not ever be seen in production. Because having triple buffers (or dynamic double buffering which will switch to triple buffers) avoids the issue.

Changed in mir:
milestone: 0.14.0 → 0.15.0
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.15.0

Changed in mir:
status: In Progress → Fix Committed
Changed in mir (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.2 KiB)

This bug was fixed in the package mir - 0.15.0+15.10.20150818-0ubuntu1

---------------
mir (0.15.0+15.10.20150818-0ubuntu1) wily; urgency=medium

  [ Daniel van Vugt ]
  * New upstream release 0.15.0 (https://launchpad.net/mir/+milestone/0.15.0)
    - ABI summary: Only servers and graphics drivers need rebuilding;
      . Mirclient ABI unchanged at 9
      . Mirserver ABI bumped to 33
      . Mircommon ABI unchanged at 5
      . Mirplatform ABI bumped to 9
    - Enhancements:
      . Add support for Mir-on-X11.
      . Latency reduction optimizations (around ~15ms reduction in total):
        Reduced input event resampling latency by 5ms. Reduced output latency
        (in system compositors) by around 10ms with the introduction of
        "predictive bypass". And we're not finished; future Mir releases
        should reduce latency further.
      . Introduced a python3-based Mir performance framework.
      . Lots of preparation for an architectural overhaul of buffer swapping,
        required in the least to support future optimizations like nested
        bypass.
      . Added a new cursor: crosshair
      . Added support for 15/16-bit client pixel formats ("high colour").
      . Added a new client function to make picking the right pixel format
        for a given EGLConfig super simple: mir_connection_get_egl_pixel_format
      . Added application-not-responding detection
      . Added client API for specifying input region shape.
      . Fixed the remaining threading flaws identified by ThreadSanitizer and
        turned it on permanently for all continuous integration in future.
      . Added support for relative pointer motion events (e.g. for gaming).
    - Bug fixes:
      . Fix focus issues breaking autopilot tests entering text (LP: #1468029)
      . Fix mir tests failure on armhf with GCC5 (LP: #1478213)
      . mir_buffer_stream_swap_buffers_sync can hang constraints (LP: #1479899)
      . Loading libmirclient.so twice leads to a segfault in libmirprotobuf.so
        (LP: #1391976)
      . Visible corruption in SDL apps (LP: #1460149)
      . MultiThreadedCompositor::destroy_compositing_threads hangs/deadlocks on
        shutdown or display reconfiguration (LP: #1471909)
      . ctest/"make test" reports 100% tests pass even when some fail.
        (LP: #1472911)
      . Mir server crashed - GLib-CRITICAL **: g_source_get_context: assertion
       'source->context != NULL || !SOURCE_DESTROYED (source)' failed
        (LP: #1473869)
      . USC crash on multimonitor unplug [std::exception::what: error during
        hwc prepare()] (LP: #1474891)
      . [regression] Input focus delay after switching app back into focus
        (LP: #1480654)
      . GLibMainLoopTest.propagates_exception_from_server_action fails with
        GCC 5 in armhf (LP: #1482274)
      . [enhancement] Mir lacks relative mouse support (LP: #1276322)
      . ShmBuffer ignores pixel_format (LP: #1424909)
      . Fullscreen bypassed clients stutter with double buffers when other
        clients are running (LP: #1447896)
      . [regression] Demo servers crash on start-up if MIR_ENABLE_TESTS=OFF
        (LP: #1439078)
      . [regression] The software curs...

Read more...

Changed in mir (Ubuntu):
status: Triaged → Fix Released
Changed in mir:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.