From 5de9297df2e5c99e72a565e5971d661ddbe730e6 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Tue, 15 Oct 2019 13:25:41 +0300 Subject: [PATCH] libweston: Notify timeline of object modification We notify the timeline of the fact that the object suffered modifications through the 'set_label' function. Remove the old refresh variable. Signed-off-by: Marius Vlad --- include/libweston/libweston.h | 4 ++++ include/libweston/timeline-object.h | 8 -------- libweston/compositor.c | 3 ++- libweston/timeline.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 3d69f4753..d0ef98653 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -2049,6 +2049,10 @@ weston_log_ctx_compositor_destroy(struct weston_compositor *compositor); int weston_compositor_enable_content_protection(struct weston_compositor *compositor); +void +weston_timeline_refresh_subscription_objects(struct weston_compositor *wc, + void *object); + #ifdef __cplusplus } #endif diff --git a/include/libweston/timeline-object.h b/include/libweston/timeline-object.h index 943f979c1..6c9b2a8ae 100644 --- a/include/libweston/timeline-object.h +++ b/include/libweston/timeline-object.h @@ -42,14 +42,6 @@ struct weston_timeline_object { /* Object id in the timeline JSON output. 0 is invalid. */ unsigned id; - - /* - * If non-zero, forces a re-emission of object description. - * Should be set to non-zero, when changing long-lived - * object state that is not emitted on normal timeline - * events. - */ - unsigned force_refresh; }; #endif /* WESTON_TIMELINE_OBJECT_H */ diff --git a/libweston/compositor.c b/libweston/compositor.c index 420bc847a..26a62c7ec 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -4088,7 +4088,8 @@ weston_surface_set_label_func(struct weston_surface *surface, char *, size_t)) { surface->get_label = desc; - surface->timeline.force_refresh = 1; + weston_timeline_refresh_subscription_objects(surface->compositor, + surface); } /** Get the size of surface contents diff --git a/libweston/timeline.c b/libweston/timeline.c index 33a533c4f..2c782deb2 100644 --- a/libweston/timeline.c +++ b/libweston/timeline.c @@ -308,6 +308,34 @@ emit_gpu_timestamp(struct timeline_emit_context *ctx, void *obj) return 1; } +static struct weston_timeline_subscription_object * +weston_timeline_get_subscription_object(struct weston_log_subscription *sub, + void *object) +{ + struct weston_timeline_subscription *tl_sub; + + tl_sub = weston_log_subscription_get_data(sub); + if (!tl_sub) + return NULL; + + return weston_timeline_subscription_search(tl_sub, object); +} + +WL_EXPORT void +weston_timeline_refresh_subscription_objects(struct weston_compositor *wc, + void *object) +{ + struct weston_log_subscription *sub = NULL; + + while ((sub = weston_log_subscription_iterate(wc->timeline, sub))) { + struct weston_timeline_subscription_object *sub_obj; + + sub_obj = weston_timeline_get_subscription_object(sub, object); + if (sub_obj) + sub_obj->force_refresh = true; + } +} + typedef int (*type_func)(struct timeline_emit_context *ctx, void *obj); static const type_func type_dispatch[] = {