[PATCH weston] window: use wl_cursor_frame_and_duration() for mouse cursor updates

Pekka Paalanen ppaalanen at gmail.com
Wed Mar 4 00:05:02 PST 2015


On Tue,  3 Mar 2015 15:26:30 -0600
Derek Foreman <derekf at osg.samsung.com> wrote:

> Instead of a frame callback we can now use a timerfd and the time
> left in the current cursor frame.  This saves us from setting
> the cursor at 60hz even when no updates are required.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
> NOTE: this requires a wayland change I just posted...

Could just say in the commit message that this depends on Wayland patch
"...".


I understand the problem this patch fixes and I agree it needs fixing.
There is however a fundamental controversy in this patch.

In Wayland, we have driven hard the point that animations should not be
driven by timers, because timers are inaccurate in the kind of systems
where Wayland is used and completely ignore restrictions set by the
refresh cycle. Instead, one should lock to the screen update frequency
and compute which animation frame you have to show on each cycle.

This patch goes from refresh driven updates to timer based updates,
which sends a totally wrong signal to the public, even if it is just
the toytoolkit's cursors.

But, the timer is needed here to avoid hogging the CPU.

I would propose a hybrid: if the duration until next frame change is
below, say, 100 ms, then use the frame callback driven active loop. If
the duration is longer, fall off the frame callback and set a timer to
trigger a little before the duration is over so you can restart the
active loop.

How would that sound?


Thanks,
pq


More information about the wayland-devel mailing list