vkr: add vkr_queue::context

It replaces vkr_queue::thread_ctx_id.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
macos/master
Chia-I Wu 3 years ago
parent d2aa0783e5
commit 9074c20c74
  1. 7
      src/vkr_renderer.c

@ -162,6 +162,7 @@ struct vkr_device {
struct vkr_queue { struct vkr_queue {
struct vkr_object base; struct vkr_object base;
struct vkr_context *context;
struct vkr_device *device; struct vkr_device *device;
uint32_t family; uint32_t family;
@ -169,7 +170,6 @@ 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;
@ -1510,11 +1510,12 @@ static int
vkr_queue_thread(void *arg) vkr_queue_thread(void *arg)
{ {
struct vkr_queue *queue = arg; struct vkr_queue *queue = arg;
struct vkr_context *ctx = queue->context;
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]; 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); pipe_thread_setname(thread_name);
mtx_lock(&queue->mutex); mtx_lock(&queue->mutex);
@ -1601,6 +1602,7 @@ vkr_queue_create(struct vkr_context *ctx,
queue->base.id = id; queue->base.id = id;
queue->base.handle.queue = handle; queue->base.handle.queue = handle;
queue->context = ctx;
queue->device = dev; queue->device = dev;
queue->family = family; queue->family = family;
queue->index = index; queue->index = index;
@ -1621,7 +1623,6 @@ 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);

Loading…
Cancel
Save