diff options
author | Boyuan Zhang <boyuan.zhang@amd.com> | 2021-06-16 11:39:16 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-06-18 14:35:44 +0000 |
commit | e1af22d9dd7777739fbb5f1198a1dd5748d85964 (patch) | |
tree | f2fc6e63f5523db45e341c28d49641351a7dfc22 /src/gallium | |
parent | 796358e2f56b8444f2d422ea14639945be7c709e (diff) |
radeon/vcn: allocate non-tmz context buffer for VCN2+
By design, context buffer should be allocated as TMZ buffer for secure playback
for VCN 1 only. For VCN 2&2+, context buffer should be moved out of TMZ.
Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11388>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vcn_dec.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vcn_dec.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c index ae9afc07900..2fd61bf37e2 100644 --- a/src/gallium/drivers/radeon/radeon_vcn_dec.c +++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c @@ -1550,12 +1550,12 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, if (dec->stream_type == RDECODE_CODEC_H264_PERF) { unsigned ctx_size = calc_ctx_size_h264_perf(dec); bool r; - if (encrypted) { + if (encrypted && dec->tmz_ctx) { r = si_vid_create_tmz_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT); } else { r = si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT); } - assert(encrypted == (bool)(dec->ctx.res->flags & RADEON_FLAG_ENCRYPTED)); + assert((encrypted && dec->tmz_ctx) == (bool)(dec->ctx.res->flags & RADEON_FLAG_ENCRYPTED)); if (!r) { RVID_ERR("Can't allocated context buffer.\n"); @@ -1586,7 +1586,7 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, if (dec->base.profile == PIPE_VIDEO_PROFILE_VP9_PROFILE2) ctx_size += 8 * 2 * 4096; - if (encrypted) { + if (encrypted && dec->tmz_ctx) { r = si_vid_create_tmz_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT); } else { r = si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT); @@ -1611,7 +1611,7 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, else ctx_size = calc_ctx_size_h265_main(dec); - if (encrypted) { + if (encrypted && dec->tmz_ctx) { r = si_vid_create_tmz_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT); } else { r = si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT); @@ -2499,6 +2499,8 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context, list_inithead(&dec->dpb_unref_list); } + dec->tmz_ctx = sctx->family < CHIP_RENOIR; + return &dec->base; error: diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.h b/src/gallium/drivers/radeon/radeon_vcn_dec.h index 7ad88aaa8a6..1c8dbabb46d 100644 --- a/src/gallium/drivers/radeon/radeon_vcn_dec.h +++ b/src/gallium/drivers/radeon/radeon_vcn_dec.h @@ -1104,6 +1104,7 @@ struct radeon_decoder { void *render_pic_list[32]; bool show_frame; unsigned ref_idx; + bool tmz_ctx; struct { unsigned data0; unsigned data1; |