vkr: set the names for the queue threads and ring threads
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
diff --git a/src/vkr_renderer.c b/src/vkr_renderer.c
index 7cdfba3..69fae58 100644
--- a/src/vkr_renderer.c
+++ b/src/vkr_renderer.c
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include "c11/threads.h"
+#include "os/os_thread.h"
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
#include "util/u_debug.h"
@@ -168,6 +169,7 @@
bool has_thread;
int eventfd;
+ uint32_t thread_ctx_id;
thrd_t thread;
mtx_t mutex;
cnd_t cond;
@@ -1478,6 +1480,10 @@
struct vkr_queue *queue = arg;
struct vkr_device *dev = queue->device;
const uint64_t ns_per_sec = 1000000000llu;
+ char thread_name[16];
+
+ snprintf(thread_name, ARRAY_SIZE(thread_name), "vkr-queue-%d", queue->thread_ctx_id);
+ pipe_thread_setname(thread_name);
mtx_lock(&queue->mutex);
while (true) {
@@ -1583,6 +1589,7 @@
}
if (ctx->fence_eventfd >= 0) {
+ queue->thread_ctx_id = ctx->base.ctx_id;
ret = thrd_create(&queue->thread, vkr_queue_thread, queue);
if (ret != thrd_success) {
mtx_destroy(&queue->mutex);
diff --git a/src/vkr_ring.c b/src/vkr_ring.c
index b0a3392..74ba96a 100644
--- a/src/vkr_ring.c
+++ b/src/vkr_ring.c
@@ -6,11 +6,14 @@
#include "vkr_ring.h"
#include <assert.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include "os/os_thread.h"
#include "util/u_math.h"
+#include "util/u_memory.h"
#include "virgl_context.h"
enum vkr_ring_status_flag {
@@ -163,10 +166,14 @@
{
struct vkr_ring *ring = arg;
struct virgl_context *ctx = ring->context;
+ char thread_name[16];
+
+ snprintf(thread_name, ARRAY_SIZE(thread_name), "vkr-ring-%d", ctx->ctx_id);
+ pipe_thread_setname(thread_name);
+
uint64_t last_submit = vkr_ring_now();
uint32_t relax_iter = 0;
int ret = 0;
-
while (ring->started) {
bool wait = false;
uint32_t cmd_size;