Merge "video: driver: resolve subsystem restart failure"

This commit is contained in:
qctecmdr
2023-02-06 10:11:50 -08:00
committed by Gerrit - the friendly Code Review server
3 changed files with 35 additions and 34 deletions

View File

@@ -3868,12 +3868,6 @@ int msm_vidc_vb2_queue_deinit(struct msm_vidc_inst *inst)
return 0; return 0;
} }
vb2_queue_release(inst->bufq[OUTPUT_META_PORT].vb2q);
msm_vidc_vmem_free((void **)&inst->bufq[OUTPUT_META_PORT].vb2q);
inst->bufq[OUTPUT_META_PORT].vb2q = NULL;
vb2_queue_release(inst->bufq[INPUT_META_PORT].vb2q);
msm_vidc_vmem_free((void **)&inst->bufq[INPUT_META_PORT].vb2q);
inst->bufq[INPUT_META_PORT].vb2q = NULL;
/* /*
* vb2_queue_release() for input and output queues * vb2_queue_release() for input and output queues
* is called from v4l2_m2m_ctx_release() * is called from v4l2_m2m_ctx_release()
@@ -3882,6 +3876,13 @@ int msm_vidc_vb2_queue_deinit(struct msm_vidc_inst *inst)
inst->bufq[OUTPUT_PORT].vb2q = NULL; inst->bufq[OUTPUT_PORT].vb2q = NULL;
inst->bufq[INPUT_PORT].vb2q = NULL; inst->bufq[INPUT_PORT].vb2q = NULL;
v4l2_m2m_release(inst->m2m_dev); v4l2_m2m_release(inst->m2m_dev);
vb2_queue_release(inst->bufq[OUTPUT_META_PORT].vb2q);
msm_vidc_vmem_free((void **)&inst->bufq[OUTPUT_META_PORT].vb2q);
inst->bufq[OUTPUT_META_PORT].vb2q = NULL;
vb2_queue_release(inst->bufq[INPUT_META_PORT].vb2q);
msm_vidc_vmem_free((void **)&inst->bufq[INPUT_META_PORT].vb2q);
inst->bufq[INPUT_META_PORT].vb2q = NULL;
inst->vb2q_init = false; inst->vb2q_init = false;
return rc; return rc;
@@ -4158,38 +4159,44 @@ int msm_vidc_session_close(struct msm_vidc_inst *inst)
{ {
int rc = 0; int rc = 0;
struct msm_vidc_core *core; struct msm_vidc_core *core;
bool wait_for_response;
if (!inst || !inst->core) { if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__); d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL; return -EINVAL;
} }
core = inst->core;
wait_for_response = true;
rc = venus_hfi_session_close(inst); rc = venus_hfi_session_close(inst);
if (rc) if (rc) {
return rc; i_vpr_e(inst, "%s: session close cmd failed\n", __func__);
wait_for_response = false;
}
/* we are not supposed to send any more commands after close */ /* we are not supposed to send any more commands after close */
i_vpr_h(inst, "%s: free session packet data\n", __func__); i_vpr_h(inst, "%s: free session packet data\n", __func__);
msm_vidc_vmem_free((void **)&inst->packet); msm_vidc_vmem_free((void **)&inst->packet);
inst->packet = NULL; inst->packet = NULL;
core = inst->core; if (wait_for_response) {
i_vpr_h(inst, "%s: wait on close for time: %d ms\n", i_vpr_h(inst, "%s: wait on close for time: %d ms\n",
__func__, core->capabilities[HW_RESPONSE_TIMEOUT].value); __func__, core->capabilities[HW_RESPONSE_TIMEOUT].value);
inst_unlock(inst, __func__); inst_unlock(inst, __func__);
rc = wait_for_completion_timeout( rc = wait_for_completion_timeout(
&inst->completions[SIGNAL_CMD_CLOSE], &inst->completions[SIGNAL_CMD_CLOSE],
msecs_to_jiffies( msecs_to_jiffies(
core->capabilities[HW_RESPONSE_TIMEOUT].value)); core->capabilities[HW_RESPONSE_TIMEOUT].value));
if (!rc) { if (!rc) {
i_vpr_e(inst, "%s: session close timed out\n", __func__); i_vpr_e(inst, "%s: session close timed out\n", __func__);
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
msm_vidc_inst_timeout(inst); msm_vidc_inst_timeout(inst);
} else { } else {
rc = 0; rc = 0;
i_vpr_h(inst, "%s: close successful\n", __func__); i_vpr_h(inst, "%s: close successful\n", __func__);
}
inst_lock(inst, __func__);
} }
inst_lock(inst, __func__);
return rc; return rc;
} }

View File

@@ -514,11 +514,14 @@ int msm_v4l2_streamoff(struct file *filp, void *fh,
return -EINVAL; return -EINVAL;
} }
client_lock(inst, __func__);
inst_lock(inst, __func__);
rc = msm_vidc_streamoff((void *)inst, i); rc = msm_vidc_streamoff((void *)inst, i);
if (rc) if (rc)
goto exit; i_vpr_e(inst, "%s: msm_vidc_stramoff failed\n", __func__);
exit: inst_unlock(inst, __func__);
client_unlock(inst, __func__);
put_inst(inst); put_inst(inst);
return rc; return rc;

View File

@@ -577,26 +577,17 @@ void msm_vb2_stop_streaming(struct vb2_queue *q)
return; return;
} }
inst = q->drv_priv; inst = q->drv_priv;
inst = get_inst_ref(g_core, inst);
if (!inst) { if (!inst) {
d_vpr_e("%s: invalid params\n", __func__); d_vpr_e("%s: invalid params\n", __func__);
return; return;
} }
client_lock(inst, __func__);
inst_lock(inst, __func__);
rc = inst->event_handle(inst, MSM_VIDC_STREAMOFF, q); rc = inst->event_handle(inst, MSM_VIDC_STREAMOFF, q);
if (rc) { if (rc) {
i_vpr_e(inst, "Streamoff: %s failed\n", v4l2_type_name(q->type)); i_vpr_e(inst, "Streamoff: %s failed\n", v4l2_type_name(q->type));
msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__); msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__);
goto unlock;
} }
unlock:
inst_unlock(inst, __func__);
client_unlock(inst, __func__);
put_inst(inst);
return; return;
} }