diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c index 0aa6b9992db..5ddc2b9d492 100644 --- a/src/gallium/drivers/radeonsi/si_gfx_cs.c +++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c @@ -368,6 +368,23 @@ void si_set_tracked_regs_to_clear_state(struct si_context *ctx) ctx->last_gs_out_prim = 0; /* cleared by CLEAR_STATE */ } +static void si_draw_vbo_tmz_preamble(struct pipe_context *ctx, + const struct pipe_draw_info *info, + unsigned drawid_offset, + const struct pipe_draw_indirect_info *indirect, + const struct pipe_draw_start_count_bias *draws, + unsigned num_draws) { + struct si_context *sctx = (struct si_context *)ctx; + + bool secure = si_gfx_resources_check_encrypted(sctx); + if (secure != sctx->ws->cs_is_secure(&sctx->gfx_cs)) { + si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW | + RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION, NULL); + } + + sctx->real_draw_vbo(ctx, info, drawid_offset, indirect, draws, num_draws); +} + void si_begin_new_gfx_cs(struct si_context *ctx, bool first_cs) { bool is_secure = false; @@ -379,6 +396,8 @@ void si_begin_new_gfx_cs(struct si_context *ctx, bool first_cs) ctx->prim_discard_vertex_count_threshold = UINT_MAX; is_secure = ctx->ws->cs_is_secure(&ctx->gfx_cs); + + si_install_draw_wrapper(ctx, si_draw_vbo_tmz_preamble); } if (ctx->is_debug) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 67b6610641b..29a0e0a79d4 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -1777,15 +1777,6 @@ static void si_draw_vbo(struct pipe_context *ctx, si_decompress_textures(sctx, u_bit_consecutive(0, SI_NUM_GRAPHICS_SHADERS)); si_need_gfx_cs_space(sctx, num_draws); - /* If we're using a secure context, determine if cs must be secure or not */ - if (GFX_VERSION >= GFX9 && unlikely(radeon_uses_secure_bos(sctx->ws))) { - bool secure = si_gfx_resources_check_encrypted(sctx); - if (secure != sctx->ws->cs_is_secure(&sctx->gfx_cs)) { - si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW | - RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION, NULL); - } - } - if (HAS_TESS) { struct si_shader_selector *tcs = sctx->shader.tcs.cso;