|
@@ -1651,6 +1651,67 @@ bool msm_vidc_allow_last_flag(struct msm_vidc_inst *inst)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+static int msm_vidc_flush_pending_last_flag(struct msm_vidc_inst *inst)
|
|
|
+{
|
|
|
+ int rc = 0;
|
|
|
+ struct response_work *resp_work, *dummy = NULL;
|
|
|
+
|
|
|
+ if (!inst) {
|
|
|
+ d_vpr_e("%s: invalid params\n", __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (list_empty(&inst->response_works))
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ /* flush pending last flag buffers if any */
|
|
|
+ list_for_each_entry_safe(resp_work, dummy,
|
|
|
+ &inst->response_works, list) {
|
|
|
+ if (resp_work->type == RESP_WORK_LAST_FLAG) {
|
|
|
+ i_vpr_h(inst, "%s: flush pending last flag buffer\n",
|
|
|
+ __func__);
|
|
|
+ rc = handle_session_response_work(inst, resp_work);
|
|
|
+ if (rc) {
|
|
|
+ msm_vidc_change_inst_state(inst,
|
|
|
+ MSM_VIDC_ERROR, __func__);
|
|
|
+ return rc;
|
|
|
+ }
|
|
|
+ list_del(&resp_work->list);
|
|
|
+ kfree(resp_work->data);
|
|
|
+ kfree(resp_work);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int msm_vidc_discard_pending_opsc(struct msm_vidc_inst *inst)
|
|
|
+{
|
|
|
+ struct response_work *resp_work, *dummy = NULL;
|
|
|
+
|
|
|
+ if (!inst) {
|
|
|
+ d_vpr_e("%s: invalid params\n", __func__);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (list_empty(&inst->response_works))
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ /* discard pending port settings change if any */
|
|
|
+ list_for_each_entry_safe(resp_work, dummy,
|
|
|
+ &inst->response_works, list) {
|
|
|
+ if (resp_work->type == RESP_WORK_OUTPUT_PSC) {
|
|
|
+ i_vpr_h(inst,
|
|
|
+ "%s: discard pending output psc\n", __func__);
|
|
|
+ list_del(&resp_work->list);
|
|
|
+ kfree(resp_work->data);
|
|
|
+ kfree(resp_work);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int msm_vidc_discard_pending_ipsc(struct msm_vidc_inst *inst)
|
|
|
{
|
|
|
struct response_work *resp_work, *dummy = NULL;
|
|
@@ -3883,6 +3944,17 @@ int msm_vidc_session_streamoff(struct msm_vidc_inst *inst,
|
|
|
if(rc)
|
|
|
goto error;
|
|
|
|
|
|
+ /* discard pending input port settings change if any */
|
|
|
+ if (port == INPUT_PORT)
|
|
|
+ msm_vidc_discard_pending_ipsc(inst);
|
|
|
+
|
|
|
+ if (port == OUTPUT_PORT) {
|
|
|
+ /* discard pending opsc if any*/
|
|
|
+ msm_vidc_discard_pending_opsc(inst);
|
|
|
+ /* flush out pending last flag buffers if any */
|
|
|
+ msm_vidc_flush_pending_last_flag(inst);
|
|
|
+ }
|
|
|
+
|
|
|
/* no more queued buffers after streamoff */
|
|
|
count = msm_vidc_num_buffers(inst, buffer_type, MSM_VIDC_ATTR_QUEUED);
|
|
|
if (!count) {
|
|
@@ -3896,9 +3968,6 @@ int msm_vidc_session_streamoff(struct msm_vidc_inst *inst,
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
|
- /* discard pending port settings change if any */
|
|
|
- msm_vidc_discard_pending_ipsc(inst);
|
|
|
-
|
|
|
/* flush deferred buffers */
|
|
|
msm_vidc_flush_buffers(inst, buffer_type);
|
|
|
msm_vidc_flush_delayed_unmap_buffers(inst, buffer_type);
|