Mesa (master): radeonsi/tmz: add safety assert when tmz is enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 24 15:06:53 UTC 2020


Module: Mesa
Branch: master
Commit: 0a59d2a3e9ed9965b303abd469065486ced5da77
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a59d2a3e9ed9965b303abd469065486ced5da77

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Thu Jul 23 09:41:40 2020 +0200

radeonsi/tmz: add safety assert when tmz is enabled

This commit adds asserts verifying the following conditions when
using a secure job:
- fb textures are encrypted (both colors and depth/stencil buffers)
- all writeable bo are encrypted

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

---

 src/gallium/drivers/radeonsi/si_descriptors.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 76c35ca8028..8f71ffdd2f3 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -2729,6 +2729,25 @@ bool si_gfx_resources_check_encrypted(struct si_context *sctx)
       }
    }
 
+#ifndef NDEBUG
+   if (use_encrypted_bo) {
+      /* Verify that color buffers are encrypted */
+      for (int i = 0; i < sctx->framebuffer.state.nr_cbufs; i++) {
+         struct pipe_surface *surf = sctx->framebuffer.state.cbufs[i];
+         if (!surf)
+            continue;
+         struct si_texture *tex = (struct si_texture *)surf->texture;
+         assert(!surf->texture || (tex->buffer.flags & RADEON_FLAG_ENCRYPTED));
+      }
+      /* Verify that depth/stencil buffer is encrypted */
+      if (sctx->framebuffer.state.zsbuf) {
+         struct pipe_surface *surf = sctx->framebuffer.state.zsbuf;
+         struct si_texture *tex = (struct si_texture *)surf->texture;
+         assert(!surf->texture || (tex->buffer.flags & RADEON_FLAG_ENCRYPTED));
+      }
+   }
+#endif
+
    return use_encrypted_bo;
 }
 



More information about the mesa-commit mailing list