summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-03-22 11:33:38 -0400
committerMarge Bot <eric+marge@anholt.net>2021-03-30 15:12:59 +0000
commit38c5e154dfd5773f9e3a673d8ca0d5b35c6d0c24 (patch)
tree8add78d2cbee082c02636051dc3d811e78afe084
parentef538e50c84ae606496c6d99a8185feb5ec25402 (diff)
zink: move VkQueue to batch object
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9885>
-rw-r--r--src/gallium/drivers/zink/zink_batch.c2
-rw-r--r--src/gallium/drivers/zink/zink_batch.h1
-rw-r--r--src/gallium/drivers/zink/zink_context.c5
-rw-r--r--src/gallium/drivers/zink/zink_context.h1
4 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index 0bed629951a..eeffef7b7eb 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -303,7 +303,7 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
si.pNext = &mem_signal;
}
- if (vkQueueSubmit(ctx->queue, 1, &si, batch->state->fence.fence) != VK_SUCCESS) {
+ if (vkQueueSubmit(batch->queue, 1, &si, batch->state->fence.fence) != VK_SUCCESS) {
debug_printf("ZINK: vkQueueSubmit() failed\n");
ctx->is_device_lost = true;
diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h
index 6abec76c55b..0fb4e9ca644 100644
--- a/src/gallium/drivers/zink/zink_batch.h
+++ b/src/gallium/drivers/zink/zink_batch.h
@@ -78,6 +78,7 @@ struct zink_batch {
struct zink_batch_state *state;
uint32_t last_batch_id;
+ VkQueue queue; //gfx+compute
bool has_work;
bool in_rp; //renderpass is currently active
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 4b2c355c6f0..4cef7b468de 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -289,7 +289,7 @@ zink_context_destroy(struct pipe_context *pctx)
struct zink_context *ctx = zink_context(pctx);
struct zink_screen *screen = zink_screen(pctx->screen);
- if (ctx->queue && vkQueueWaitIdle(ctx->queue) != VK_SUCCESS)
+ if (ctx->batch.queue && vkQueueWaitIdle(ctx->batch.queue) != VK_SUCCESS)
debug_printf("vkQueueWaitIdle failed\n");
util_blitter_destroy(ctx->blitter);
@@ -2587,12 +2587,13 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
if (!ctx->blitter)
goto fail;
+ vkGetDeviceQueue(screen->dev, screen->gfx_queue, 0, &ctx->batch.queue);
+
incr_curr_batch(ctx);
zink_start_batch(ctx, &ctx->batch);
if (!ctx->batch.state)
goto fail;
- vkGetDeviceQueue(screen->dev, screen->gfx_queue, 0, &ctx->queue);
simple_mtx_init(&ctx->batch_mtx, mtx_plain);
ctx->program_cache = _mesa_hash_table_create(NULL,
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 829fd422596..fe9f73fcc3e 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -136,7 +136,6 @@ struct zink_context {
struct zink_batch batch;
simple_mtx_t batch_mtx;
struct zink_fence *last_fence; //the last command buffer submitted
- VkQueue queue; //gfx+compute
struct hash_table batch_states; //submitted batch states
struct util_dynarray free_batch_states; //unused batch states
VkDeviceSize resource_size; //the accumulated size of resources in submitted buffers