Mir

Merge lp://qastaging/~andreas-pokorny/mir/use-monotonic-clock-for-input into lp://qastaging/mir

Proposed by Andreas Pokorny
Status: Merged
Approved by: Andreas Pokorny
Approved revision: no longer in the source branch.
Merged at revision: 3104
Proposed branch: lp://qastaging/~andreas-pokorny/mir/use-monotonic-clock-for-input
Merge into: lp://qastaging/mir
Diff against target: 162 lines (+28/-48)
5 files modified
3rd_party/android-input/android/frameworks/native/libs/utils/Timers.cpp (+4/-30)
src/common/logging/input_timestamp.cpp (+6/-12)
src/platforms/evdev/libinput_ptr.cpp (+13/-1)
src/server/input/key_repeat_dispatcher.cpp (+1/-1)
tests/mir_test_framework/fake_input_device_impl.cpp (+4/-4)
To merge this branch: bzr merge lp://qastaging/~andreas-pokorny/mir/use-monotonic-clock-for-input
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Chris Halse Rogers Approve
Review via email: mp+277635@code.qastaging.launchpad.net

Commit message

Switch to monotonic clock for everything input related

sytemTime from android-input is used by client and server within the input receiver to calculate an assumed frame time, and to attach timestamps to input events. The evdev platform now ensures with EVIOCSCLOCKID(CLOCK_MONOTONIC) that for every device opened through libinput CLOCK_MONOTONIC is used. Note that EventHub.cpp does the same.
KeyRepeatDispatcher used to emit timer events from system_clock which uses CLOCK_REALTIME. Similar reports and fake event devices required adaptation too.

Before this change CLOCK_REALTIME was used because the default build configuration of android-input refrained from using any other clock (c.f. HAVE_POSIX_CLOCKS). Hence the input event timestamps were replaced by CLOCK_REALTIME timestamps. And everything else had to follow that setup.

Description of the change

As opposed to the previous attempt, this MP does not introduce the idea of a Clock passed to platforms. Instead it relies on the underlying system to come up with good timestamps. Especially for evdev events the timestamps from the device are more accurate than the ones generated when the system compositor gets to interpret the results from libinput.

So in the end this MP just changes the already spread time stamp related bits to use the monotonic clock.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

Seems reasonable.

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

+ auto age =
+ std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now().time_since_epoch() - when);

1. A bit wordy.
2. could be const.

    using namespace std::chrono;
    ...
    duration<double, std::milli> const age{steady_clock::now().time_since_epoch() - when};

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

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