diff options
Diffstat (limited to 'bsp/meta-synopsys/recipes-graphics/wayland/weston/1010-xwm-dump_property-to-use-FILE-internally.patch')
-rw-r--r-- | bsp/meta-synopsys/recipes-graphics/wayland/weston/1010-xwm-dump_property-to-use-FILE-internally.patch | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/bsp/meta-synopsys/recipes-graphics/wayland/weston/1010-xwm-dump_property-to-use-FILE-internally.patch b/bsp/meta-synopsys/recipes-graphics/wayland/weston/1010-xwm-dump_property-to-use-FILE-internally.patch new file mode 100644 index 00000000..e9e46002 --- /dev/null +++ b/bsp/meta-synopsys/recipes-graphics/wayland/weston/1010-xwm-dump_property-to-use-FILE-internally.patch @@ -0,0 +1,141 @@ +From 0a3ef9902a210ab1fa0e4ed317ad7782f0399b51 Mon Sep 17 00:00:00 2001 +From: Pekka Paalanen <pq@iki.fi> +Date: Thu, 12 Oct 2017 13:18:12 +0200 +Subject: [PATCH 10/46] xwm: dump_property() to use FILE internally + +Write the output of dump_property() out in one log call. When multiple +processes (weston and Xwayland) are writing to the same file, this will +keep the property dump uninterrupted by Xwayland debug prints. + +This is also preparation for more development in the same direction. + +Signed-off-by: Pekka Paalanen <pq@iki.fi> +Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com> +Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> +Reviewed-by: Daniel Stone <daniels@collabora.com> +--- + xwayland/window-manager.c | 58 ++++++++++++++++++++++++----------------------- + 1 file changed, 30 insertions(+), 28 deletions(-) + +diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c +index 2b3defb7..3bf323a4 100644 +--- a/xwayland/window-manager.c ++++ b/xwayland/window-manager.c +@@ -410,20 +410,14 @@ dump_cardinal_array_elem(FILE *fp, unsigned format, + } + + static void +-dump_cardinal_array(xcb_get_property_reply_t *reply) ++dump_cardinal_array(FILE *fp, xcb_get_property_reply_t *reply) + { + unsigned i = 0; +- FILE *fp; + void *arr; + char *str = NULL; +- size_t size = 0; + + assert(reply->type == XCB_ATOM_CARDINAL); + +- fp = open_memstream(&str, &size); +- if (!fp) +- return; +- + arr = xcb_get_property_value(reply); + + fprintf(fp, "["); +@@ -432,10 +426,6 @@ dump_cardinal_array(xcb_get_property_reply_t *reply) + arr, reply->value_len, i); + fprintf(fp, "]"); + +- if (fclose(fp) != 0) +- return; +- +- wm_log_continue("%s\n", str); + free(str); + } + +@@ -449,22 +439,29 @@ dump_property(struct weston_wm *wm, + xcb_window_t *window_value; + int width, len; + uint32_t i; ++ FILE *fp; ++ char *logstr; ++ size_t logsize; + +- width = wm_log_continue("%s: ", get_atom_name(wm->conn, property)); +- if (reply == NULL) { +- wm_log_continue("(no reply)\n"); ++ fp = open_memstream(&logstr, &logsize); ++ if (!fp) + return; ++ ++ width = fprintf(fp, "%s: ", get_atom_name(wm->conn, property)); ++ if (reply == NULL) { ++ fprintf(fp, "(no reply)\n"); ++ goto out; + } + +- width += wm_log_continue("%s/%d, length %d (value_len %d): ", +- get_atom_name(wm->conn, reply->type), +- reply->format, +- xcb_get_property_value_length(reply), +- reply->value_len); ++ width += fprintf(fp, "%s/%d, length %d (value_len %d): ", ++ get_atom_name(wm->conn, reply->type), ++ reply->format, ++ xcb_get_property_value_length(reply), ++ reply->value_len); + + if (reply->type == wm->atom.incr) { + incr_value = xcb_get_property_value(reply); +- wm_log_continue("%d\n", *incr_value); ++ fprintf(fp, "%d\n", *incr_value); + } else if (reply->type == wm->atom.utf8_string || + reply->type == wm->atom.string) { + text_value = xcb_get_property_value(reply); +@@ -472,29 +469,34 @@ dump_property(struct weston_wm *wm, + len = 40; + else + len = reply->value_len; +- wm_log_continue("\"%.*s\"\n", len, text_value); ++ fprintf(fp, "\"%.*s\"\n", len, text_value); + } else if (reply->type == XCB_ATOM_ATOM) { + atom_value = xcb_get_property_value(reply); + for (i = 0; i < reply->value_len; i++) { + name = get_atom_name(wm->conn, atom_value[i]); + if (width + strlen(name) + 2 > 78) { +- wm_log_continue("\n "); ++ fprintf(fp, "\n "); + width = 4; + } else if (i > 0) { +- width += wm_log_continue(", "); ++ width += fprintf(fp, ", "); + } + +- width += wm_log_continue("%s", name); ++ width += fprintf(fp, "%s", name); + } +- wm_log_continue("\n"); ++ fprintf(fp, "\n"); + } else if (reply->type == XCB_ATOM_CARDINAL) { +- dump_cardinal_array(reply); ++ dump_cardinal_array(fp, reply); + } else if (reply->type == XCB_ATOM_WINDOW && reply->format == 32) { + window_value = xcb_get_property_value(reply); +- wm_log_continue("win %u\n", *window_value); ++ fprintf(fp, "win %u\n", *window_value); + } else { +- wm_log_continue("huh?\n"); ++ fprintf(fp, "huh?\n"); + } ++ ++out: ++ if (fclose(fp) == 0) ++ wm_log_continue("%s", logstr); ++ free(logstr); + } + + static void +-- +2.16.2 + |