Эх сурвалжийг харах

video: driver: adding encoder GOP awareness settings in the power calculation

power calculation is optimized by using encoder reference handling
and GOP details.

Change-Id: I29707fcd152f89e213532afc9c4b6191d23b4d6c
Signed-off-by: Ashish Patil <[email protected]>
Ashish Patil 2 жил өмнө
parent
commit
dabd91e62e

+ 2 - 2
driver/platform/pineapple/inc/pineapple_technology.h

@@ -244,7 +244,7 @@ static u32 av1_num_tiles_pineapple[7][3] =
 */
 
 /* 1000x */
-static u32 pineapple_en_readfactor[7] = {1000, 1500, 1750, 1875, 1000, 2000, 2000};
+static u32 pineapple_en_readfactor[8] = {1000, 1500, 1750, 1875, 1000, 2000, 2000, 1000};
 /* 1000x */
-static u32 pineapple_en_writefactor[7] = {1000, 500, 500, 500, 1000, 0, 1000};
+static u32 pineapple_en_writefactor[8] = {1000, 500, 500, 500, 1000, 0, 1000, 1000};
 static u32 pineapple_en_frame_num_parallel = 1;

+ 2 - 2
driver/variant/iris33/src/msm_vidc_bus_iris33.c

@@ -704,7 +704,7 @@ static int calculate_bandwidth_encoder_iris33(
 		codec_output->collocated_rd_wr_total_noc;
 
 	/* I frame only */
-	if (codec_input.hierachical_layer == 7) {
+	if (codec_input.hierachical_layer == CODEC_GOP_IONLY) {
 		codec_output->collocated_rd_noc = 0;
 		codec_output->collocated_wr_noc = 0;
 		codec_output->collocated_rd_ddr = 0;
@@ -817,7 +817,7 @@ static int calculate_bandwidth_encoder_iris33(
 		0 : codec_output->dpb_wr_noc;
 
 	/* I frame only */
-	if (codec_input.hierachical_layer == 7) {
+	if (codec_input.hierachical_layer == CODEC_GOP_IONLY) {
 		codec_output->dpb_rd_y_noc = 0;
 		codec_output->dpb_rd_crcb_noc =0;
 		codec_output->dpb_rdwr_duetooverlap_noc =0;

+ 30 - 15
driver/variant/iris33/src/msm_vidc_power_iris33.c

@@ -19,6 +19,32 @@ static u64 __calculate_encoder(struct vidc_bus_vote_data *d);
 static u64 __calculate(struct msm_vidc_inst* inst, struct vidc_bus_vote_data *d);
 static u64 msm_vidc_calc_freq_iris33_legacy(struct msm_vidc_inst *inst, u32 data_size);
 
+
+static int msm_vidc_get_hier_layer_val(struct msm_vidc_inst *inst)
+{
+	int hierachical_layer = CODEC_GOP_IPP;
+
+	if (inst->domain == MSM_VIDC_ENCODER) {
+		if (inst->capabilities->cap[ALL_INTRA].value) {
+			/* no P and B frames case */
+			hierachical_layer = CODEC_GOP_IONLY;
+		} else if (inst->capabilities->cap[B_FRAME].value == 0) {
+			/* no B frames case */
+			hierachical_layer = CODEC_GOP_IPP;
+		} else { /* P and B frames enabled case */
+			if (inst->capabilities->cap[ENH_LAYER_COUNT].value == 0 ||
+				inst->capabilities->cap[ENH_LAYER_COUNT].value == 1)
+				hierachical_layer = CODEC_GOP_IbP;
+			else if (inst->capabilities->cap[ENH_LAYER_COUNT].value == 2)
+				hierachical_layer = CODEC_GOP_I1B2b1P;
+			else
+				hierachical_layer = CODEC_GOP_I3B4b1P;
+		}
+	}
+
+	return hierachical_layer;
+}
+
 static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_size,
 		struct api_calculation_input *codec_input)
 {
@@ -83,15 +109,8 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
 	else
 		codec_input->bitdepth = CODEC_BITDEPTH_10;
 
-	/*
-	 * Used for calculating Encoder GOP Complexity
-	 * hierachical_layer=0..7 used as Array Index
-	 * inst->capabilities->cap[B_FRAME].value=[ 0 1 2 ]
-	 * TODO how to map?
-	 */
-
-	/* set as IPP */
-	codec_input->hierachical_layer = 0;
+	codec_input->hierachical_layer =
+		msm_vidc_get_hier_layer_val(inst);
 
 	if (inst->domain == MSM_VIDC_DECODER)
 		color_fmt = v4l2_colorformat_to_driver(inst,
@@ -177,12 +196,8 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
 		return -EINVAL;
 	}
 
-	/*
-	 * Used for calculating Encoder GOP Complexity
-	 * hierachical_layer=0..7 used as Array Index
-	 * TODO how to map?
-	 */
-	codec_input->hierachical_layer = 0; /* set as IPP */
+	codec_input->hierachical_layer =
+		msm_vidc_get_hier_layer_val(inst);
 
 	/*
 	 * If the calculated motion_vector_complexity is > 2 then set the