video: driver: added support for av1 uniform tile handling for power calculations

If the av1 tile rows and columns are greater than recommended decoder
av1 settings,vote for higher frequency.

Change-Id: Iea9f542e0b925a9ecb063c11b1827f31164f5a7b
Signed-off-by: Ashish Patil <quic_ashpat@quicinc.com>
Цей коміт міститься в:
Ashish Patil
2023-03-29 10:41:00 -07:00
джерело 1695b926ee
коміт cb18a42fa6
8 змінених файлів з 50 додано та 6 видалено

Переглянути файл

@@ -148,7 +148,6 @@ struct api_calculation_input {
/* used in aurora for depth map decode */
u32 lumaonly_decode;
};
struct corner_voting {

Переглянути файл

@@ -2824,6 +2824,7 @@ static const u32 pineapple_vdec_input_properties[] = {
HFI_PROP_NO_OUTPUT,
HFI_PROP_SUBFRAME_INPUT,
HFI_PROP_DPB_LIST,
HFI_PROP_AV1_TILE_ROWS_COLUMNS,
};
static const u32 pineapple_vdec_output_properties[] = {

Переглянути файл

@@ -49,7 +49,7 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
struct api_calculation_input *codec_input)
{
enum msm_vidc_port_type port;
u32 color_fmt;
u32 color_fmt, tile_rows_columns = 0;
if (inst->domain == MSM_VIDC_ENCODER) {
codec_input->decoder_or_encoder = CODEC_ENCODER;
@@ -78,10 +78,11 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
codec_input->lcu_size = 32;
} else if (inst->codec == MSM_VIDC_VP9) {
codec_input->codec = CODEC_VP9;
codec_input->lcu_size = 16;
codec_input->lcu_size = 32;
} else if (inst->codec == MSM_VIDC_AV1) {
codec_input->codec = CODEC_AV1;
codec_input->lcu_size = 32;
codec_input->lcu_size =
inst->capabilities[SUPER_BLOCK].value ? 128 : 64;
} else {
d_vpr_e("%s: invalid codec %d\n", __func__, inst->codec);
return -EINVAL;
@@ -128,8 +129,31 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
codec_input->bitrate_mbps =
inst->capabilities[BIT_RATE].value / 1000000;
/* disable av1d commercial tile */
codec_input->av1d_commer_tile_enable = 0;
/* av1d commercial tile */
if (inst->codec == MSM_VIDC_AV1 && codec_input->lcu_size == 128) {
tile_rows_columns = inst->power.fw_av1_tile_rows *
inst->power.fw_av1_tile_columns;
/* check resolution and tile info */
codec_input->av1d_commer_tile_enable = 1;
if (res_is_less_than_or_equal_to(1920, 1088, codec_input->frame_width,
codec_input->frame_height)) {
if (tile_rows_columns <= 2)
codec_input->av1d_commer_tile_enable = 0;
} else if (res_is_less_than_or_equal_to(4096, 2172, codec_input->frame_width,
codec_input->frame_height)) {
if (tile_rows_columns <= 4)
codec_input->av1d_commer_tile_enable = 0;
} else if (res_is_less_than_or_equal_to(8192, 4320, codec_input->frame_width,
codec_input->frame_height)) {
if (tile_rows_columns <= 16)
codec_input->av1d_commer_tile_enable = 0;
}
} else {
codec_input->av1d_commer_tile_enable = 0;
}
/* set as sanity mode */
codec_input->regression_mode = 1;

Переглянути файл

@@ -549,6 +549,8 @@ enum hfi_nal_length_field_type {
#define HFI_PROP_OPB_ENABLE 0x03000184
#define HFI_PROP_AV1_TILE_ROWS_COLUMNS 0x03000187
#define HFI_PROP_AV1_DRAP_CONFIG 0x03000189
enum hfi_saliency_type {

Переглянути файл

@@ -800,6 +800,7 @@ struct msm_vidc_hfi_frame_info {
u32 overflow;
u32 fence_id;
u32 fence_error;
u32 av1_tile_rows_columns;
};
struct msm_vidc_decode_vpp_delay {
@@ -857,6 +858,8 @@ struct msm_vidc_power {
u32 dcvs_flags;
u32 fw_cr;
u32 fw_cf;
u32 fw_av1_tile_rows;
u32 fw_av1_tile_columns;
};
enum msm_vidc_fence_type {

Переглянути файл

@@ -1007,6 +1007,7 @@ bool msm_vidc_allow_property(struct msm_vidc_inst *inst, u32 hfi_id)
case HFI_PROP_WORST_COMPRESSION_RATIO:
case HFI_PROP_WORST_COMPLEXITY_FACTOR:
case HFI_PROP_PICTURE_TYPE:
case HFI_PROP_AV1_TILE_ROWS_COLUMNS:
is_allowed = true;
break;
case HFI_PROP_DPB_LIST:
@@ -1047,6 +1048,7 @@ int msm_vidc_update_property_cap(struct msm_vidc_inst *inst, u32 hfi_id,
case HFI_PROP_WORST_COMPRESSION_RATIO:
case HFI_PROP_WORST_COMPLEXITY_FACTOR:
case HFI_PROP_PICTURE_TYPE:
case HFI_PROP_AV1_TILE_ROWS_COLUMNS:
break;
case HFI_PROP_DPB_LIST:
if (!allow)

Переглянути файл

@@ -699,6 +699,8 @@ void msm_vidc_power_data_reset(struct msm_vidc_inst *inst)
inst->power.buffer_counter = 0;
inst->power.fw_cr = 0;
inst->power.fw_cf = INT_MAX;
inst->power.fw_av1_tile_rows = 1;
inst->power.fw_av1_tile_columns = 1;
rc = msm_vidc_scale_power(inst, true);
if (rc)

Переглянути файл

@@ -837,6 +837,13 @@ static int handle_input_buffer(struct msm_vidc_inst *inst,
return 0;
}
if (is_decode_session(inst) && inst->codec == MSM_VIDC_AV1) {
inst->power.fw_av1_tile_rows =
inst->hfi_frame_info.av1_tile_rows_columns >> 16;
inst->power.fw_av1_tile_columns =
inst->hfi_frame_info.av1_tile_rows_columns & 0x0000FFFF;
}
buf->data_size = buffer->data_size;
buf->attr &= ~MSM_VIDC_ATTR_QUEUED;
buf->attr |= MSM_VIDC_ATTR_DEQUEUED;
@@ -1748,6 +1755,10 @@ static int handle_property_with_payload(struct msm_vidc_inst *inst,
case HFI_PROP_WORST_COMPLEXITY_FACTOR:
inst->hfi_frame_info.cf = payload_ptr[0];
break;
case HFI_PROP_AV1_TILE_ROWS_COLUMNS:
inst->hfi_frame_info.av1_tile_rows_columns =
payload_ptr[0];
break;
case HFI_PROP_CABAC_SESSION:
if (payload_ptr[0] == 1)
msm_vidc_update_cap_value(inst, ENTROPY_MODE,