zink: more batch-ism
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 20 Jun 2019 08:24:03 +0000 (10:24 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:45 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_batch.c
src/gallium/drivers/zink/zink_batch.h
src/gallium/drivers/zink/zink_context.c

index 7f73d26..0db58c6 100644 (file)
@@ -37,7 +37,7 @@ reset_batch(struct zink_screen *screen, struct zink_batch *batch)
 }
 
 void
-zink_start_cmdbuf(struct zink_context *ctx, struct zink_batch *batch)
+zink_start_batch(struct zink_context *ctx, struct zink_batch *batch)
 {
    reset_batch(zink_screen(ctx->base.screen), batch);
 
@@ -72,7 +72,7 @@ submit_cmdbuf(struct zink_context *ctx, VkCommandBuffer cmdbuf, VkFence fence)
 }
 
 void
-zink_end_cmdbuf(struct zink_context *ctx, struct zink_batch *batch)
+zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
 {
    if (vkEndCommandBuffer(batch->cmdbuf) != VK_SUCCESS) {
       debug_printf("vkEndCommandBuffer failed\n");
index 49fd8a5..d08a5d4 100644 (file)
@@ -47,10 +47,10 @@ struct zink_batch {
 };
 
 void
-zink_start_cmdbuf(struct zink_context *ctx, struct zink_batch *batch);
+zink_start_batch(struct zink_context *ctx, struct zink_batch *batch);
 
 void
-zink_end_cmdbuf(struct zink_context *ctx, struct zink_batch *batch);
+zink_end_batch(struct zink_context *ctx, struct zink_batch *batch);
 
 void
 zink_batch_reference_resoure(struct zink_batch *cmdbuf,
index a4bd82f..fde12a9 100644 (file)
@@ -506,15 +506,6 @@ get_framebuffer(struct zink_context *ctx)
    return entry->data;
 }
 
-static void
-end_batch(struct zink_context *ctx, struct zink_batch *batch)
-{
-   if (batch->rp)
-      vkCmdEndRenderPass(batch->cmdbuf);
-
-   zink_end_cmdbuf(ctx, batch);
-}
-
 void
 zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
 {
@@ -546,14 +537,18 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
 static void
 flush_batch(struct zink_context *ctx)
 {
-   end_batch(ctx, zink_context_curr_batch(ctx));
+   struct zink_batch *batch = zink_context_curr_batch(ctx);
+   if (batch->rp)
+      vkCmdEndRenderPass(batch->cmdbuf);
+
+   zink_end_batch(ctx, batch);
 
    ctx->curr_batch++;
    if (ctx->curr_batch == ARRAY_SIZE(ctx->batches))
       ctx->curr_batch = 0;
 
-   struct zink_batch *batch = zink_context_curr_batch(ctx);
-   zink_start_cmdbuf(ctx, batch);
+   batch = zink_context_curr_batch(ctx);
+   zink_start_batch(ctx, batch);
 }
 
 static void
@@ -1385,7 +1380,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
    ctx->dirty = ZINK_DIRTY_PROGRAM;
 
    /* start the first batch */
-   zink_start_cmdbuf(ctx, zink_context_curr_batch(ctx));
+   zink_start_batch(ctx, zink_context_curr_batch(ctx));
 
    return &ctx->base;