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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2020-07-23 09:41:40 +02:00
committed by Marge Bot
parent 59b267dea4
commit 0a59d2a3e9
@@ -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;
}