libweston: Notify timeline of object modification
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 15 Oct 2019 10:25:41 +0000 (13:25 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 17 Oct 2019 18:42:25 +0000 (21:42 +0300)
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 <marius.vlad@collabora.com>
include/libweston/libweston.h
include/libweston/timeline-object.h
libweston/compositor.c
libweston/timeline.c

index 3d69f4753052eedeb99dde1197cf78e19c30f292..d0ef986531486cea3bfa21fb71257b9caee7ced3 100644 (file)
@@ -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
index 943f979c1633620dbe43623af3b162cf87ddba97..6c9b2a8ae239543ca39cf5f35c927f9fb17bc755 100644 (file)
@@ -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 */
index 420bc847a2151da6b9be812faf5dfae8e229e676..26a62c7ec0bf51a88e9349d282b00cb045d52896 100644 (file)
@@ -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
index 33a533c4fe2d86380ed59c3d09c28fb660a19829..2c782deb2bb4d8bfe00977a5facd8d6cb8251f2d 100644 (file)
@@ -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[] = {