Selaa lähdekoodia

video: driver: Add info for uniform AV1 tile handling

read the av1 uniform tile handling propert from fw
and display it. Required in debugging av1 usecases for
power calculation

Change-Id: I443e5afd591a8131c667c64cebb417fc022693ac
Signed-off-by: Ashish Patil <[email protected]>
Ashish Patil 2 vuotta sitten
vanhempi
sitoutus
0b7870402e

+ 1 - 0
driver/platform/pineapple/src/msm_vidc_pineapple.c

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

+ 28 - 5
driver/variant/iris33/src/msm_vidc_power_iris33.c

@@ -154,8 +154,8 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
 		codec_input->av1d_commer_tile_enable = 0;
 	}
 
-	/* set as sanity mode */
-	codec_input->regression_mode = 1;
+	/* set as sanity mode, this regression mode has no effect on power calculations */
+	codec_input->regression_mode = REGRESSION_MODE_SANITY;
 
 	return 0;
 }
@@ -163,7 +163,7 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
 static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc_bus_vote_data *d,
 		struct api_calculation_input *codec_input)
 {
-	u32 complexity_factor_int = 0, complexity_factor_frac = 0;
+	u32 complexity_factor_int = 0, complexity_factor_frac = 0, tile_rows_columns = 0;
 	bool opb_compression_enabled = false;
 
 	if (!d)
@@ -292,11 +292,34 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
 
 	/* disable by default, only enable for aurora depth map session */
 	codec_input->lumaonly_decode = 0;
-	/* TODO: disable av1d commercial tile */
-	codec_input->av1d_commer_tile_enable = 0;
+
 	/* set as custom regression mode, as are using cr,cf values from FW */
 	codec_input->regression_mode = REGRESSION_MODE_CUSTOM;
 
+	/* 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;
+	}
 
 	/* Dump all the variables for easier debugging */
 	if (msm_vidc_debug & VIDC_BUS) {

+ 2 - 0
driver/vidc/inc/hfi_property.h

@@ -575,6 +575,8 @@ enum hfi_saliency_type {
 
 #define HFI_PROP_SLICE_DECODE                                   0x03000196
 
+#define HFI_PROP_AV1_UNIFORM_TILE_SPACING                       0x03000197
+
 #define HFI_PROP_ENC_RING_BIN_BUF                               0x0300019C
 
 /* u32 */

+ 1 - 0
driver/vidc/inc/msm_vidc_internal.h

@@ -832,6 +832,7 @@ struct msm_vidc_hfi_frame_info {
 	u32                    fence_id;
 	u32                    fence_error;
 	u32                    av1_tile_rows_columns;
+	bool                   av1_non_uniform_tile_spacing;
 };
 
 struct msm_vidc_decode_vpp_delay {

+ 8 - 1
driver/vidc/src/msm_vidc_driver.c

@@ -1007,9 +1007,15 @@ 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_AV1_TILE_ROWS_COLUMNS:
+	case HFI_PROP_AV1_UNIFORM_TILE_SPACING:
+		if (inst->codec == MSM_VIDC_AV1)
+			is_allowed = true;
+		else
+			is_allowed = false;
+		break;
 	case HFI_PROP_DPB_LIST:
 		if (!is_ubwc_colorformat(inst->capabilities[PIX_FMTS].value)) {
 			i_vpr_h(inst,
@@ -1049,6 +1055,7 @@ int msm_vidc_update_property_cap(struct msm_vidc_inst *inst, u32 hfi_id,
 	case HFI_PROP_WORST_COMPLEXITY_FACTOR:
 	case HFI_PROP_PICTURE_TYPE:
 	case HFI_PROP_AV1_TILE_ROWS_COLUMNS:
+	case HFI_PROP_AV1_UNIFORM_TILE_SPACING:
 		break;
 	case HFI_PROP_DPB_LIST:
 		if (!allow)

+ 8 - 0
driver/vidc/src/venus_hfi_response.c

@@ -842,6 +842,10 @@ static int handle_input_buffer(struct msm_vidc_inst *inst,
 			inst->hfi_frame_info.av1_tile_rows_columns >> 16;
 		inst->power.fw_av1_tile_columns =
 			inst->hfi_frame_info.av1_tile_rows_columns & 0x0000FFFF;
+
+		if (inst->hfi_frame_info.av1_non_uniform_tile_spacing)
+			i_vpr_l(inst, "%s: av1_non_uniform_tile_spacing %d\n",
+				__func__, inst->hfi_frame_info.av1_non_uniform_tile_spacing);
 	}
 
 	buf->data_size = buffer->data_size;
@@ -1759,6 +1763,10 @@ static int handle_property_with_payload(struct msm_vidc_inst *inst,
 		inst->hfi_frame_info.av1_tile_rows_columns =
 			payload_ptr[0];
 		break;
+	case HFI_PROP_AV1_UNIFORM_TILE_SPACING:
+		if (!payload_ptr[0])
+			inst->hfi_frame_info.av1_non_uniform_tile_spacing = true;
+		break;
 	case HFI_PROP_CABAC_SESSION:
 		if (payload_ptr[0] == 1)
 			msm_vidc_update_cap_value(inst, ENTROPY_MODE,