radeonsi: use si_install_draw_wrapper for tmz handling

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10979>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2021-05-19 18:38:29 +02:00
parent b2bd9c5ccd
commit 9675de4c18
2 changed files with 19 additions and 9 deletions
+19
View File
@@ -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)
@@ -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;