compositor: set and use the presentation clock everywhere

Graphics / Wayland / Weston - Pekka Paalanen [collabora.co.uk] - 30 September 2014 03:37 UTC

Add presentation clock setters that verify the given clock actually works. Offer an automatic choice of a software fallback clock, when a backend has to always use clock_gettime() to approximate the presentation time.

The DRM backend already queried the DRM about the clock id, just let the DRM backend set the presentation clock from that.

For all other backends which do not get a timestamp from the driver, call the software clock setter to choose a suitable clock.

Report the chosen clock via presentation.clock_id event to clients.

In finish_frame(), upgrade the argument from uint32_t milliseconds to struct timespec which can accurately hold the presentation clock values. This will be needed when weston_output_finish_frame() starts to send out presentation_feedback.presented events.

While at it, replace gettimeofday() calls with clock_gettime() using the chosen presentation clock, so we manufacture presentation timestamps from the presentation clock when the gfx drivers cannot give us a proper timestamp.

Rpi patch is more verbose due to not having the compositor pointer available in rpi_flippipe_update_complete(). Explicitly carry the clock id with flippipe so it is available in the thread.

Changes in v4:

- rpi debug build fix

b5eedad compositor: set and use the presentation clock everywhere
src/compositor-drm.c | 32 ++++++++++--------
src/compositor-fbdev.c | 12 ++++---
src/compositor-headless.c | 11 ++++---
src/compositor-rdp.c | 11 ++++---
src/compositor-rpi.c | 49 ++++++++++++++--------------
src/compositor-wayland.c | 11 +++++--
src/compositor-x11.c | 11 ++++---
src/compositor.c | 79 +++++++++++++++++++++++++++++++++++++++++----
src/compositor.h | 14 ++++++--
9 files changed, 161 insertions(+), 69 deletions(-)

Upstream: cgit.freedesktop.org


  • Share