소스 검색

video: driver: refine max_host_buffer count logic

- added max_host_buffer_count for decoder input & output.
- increased buffer count for image_session & encode
  batching case.

Change-Id: I4edf1c3a0953e38d6f84f554ab78e624d39a7306
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal 4 년 전
부모
커밋
6791a81197
3개의 변경된 파일35개의 추가작업 그리고 11개의 파일을 삭제
  1. 2 3
      driver/vidc/inc/msm_vidc_internal.h
  2. 30 0
      driver/vidc/src/msm_vdec.c
  3. 3 8
      driver/vidc/src/msm_venc.c

+ 2 - 3
driver/vidc/inc/msm_vidc_internal.h

@@ -43,9 +43,8 @@
 #define MAX_CAP_CHILDREN         16
 #define DEFAULT_BITSTREM_ALIGNMENT  16
 #define H265_BITSTREM_ALIGNMENT     32
-#define DEFAULT_MAX_HOST_ENC_BUF_COUNT  64
-#define DEFAULT_MAX_HOST_DEC_BUF_COUNT  64
-#define DEFAULT_MAX_HOST_ENC_SUPER_BUF_COUNT 256
+#define DEFAULT_MAX_HOST_BUF_COUNT  64
+#define DEFAULT_MAX_HOST_BURST_BUF_COUNT 256
 #define BIT_DEPTH_8 (8 << 16 | 8)
 #define BIT_DEPTH_10 (10 << 16 | 10)
 #define CODED_FRAMES_PROGRESSIVE 0x0

+ 30 - 0
driver/vidc/src/msm_vdec.c

@@ -739,6 +739,28 @@ static int msm_vdec_set_conceal_color_10bit(struct msm_vidc_inst *inst,
 	return rc;
 }
 
+static int msm_vdec_set_host_max_buf_count(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 count = DEFAULT_MAX_HOST_BUF_COUNT;
+
+	if (is_image_session(inst))
+		count = DEFAULT_MAX_HOST_BURST_BUF_COUNT;
+
+	i_vpr_h(inst, "%s: count: %u port: %u\n", __func__, count, port);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_BUFFER_HOST_MAX_COUNT,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32,
+			&count,
+			sizeof(u32));
+	if (rc)
+		return rc;
+	return 0;
+}
+
 static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
@@ -772,6 +794,10 @@ static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 	if (rc)
 		return rc;
 
+	rc = msm_vdec_set_host_max_buf_count(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
 	return rc;
 }
 
@@ -800,6 +826,10 @@ static int msm_vdec_set_output_properties(struct msm_vidc_inst *inst)
 	if (rc)
 		return rc;
 
+	rc = msm_vdec_set_host_max_buf_count(inst, OUTPUT_PORT);
+	if (rc)
+		return rc;
+
 	return rc;
 }
 

+ 3 - 8
driver/vidc/src/msm_venc.c

@@ -269,15 +269,10 @@ static int msm_venc_set_host_max_buf_count(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	u32 count = DEFAULT_MAX_HOST_ENC_BUF_COUNT;
+	u32 count = DEFAULT_MAX_HOST_BUF_COUNT;
 
-	if (port != INPUT_PORT && port != OUTPUT_PORT) {
-		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
-		return -EINVAL;
-	}
-
-	if (msm_vidc_is_super_buffer(inst))
-		count = DEFAULT_MAX_HOST_ENC_SUPER_BUF_COUNT;
+	if (msm_vidc_is_super_buffer(inst) || is_image_session(inst))
+		count = DEFAULT_MAX_HOST_BURST_BUF_COUNT;
 
 	i_vpr_h(inst, "%s: count: %u port: %u\n", __func__, count, port);
 	rc = venus_hfi_session_property(inst,