zink: move VkQueue to batch object
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 22 Mar 2021 15:33:38 +0000 (11:33 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 30 Mar 2021 15:12:59 +0000 (15:12 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9885>

src/gallium/drivers/zink/zink_batch.c
src/gallium/drivers/zink/zink_batch.h
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_context.h

index 0bed629..eeffef7 100644 (file)
@@ -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;
 
index 6abec76..0fb4e9c 100644 (file)
@@ -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
index 4b2c355..4cef7b4 100644 (file)
@@ -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,
index 829fd42..fe9f73f 100644 (file)
@@ -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