Mesa (main): radeon/vcn: allocate non-tmz context buffer for VCN2+
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 18 14:46:40 UTC 2021
Module: Mesa
Branch: main
Commit: e1af22d9dd7777739fbb5f1198a1dd5748d85964
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1af22d9dd7777739fbb5f1198a1dd5748d85964
Author: Boyuan Zhang <boyuan.zhang at amd.com>
Date: Wed Jun 16 11:39:16 2021 -0400
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 at amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11388>
---
src/gallium/drivers/radeon/radeon_vcn_dec.c | 10 ++++++----
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;
More information about the mesa-commit
mailing list