video: driver: Add HFI and internal buffer changes for AV1 DRAP

Add changes for AV1 DRAP (Delayed Random Access Point) handling:
1) Add config in kalama database to control DRAP and the HFI property
to set DRAP config.
2) Update buffer calculations:
- When DRAP is disabled, COMV buffer must be allocated
and PERSIST buffer must be allocated with total_ref_count = 0
- When DRAP is enabled, COMV buffer must not be allocated -
it is part of PERSIST buffer. Persist buffer must be allocated with
the max_width, max_height and total_ref_count configured for DRAP.

Change-Id: I2d2e8fd3f63ea8f9fc2845acd0b4e16ba4776a6b
Signed-off-by: Mihir Ganu <quic_mganu@quicinc.com>
此提交包含在:
Mihir Ganu
2022-01-27 11:30:09 -08:00
父節點 0c0981b43c
當前提交 9bacc5d124
共有 8 個檔案被更改,包括 95 行新增14 行删除

查看文件

@@ -880,6 +880,17 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define AV1D_LCU_MIN_SIZE_PELS 64
#define AV1D_MAX_TILE_COLS 64
#define HFI_BUFFER_COMV_AV1D(_size, frame_width, frame_height, \
_yuv_bufcount_min) \
do { \
_size = 2 * HFI_ALIGN(MAX(((frame_width + 63) / 64) * \
((frame_height + 63) / 64) * 512, \
((frame_width + 127) / 128) * \
((frame_height + 127) / 128) * 2816), \
VENUS_DMA_ALIGNMENT); \
_size *= _yuv_bufcount_min; \
} while (0)
#define SIZE_AV1D_LB_FE_TOP_DATA(frame_width, frame_height) \
(HFI_ALIGN(frame_width, AV1D_LCU_MAX_SIZE_PELS) * ((16 * 10) >> 3) + \
HFI_ALIGN(frame_width, AV1D_LCU_MAX_SIZE_PELS) / 2 * ((16 * 6) >> 3) * 2)
@@ -1135,15 +1146,18 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
(((8192 + 127) / 128) * ((4352 + 127) / 128) * \
AV1D_SIZE_BSE_COL_MV_128x128))
#define HFI_BUFFER_PERSIST_AV1D(_size) \
#define HFI_BUFFER_PERSIST_AV1D(_size, max_width, max_height, total_ref_count) \
do \
{ \
_size = HFI_ALIGN(SIZE_AV1D_SEQUENCE_HEADER * 2 + \
SIZE_AV1D_METADATA + \
HFI_U32 comv_size; \
HFI_BUFFER_COMV_AV1D(comv_size, max_width, max_height, total_ref_count); \
_size = \
HFI_ALIGN((SIZE_AV1D_SEQUENCE_HEADER * 2 + \
SIZE_AV1D_METADATA + \
AV1D_NUM_HW_PIC_BUF * (SIZE_AV1D_TILE_OFFSET + SIZE_AV1D_QM) + \
AV1D_NUM_FRAME_HEADERS * (SIZE_AV1D_FRAME_HEADER + \
2 * SIZE_AV1D_PROB_TABLE) + \
AV1D_NUM_HW_PIC_BUF * 2 * SIZE_AV1D_COL_MV, VENUS_DMA_ALIGNMENT); \
2 * SIZE_AV1D_PROB_TABLE) + \
comv_size), VENUS_DMA_ALIGNMENT); \
} while (0)
#define HFI_BUFFER_BITSTREAM_ENC(size, frame_width, frame_height, \

查看文件

@@ -69,7 +69,7 @@ static u32 msm_vidc_decoder_comv_size_iris3(struct msm_vidc_inst* inst)
{
u32 size = 0;
u32 width, height, out_min_count, vpp_delay;
struct v4l2_format* f;
struct v4l2_format *f;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
@@ -86,10 +86,21 @@ static u32 msm_vidc_decoder_comv_size_iris3(struct msm_vidc_inst* inst)
out_min_count = inst->buffers.output.min_count;
out_min_count = max(vpp_delay + 1, out_min_count);
if (inst->codec == MSM_VIDC_H264)
if (inst->codec == MSM_VIDC_H264) {
HFI_BUFFER_COMV_H264D(size, width, height, out_min_count);
else if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC)
} else if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC) {
HFI_BUFFER_COMV_H265D(size, width, height, out_min_count);
} else if (inst->codec == MSM_VIDC_AV1) {
/*
* When DRAP is enabled, COMV buffer is part of PERSIST buffer and
* should not be allocated separately.
* When DRAP is disabled, COMV buffer must be allocated.
*/
if (inst->capabilities->cap[DRAP].value)
size = 0;
else
HFI_BUFFER_COMV_AV1D(size, width, height, out_min_count);
}
i_vpr_l(inst, "%s: size %d\n", __func__, size);
return size;
@@ -195,14 +206,28 @@ static u32 msm_vidc_decoder_persist_size_iris3(struct msm_vidc_inst *inst)
return size;
}
if (inst->codec == MSM_VIDC_H264)
if (inst->codec == MSM_VIDC_H264) {
HFI_BUFFER_PERSIST_H264D(size);
else if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC)
} else if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC) {
HFI_BUFFER_PERSIST_H265D(size);
else if (inst->codec == MSM_VIDC_VP9)
} else if (inst->codec == MSM_VIDC_VP9) {
HFI_BUFFER_PERSIST_VP9D(size);
else if (inst->codec == MSM_VIDC_AV1)
HFI_BUFFER_PERSIST_AV1D(size);
} else if (inst->codec == MSM_VIDC_AV1) {
/*
* When DRAP is enabled, COMV buffer is part of PERSIST buffer and
* should not be allocated separately. PERSIST buffer should include
* COMV buffer calculated with width, height, refcount.
* When DRAP is disabled, COMV buffer should not be included in PERSIST
* buffer.
*/
if (inst->capabilities->cap[DRAP].value)
HFI_BUFFER_PERSIST_AV1D(size,
inst->capabilities->cap[FRAME_WIDTH].max,
inst->capabilities->cap[FRAME_HEIGHT].max, 16);
else
HFI_BUFFER_PERSIST_AV1D(size, 0, 0, 0);
}
i_vpr_l(inst, "%s: size %d\n", __func__, size);
return size;
}