Merge "msm: vidc: do not allow qbuf during flush"

This commit is contained in:
qctecmdr 2019-08-12 17:32:50 -07:00 committed by Gerrit - the friendly Code Review server
commit a81cba00ec
3 changed files with 25 additions and 11 deletions

View File

@ -346,9 +346,10 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b)
return -EINVAL;
}
if (inst->in_flush && is_decode_session(inst) &&
b->type == OUTPUT_MPLANE) {
dprintk(VIDC_ERR, "%s: in flush, discarding qbuf\n", __func__);
if ((inst->out_flush && b->type == OUTPUT_MPLANE) || inst->in_flush) {
dprintk(VIDC_ERR,
"%s: %x: in flush, discarding qbuf, type %u, index %u\n",
__func__, hash32_ptr(inst->session), b->type, b->index);
return -EINVAL;
}

View File

@ -2096,19 +2096,22 @@ static void handle_session_flush(enum hal_command_response cmd, void *data)
}
}
}
inst->in_flush = false;
flush_event.type = V4L2_EVENT_MSM_VIDC_FLUSH_DONE;
ptr = (u32 *)flush_event.u.data;
flush_type = response->data.flush_type;
switch (flush_type) {
case HAL_FLUSH_INPUT:
inst->in_flush = false;
ptr[0] = V4L2_CMD_FLUSH_OUTPUT;
break;
case HAL_FLUSH_OUTPUT:
inst->out_flush = false;
ptr[0] = V4L2_CMD_FLUSH_CAPTURE;
break;
case HAL_FLUSH_ALL:
inst->in_flush = false;
inst->out_flush = false;
ptr[0] |= V4L2_CMD_FLUSH_CAPTURE;
ptr[0] |= V4L2_CMD_FLUSH_OUTPUT;
break;
@ -5391,14 +5394,20 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
core = inst->core;
hdev = core->device;
ip_flush = flags & V4L2_CMD_FLUSH_OUTPUT;
op_flush = flags & V4L2_CMD_FLUSH_CAPTURE;
ip_flush = !!(flags & V4L2_CMD_FLUSH_OUTPUT);
op_flush = !!(flags & V4L2_CMD_FLUSH_CAPTURE);
if (ip_flush && !op_flush) {
dprintk(VIDC_ERR,
"Input only flush not supported, making it flush all\n");
op_flush = true;
return 0;
goto exit;
}
if ((inst->in_flush && ip_flush) || (inst->out_flush && op_flush)) {
dprintk(VIDC_ERR, "%s: %x : Already in flush\n",
__func__, hash32_ptr(inst->session));
goto exit;
}
msm_clock_data_reset(inst);
@ -5409,12 +5418,13 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
"Core %pK and inst %pK are in bad state\n",
core, inst);
msm_comm_flush_in_invalid_state(inst);
return 0;
goto exit;
}
mutex_lock(&inst->flush_lock);
/* enable in flush */
inst->in_flush = true;
inst->in_flush = ip_flush;
inst->out_flush = op_flush;
mutex_lock(&inst->registeredbufs.lock);
list_for_each_entry_safe(mbuf, next, &inst->registeredbufs.list, list) {
@ -5472,10 +5482,12 @@ int msm_comm_flush(struct msm_vidc_inst *inst, u32 flags)
dprintk(VIDC_ERR,
"Sending flush to firmware failed, flush out all buffers\n");
msm_comm_flush_in_invalid_state(inst);
/* disable in_flush */
/* disable in_flush & out_flush */
inst->in_flush = false;
inst->out_flush = false;
}
exit:
return rc;
}
@ -6850,7 +6862,7 @@ void handle_release_buffer_reference(struct msm_vidc_inst *inst,
goto unlock;
/* buffer found means client queued the buffer already */
if (inst->in_reconfig || inst->in_flush) {
if (inst->in_reconfig || inst->out_flush) {
print_vidc_buffer(VIDC_HIGH, "rbr flush buf", inst, mbuf);
msm_comm_flush_vidc_buffer(inst, mbuf);
msm_comm_unmap_vidc_buffer(inst, mbuf);

View File

@ -526,6 +526,7 @@ struct msm_vidc_inst {
int bit_depth;
struct kref kref;
bool in_flush;
bool out_flush;
u32 pic_struct;
u32 colour_space;
u32 profile;