zink: barrier_cmdbuf -> reordered_cmdbuf

this is more consistent with the current usage of the cmdbuf

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25624>
This commit is contained in:
Mike Blumenkrantz
2023-10-13 08:20:28 -04:00
committed by Marge Bot
parent 00206e01a4
commit 0b11b41fff
7 changed files with 22 additions and 22 deletions

View File

@@ -285,8 +285,8 @@ zink_batch_state_destroy(struct zink_screen *screen, struct zink_batch_state *bs
if (bs->cmdbuf) if (bs->cmdbuf)
VKSCR(FreeCommandBuffers)(screen->dev, bs->cmdpool, 1, &bs->cmdbuf); VKSCR(FreeCommandBuffers)(screen->dev, bs->cmdpool, 1, &bs->cmdbuf);
if (bs->barrier_cmdbuf) if (bs->reordered_cmdbuf)
VKSCR(FreeCommandBuffers)(screen->dev, bs->cmdpool, 1, &bs->barrier_cmdbuf); VKSCR(FreeCommandBuffers)(screen->dev, bs->cmdpool, 1, &bs->reordered_cmdbuf);
if (bs->cmdpool) if (bs->cmdpool)
VKSCR(DestroyCommandPool)(screen->dev, bs->cmdpool, NULL); VKSCR(DestroyCommandPool)(screen->dev, bs->cmdpool, NULL);
free(bs->real_objs.objs); free(bs->real_objs.objs);
@@ -344,7 +344,7 @@ create_batch_state(struct zink_context *ctx)
goto fail; goto fail;
} }
bs->cmdbuf = cmdbufs[0]; bs->cmdbuf = cmdbufs[0];
bs->barrier_cmdbuf = cmdbufs[1]; bs->reordered_cmdbuf = cmdbufs[1];
#define SET_CREATE_OR_FAIL(ptr) \ #define SET_CREATE_OR_FAIL(ptr) \
if (!_mesa_set_init(ptr, bs, _mesa_hash_pointer, _mesa_key_pointer_equal)) \ if (!_mesa_set_init(ptr, bs, _mesa_hash_pointer, _mesa_key_pointer_equal)) \
@@ -472,7 +472,7 @@ zink_batch_bind_db(struct zink_context *ctx)
count++; count++;
} }
VKSCR(CmdBindDescriptorBuffersEXT)(batch->state->cmdbuf, count, infos); VKSCR(CmdBindDescriptorBuffersEXT)(batch->state->cmdbuf, count, infos);
VKSCR(CmdBindDescriptorBuffersEXT)(batch->state->barrier_cmdbuf, count, infos); VKSCR(CmdBindDescriptorBuffersEXT)(batch->state->reordered_cmdbuf, count, infos);
batch->state->dd.db_bound = true; batch->state->dd.db_bound = true;
} }
@@ -493,7 +493,7 @@ zink_start_batch(struct zink_context *ctx, struct zink_batch *batch)
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
mesa_loge("ZINK: vkBeginCommandBuffer failed (%s)", vk_Result_to_str(result)); mesa_loge("ZINK: vkBeginCommandBuffer failed (%s)", vk_Result_to_str(result));
result = VKCTX(BeginCommandBuffer)(batch->state->barrier_cmdbuf, &cbbi); result = VKCTX(BeginCommandBuffer)(batch->state->reordered_cmdbuf, &cbbi);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
mesa_loge("ZINK: vkBeginCommandBuffer failed (%s)", vk_Result_to_str(result)); mesa_loge("ZINK: vkBeginCommandBuffer failed (%s)", vk_Result_to_str(result));
@@ -511,7 +511,7 @@ zink_start_batch(struct zink_context *ctx, struct zink_batch *batch)
capture_label.pNext = NULL; capture_label.pNext = NULL;
capture_label.pLabelName = "vr-marker,frame_end,type,application"; capture_label.pLabelName = "vr-marker,frame_end,type,application";
memset(capture_label.color, 0, sizeof(capture_label.color)); memset(capture_label.color, 0, sizeof(capture_label.color));
VKCTX(CmdInsertDebugUtilsLabelEXT)(batch->state->barrier_cmdbuf, &capture_label); VKCTX(CmdInsertDebugUtilsLabelEXT)(batch->state->reordered_cmdbuf, &capture_label);
VKCTX(CmdInsertDebugUtilsLabelEXT)(batch->state->cmdbuf, &capture_label); VKCTX(CmdInsertDebugUtilsLabelEXT)(batch->state->cmdbuf, &capture_label);
} }
@@ -529,7 +529,7 @@ zink_start_batch(struct zink_context *ctx, struct zink_batch *batch)
/* zero init for unordered blits */ /* zero init for unordered blits */
if (screen->info.have_EXT_attachment_feedback_loop_dynamic_state) { if (screen->info.have_EXT_attachment_feedback_loop_dynamic_state) {
VKCTX(CmdSetAttachmentFeedbackLoopEnableEXT)(ctx->batch.state->cmdbuf, 0); VKCTX(CmdSetAttachmentFeedbackLoopEnableEXT)(ctx->batch.state->cmdbuf, 0);
VKCTX(CmdSetAttachmentFeedbackLoopEnableEXT)(ctx->batch.state->barrier_cmdbuf, 0); VKCTX(CmdSetAttachmentFeedbackLoopEnableEXT)(ctx->batch.state->reordered_cmdbuf, 0);
} }
} }
@@ -614,7 +614,7 @@ submit_queue(void *data, void *gdata, int thread_index)
si[ZINK_SUBMIT_CMDBUF].pWaitDstStageMask = bs->wait_semaphore_stages.data; si[ZINK_SUBMIT_CMDBUF].pWaitDstStageMask = bs->wait_semaphore_stages.data;
si[ZINK_SUBMIT_CMDBUF].commandBufferCount = bs->has_barriers ? 2 : 1; si[ZINK_SUBMIT_CMDBUF].commandBufferCount = bs->has_barriers ? 2 : 1;
VkCommandBuffer cmdbufs[2] = { VkCommandBuffer cmdbufs[2] = {
bs->barrier_cmdbuf, bs->reordered_cmdbuf,
bs->cmdbuf, bs->cmdbuf,
}; };
si[ZINK_SUBMIT_CMDBUF].pCommandBuffers = bs->has_barriers ? cmdbufs : &cmdbufs[1]; si[ZINK_SUBMIT_CMDBUF].pCommandBuffers = bs->has_barriers ? cmdbufs : &cmdbufs[1];
@@ -654,11 +654,11 @@ submit_queue(void *data, void *gdata, int thread_index)
mb.pNext = NULL; mb.pNext = NULL;
mb.srcAccessMask = bs->unordered_write_access; mb.srcAccessMask = bs->unordered_write_access;
mb.dstAccessMask = 0; mb.dstAccessMask = 0;
VKSCR(CmdPipelineBarrier)(bs->barrier_cmdbuf, VKSCR(CmdPipelineBarrier)(bs->reordered_cmdbuf,
bs->unordered_write_stages, 0, bs->unordered_write_stages, 0,
0, 1, &mb, 0, NULL, 0, NULL); 0, 1, &mb, 0, NULL, 0, NULL);
} }
result = VKSCR(EndCommandBuffer)(bs->barrier_cmdbuf); result = VKSCR(EndCommandBuffer)(bs->reordered_cmdbuf);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result)); mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
bs->is_device_lost = true; bs->is_device_lost = true;

View File

@@ -404,7 +404,7 @@ zink_blit(struct pipe_context *pctx,
ctx->unordered_blitting = !(info->render_condition_enable && ctx->render_condition_active) && ctx->unordered_blitting = !(info->render_condition_enable && ctx->render_condition_active) &&
zink_screen(ctx->base.screen)->info.have_KHR_dynamic_rendering && zink_screen(ctx->base.screen)->info.have_KHR_dynamic_rendering &&
!needs_present_readback && !needs_present_readback &&
zink_get_cmdbuf(ctx, src, dst) == ctx->batch.state->barrier_cmdbuf; zink_get_cmdbuf(ctx, src, dst) == ctx->batch.state->reordered_cmdbuf;
VkCommandBuffer cmdbuf = ctx->batch.state->cmdbuf; VkCommandBuffer cmdbuf = ctx->batch.state->cmdbuf;
VkPipeline pipeline = ctx->gfx_pipeline_state.pipeline; VkPipeline pipeline = ctx->gfx_pipeline_state.pipeline;
bool in_rp = ctx->batch.in_rp; bool in_rp = ctx->batch.in_rp;
@@ -415,7 +415,7 @@ zink_blit(struct pipe_context *pctx,
bool rp_tc_info_updated = ctx->rp_tc_info_updated; bool rp_tc_info_updated = ctx->rp_tc_info_updated;
if (ctx->unordered_blitting) { if (ctx->unordered_blitting) {
/* for unordered blit, swap the unordered cmdbuf for the main one for the whole op to avoid conditional hell */ /* for unordered blit, swap the unordered cmdbuf for the main one for the whole op to avoid conditional hell */
ctx->batch.state->cmdbuf = ctx->batch.state->barrier_cmdbuf; ctx->batch.state->cmdbuf = ctx->batch.state->reordered_cmdbuf;
ctx->batch.in_rp = false; ctx->batch.in_rp = false;
ctx->rp_changed = true; ctx->rp_changed = true;
ctx->queries_disabled = true; ctx->queries_disabled = true;

View File

@@ -705,14 +705,14 @@ fb_clears_apply_internal(struct zink_context *ctx, struct pipe_resource *pres, i
bool can_reorder = zink_screen(ctx->base.screen)->info.have_KHR_dynamic_rendering && bool can_reorder = zink_screen(ctx->base.screen)->info.have_KHR_dynamic_rendering &&
!ctx->render_condition_active && !ctx->render_condition_active &&
!ctx->unordered_blitting && !ctx->unordered_blitting &&
zink_get_cmdbuf(ctx, NULL, res) == ctx->batch.state->barrier_cmdbuf; zink_get_cmdbuf(ctx, NULL, res) == ctx->batch.state->reordered_cmdbuf;
if (can_reorder) { if (can_reorder) {
/* set unordered_blitting but NOT blitting: /* set unordered_blitting but NOT blitting:
* let begin_rendering handle layouts * let begin_rendering handle layouts
*/ */
ctx->unordered_blitting = true; ctx->unordered_blitting = true;
/* for unordered clears, swap the unordered cmdbuf for the main one for the whole op to avoid conditional hell */ /* for unordered clears, swap the unordered cmdbuf for the main one for the whole op to avoid conditional hell */
ctx->batch.state->cmdbuf = ctx->batch.state->barrier_cmdbuf; ctx->batch.state->cmdbuf = ctx->batch.state->reordered_cmdbuf;
ctx->rp_changed = true; ctx->rp_changed = true;
ctx->queries_disabled = true; ctx->queries_disabled = true;
ctx->batch.state->has_barriers = true; ctx->batch.state->has_barriers = true;

View File

@@ -3272,7 +3272,7 @@ reapply_color_write(struct zink_context *ctx)
const VkBool32 disables[PIPE_MAX_COLOR_BUFS] = {0}; const VkBool32 disables[PIPE_MAX_COLOR_BUFS] = {0};
const unsigned max_att = MIN2(PIPE_MAX_COLOR_BUFS, screen->info.props.limits.maxColorAttachments); const unsigned max_att = MIN2(PIPE_MAX_COLOR_BUFS, screen->info.props.limits.maxColorAttachments);
VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->cmdbuf, max_att, ctx->disable_color_writes ? disables : enables); VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->cmdbuf, max_att, ctx->disable_color_writes ? disables : enables);
VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->barrier_cmdbuf, max_att, enables); VKCTX(CmdSetColorWriteEnableEXT)(ctx->batch.state->reordered_cmdbuf, max_att, enables);
assert(screen->info.have_EXT_extended_dynamic_state); assert(screen->info.have_EXT_extended_dynamic_state);
if (ctx->dsa_state) if (ctx->dsa_state)
VKCTX(CmdSetDepthWriteEnableEXT)(ctx->batch.state->cmdbuf, ctx->disable_color_writes ? VK_FALSE : ctx->dsa_state->hw_state.depth_write); VKCTX(CmdSetDepthWriteEnableEXT)(ctx->batch.state->cmdbuf, ctx->disable_color_writes ? VK_FALSE : ctx->dsa_state->hw_state.depth_write);
@@ -3342,7 +3342,7 @@ flush_batch(struct zink_context *ctx, bool sync)
ctx->sample_locations_changed = ctx->gfx_pipeline_state.sample_locations_enabled; ctx->sample_locations_changed = ctx->gfx_pipeline_state.sample_locations_enabled;
if (zink_screen(ctx->base.screen)->info.dynamic_state2_feats.extendedDynamicState2PatchControlPoints) { if (zink_screen(ctx->base.screen)->info.dynamic_state2_feats.extendedDynamicState2PatchControlPoints) {
VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->cmdbuf, ctx->gfx_pipeline_state.dyn_state2.vertices_per_patch); VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->cmdbuf, ctx->gfx_pipeline_state.dyn_state2.vertices_per_patch);
VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->barrier_cmdbuf, 1); VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->reordered_cmdbuf, 1);
} }
update_feedback_loop_dynamic_state(ctx); update_feedback_loop_dynamic_state(ctx);
if (screen->info.have_EXT_color_write_enable) if (screen->info.have_EXT_color_write_enable)
@@ -4424,7 +4424,7 @@ zink_copy_buffer(struct zink_context *ctx, struct zink_resource *dst, struct zin
zink_screen(ctx->base.screen)->buffer_barrier(ctx, src, VK_ACCESS_TRANSFER_READ_BIT, 0); zink_screen(ctx->base.screen)->buffer_barrier(ctx, src, VK_ACCESS_TRANSFER_READ_BIT, 0);
bool unordered_dst = zink_resource_buffer_transfer_dst_barrier(ctx, dst, dst_offset, size); bool unordered_dst = zink_resource_buffer_transfer_dst_barrier(ctx, dst, dst_offset, size);
bool can_unorder = unordered_dst && unordered_src && !(zink_debug & ZINK_DEBUG_NOREORDER); bool can_unorder = unordered_dst && unordered_src && !(zink_debug & ZINK_DEBUG_NOREORDER);
VkCommandBuffer cmdbuf = can_unorder ? ctx->batch.state->barrier_cmdbuf : zink_get_cmdbuf(ctx, src, dst); VkCommandBuffer cmdbuf = can_unorder ? ctx->batch.state->reordered_cmdbuf : zink_get_cmdbuf(ctx, src, dst);
ctx->batch.state->has_barriers |= can_unorder; ctx->batch.state->has_barriers |= can_unorder;
zink_batch_reference_resource_rw(batch, src, false); zink_batch_reference_resource_rw(batch, src, false);
zink_batch_reference_resource_rw(batch, dst, true); zink_batch_reference_resource_rw(batch, dst, true);
@@ -5436,7 +5436,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
*/ */
if (screen->info.dynamic_state2_feats.extendedDynamicState2PatchControlPoints) { if (screen->info.dynamic_state2_feats.extendedDynamicState2PatchControlPoints) {
VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->cmdbuf, 1); VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->cmdbuf, 1);
VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->barrier_cmdbuf, 1); VKCTX(CmdSetPatchControlPointsEXT)(ctx->batch.state->reordered_cmdbuf, 1);
} }
} }
if (!is_copy_only) { if (!is_copy_only) {

View File

@@ -148,7 +148,7 @@ reset_vk_query_pool(struct zink_context *ctx, struct zink_vk_query *vkq)
{ {
struct zink_batch *batch = &ctx->batch; struct zink_batch *batch = &ctx->batch;
if (vkq->needs_reset) { if (vkq->needs_reset) {
VKCTX(CmdResetQueryPool)(batch->state->barrier_cmdbuf, vkq->pool->query_pool, vkq->query_id, 1); VKCTX(CmdResetQueryPool)(batch->state->reordered_cmdbuf, vkq->pool->query_pool, vkq->query_id, 1);
batch->state->has_barriers = true; batch->state->has_barriers = true;
} }
vkq->needs_reset = false; vkq->needs_reset = false;

View File

@@ -288,7 +288,7 @@ zink_get_cmdbuf(struct zink_context *ctx, struct zink_resource *src, struct zink
if (unordered_exec) { if (unordered_exec) {
ctx->batch.state->has_barriers = true; ctx->batch.state->has_barriers = true;
ctx->batch.has_work = true; ctx->batch.has_work = true;
return ctx->batch.state->barrier_cmdbuf; return ctx->batch.state->reordered_cmdbuf;
} }
return ctx->batch.state->cmdbuf; return ctx->batch.state->cmdbuf;
} }
@@ -357,7 +357,7 @@ zink_resource_image_barrier(struct zink_context *ctx, struct zink_resource *res,
} else { } else {
cmdbuf = is_write ? zink_get_cmdbuf(ctx, NULL, res) : zink_get_cmdbuf(ctx, res, NULL); cmdbuf = is_write ? zink_get_cmdbuf(ctx, NULL, res) : zink_get_cmdbuf(ctx, res, NULL);
/* force subsequent barriers to be ordered to avoid layout desync */ /* force subsequent barriers to be ordered to avoid layout desync */
if (cmdbuf != ctx->batch.state->barrier_cmdbuf) { if (cmdbuf != ctx->batch.state->reordered_cmdbuf) {
res->obj->unordered_write = false; res->obj->unordered_write = false;
res->obj->unordered_read = false; res->obj->unordered_read = false;
} }

View File

@@ -598,7 +598,7 @@ struct zink_batch_state {
struct zink_context *ctx; struct zink_context *ctx;
VkCommandPool cmdpool; VkCommandPool cmdpool;
VkCommandBuffer cmdbuf; VkCommandBuffer cmdbuf;
VkCommandBuffer barrier_cmdbuf; VkCommandBuffer reordered_cmdbuf;
VkSemaphore signal_semaphore; //external signal semaphore VkSemaphore signal_semaphore; //external signal semaphore
struct util_dynarray signal_semaphores; //external signal semaphores struct util_dynarray signal_semaphores; //external signal semaphores
struct util_dynarray wait_semaphores; //external wait semaphores struct util_dynarray wait_semaphores; //external wait semaphores