소스 검색

Merge "video: driver: handle dpb list property without payload"

qctecmdr 2 년 전
부모
커밋
2cb052e9a1
2개의 변경된 파일35개의 추가작업 그리고 18개의 파일을 삭제
  1. 10 1
      driver/vidc/src/msm_vidc_driver.c
  2. 25 17
      driver/vidc/src/venus_hfi_response.c

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

@@ -2712,7 +2712,16 @@ int msm_vidc_get_internal_buffers(struct msm_vidc_inst *inst,
 	if (!buffers)
 		return -EINVAL;
 
-	if (buf_size <= buffers->size && buf_count <= buffers->min_count) {
+	/*
+	 * In a usecase when film grain is initially present, dpb buffers
+	 * are allocated and in the middle of the session, if film grain
+	 * is disabled, then dpb internal buffers should be destroyed.
+	 * When film grain is disabled, buffer_size op call returns 0.
+	 * To ensure buffers->reuse is set to false, add check to detect
+	 * if buf_size has become zero. Do the same for buf_count as well.
+	 */
+	if (buf_size && buf_size <= buffers->size &&
+	    buf_count && buf_count <= buffers->min_count) {
 		buffers->reuse = true;
 	} else {
 		buffers->reuse = false;

+ 25 - 17
driver/vidc/src/venus_hfi_response.c

@@ -1006,12 +1006,10 @@ static int handle_output_buffer(struct msm_vidc_inst *inst,
 	}
 
 	if (is_decode_session(inst)) {
-		/* RO flag is not expected for linear colorformat */
-		if (is_linear_colorformat(inst->capabilities[PIX_FMTS].value) &&
-			(buffer->flags & HFI_BUF_FW_FLAG_READONLY)) {
-			buffer->flags &= ~HFI_BUF_FW_FLAG_READONLY;
-			print_vidc_buffer(
-				VIDC_HIGH, "high", "RO flag in linear colorformat", inst, buf);
+		/* RO flag is not expected when internal dpb buffers are allocated */
+		if (inst->buffers.dpb.size && buffer->flags & HFI_BUF_FW_FLAG_READONLY) {
+			print_vidc_buffer(VIDC_ERR, "err ", "unexpected RO flag", inst, buf);
+			msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__);
 		}
 
 		if (buffer->flags & HFI_BUF_FW_FLAG_READONLY) {
@@ -1621,6 +1619,12 @@ static int handle_dpb_list_property(struct msm_vidc_inst *inst,
 	bool found = false;
 	u64 device_addr;
 
+	if (!is_decode_session(inst)) {
+		i_vpr_e(inst,
+			"%s: unsupported for non-decode session\n", __func__);
+		return -EINVAL;
+	}
+
 	payload_size = pkt->size - sizeof(struct hfi_packet);
 	num_words_in_payload = payload_size / 4;
 	payload_start = (u8 *)((u8 *)pkt + sizeof(struct hfi_packet));
@@ -1771,16 +1775,9 @@ static int handle_property_with_payload(struct msm_vidc_inst *inst,
 				__func__);
 		break;
 	case HFI_PROP_DPB_LIST:
-		if (is_decode_session(inst)) {
-			rc = handle_dpb_list_property(inst, pkt);
-			if (rc)
-				break;
-		} else {
-			i_vpr_e(inst,
-				"%s: invalid dpb property %#x for %s port %d\n",
-				__func__, pkt->type, is_decode_session(inst) ? "decode" : "encode",
-				port);
-		}
+		rc = handle_dpb_list_property(inst, pkt);
+		if (rc)
+			break;
 		break;
 	case HFI_PROP_QUALITY_MODE:
 		if (inst->capabilities[QUALITY_MODE].value !=  payload_ptr[0])
@@ -1816,7 +1813,18 @@ static int handle_property_with_payload(struct msm_vidc_inst *inst,
 static int handle_property_without_payload(struct msm_vidc_inst *inst,
 	struct hfi_packet *pkt, u32 port)
 {
+	int rc = 0;
+
 	switch (pkt->type) {
+	case HFI_PROP_DPB_LIST:
+		/*
+		 * if fw sends dpb list property without payload,
+		 * it means there are no more reference buffers.
+		 */
+		rc = handle_dpb_list_property(inst, pkt);
+		if (rc)
+			break;
+		break;
 	case HFI_PROP_NO_OUTPUT:
 		if (port != INPUT_PORT) {
 			i_vpr_e(inst,
@@ -1833,7 +1841,7 @@ static int handle_property_without_payload(struct msm_vidc_inst *inst,
 		break;
 	}
 
-	return 0;
+	return rc;
 }
 
 static int handle_session_property(struct msm_vidc_inst *inst,