diff options
author | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-09-23 22:08:45 -0400 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-09-30 11:37:02 +0300 |
commit | b5eedade367098c61e656c1c5b795760da60b978 (patch) | |
tree | 056a84a901b01f6c028c029f8826cae6ec4b2ee7 /src/compositor.h | |
parent | 93a6afdf6ed88a1ee2965a3de56a49ec152087ce (diff) | |
download | weston-b5eedade367098c61e656c1c5b795760da60b978.tar.gz |
compositor: set and use the presentation clock everywhere
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
v4 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Diffstat (limited to 'src/compositor.h')
-rw-r--r-- | src/compositor.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/compositor.h b/src/compositor.h index f4263d8f..61b374f7 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -28,6 +28,7 @@ extern "C" { #endif +#include <time.h> #include <pixman.h> #include <xkbcommon/xkbcommon.h> @@ -201,7 +202,7 @@ struct weston_output { struct wl_signal frame_signal; struct wl_signal destroy_signal; int move_x, move_y; - uint32_t frame_time; + uint32_t frame_time; /* presentation timestamp in milliseconds */ int disable_planes; int destroying; @@ -663,6 +664,8 @@ struct weston_compositor { int32_t kb_repeat_rate; int32_t kb_repeat_delay; + + clockid_t presentation_clock; }; struct weston_buffer { @@ -1046,7 +1049,8 @@ weston_compositor_stack_plane(struct weston_compositor *ec, struct weston_plane *above); void -weston_output_finish_frame(struct weston_output *output, uint32_t msecs); +weston_output_finish_frame(struct weston_output *output, + const struct timespec *stamp); void weston_output_schedule_repaint(struct weston_output *output); void @@ -1234,6 +1238,12 @@ weston_compositor_get_time(void); int weston_compositor_init(struct weston_compositor *ec, struct wl_display *display, int *argc, char *argv[], struct weston_config *config); +int +weston_compositor_set_presentation_clock(struct weston_compositor *compositor, + clockid_t clk_id); +int +weston_compositor_set_presentation_clock_software( + struct weston_compositor *compositor); void weston_compositor_shutdown(struct weston_compositor *ec); void |