timeline: Add GPU timestamp timepoint argument

The purpose of this argument is to hold timestamp information about
events that occurred on the GPU. This argument allows us to include GPU
timestamps in timepoints such as the beginning and end of frame
rendering.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/libweston/timeline.c b/libweston/timeline.c
index cf82428..8234c27 100644
--- a/libweston/timeline.c
+++ b/libweston/timeline.c
@@ -232,12 +232,24 @@
 	return 1;
 }
 
+static int
+emit_gpu_timestamp(struct timeline_emit_context *ctx, void *obj)
+{
+	struct timespec *ts = obj;
+
+	fprintf(ctx->cur, "\"gpu\":[%" PRId64 ", %ld]",
+		(int64_t)ts->tv_sec, ts->tv_nsec);
+
+	return 1;
+}
+
 typedef int (*type_func)(struct timeline_emit_context *ctx, void *obj);
 
 static const type_func type_dispatch[] = {
 	[TLT_OUTPUT] = emit_weston_output,
 	[TLT_SURFACE] = emit_weston_surface,
 	[TLT_VBLANK] = emit_vblank_timestamp,
+	[TLT_GPU] = emit_gpu_timestamp,
 };
 
 WL_EXPORT void