From a6acfa83460d4f1e9f59fd5e52a8e39e1b8d4167 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Sun, 17 Mar 2019 18:10:09 +0200 Subject: [PATCH] compositor: Fix invalid view numbering in scene-graph With the addition of patch 433f4e77b7729 we display the same view id (0) for every view as we're modifying the local variable. Displaying sub-surfaces based views is also problematic. The caller need to modify the view number as well, so we instead we pass the address as to allow that to happen. Otherwise we end up repeating the same number for views without sub-subrfaces once those have been printed. Signed-off-by: Marius Vlad --- libweston/compositor.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index d87522e7..4c096ae3 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -6647,7 +6647,7 @@ debug_scene_view_print(FILE *fp, struct weston_view *view, int view_idx) static void debug_scene_view_print_tree(struct weston_view *view, - FILE *fp, int view_idx) + FILE *fp, int *view_idx) { struct weston_subsurface *sub; struct weston_view *ev; @@ -6656,7 +6656,7 @@ debug_scene_view_print_tree(struct weston_view *view, * print the view first, then we recursively go on printing * sub-surfaces. We bail out once no more sub-surfaces are available. */ - debug_scene_view_print(fp, view, view_idx++); + debug_scene_view_print(fp, view, *view_idx); /* no more sub-surfaces */ if (wl_list_empty(&view->surface->subsurface_list)) @@ -6667,6 +6667,8 @@ debug_scene_view_print_tree(struct weston_view *view, /* do not print again the parent view */ if (view == ev) continue; + + (*view_idx)++; debug_scene_view_print_tree(ev, fp, view_idx); } } @@ -6741,8 +6743,10 @@ weston_compositor_print_scene_graph(struct weston_compositor *ec) layer->mask.x2, layer->mask.y2); } - wl_list_for_each(view, &layer->view_list.link, layer_link.link) - debug_scene_view_print_tree(view, fp, view_idx); + wl_list_for_each(view, &layer->view_list.link, layer_link.link) { + debug_scene_view_print_tree(view, fp, &view_idx); + view_idx++; + } if (wl_list_empty(&layer->view_list.link)) fprintf(fp, "\t[no views]\n");