diff --git a/libweston/perfetto/annotations.c b/libweston/perfetto/annotations.c index 8eccf79f8..f4daeac9b 100644 --- a/libweston/perfetto/annotations.c +++ b/libweston/perfetto/annotations.c @@ -145,6 +145,39 @@ perfetto_annotate_container(struct weston_debug_annotation *annots, #define ADD_FLOAT(parent, key, value) \ do_perfetto_annotate_float(annots, count + new_items, parent, key, sizeof(key), value) +static int +do_perfetto_annotate_solid_buffer_values(struct weston_debug_annotation *annots, + unsigned int count, + unsigned int parent, + const char *key, + unsigned int key_size, + const struct weston_solid_buffer_values *values) +{ + int new_items = 0; + + new_items += perfetto_annotate_container(annots, count, parent, key, key_size); + + new_items += ADD_FLOAT(count, "red", values->r); + new_items += ADD_FLOAT(count, "green", values->g); + new_items += ADD_FLOAT(count, "blue", values->b); + new_items += ADD_FLOAT(count, "alpha", values->a); + + return new_items; +} + +WL_EXPORT int +perfetto_annotate_solid_buffer_values(struct weston_debug_annotation *annots, + unsigned int count, + const char *key, + unsigned int key_size, + const struct weston_solid_buffer_values *values) +{ + return do_perfetto_annotate_solid_buffer_values(annots, count, count, key, key_size, values); +} + +#define ADD_SOLID_VALUES(parent, key, value) \ + do_perfetto_annotate_solid_buffer_values(annots, count + new_items, parent, key, sizeof(key), value) + WL_EXPORT int perfetto_annotate_buffer(struct weston_debug_annotation *annots, unsigned int count, @@ -165,5 +198,8 @@ perfetto_annotate_buffer(struct weston_debug_annotation *annots, new_items += ADD_INT(parent, "width", buffer->width); new_items += ADD_INT(parent, "height", buffer->height); + if (buffer->type == WESTON_BUFFER_SOLID) + new_items += ADD_SOLID_VALUES(parent, "solid", &buffer->solid); + return new_items; } diff --git a/libweston/perfetto/annotations.h b/libweston/perfetto/annotations.h index aaa64e1e0..9eeb1c831 100644 --- a/libweston/perfetto/annotations.h +++ b/libweston/perfetto/annotations.h @@ -56,3 +56,10 @@ perfetto_annotate_buffer(struct weston_debug_annotation *annots, const char *key, unsigned int key_size, const struct weston_buffer *buffer); + +int +perfetto_annotate_solid_buffer_values(struct weston_debug_annotation *annots, + unsigned int count, + const char *key, + unsigned int key_size, + const struct weston_solid_buffer_values *values);