Mesa (master): zink: move VkQueue to batch object

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 30 15:21:23 UTC 2021


Module: Mesa
Branch: master
Commit: 38c5e154dfd5773f9e3a673d8ca0d5b35c6d0c24
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=38c5e154dfd5773f9e3a673d8ca0d5b35c6d0c24

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Mar 22 11:33:38 2021 -0400

zink: move VkQueue to batch object

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9885>

---

 src/gallium/drivers/zink/zink_batch.c   | 2 +-
 src/gallium/drivers/zink/zink_batch.h   | 1 +
 src/gallium/drivers/zink/zink_context.c | 5 +++--
 src/gallium/drivers/zink/zink_context.h | 1 -
 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



More information about the mesa-commit mailing list