Mesa (main): radeonsi: use si_install_draw_wrapper for tmz handling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 15 10:25:51 UTC 2021


Module: Mesa
Branch: main
Commit: 9675de4c184f200a2e2c88334a9592f3172b0e02
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9675de4c184f200a2e2c88334a9592f3172b0e02

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Wed May 19 18:38:29 2021 +0200

radeonsi: use si_install_draw_wrapper for tmz handling

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10979>

---

 src/gallium/drivers/radeonsi/si_gfx_cs.c       | 19 +++++++++++++++++++
 src/gallium/drivers/radeonsi/si_state_draw.cpp |  9 ---------
 2 files changed, 19 insertions(+), 9 deletions(-)

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;
 



More information about the mesa-commit mailing list