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
melakukan 49f99eba76
3 mengubah file dengan 35 tambahan dan 34 penghapusan

Melihat File

@@ -3868,12 +3868,6 @@ int msm_vidc_vb2_queue_deinit(struct msm_vidc_inst *inst)
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
* 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[INPUT_PORT].vb2q = NULL;
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;
return rc;
@@ -4158,38 +4159,44 @@ int msm_vidc_session_close(struct msm_vidc_inst *inst)
{
int rc = 0;
struct msm_vidc_core *core;
bool wait_for_response;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
wait_for_response = true;
rc = venus_hfi_session_close(inst);
if (rc)
return rc;
if (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 */
i_vpr_h(inst, "%s: free session packet data\n", __func__);
msm_vidc_vmem_free((void **)&inst->packet);
inst->packet = NULL;
core = inst->core;
i_vpr_h(inst, "%s: wait on close for time: %d ms\n",
if (wait_for_response) {
i_vpr_h(inst, "%s: wait on close for time: %d ms\n",
__func__, core->capabilities[HW_RESPONSE_TIMEOUT].value);
inst_unlock(inst, __func__);
rc = wait_for_completion_timeout(
&inst->completions[SIGNAL_CMD_CLOSE],
msecs_to_jiffies(
core->capabilities[HW_RESPONSE_TIMEOUT].value));
if (!rc) {
i_vpr_e(inst, "%s: session close timed out\n", __func__);
rc = -ETIMEDOUT;
msm_vidc_inst_timeout(inst);
} else {
rc = 0;
i_vpr_h(inst, "%s: close successful\n", __func__);
inst_unlock(inst, __func__);
rc = wait_for_completion_timeout(
&inst->completions[SIGNAL_CMD_CLOSE],
msecs_to_jiffies(
core->capabilities[HW_RESPONSE_TIMEOUT].value));
if (!rc) {
i_vpr_e(inst, "%s: session close timed out\n", __func__);
rc = -ETIMEDOUT;
msm_vidc_inst_timeout(inst);
} else {
rc = 0;
i_vpr_h(inst, "%s: close successful\n", __func__);
}
inst_lock(inst, __func__);
}
inst_lock(inst, __func__);
return rc;
}

Melihat File

@@ -514,11 +514,14 @@ int msm_v4l2_streamoff(struct file *filp, void *fh,
return -EINVAL;
}
client_lock(inst, __func__);
inst_lock(inst, __func__);
rc = msm_vidc_streamoff((void *)inst, i);
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);
return rc;

Melihat File

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