Mouse cursor is unusably slow in Unity 8 with a 1000Hz mouse

Bug #1539009 reported by Daniel van Vugt
34
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mir
Fix Released
High
Andreas Pokorny
0.20
Won't Fix
High
Unassigned
mir (Ubuntu)
Fix Released
High
Andreas Pokorny
Nominated for Xenial by Alberto Salvia Novella
qtmir (Ubuntu)
Invalid
High
Unassigned
Nominated for Xenial by Alberto Salvia Novella
unity8 (Ubuntu)
Invalid
High
Unassigned
Nominated for Xenial by Alberto Salvia Novella

Bug Description

Logging in to Unity8 on desktop (xenial) the mouse cursor moves glacially slow. I have to move the mouse across the whole desk to get anywhere. This is surprising given bug 1524145 shows the opposite is happening in the Mir demo servers.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: unity8 8.11+16.04.20160122-0ubuntu1
ProcVersionSignature: Ubuntu 4.3.0-7.18-generic 4.3.3
Uname: Linux 4.3.0-7-generic x86_64
ApportVersion: 2.19.4-0ubuntu1
Architecture: amd64
Date: Thu Jan 28 18:32:27 2016
InstallationDate: Installed on 2015-12-03 (56 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Alpha amd64 (20151202)
SourcePackage: unity8
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

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

Found the problem!

Somewhere is the bespoke input logic for Unity8 we're assuming the device is (typically) around 100Hz so also generates large motion deltas. That's incorrect. My mouse is configured for 1000Hz so generates small (but many) deltas. You can test this with a sufficiently capable mouse using kernel parameter: usbhid.mousepoll=1.

Removing that kernel parameter fixes the speed. Although we should fix Unity8 because Xorg and Mir's demo servers don't have such problems with 1000Hz mice.

summary: - Mouse cursor moves way too slow in Unity 8
+ Mouse cursor moves way too slow in Unity 8 with a 1000Hz mouse
Gerry Boland (gerboland)
Changed in qtmir (Ubuntu):
status: New → Confirmed
Changed in qtmir:
status: New → Confirmed
Changed in unity8 (Ubuntu):
status: New → Confirmed
Changed in qtmir:
importance: Undecided → Medium
Changed in qtmir (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: Mouse cursor moves way too slow in Unity 8 with a 1000Hz mouse

Interestingly, bug 1517133 shows this issue existed before the switch to libinput. So the bug has remained consistent with both android-input and libinput backends in Mir. And the switch to libinput made no visible difference.

I have a theory that the relative motion data Unity8 is receiving might be incomplete. Because it's a nested server and subject to input resampling, meaning it will only get input events at 59Hz. It's possible we don't have sufficient logic to merge the relative motion data accurately before it's delivered to Unity8 at the lower rate.

summary: - Mouse cursor moves way too slow in Unity 8 with a 1000Hz mouse
+ Mouse cursor is unusably slow in Unity 8 with a 1000Hz mouse
Changed in unity8 (Ubuntu):
importance: Undecided → Medium
importance: Medium → High
Changed in qtmir (Ubuntu):
importance: Medium → High
Changed in qtmir (Ubuntu):
status: Confirmed → Triaged
Changed in unity8 (Ubuntu):
status: Confirmed → Triaged
Changed in mir:
status: New → Confirmed
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

Ah. It seems InputConsumer does not care about EVENT_AXIS_RX and EVENT_AXIS_RY at all - but it should accumulate it. So it only resamples the absolute coodinates. That could be a good reason to rewrite the InputConsume to a more readable code..

Changed in mir:
status: Confirmed → Triaged
importance: Undecided → High
Changed in mir (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in qtmir:
status: Confirmed → Incomplete
Changed in qtmir (Ubuntu):
status: Triaged → Incomplete
Changed in unity8 (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, so sounds like a Mir bug, but a Mir bug that only Unity8 would ever hit. Because the bug would only happen in clients (or nested servers) who use the relative motion data instead of the usual absolute motion data.

We're only delivering one relative motion event to Unity8 every 17ms (59Hz as intended). Therefore on your normal 125Hz mouse we're dropping 50% of the motion information. And on my 1000Hz mouse we're missing 94% of the motion data.

It's a solid theory that explains everything we've seen.

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

Looks like the relevant code is what was introduced in r2770 (2015-07-23). Probably more work required there.

tags: added: cursor
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

Started working on a test harness for input resampling..

Changed in mir (Ubuntu):
assignee: nobody → Andreas Pokorny (andreas-pokorny)
Changed in mir:
milestone: none → 0.21.0
status: Triaged → In Progress
assignee: nobody → Andreas Pokorny (andreas-pokorny)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Manual test case using only mir-demos:

0. Get a high quality high resolution mouse.
1. Add this to your kernel command line and reboot: usbhid.mousepoll=1
2. Start the server: $ sudo mir_demo_server --mouse-acceleration=none --vt=1
3. Start the client: $ sudo env MIR_CLIENT_INPUT_RECEIVER_REPORT=log mir_demo_client_egltriangle
4. Move the window into the middle of the screen.
5. Swipe the mouse across the screen (and over the window) very quickly.
6. Now look at the client's input receiver report closely...

Verify: Changes in the 'x=' values should match the 'dx=' values fairly closely.

Changed in qtmir:
status: Incomplete → Invalid
Changed in qtmir (Ubuntu):
status: Incomplete → Invalid
Changed in unity8 (Ubuntu):
status: Incomplete → Invalid
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.21.0

Changed in mir:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.2 KiB)

This bug was fixed in the package mir - 0.21.0+16.04.20160330-0ubuntu1

---------------
mir (0.21.0+16.04.20160330-0ubuntu1) xenial; urgency=medium

  [ Alberto Aguirre ]
  * New upstream release 0.21.0 (https://launchpad.net/mir/+milestone/0.21.0)
    - ABI summary:
      . mirclient ABI unchanged at 9
      . mirserver ABI unchanged at 38
      . mircommon ABI unchanged at 5
      . mirplatform ABI unchanged at 11
      . mirprotobuf ABI unchanged at 3
      . mirplatformgraphics ABI unchaged at 8
      . mirclientplatform ABI bumped to 5
      . mirinputplatform ABI unchanged at 5
    - Enhancements:
      . New display enumeration API
      . Added Android diagnostic tests to assist during porting to
        new devices
      . Added mir_demo_client_camera: a Video4Linux2 client
    - Bugs fixed:
      . Sometimes devices don't suspend - display turns back on
        immediately (LP: #1549701)
      . Mir crashed with exception 'failed to add sync point to command
        buffer' (LP: #1554635)
      . Mouse cursor is unusably slow in Unity 8 with a 1000Hz mouse
        (LP: #1539009)
      . Packaged mir_unit_tests binary is not suitable for general use
        (LP: #1547015)
      . [regression] Mir stops receiving input after a pause/resume
        cycle (LP: #1548989)
      . NBS (--nbuffers=0) causes software clients to crash with
        std::exception::what: Failed to mmap buffer 13, "Permission denied")
        (LP: #1550432)
      . Fullscreen clients freeze when using NBS with multiple monitors
        (LP: #1551536)
      . [ FAILED ] DisplayConfigurationTest.output_position_is_independent_of_
        orientation (LP: #1552065)
      . The server-side use of MIR_SOCKET is confusing (LP: #1290345)
      . [regression] FTBFS with -DMIR_LINK_TIME_OPTIMIZATION=on
        -Duse_debflags=on (LP: #1350343)
      . Mir On X (mesa-x11) keeps receiving mouse movement events even
        when not focused (LP: #1528110)
      . x11 platform: mouse cursor moves strange (LP: #1546324)
      . Cross compiling to wily/vivid doesn't work (LP: #1549152)
      . Rendering stutters when a new client establishes a connection
        (LP: #1549359)
      . 'mir_demo_server --test-client' crashes (SIGSEGV) when client
        dies (LP: #1555620)
      . [testfail] CI failure: TestClientInput.client_input_config_request_
        receives_all_attached_devices (LP: #1555708)
      . [regression] Mir FTBFS when MIR_ENABLE_TESTS=no (LP: #1556080)
      . Mir-on-X11 doesn't exit (until it gets an event) (LP: #1556210)
      . InputPlatformProbe.x11_platform_found_and_used_when_display_connection_
        works breaks with old input drivers present (LP: #1543049)
      . [regression] MIR_CLIENT_PERF_REPORT is missing window/surface
        names (LP: #1546933)
      . Installed binaries fail to run with mir_demo_server --test-client XXXX
        (LP: #1556160)
      . mir_demo_server --test-client [mir_demo_client_scroll|
        mir_demo_client_flicker] fails (LP: #1556205)
      . The contents of debian/mir-demos.examples are out of date and useless
        (LP: #1557446)

  [ CI Train Bot ]
  * No-change rebuild.

 -- Alberto Aguirre <alberto.aguirre@can...

Read more...

Changed in mir (Ubuntu):
status: Triaged → Fix Released
Changed in mir:
status: Fix Committed → Fix Released
tags: added: performance
Michał Sawicz (saviq)
no longer affects: qtmir
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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