From 9698a222a6c26e998d9efe6d940e11772aa8610c Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 6 Oct 2020 16:21:53 +0200 Subject: [PATCH] radeonsi: honor PIPE_BIND_PROTECTED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_buffer.c | 7 ++++--- src/gallium/drivers/radeonsi/si_texture.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_buffer.c b/src/gallium/drivers/radeonsi/si_buffer.c index 31f1318542d..f44f3fd2e32 100644 --- a/src/gallium/drivers/radeonsi/si_buffer.c +++ b/src/gallium/drivers/radeonsi/si_buffer.c @@ -166,9 +166,10 @@ void si_init_resource_fields(struct si_screen *sscreen, struct si_resource *res, else res->flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING; - /* Force scanout/depth/stencil buffer allocation to be encrypted */ - if (sscreen->debug_flags & DBG(TMZ) && - res->b.b.bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DEPTH_STENCIL)) + if (res->b.b.bind & PIPE_BIND_PROTECTED || + /* Force scanout/depth/stencil buffer allocation to be encrypted */ + (sscreen->debug_flags & DBG(TMZ) && + res->b.b.bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DEPTH_STENCIL))) res->flags |= RADEON_FLAG_ENCRYPTED; if (res->b.b.flags & PIPE_RESOURCE_FLAG_ENCRYPTED) diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 25b6c380e3d..6aaf9ebfd04 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1437,6 +1437,8 @@ static struct pipe_resource *si_texture_from_winsys_buffer(struct si_screen *ssc tex->buffer.b.is_shared = true; tex->buffer.external_usage = usage; tex->num_planes = 1; + if (tex->buffer.flags & RADEON_FLAG_ENCRYPTED) + tex->buffer.b.b.bind |= PIPE_BIND_PROTECTED; /* Account for multiple planes with lowered yuv import. */ struct pipe_resource *next_plane = tex->buffer.b.b.next;