diff options
author | Alexandros Frantzis <alexandros.frantzis@collabora.com> | 2017-09-27 15:09:13 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-09-29 10:20:42 +0300 |
commit | 75d38ef1ed100bbb2883e242f4c87fbab3dd0617 (patch) | |
tree | a26d2c67e7e378fd77a174b2120d1381588344d1 | |
parent | 3052bc7e6d9e05449908a22105a7b3c5143838e7 (diff) |
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>
-rw-r--r-- | libweston/timeline.c | 12 | ||||
-rw-r--r-- | libweston/timeline.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/libweston/timeline.c b/libweston/timeline.c index cf82428e..8234c27c 100644 --- a/libweston/timeline.c +++ b/libweston/timeline.c @@ -232,12 +232,24 @@ emit_vblank_timestamp(struct timeline_emit_context *ctx, void *obj) 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 diff --git a/libweston/timeline.h b/libweston/timeline.h index b10a8157..9599d813 100644 --- a/libweston/timeline.h +++ b/libweston/timeline.h @@ -42,6 +42,7 @@ enum timeline_type { TLT_OUTPUT, TLT_SURFACE, TLT_VBLANK, + TLT_GPU, }; #define TYPEVERIFY(type, arg) ({ \ @@ -53,6 +54,7 @@ enum timeline_type { #define TLP_OUTPUT(o) TLT_OUTPUT, TYPEVERIFY(struct weston_output *, (o)) #define TLP_SURFACE(s) TLT_SURFACE, TYPEVERIFY(struct weston_surface *, (s)) #define TLP_VBLANK(t) TLT_VBLANK, TYPEVERIFY(const struct timespec *, (t)) +#define TLP_GPU(t) TLT_GPU, TYPEVERIFY(const struct timespec *, (t)) #define TL_POINT(...) do { \ if (weston_timeline_enabled_) \ |