Browse Source

video: driver: Add pipes scalability for multi slice count

- Add pipes check to support different Tile sizes based on
number of VPP Pipes for HFI_IRIS3_ENC_TILE_SIZE_INFO,
HFI_IRIS3_ENC_MB_BASED_MULTI_SLICE_COUNT.

HFI review done with ccb id 3284017.

Change-Id: I2e403ac712143635fd9ff5167260e23d6b48c482
Signed-off-by: Megha Byahatti <[email protected]>
Megha Byahatti 1 năm trước cách đây
mục cha
commit
9df60c1fa4

+ 16 - 5
driver/variant/iris3/inc/hfi_buffer_iris3.h

@@ -1168,10 +1168,21 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes)           \
 	} while (0)
 
 #define HFI_IRIS3_ENC_TILE_SIZE_INFO(tile_size, tile_count, last_tile_size, \
-				frame_width_coded, codec_standard) \
+				frame_width_coded, codec_standard, num_vpp_pipes) \
 	do { \
-		HFI_U32 without_tile_enc_width; \
-		HFI_U32 min_tile_size = 352, fixed_tile_width = 960; \
+		HFI_U32 without_tile_enc_width, min_tile_size, fixed_tile_width; \
+		if (num_vpp_pipes == 4) { \
+			min_tile_size = 352; \
+			fixed_tile_width = 960; \
+		} \
+		else if (num_vpp_pipes == 2) { \
+			min_tile_size = 256; \
+			fixed_tile_width = 768; \
+		} \
+		else { \
+			min_tile_size = 256; \
+			fixed_tile_width = 672; \
+		} \
 		without_tile_enc_width = min_tile_size + fixed_tile_width; \
 		if ((codec_standard == HFI_CODEC_ENCODE_HEVC) && \
 			(frame_width_coded > without_tile_enc_width)) { \
@@ -1190,7 +1201,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes)           \
 	} while (0)
 
 #define HFI_IRIS3_ENC_MB_BASED_MULTI_SLICE_COUNT(total_slice_count, frame_width, frame_height, \
-			codec_standard, multi_slice_max_mb_count) \
+			codec_standard, multi_slice_max_mb_count, num_vpp_pipes) \
 	do { \
 		HFI_U32 tile_size, tile_count, last_tile_size, \
 			slice_count_per_tile, slice_count_in_last_tile; \
@@ -1200,7 +1211,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes)           \
 		frame_width_coded = HFI_ALIGN(frame_width, lcu_size); \
 		frame_height_coded = HFI_ALIGN(frame_height, lcu_size); \
 		HFI_IRIS3_ENC_TILE_SIZE_INFO(tile_size, tile_count, last_tile_size, \
-			frame_width_coded, codec_standard); \
+			frame_width_coded, codec_standard, num_vpp_pipes); \
 		mbs_in_one_tile = (tile_size * frame_height_coded) / (lcu_size * lcu_size); \
 		slice_count_per_tile = \
 			(mbs_in_one_tile + multi_slice_max_mb_count - 1) / \

+ 6 - 1
driver/variant/iris3/src/msm_vidc_buffer_iris3.c

@@ -642,11 +642,13 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst *
 	uint32_t count)
 {
 	struct v4l2_format *f;
+	struct msm_vidc_core *core = NULL;
 	u32 width, height, total_num_slices = 1;
 	u32 hfi_codec = 0;
 	u32 max_mbs_per_slice = 0;
 	u32 slice_mode = 0;
 	u32 delivery_mode = 0;
+	u32 num_vpp_pipes;
 
 	slice_mode = inst->capabilities[SLICE_MODE].value;
 	delivery_mode = inst->capabilities[DELIVERY_MODE].value;
@@ -666,8 +668,11 @@ static int msm_buffer_delivery_mode_based_min_count_iris3(struct msm_vidc_inst *
 	else if (inst->codec == MSM_VIDC_HEVC)
 		hfi_codec = HFI_CODEC_ENCODE_HEVC;
 
+	core = inst->core;
+	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
+
 	HFI_IRIS3_ENC_MB_BASED_MULTI_SLICE_COUNT(total_num_slices, width, height,
-			hfi_codec, max_mbs_per_slice);
+			hfi_codec, max_mbs_per_slice, num_vpp_pipes);
 
 	return (total_num_slices * count);
 }

+ 16 - 5
driver/variant/iris33/inc/hfi_buffer_iris33.h

@@ -1168,10 +1168,21 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes)           \
 	} while (0)
 
 #define HFI_IRIS3_ENC_TILE_SIZE_INFO(tile_size, tile_count, last_tile_size, \
-				frame_width_coded, codec_standard) \
+				frame_width_coded, codec_standard, num_vpp_pipes) \
 	do { \
-		HFI_U32 without_tile_enc_width; \
-		HFI_U32 min_tile_size = 352, fixed_tile_width = 960; \
+		HFI_U32 without_tile_enc_width, min_tile_size, fixed_tile_width; \
+		if (num_vpp_pipes == 4) { \
+			min_tile_size = 352; \
+			fixed_tile_width = 960; \
+		} \
+		else if (num_vpp_pipes == 2) { \
+			min_tile_size = 256; \
+			fixed_tile_width = 768; \
+		} \
+		else { \
+			min_tile_size = 256; \
+			fixed_tile_width = 672; \
+		} \
 		without_tile_enc_width = min_tile_size + fixed_tile_width; \
 		if ((codec_standard == HFI_CODEC_ENCODE_HEVC) && \
 			(frame_width_coded > without_tile_enc_width)) { \
@@ -1190,7 +1201,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes)           \
 	} while (0)
 
 #define HFI_IRIS3_ENC_MB_BASED_MULTI_SLICE_COUNT(total_slice_count, frame_width, frame_height, \
-			codec_standard, multi_slice_max_mb_count) \
+			codec_standard, multi_slice_max_mb_count, num_vpp_pipes) \
 	do { \
 		HFI_U32 tile_size, tile_count, last_tile_size, \
 			slice_count_per_tile, slice_count_in_last_tile; \
@@ -1200,7 +1211,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes)           \
 		frame_width_coded = HFI_ALIGN(frame_width, lcu_size); \
 		frame_height_coded = HFI_ALIGN(frame_height, lcu_size); \
 		HFI_IRIS3_ENC_TILE_SIZE_INFO(tile_size, tile_count, last_tile_size, \
-			frame_width_coded, codec_standard); \
+			frame_width_coded, codec_standard, num_vpp_pipes); \
 		mbs_in_one_tile = (tile_size * frame_height_coded) / (lcu_size * lcu_size); \
 		slice_count_per_tile = \
 			(mbs_in_one_tile + multi_slice_max_mb_count - 1) / \

+ 6 - 1
driver/variant/iris33/src/msm_vidc_buffer_iris33.c

@@ -649,11 +649,13 @@ static int msm_buffer_delivery_mode_based_min_count_iris33(struct msm_vidc_inst
 	uint32_t count)
 {
 	struct v4l2_format *f;
+	struct msm_vidc_core *core = NULL;
 	u32 width, height, total_num_slices = 1;
 	u32 hfi_codec = 0;
 	u32 max_mbs_per_slice = 0;
 	u32 slice_mode = 0;
 	u32 delivery_mode = 0;
+	u32 num_vpp_pipes;
 
 	slice_mode = inst->capabilities[SLICE_MODE].value;
 	delivery_mode = inst->capabilities[DELIVERY_MODE].value;
@@ -673,8 +675,11 @@ static int msm_buffer_delivery_mode_based_min_count_iris33(struct msm_vidc_inst
 	else if (inst->codec == MSM_VIDC_HEVC)
 		hfi_codec = HFI_CODEC_ENCODE_HEVC;
 
+	core = inst->core;
+	num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value;
+
 	HFI_IRIS3_ENC_MB_BASED_MULTI_SLICE_COUNT(total_num_slices, width, height,
-			hfi_codec, max_mbs_per_slice);
+			hfi_codec, max_mbs_per_slice, num_vpp_pipes);
 
 	return (total_num_slices * count);
 }