On 21.06.2016 14:17, Marek Olšák wrote:
From: Marek Olšák <marek.ol...@amd.com>
for debugging
---
src/gallium/auxiliary/util/u_queue.c | 10 ++++++++++
src/gallium/auxiliary/util/u_queue.h | 2 ++
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 2 +-
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 2 +-
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_queue.c
b/src/gallium/auxiliary/util/u_queue.c
index d14d850..a0b0317 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -26,6 +26,7 @@
#include "u_queue.h"
#include "u_memory.h"
+#include "u_string.h"
#include "os/os_time.h"
static void
@@ -61,6 +62,13 @@ static PIPE_THREAD_ROUTINE(util_queue_thread_func, input)
FREE(input);
+ if (queue->name) {
+ char name[16] = {0};
+ util_snprintf(name, sizeof(name) - 1, "%s:%i",
+ queue->name, thread_index);
It should be safe to just say util_snprintf(name, sizeof(name), ...)
without initializing name.
Nicolai
+ pipe_thread_setname(name);
+ }
+
while (1) {
struct util_queue_job job;
@@ -96,6 +104,7 @@ static PIPE_THREAD_ROUTINE(util_queue_thread_func, input)
bool
util_queue_init(struct util_queue *queue,
+ const char *name,
unsigned max_jobs,
unsigned num_threads,
void (*execute_job)(void *, int))
@@ -103,6 +112,7 @@ util_queue_init(struct util_queue *queue,
unsigned i;
memset(queue, 0, sizeof(*queue));
+ queue->name = name;
queue->num_threads = num_threads;
queue->max_jobs = max_jobs;
diff --git a/src/gallium/auxiliary/util/u_queue.h
b/src/gallium/auxiliary/util/u_queue.h
index f3aa4f6..f005ad5 100644
--- a/src/gallium/auxiliary/util/u_queue.h
+++ b/src/gallium/auxiliary/util/u_queue.h
@@ -51,6 +51,7 @@ struct util_queue_job {
/* Put this into your context. */
struct util_queue {
+ const char *name;
pipe_mutex lock;
pipe_semaphore has_space;
pipe_semaphore queued;
@@ -64,6 +65,7 @@ struct util_queue {
};
bool util_queue_init(struct util_queue *queue,
+ const char *name,
unsigned max_jobs,
unsigned num_threads,
void (*execute_job)(void *, int));
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index 22a8122..8782665 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -493,7 +493,7 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t
screen_create)
pipe_mutex_init(ws->bo_fence_lock);
if (sysconf(_SC_NPROCESSORS_ONLN) > 1 && debug_get_option_thread())
- util_queue_init(&ws->cs_queue, 8, 1, amdgpu_cs_submit_ib);
+ util_queue_init(&ws->cs_queue, "amdgpu_cs", 8, 1, amdgpu_cs_submit_ib);
/* Create the screen at the end. The winsys must be initialized
* completely.
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 32d58b9..ea5d212 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -783,7 +783,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t
screen_create)
ws->info.gart_page_size = sysconf(_SC_PAGESIZE);
if (ws->num_cpus > 1 && debug_get_option_thread())
- util_queue_init(&ws->cs_queue, 8, 1,
+ util_queue_init(&ws->cs_queue, "radeon_cs", 8, 1,
radeon_drm_cs_emit_ioctl_oneshot);
/* Create the screen at the end. The winsys must be initialized
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev