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>
macos/master
Chia-I Wu 4 years ago
parent 200ef69dc9
commit 5ec017709c
  1. 7
      src/vkr_renderer.c
  2. 9
      src/vkr_ring.c

@ -11,6 +11,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "c11/threads.h" #include "c11/threads.h"
#include "os/os_thread.h"
#include "pipe/p_compiler.h" #include "pipe/p_compiler.h"
#include "pipe/p_state.h" #include "pipe/p_state.h"
#include "util/u_debug.h" #include "util/u_debug.h"
@ -168,6 +169,7 @@ struct vkr_queue {
bool has_thread; bool has_thread;
int eventfd; int eventfd;
uint32_t thread_ctx_id;
thrd_t thread; thrd_t thread;
mtx_t mutex; mtx_t mutex;
cnd_t cond; cnd_t cond;
@ -1478,6 +1480,10 @@ vkr_queue_thread(void *arg)
struct vkr_queue *queue = arg; struct vkr_queue *queue = arg;
struct vkr_device *dev = queue->device; struct vkr_device *dev = queue->device;
const uint64_t ns_per_sec = 1000000000llu; 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); mtx_lock(&queue->mutex);
while (true) { while (true) {
@ -1583,6 +1589,7 @@ vkr_queue_create(struct vkr_context *ctx,
} }
if (ctx->fence_eventfd >= 0) { if (ctx->fence_eventfd >= 0) {
queue->thread_ctx_id = ctx->base.ctx_id;
ret = thrd_create(&queue->thread, vkr_queue_thread, queue); ret = thrd_create(&queue->thread, vkr_queue_thread, queue);
if (ret != thrd_success) { if (ret != thrd_success) {
mtx_destroy(&queue->mutex); mtx_destroy(&queue->mutex);

@ -6,11 +6,14 @@
#include "vkr_ring.h" #include "vkr_ring.h"
#include <assert.h> #include <assert.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include "os/os_thread.h"
#include "util/u_math.h" #include "util/u_math.h"
#include "util/u_memory.h"
#include "virgl_context.h" #include "virgl_context.h"
enum vkr_ring_status_flag { enum vkr_ring_status_flag {
@ -163,10 +166,14 @@ vkr_ring_thread(void *arg)
{ {
struct vkr_ring *ring = arg; struct vkr_ring *ring = arg;
struct virgl_context *ctx = ring->context; 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(); uint64_t last_submit = vkr_ring_now();
uint32_t relax_iter = 0; uint32_t relax_iter = 0;
int ret = 0; int ret = 0;
while (ring->started) { while (ring->started) {
bool wait = false; bool wait = false;
uint32_t cmd_size; uint32_t cmd_size;

Loading…
Cancel
Save