Mesa (master): ddebug: set thread name

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 25 10:37:35 UTC 2019


Module: Mesa
Branch: master
Commit: fe0d2b3d372796367ce3ca20589cf8cb34352b0b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe0d2b3d372796367ce3ca20589cf8cb34352b0b

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Tue Feb 26 13:07:30 2019 +0100

ddebug: set thread name

For better debuggability.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/driver_ddebug/dd_draw.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
index f5b94356119..4eb0dd096f4 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
@@ -33,6 +33,7 @@
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
+#include "util/u_process.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_scan.h"
 #include "util/os_time.h"
@@ -1002,6 +1003,15 @@ dd_thread_main(void *input)
    struct dd_screen *dscreen = dd_screen(dctx->base.screen);
    struct pipe_screen *screen = dscreen->screen;
 
+   const char *process_name = util_get_process_name();
+   if (process_name) {
+      char threadname[16];
+      util_snprintf(threadname, sizeof(threadname), "%.*s:ddbg",
+                    (int)MIN2(strlen(process_name), sizeof(threadname) - 6),
+                    process_name);
+      u_thread_setname(threadname);
+   }
+
    mtx_lock(&dctx->mutex);
 
    for (;;) {




More information about the mesa-commit mailing list