mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
radeonsi/vcn: add subsample for cenc
Create new buffer for subsample parameters and submit it for cenc decryption Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com> Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34854>
This commit is contained in:
parent
5565043534
commit
d6e2438113
4 changed files with 42 additions and 6 deletions
|
|
@ -1981,8 +1981,8 @@ static void parse_vcn_ib(FILE *f, struct ac_ib_parser *ib)
|
|||
case RDECODE_CMDBUF_FLAGS_REPORT_EVENT_STATUS:
|
||||
fprintf(f, "REPORT EVENT STATUS\n");
|
||||
break;
|
||||
case RDECODE_CMDBUF_FLAGS_RESERVED_SIZE_INFO_BUFFER:
|
||||
fprintf(f, "RESERVED SIZE INFO BUFFER\n");
|
||||
case RDECODE_CMDBUF_FLAGS_SUBSAMPLE_SIZE_INFO_BUFFER:
|
||||
fprintf(f, "SUBSAMPLE SIZE INFO BUFFER\n");
|
||||
break;
|
||||
case RDECODE_CMDBUF_FLAGS_LUMA_HIST_BUFFER:
|
||||
fprintf(f, "LUMA HIST BUFFER\n");
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
#define RDECODE_CMDBUF_FLAGS_SCLR_COEF_BUFFER (0x00008000)
|
||||
#define RDECODE_CMDBUF_FLAGS_RECORD_TIMESTAMP (0x00010000)
|
||||
#define RDECODE_CMDBUF_FLAGS_REPORT_EVENT_STATUS (0x00020000)
|
||||
#define RDECODE_CMDBUF_FLAGS_RESERVED_SIZE_INFO_BUFFER (0x00040000)
|
||||
#define RDECODE_CMDBUF_FLAGS_SUBSAMPLE_SIZE_INFO_BUFFER (0x00040000)
|
||||
#define RDECODE_CMDBUF_FLAGS_LUMA_HIST_BUFFER (0x00080000)
|
||||
#define RDECODE_CMDBUF_FLAGS_SESSION_CONTEXT_BUFFER (0x00100000)
|
||||
#define RDECODE_CMDBUF_FLAGS_REF_BUFFER (0x00200000)
|
||||
|
|
@ -75,6 +75,7 @@
|
|||
#define RDECODE_CMD_BITSTREAM_BUFFER 0x00000100
|
||||
#define RDECODE_CMD_IT_SCALING_TABLE_BUFFER 0x00000204
|
||||
#define RDECODE_CMD_CONTEXT_BUFFER 0x00000206
|
||||
#define RDECODE_CMD_SUBSAMPLE 0x00000700
|
||||
#define RDECODE_CMD_WRITE_MEMORY 0x00000800
|
||||
|
||||
#define RDECODE_MSG_CREATE 0x00000000
|
||||
|
|
@ -146,6 +147,7 @@
|
|||
#define RDECODE_MESSAGE_VP9 0x0000000E
|
||||
#define RDECODE_MESSAGE_DYNAMIC_DPB 0x00000010
|
||||
#define RDECODE_MESSAGE_AV1 0x00000011
|
||||
#define RDECODE_MESSAGE_DRM_KEYBLOB 0x00000014
|
||||
|
||||
#define RDECODE_FEEDBACK_PROFILING 0x00000001
|
||||
|
||||
|
|
@ -464,8 +466,8 @@ typedef struct rvcn_decode_buffer_s {
|
|||
unsigned int it_sclr_table_buffer_address_lo;
|
||||
unsigned int sclr_target_buffer_address_hi;
|
||||
unsigned int sclr_target_buffer_address_lo;
|
||||
unsigned int reserved_size_info_buffer_address_hi;
|
||||
unsigned int reserved_size_info_buffer_address_lo;
|
||||
unsigned int subsample_hi;
|
||||
unsigned int subsample_lo;
|
||||
unsigned int mpeg2_pic_param_buffer_address_hi;
|
||||
unsigned int mpeg2_pic_param_buffer_address_lo;
|
||||
unsigned int mpeg2_mb_control_buffer_address_hi;
|
||||
|
|
@ -559,7 +561,8 @@ typedef struct rvcn_dec_message_drm_s {
|
|||
unsigned int drm_offset;
|
||||
unsigned int drm_cmd;
|
||||
unsigned int drm_cntl;
|
||||
unsigned int drm_reserved;
|
||||
unsigned int drm_max_res;
|
||||
unsigned int drm_subsample_size;
|
||||
} rvcn_dec_message_drm_t;
|
||||
|
||||
typedef struct rvcn_dec_message_dynamic_dpb_s {
|
||||
|
|
@ -1244,6 +1247,7 @@ struct jpeg_params {
|
|||
#define RDECODE_VCN2_5_ENGINE_CNTL 0x9b4
|
||||
|
||||
#define RDECODE_SESSION_CONTEXT_SIZE (128 * 1024)
|
||||
#define RDECODE_MAX_SUBSAMPLE_SIZE (2048 * 2 * 4)
|
||||
|
||||
unsigned ac_vcn_dec_calc_ctx_size_av1(unsigned av1_version);
|
||||
void ac_vcn_av1_init_probs(unsigned av1_version, uint8_t *prob);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "util/vl_zscan_data.h"
|
||||
#include "vl/vl_probs_table.h"
|
||||
#include "pspdecryptionparam.h"
|
||||
#include "cencdecryptionparam.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -1488,6 +1489,7 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
|||
struct pipe_picture_desc *picture)
|
||||
{
|
||||
DECRYPT_PARAMETERS *decrypt = (DECRYPT_PARAMETERS *)picture->decrypt_key;
|
||||
amd_secure_buffer_format *secure_buf = (amd_secure_buffer_format *)picture->decrypt_key;
|
||||
bool encrypted = picture->protected_playback;
|
||||
struct si_texture *luma;
|
||||
struct si_texture *chroma;
|
||||
|
|
@ -1791,6 +1793,26 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
|||
if (dec->stream_type == RDECODE_CODEC_AV1)
|
||||
decode->db_pitch_uv = chroma->surface.u.gfx9.surf_pitch * chroma->surface.blk_w;
|
||||
|
||||
if (picture->cenc) {
|
||||
if (!dec->subsample.res && !si_vid_create_buffer(dec->screen, &dec->subsample,
|
||||
RDECODE_MAX_SUBSAMPLE_SIZE,
|
||||
PIPE_USAGE_DEFAULT)) {
|
||||
RADEON_DEC_ERR("Can't allocate subsample buffer.\n");
|
||||
return NULL;
|
||||
}
|
||||
int ss_length = MIN2(secure_buf->desc.subsamples_length, MAX_SUBSAMPLES);
|
||||
uint32_t *ss_ptr = dec->ws->buffer_map(dec->ws, dec->subsample.res->buf, &dec->cs,
|
||||
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||
if (!ss_ptr) {
|
||||
RADEON_DEC_ERR("Failed to map subsample buffer memory.\n");
|
||||
return NULL;
|
||||
}
|
||||
for (int i = 0; i < ss_length; i++)
|
||||
memcpy(&ss_ptr[i * 2], &secure_buf->desc.subsamples[i].num_bytes_clear, 8);
|
||||
ss_ptr[ss_length * 2 - 1] = align(ss_ptr[ss_length * 2 - 1], 256);
|
||||
dec->ws->buffer_unmap(dec->ws, dec->subsample.res->buf);
|
||||
}
|
||||
|
||||
if (encrypted) {
|
||||
assert(sscreen->info.has_tmz_support);
|
||||
set_drm_keys(drm, decrypt);
|
||||
|
|
@ -2064,6 +2086,11 @@ static void send_cmd(struct radeon_decoder *dec, unsigned cmd, struct pb_buffer_
|
|||
dec->decode_buffer->context_buffer_address_hi = (addr >> 32);
|
||||
dec->decode_buffer->context_buffer_address_lo = (addr);
|
||||
break;
|
||||
case RDECODE_CMD_SUBSAMPLE:
|
||||
dec->decode_buffer->valid_buf_flag |= (RDECODE_CMDBUF_FLAGS_SUBSAMPLE_SIZE_INFO_BUFFER);
|
||||
dec->decode_buffer->subsample_hi = (addr >> 32);
|
||||
dec->decode_buffer->subsample_lo = (addr);
|
||||
break;
|
||||
default:
|
||||
printf("Not Support!");
|
||||
}
|
||||
|
|
@ -2393,6 +2420,7 @@ static void radeon_dec_destroy(struct pipe_video_codec *decoder)
|
|||
}
|
||||
si_vid_destroy_buffer(&dec->ctx);
|
||||
si_vid_destroy_buffer(&dec->sessionctx);
|
||||
si_vid_destroy_buffer(&dec->subsample);
|
||||
|
||||
FREE(dec->jcs);
|
||||
FREE(dec->jctx);
|
||||
|
|
@ -2599,6 +2627,9 @@ bool send_cmd_dec(struct radeon_decoder *dec, struct pipe_video_buffer *target,
|
|||
else if (have_probs(dec))
|
||||
send_cmd(dec, RDECODE_CMD_PROB_TBL_BUFFER, msg_fb_it_probs_buf->res->buf,
|
||||
FB_BUFFER_OFFSET + FB_BUFFER_SIZE, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
||||
if (picture->cenc)
|
||||
send_cmd(dec, RDECODE_CMD_SUBSAMPLE, dec->subsample.res->buf, 0, RADEON_USAGE_READ,
|
||||
RADEON_DOMAIN_VRAM);
|
||||
|
||||
if (dec->dpb_type == DPB_DYNAMIC_TIER_3)
|
||||
send_ref_buffers(dec);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ struct radeon_decoder {
|
|||
struct rvid_buffer dpb;
|
||||
struct rvid_buffer ctx;
|
||||
struct rvid_buffer sessionctx;
|
||||
struct rvid_buffer subsample;
|
||||
|
||||
unsigned bs_size;
|
||||
unsigned cur_buffer;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue