[wayland] Send correct current time in the frame callback
ClosedPublic

Authored by zzag on Feb 1 2019, 10:16 PM.

Details

Summary

Currently, each frame callback sent by KWin has the current time in
nanoseconds, but the protocol spec states that we have to send the time
in milliseconds.

Also, it's worth to mention that m_timeSinceStart isn't actually "time
since start," it's rather accumulated duration of all painting cycles.
If there is something to draw and it takes quite a while to compose the
scene, maybe m_timeSinceStart will be close enough to the current time.

Test Plan

The triangle in weston-subsurfaces no longer spins very fast.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Feb 1 2019, 10:16 PM
Restricted Application added a project: KWin. · View Herald TranscriptFeb 1 2019, 10:16 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Feb 1 2019, 10:16 PM
zzag updated this revision to Diff 52482.Sun, Feb 24, 7:36 PM

Use better name for the timer

romangg accepted this revision.Sun, Feb 24, 8:06 PM
romangg added a subscriber: romangg.

Code makes sense, but what exactly do you mean by:

Also, it's worth to mention that m_timeSinceStart isn't actually "time
since start," it's rather accumulated duration of all painting cycles.
If there is something to draw and it takes quite a while to compose the
scene, maybe m_timeSinceStart will be close enough to the current time.

In constructor of global Compositor object the timer is started and then it never stops, right? We also only ask for the elapsed time later on. So why is it not the "time since start"?

This revision is now accepted and ready to land.Sun, Feb 24, 8:06 PM
zzag added a comment.EditedSun, Feb 24, 8:21 PM

In constructor of global Compositor object the timer is started and then it never stops, right? We also only ask for the elapsed time later on. So why is it not the "time since start"?

Because m_scene->paint returns how long it took to render the next frame. For example, let's say that the mean render time is 2ms and vblank interval is 16ms, then after 10 frames m_timeSinceStart will be somewhere around 20ms, which is not what one would expect (m_timeSinceStart has to be around 160ms).

Ok, maybe then change the wording in the paragraph a bit on comit. To me it sounded like there is still a problem going on, but it seems since the variable with improper name has been removed, everything is fine now. Your decision.

zzag added a comment.Sun, Feb 24, 9:16 PM

Ok, maybe then change the wording in the paragraph a bit on comit.

Sure.

This revision was automatically updated to reflect the committed changes.