summaryrefslogtreecommitdiff
path: root/src/compositor-rpi.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2013-04-05 23:07:11 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-04-08 14:24:03 -0400
commite5a1225bc436f86b5241152bb332014d64f5b446 (patch)
tree53ba499a646ba92e4e36ef3266c01c4f3c60c1bc /src/compositor-rpi.c
parentb76237e508d7440ce3f210b03d03f09723506436 (diff)
Make backends always specify output repaint time1.0.90
Most backends relies on gettimeofday(2) for output repaint timestamps but this is not a requirement. Before this patch repaints coming from idle_repaint() always used gettimeofday(2) for timestamps. For backends not using that time source this could cause large jumps between timestamps. To fix this, timestamps needs to always come from the backend. This means that the backend needs to always be responsible of starting the repaint loop in case that the repaint cannot start immediately. The drm backend implementation is from the patch by Ander Conselvan de Oliveira found here: http://lists.freedesktop.org/archives/wayland-devel/2013-February/007393.html Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Diffstat (limited to 'src/compositor-rpi.c')
-rw-r--r--src/compositor-rpi.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index cae6f7b9..0b3bab34 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -612,19 +612,26 @@ rpi_element_update(struct rpi_element *element,
return 0;
}
+static uint64_t
+rpi_get_current_time(void)
+{
+ struct timeval tv;
+
+ /* XXX: use CLOCK_MONOTONIC instead? */
+ gettimeofday(&tv, NULL);
+ return (uint64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000;
+}
+
static void
rpi_flippipe_update_complete(DISPMANX_UPDATE_HANDLE_T update, void *data)
{
/* This function runs in a different thread. */
struct rpi_flippipe *flippipe = data;
- struct timeval tv;
uint64_t time;
ssize_t ret;
/* manufacture flip completion timestamp */
- /* XXX: use CLOCK_MONOTONIC instead? */
- gettimeofday(&tv, NULL);
- time = (uint64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ time = rpi_get_current_time();
ret = write(flippipe->writefd, &time, sizeof time);
if (ret != sizeof time)
@@ -885,6 +892,15 @@ rpi_output_destroy_old_elements(struct rpi_output *output)
}
static void
+rpi_output_start_repaint_loop(struct weston_output *output)
+{
+ uint64_t time;
+
+ time = rpi_get_current_time();
+ weston_output_finish_frame(output, time);
+}
+
+static void
rpi_output_repaint(struct weston_output *base, pixman_region32_t *damage)
{
struct rpi_output *output = to_rpi_output(base);
@@ -1029,6 +1045,7 @@ rpi_output_create(struct rpi_compositor *compositor)
output->egl_window.width = modeinfo.width;
output->egl_window.height = modeinfo.height;
+ output->base.start_repaint_loop = rpi_output_start_repaint_loop;
output->base.repaint = rpi_output_repaint;
output->base.destroy = rpi_output_destroy;
if (compositor->max_planes > 0)