trace: Add annotations for solid buffers

Added as an example of adding another layer of nesting, to show
the entry point for the Generic (which has no parent), and
a helper function for nesting inside another structure.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-05-05 21:27:36 -05:00
parent 84891c9e2f
commit a92dd64159
2 changed files with 43 additions and 0 deletions

View file

@ -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;
}

View file

@ -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);