[PATCH wayland] add apis to enable/disable wayland debug at runtime

박성진 sj76.park at samsung.com
Fri Nov 13 02:36:28 PST 2015


Sorry, I attached the patch at the end of the following email. :)

Thanks,
Sung-Jin Park

-----Original Message-----
From: 박성진 [mailto:sj76.park at samsung.com] 
Sent: Friday, November 13, 2015 7:33 PM
To: wayland-devel at lists.freedesktop.org
Cc: Sung-Jin Park/Common Platform Lab(S/W Center)/S5/Samsung Electronics
Subject: [PATCH wayland] add apis to enable/disable wayland debug at runtime

Hello,
I added two apis in wayland-util to enable/disable display of wayland debug
information at runtime.

I had a difficulty to see wayland debug information at runtime when I'd
like to debug both a compositor and client(s).
And I found that there is no proper apis yet to enable/disable wayland
debug information at runtime.

Actually, we already know that we can see wayland debug information by
setting WAYLAND_DEBUG environment to 1.
But the environment will merely check when a compositor creates a wayland
display or a client tries to connect to an wayland display.
IMO, it's better to have the additional apis to enable/disable wayland
debug information at runtime.
It would also help if we are to catch the problems associated with timing.

Plz kindly review this patch.

=====================================================

>From 018eec7b3a7a0667d25b116945a2c98dc914dc38 Mon Sep 17 00:00:00 2001
From: Sung-Jin Park <sj76.park at samsung.com>
Date: Fri, 13 Nov 2015 18:55:17 +0900
Subject: [PATCH] add apis to enable/disable wayland debug at runtime

---
 src/wayland-client.c  |  2 --
 src/wayland-private.h |  9 +++++++++
 src/wayland-server.c  |  2 --
 src/wayland-util.c    | 15 +++++++++++++++
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index b1c600f..151d18e 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -110,8 +110,6 @@ struct wl_display {

 /** \endcond */

-static int debug_client = 0;
-
 /**
  * This helper function wakes up all threads that are
  * waiting for display->reader_cond (i. e. when reading is done,
diff --git a/src/wayland-private.h b/src/wayland-private.h
index da9040a..3003417 100644
--- a/src/wayland-private.h
+++ b/src/wayland-private.h
@@ -206,6 +206,15 @@ wl_closure_print(struct wl_closure *closure,
 void
 wl_closure_destroy(struct wl_closure *closure);

+extern int debug_client;
+extern int debug_server;
+
+void
+wl_debug_client_enable(int enable);
+
+void
+wl_debug_server_enable(int enable);
+
 extern wl_log_func_t wl_log_handler;

 void wl_log(const char *fmt, ...);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 0f04f66..c3c35ed 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -122,8 +122,6 @@ struct wl_resource {
        wl_dispatcher_func_t dispatcher;
 };

-static int debug_server = 0;
-
 WL_EXPORT void
 wl_resource_post_event_array(struct wl_resource *resource, uint32_t opcode,
                             union wl_argument *args)
diff --git a/src/wayland-util.c b/src/wayland-util.c
index 00265e9..8f9f30b 100644
--- a/src/wayland-util.c
+++ b/src/wayland-util.c
@@ -33,6 +33,9 @@
 #include "wayland-util.h"
 #include "wayland-private.h"

+int debug_client = 0;
+int debug_server = 0;
+
 struct wl_object global_zombie_object;

 WL_EXPORT void
@@ -366,6 +369,18 @@ wl_map_for_each(struct wl_map *map, wl_iterator_func_t
func, void *data)
        for_each_helper(&map->server_entries, func, data);
 }

+WL_EXPORT void
+wl_debug_client_enable(int enable)
+{
+       debug_client = !!enable;
+}
+
+WL_EXPORT void
+wl_debug_server_enable(int enable)
+{
+       debug_server = !!enable;
+}
+
 /** \endcond */

 static void
--
1.9.1

Thanks,
Sung-Jin Park
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-add-apis-to-enable-disable-wayland-debug-at-runtime.patch
Type: application/octet-stream
Size: 2339 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20151113/dfb91187/attachment.obj>


More information about the wayland-devel mailing list