Browse Source

video: driver: fix race between streamoff and ipsc

During input port streamoff, state is changed from START_INPUT
to OPEN and then sent CMD_STOP to firmware. So reverse thread
acquired the lock and trying to process IPSC. Since IPSC is
not allowed in OPEN state, driver treats that as a fatal issue
and moves inst->state to ERROR state. Added change to avoid
above mentioned issue.

Change-Id: If0e18f01b6ecac3c810c0dab878ae392c48ffc27
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal 4 years ago
parent
commit
69e6b8c0ca

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

@@ -833,6 +833,7 @@ enum msm_vidc_allow {
 	MSM_VIDC_DISALLOW = 0,
 	MSM_VIDC_ALLOW,
 	MSM_VIDC_DEFER,
+	MSM_VIDC_DISCARD,
 	MSM_VIDC_IGNORE,
 };
 

+ 5 - 0
driver/vidc/src/msm_vidc_driver.c

@@ -1487,6 +1487,11 @@ enum msm_vidc_allow msm_vidc_allow_input_psc(struct msm_vidc_inst *inst)
 		i_vpr_h(inst, "%s: defer input psc, inst state %s\n",
 				__func__, state_name(inst->state));
 		allow = MSM_VIDC_DEFER;
+	} else if (inst->state == MSM_VIDC_OPEN ||
+		inst->state == MSM_VIDC_START_OUTPUT) {
+		i_vpr_h(inst, "%s: discard input psc, inst state %s\n",
+				__func__, state_name(inst->state));
+		allow = MSM_VIDC_DISCARD;
 	} else {
 		i_vpr_e(inst, "%s: input psc in wrong state %s\n",
 				__func__, state_name(inst->state));

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

@@ -1517,6 +1517,9 @@ void handle_session_response_work_handler(struct work_struct *work)
 			} else if (allow == MSM_VIDC_DEFER) {
 				/* continue to next entry processing */
 				continue;
+			} else if (allow == MSM_VIDC_DISCARD) {
+				/* discard current entry processing */
+				break;
 			} else if (allow == MSM_VIDC_ALLOW) {
 				rc = handle_session_response_work(inst, resp_work);
 				if (!rc)