Mir

[regression] Unity8 stutters constantly (like half frame rate) using Mir 0.26.0

Bug #1661128 reported by Daniel van Vugt
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Daniel van Vugt
Mir
Fix Released
High
Daniel van Vugt
0.26
Fix Released
High
Daniel van Vugt
mir (Ubuntu)
Fix Released
High
Daniel van Vugt
unity8 (Ubuntu)
Invalid
High
Unassigned

Bug Description

Unity8 stutters constantly (like half frame rate) on a high-end desktop.

This regression only happened recently, perhaps due to the introduction of Mir 0.26.0.

Surprisingly though, using the same Mir release I can start a demo server on another VT and everything is silky-smooth. The problem only seems to occur with Unity8.

Related branches

Changed in mir:
importance: Undecided → High
assignee: nobody → Daniel van Vugt (vanvugt)
Changed in canonical-devices-system-image:
importance: Undecided → High
summary: - Unity8 stutters constantly (like half frame rate)
+ [regression] Unity8 stutters constantly (like half frame rate)
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: [regression] Unity8 stutters constantly (like half frame rate)

It actually feels like Unity8 has accidentally set swap interval to 2. In previous Mir releases that would have been ignored, but in Mir 0.26.0 that is now honoured.

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

It appears Unity8 is unthrottled, as in swap interval 0. So when I drag a window around rapidly it matches the USB mouse event rate rather than the display's refresh rate. MIR_CLIENT_PERF_REPORT shows:

[2017-02-02 10:29:02.531811] perf: : 131.00 FPS, render time 7.61ms, buffer lag 22.92ms (4 buffers)
[2017-02-02 10:29:03.547757] perf: : 119.21 FPS, render time 8.36ms, buffer lag 25.21ms (4 buffers)
[2017-02-02 10:29:04.551850] perf: : 95.61 FPS, render time 10.42ms, buffer lag 31.74ms (4 buffers)
[2017-02-02 10:29:05.564508] perf: : 96.83 FPS, render time 10.30ms, buffer lag 30.72ms (4 buffers)
[2017-02-02 10:29:06.579804] perf: : 94.58 FPS, render time 10.54ms, buffer lag 31.32ms (4 buffers)
[2017-02-02 10:29:07.583854] perf: : 95.61 FPS, render time 10.42ms, buffer lag 32.15ms (4 buffers)
[2017-02-02 10:29:08.584909] perf: : 131.86 FPS, render time 7.55ms, buffer lag 22.92ms (4 buffers)
[2017-02-02 10:29:09.589854] perf: : 107.56 FPS, render time 9.26ms, buffer lag 27.92ms (4 buffers)
[2017-02-02 10:29:10.603679] perf: : 120.43 FPS, render time 8.28ms, buffer lag 24.52ms (4 buffers)
[2017-02-02 10:29:11.619541] perf: : 117.24 FPS, render time 8.50ms, buffer lag 25.68ms (4 buffers)
[2017-02-02 10:29:12.628505] perf: : 120.03 FPS, render time 8.31ms, buffer lag 25.00ms (4 buffers)
[2017-02-02 10:29:13.635706] perf: : 93.34 FPS, render time 10.67ms, buffer lag 31.79ms (4 buffers)
[2017-02-02 10:29:14.643575] perf: : 122.14 FPS, render time 8.16ms, buffer lag 24.94ms (4 buffers)
[2017-02-02 10:29:15.643621] perf: : 93.00 FPS, render time 10.72ms, buffer lag 32.28ms (4 buffers)
[2017-02-02 10:29:16.647720] perf: : 108.56 FPS, render time 9.18ms, buffer lag 27.95ms (4 buffers)
[2017-02-02 10:29:17.648820] perf: : 92.90 FPS, render time 10.73ms, buffer lag 32.17ms (4 buffers)

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

No problem specifically with Qt... System Settings is still silky-smooth under Mir demo servers:

  mirrun system-settings

So the issue seems to be localised to the Unity8 server/compositor.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity8 (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

And from Unity System Compositor I can get:

[2017-02-02 14:00:54.259614] compositor: Display 0x7fadf0007be0 averaged 53.175 FPS, 0.000 ms/frame, latency 4.910 ms, 54 frames over 1.015 sec, 100% bypassed
[2017-02-02 14:00:55.260318] compositor: Display 0x7fadf0007be0 averaged 51.963 FPS, 0.000 ms/frame, latency 5.290 ms, 52 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:00:56.276872] compositor: Display 0x7fadf0007be0 averaged 46.234 FPS, 0.000 ms/frame, latency 6.132 ms, 47 frames over 1.016 sec, 100% bypassed
[2017-02-02 14:00:57.301813] compositor: Display 0x7fadf0007be0 averaged 53.661 FPS, 0.000 ms/frame, latency 5.796 ms, 55 frames over 1.024 sec, 100% bypassed
[2017-02-02 14:00:58.310135] compositor: Display 0x7fadf0007be0 averaged 53.554 FPS, 0.000 ms/frame, latency 5.546 ms, 54 frames over 1.008 sec, 100% bypassed
[2017-02-02 14:00:59.326868] compositor: Display 0x7fadf0007be0 averaged 52.127 FPS, 0.000 ms/frame, latency 5.053 ms, 53 frames over 1.016 sec, 100% bypassed
[2017-02-02 14:01:00.326897] compositor: Display 0x7fadf0007be0 averaged 39.998 FPS, 0.000 ms/frame, latency 4.814 ms, 40 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:01.326999] compositor: Display 0x7fadf0007be0 averaged 50.994 FPS, 0.000 ms/frame, latency 5.067 ms, 51 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:02.327102] compositor: Display 0x7fadf0007be0 averaged 59.993 FPS, 0.000 ms/frame, latency 4.097 ms, 60 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:03.327407] compositor: Display 0x7fadf0007be0 averaged 58.982 FPS, 0.000 ms/frame, latency 4.778 ms, 59 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:04.327648] compositor: Display 0x7fadf0007be0 averaged 55.986 FPS, 0.000 ms/frame, latency 5.231 ms, 56 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:05.327891] compositor: Display 0x7fadf0007be0 averaged 52.987 FPS, 0.000 ms/frame, latency 5.004 ms, 53 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:06.344845] compositor: Display 0x7fadf0007be0 averaged 49.166 FPS, 0.000 ms/frame, latency 5.241 ms, 50 frames over 1.016 sec, 100% bypassed
[2017-02-02 14:01:07.345121] compositor: Display 0x7fadf0007be0 averaged 50.985 FPS, 0.000 ms/frame, latency 5.065 ms, 51 frames over 1.000 sec, 100% bypassed
[2017-02-02 14:01:08.347282] compositor: Display 0x7fadf0007be0 averaged 51.887 FPS, 0.000 ms/frame, latency 4.079 ms, 52 frames over 1.002 sec, 100% bypassed
[2017-02-02 14:01:09.372834] compositor: Display 0x7fadf0007be0 averaged 52.654 FPS, 0.000 ms/frame, latency 4.522 ms, 54 frames over 1.025 sec, 100% bypassed
[2017-02-02 14:01:10.380422] compositor: Display 0x7fadf0007be0 averaged 49.623 FPS, 0.000 ms/frame, latency 4.794 ms, 50 frames over 1.007 sec, 100% bypassed
[2017-02-02 14:01:11.396684] compositor: Display 0x7fadf0007be0 averaged 51.167 FPS, 0.000 ms/frame, latency 5.505 ms, 52 frames over 1.016 sec, 100% bypassed

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

So it seems like the issue is a combination of:
  1. Unity8 using a zero swap interval (somehow, by accident?)
  2. Unity8 taking around 10ms to render each frame -> 100Hz
  3. USC can only take one frame every 16.6ms (60Hz), so will drop half of what Unity8 produces.

This yields only 50Hz output to the screen, which is roughly only every second frame from Unity8 reaching the screen, on an interval that's out of phase with the screen. So that's the stuttering.

Changed in mir:
milestone: 0.26.1 → 1.0.0
status: New → In Progress
Changed in canonical-devices-system-image:
status: New → Confirmed
description: updated
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, I think I understand this now. Maybe.

The problem is that the unity8 nested server BufferStream has not been assigned a frame_clock (doesn't know what monitor to sync to), so it's defaulting to unthrottled behaviour even though the swap interval is 1.

This problem should probably occur with any nested server. However it was not noticed in testing because it will only be perceptible if your nested server is also slow enough that its rendering period aliases visibly with the physical screen.

Changed in unity8 (Ubuntu):
status: Confirmed → Invalid
Changed in canonical-devices-system-image:
status: Confirmed → Triaged
Changed in mir:
status: In Progress → Fix Committed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix committed to lp:mir/0.26 at revision 4004, scheduled for release in Mir 0.26.1

Changed in canonical-devices-system-image:
assignee: nobody → Daniel van Vugt (vanvugt)
status: Triaged → In Progress
status: In Progress → Fix Committed
Changed in mir (Ubuntu):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Daniel van Vugt (vanvugt)
summary: - [regression] Unity8 stutters constantly (like half frame rate)
+ [regression] Unity8 stutters constantly (like half frame rate) using Mir
+ 0.26.0
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mir - 0.26.1+17.04.20170209.1-0ubuntu1

---------------
mir (0.26.1+17.04.20170209.1-0ubuntu1) zesty; urgency=medium

  * New upstream release 0.26.1 (https://launchpad.net/mir/+milestone/0.26.1)
    - ABI summary:
      . mirclient ABI unchanged at 9
      . mirserver ABI unchanged at 43
      . mircommon ABI unchanged at 7
      . mirplatform ABI bumped to 15
      . mirprotobuf ABI unchanged at 3
      . mirplatformgraphics ABI bumped to 12
      . mirclientplatform ABI unchanged at 5
      . mirinputplatform ABI unchanged at 6
      . mircore ABI unchanged at 1
    - Enhancements:
      . Support for MirBuffer API that allows for better management of
        hardware/software buffers.
      . Support for MirPresentationChain API that allows better control
        over {de}queueing of individual buffers {from}to the server.
      . Interim support for MirRenderSurface API that provides a unit of
        renderable for lower level content such as MirBufferStreams and
        MirPresentationChains, etc.. MirRenderSurface API is marked
        deprecated as it (and the relevant entry points) will be renamed to
        MirSurface before general availability. It will initially be used for
        revamping support for EGL drivers.
      . Synchronous version of mir_prompt_session_new_fds_for_prompt_providers()
        API (mir_prompt_session_new_fds_for_prompt_providers_sync()) added for
        convenience.
      . Better name for MirPersistentId-->MirWindowId. MirPersistentId has now
        been deprecated.
    - Bugs fixed:
      . [regression] Unity8 stutters constantly (like half frame rate).
        (LP: #1661128)
      . mir 0.26 - spinner loading animation, minimize, maximize too fast.
        (LP: #1661072)
      . [regression] Nested server segfaults or rapidly logs exceptions when a
        fullscreen client starts [in mir_presentation_chain_set_dropping_mode
        ... std::exception::what: Operation not permitted] (LP: #1661508)
      . mir_window_request_persistent_id_sync seg faults when called twice.
        (LP: #1661704)
      . [regression] Windowed clients of nested servers are all black.
        (LP: #1661521)
      . Mir graphics platform ABI broke in series 0.26 but sonames never
        changed (LP: #1662455)
      . Fixes for 0.26 changelog.
      . [regression] mirscreencast hangs during screencast creation. (LP: #1662997)
      . libmirclient-dev missing build dependency on libmircore-dev. (LP: #1662942)
      . mir_window_spec_set_cursor_name() doesn't trigger
        mir::scene::SurfaceObserver::cursor_image_set_to. (LP: #1663197)
      . [regression] Software clients of nested servers are all black in Mir 0.25.0
        and later. (LP: #1663062)

 -- Cemil Azizoglu <email address hidden> Thu, 09 Feb 2017 21:46:32 +0000

Changed in mir (Ubuntu):
status: Triaged → Fix Released
Changed in canonical-devices-system-image:
status: Fix Committed → 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.