Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a65bf165 authored by Shalaj Jain's avatar Shalaj Jain
Browse files

msm: vidc: Fix session error handling



Do not clean the session while handling session error, instead
only set the state to invalid and report the error to client.
The session will be cleaned as part of kill_session called when
clients calls flush/stop. Also ignore all prepare_buf calls when
in invalid state.

CRs-Fixed: 748031
Change-Id: I2d8824cddb6f86b3feb42e6021f1e0abad26be3e
Signed-off-by: default avatarShalaj Jain <shalajj@codeaurora.org>
parent c3e072e1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -766,6 +766,14 @@ int msm_vdec_prepare_buf(struct msm_vidc_inst *inst,
	}
	hdev = inst->core->device;

	if (inst->state == MSM_VIDC_CORE_INVALID ||
			inst->core->state == VIDC_CORE_INVALID) {
		dprintk(VIDC_ERR,
			"Core %p in bad state, ignoring prepare buf\n",
				inst->core);
		goto exit;
	}

	switch (b->type) {
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		break;
@@ -816,6 +824,7 @@ int msm_vdec_prepare_buf(struct msm_vidc_inst *inst,
		dprintk(VIDC_ERR, "Buffer type not recognized: %d\n", b->type);
		break;
	}
exit:
	return rc;
}

+9 −0
Original line number Diff line number Diff line
@@ -3364,6 +3364,14 @@ int msm_venc_prepare_buf(struct msm_vidc_inst *inst,

	hdev = inst->core->device;

	if (inst->state == MSM_VIDC_CORE_INVALID ||
			inst->core->state == VIDC_CORE_INVALID) {
		dprintk(VIDC_ERR,
			"Core %p in bad state, ignoring prepare buf\n",
				inst->core);
		goto exit;
	}

	switch (b->type) {
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		break;
@@ -3409,6 +3417,7 @@ int msm_venc_prepare_buf(struct msm_vidc_inst *inst,
			"Buffer type not recognized: %d\n", b->type);
		break;
	}
exit:
	return rc;
}

+3 −12
Original line number Diff line number Diff line
@@ -1034,7 +1034,6 @@ exit:
static void handle_session_error(enum command_response cmd, void *data)
{
	struct msm_vidc_cb_cmd_done *response = data;
	int rc;
	struct hfi_device *hdev = NULL;
	struct msm_vidc_inst *inst = NULL;

@@ -1057,15 +1056,6 @@ static void handle_session_error(enum command_response cmd, void *data)
	dprintk(VIDC_WARN, "Session error received for session %p\n", inst);
	change_inst_state(inst, MSM_VIDC_CORE_INVALID);

	mutex_lock(&inst->lock);
	dprintk(VIDC_DBG, "cleaning up inst: %p\n", inst);
	rc = call_hfi_op(hdev, session_clean, inst->session);
	if (rc)
		dprintk(VIDC_ERR, "Session (%p) clean failed: %d\n", inst, rc);

	inst->session = NULL;
	mutex_unlock(&inst->lock);

	if (response->status == VIDC_ERR_MAX_CLIENTS) {
		dprintk(VIDC_WARN,
			"send max clients reached error to client: %p\n",
@@ -4620,8 +4610,9 @@ int msm_comm_kill_session(struct msm_vidc_inst *inst)
	 * the session send session_abort to firmware to clean up and release
	 * the session, else just kill the session inside the driver.
	 */
	if (inst->state >= MSM_VIDC_OPEN_DONE &&
			inst->state < MSM_VIDC_CLOSE_DONE) {
	if ((inst->state >= MSM_VIDC_OPEN_DONE &&
			inst->state < MSM_VIDC_CLOSE_DONE) ||
			inst->state == MSM_VIDC_CORE_INVALID) {
		rc = msm_comm_session_abort(inst);
		if (rc == -EBUSY) {
			msm_comm_generate_sys_error(inst);