From 9074c20c7459245499eab619467ed713a21cdfdb Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 7 Jul 2021 11:18:16 -0700 Subject: [PATCH] vkr: add vkr_queue::context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It replaces vkr_queue::thread_ctx_id. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Reviewed-by: Louis-Francis Ratté-Boulianne --- src/vkr_renderer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vkr_renderer.c b/src/vkr_renderer.c index 9138e8f..5f16595 100644 --- a/src/vkr_renderer.c +++ b/src/vkr_renderer.c @@ -162,6 +162,7 @@ struct vkr_device { struct vkr_queue { struct vkr_object base; + struct vkr_context *context; struct vkr_device *device; uint32_t family; @@ -169,7 +170,6 @@ struct vkr_queue { bool has_thread; int eventfd; - uint32_t thread_ctx_id; thrd_t thread; mtx_t mutex; cnd_t cond; @@ -1510,11 +1510,12 @@ static int vkr_queue_thread(void *arg) { struct vkr_queue *queue = arg; + struct vkr_context *ctx = queue->context; 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); + snprintf(thread_name, ARRAY_SIZE(thread_name), "vkr-queue-%d", ctx->base.ctx_id); pipe_thread_setname(thread_name); mtx_lock(&queue->mutex); @@ -1601,6 +1602,7 @@ vkr_queue_create(struct vkr_context *ctx, queue->base.id = id; queue->base.handle.queue = handle; + queue->context = ctx; queue->device = dev; queue->family = family; queue->index = index; @@ -1621,7 +1623,6 @@ vkr_queue_create(struct vkr_context *ctx, } 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);