Mir

Merge lp:~vanvugt/mir/59Hz into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 2432
Proposed branch: lp:~vanvugt/mir/59Hz
Merge into: lp:mir
Diff against target: 43 lines (+6/-10)
2 files modified
src/client/input/android/android_input_receiver.cpp (+5/-9)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+1/-1)
To merge this branch: bzr merge lp:~vanvugt/mir/59Hz
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+254038@code.launchpad.net

Commit message

Bump the default input resampling rate from 55Hz to 59Hz. This provides
a visibly smoother experience without any increase in latency.
(LP: #1436192)

An input rate even slightly over the display rate will be visibly laggy,
so given the vast majority of displays are ~60Hz and commonly 59.94Hz,
this seems like the best choice. Still not optimal for krillin's 67Hz
though.

Description of the change

Recent testing has shown input resampling to be dramatically more valuable than expected. So rather than making it go away completely, just make it work better.

I'd still like to add a client function so people can choose to turn it off (or adjust).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

What's the best way to test this? (What scenarios show a convincing improvement?)

It seems like this ought to be configurable (so it can be set for a device). Or even selected according to the current display mode?

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

> It seems like this ought to be configurable (so it can be set for a device).
> Or even selected according to the current display mode?

The client does have access to the reported vsync rate... "Slightly less than vsync" seems like a more universal tuning than hard-coded to 59hz. I guess needs info

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

Test scenarios:
1. Drag the square around in mir_demo_client_eglsquare.
2. Drag a window around in a _nested_ mir_proving_server, using Alt+drag.

It is semi-configurable already by environment: MIR_CLIENT_INPUT_RATE=Hz (or 0 to disable)
If we don't get around to making autodetection work well then that could be customized per-device.

It's worth noting however that if an app is capable (like mir_demo_client_fingerpaint) then it should have the option of disabling input resampling completely by a client function in future. Apps and toolkits that can decouple the input rate from the render rate themselves are visibly nicer to use. Like: env MIR_CLIENT_INPUT_RATE=0 mir_demo_client_fingerpaint

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Okay but I still think there could be a friendlier way to configure this.

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

I believe that there's improvement in the above scenarios, but its tricky to prove whether or not this tuning is something that all the clients would appreciate without some data. I appreciate that we're lacking a quick way to gather that info, so it feels more like hopeful tuning, as opposed to tuning based on some data. I guess I buy that this would be better in theory, so I guess its an approve, with a side-point of "We'd be 'safer' to have data when tuning hardcoded numbers"

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/input/android/android_input_receiver.cpp'
2--- src/client/input/android/android_input_receiver.cpp 2015-03-24 16:02:48 +0000
3+++ src/client/input/android/android_input_receiver.cpp 2015-03-25 07:30:38 +0000
4@@ -52,7 +52,11 @@
5 input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)),
6 android_clock(clock)
7 {
8- event_rate_hz = 55;
9+ /*
10+ * 59Hz by default. This ensures the input rate never gets ahead of the
11+ * typical display rate, which would be seen as visible lag.
12+ */
13+ event_rate_hz = 59;
14 auto env = getenv("MIR_CLIENT_INPUT_RATE");
15 if (env != NULL)
16 event_rate_hz = atoi(env);
17@@ -160,14 +164,6 @@
18 * appearance of lower latency. Getting a real frame time from the
19 * graphics logic (which is messy) does not appear to be necessary to
20 * gain significant benefit.
21- *
22- * Note event_rate_hz is only 55Hz. This allows rendering to catch up and
23- * overtake the event rate every ~12th frame (200ms) on a 60Hz display.
24- * Thus on every 12th+1 frame, there will be zero buffer lag in responding
25- * to the cooked input event we have given the client.
26- * This phase control is useful as it eliminates the one frame of lag you
27- * would otherwise never catch up to if the event rate was exactly the same
28- * as the display refresh rate.
29 */
30
31 auto frame_time = std::chrono::nanoseconds(-1);
32
33=== modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp'
34--- tests/unit-tests/client/input/test_android_input_receiver.cpp 2015-03-24 16:02:48 +0000
35+++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2015-03-25 07:30:38 +0000
36@@ -277,7 +277,7 @@
37 EXPECT_GT(duration, 1ms);
38
39 // But later in a frame or so, the motion will be reported:
40- t += 2 * one_frame; // Account for the new slower 55Hz event rate
41+ t += 2 * one_frame; // Account for the slower 59Hz event rate
42 EXPECT_TRUE(mt::fd_becomes_readable(receiver.watch_fd(), next_event_timeout));
43 receiver.dispatch(md::FdEvent::readable);
44

Subscribers

People subscribed via source and target branches