mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
media: amphion: initiate a drain of the capture queue in dynamic resolution change
[ Upstream commit076b6289b2] The last buffer from before the change must be marked with the V4L2_BUF_FLAG_LAST flag, similarly to the Drain sequence above. initiate a drain of the capture queue in dynamic resolution change Fixes:6de8d628df("media: amphion: add v4l2 m2m vpu decoder stateful driver") Signed-off-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c0d500726c
commit
cb8e8950d7
@@ -229,6 +229,7 @@ static void vdec_handle_resolution_change(struct vpu_inst *inst)
|
|||||||
|
|
||||||
vdec->source_change--;
|
vdec->source_change--;
|
||||||
vpu_notify_source_change(inst);
|
vpu_notify_source_change(inst);
|
||||||
|
vpu_set_last_buffer_dequeued(inst, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vdec_update_state(struct vpu_inst *inst, enum vpu_codec_state state, u32 force)
|
static int vdec_update_state(struct vpu_inst *inst, enum vpu_codec_state state, u32 force)
|
||||||
@@ -264,7 +265,7 @@ static void vdec_set_last_buffer_dequeued(struct vpu_inst *inst)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (vdec->eos_received) {
|
if (vdec->eos_received) {
|
||||||
if (!vpu_set_last_buffer_dequeued(inst)) {
|
if (!vpu_set_last_buffer_dequeued(inst, true)) {
|
||||||
vdec->eos_received--;
|
vdec->eos_received--;
|
||||||
vdec_update_state(inst, VPU_CODEC_STATE_DRAIN, 0);
|
vdec_update_state(inst, VPU_CODEC_STATE_DRAIN, 0);
|
||||||
}
|
}
|
||||||
@@ -517,7 +518,7 @@ static int vdec_drain(struct vpu_inst *inst)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!vdec->params.frame_count) {
|
if (!vdec->params.frame_count) {
|
||||||
vpu_set_last_buffer_dequeued(inst);
|
vpu_set_last_buffer_dequeued(inst, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,7 +557,7 @@ static int vdec_cmd_stop(struct vpu_inst *inst)
|
|||||||
vpu_trace(inst->dev, "[%d]\n", inst->id);
|
vpu_trace(inst->dev, "[%d]\n", inst->id);
|
||||||
|
|
||||||
if (inst->state == VPU_CODEC_STATE_DEINIT) {
|
if (inst->state == VPU_CODEC_STATE_DEINIT) {
|
||||||
vpu_set_last_buffer_dequeued(inst);
|
vpu_set_last_buffer_dequeued(inst, true);
|
||||||
} else {
|
} else {
|
||||||
vdec->drain = 1;
|
vdec->drain = 1;
|
||||||
vdec_drain(inst);
|
vdec_drain(inst);
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ static int venc_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd
|
|||||||
vpu_inst_lock(inst);
|
vpu_inst_lock(inst);
|
||||||
if (cmd->cmd == V4L2_ENC_CMD_STOP) {
|
if (cmd->cmd == V4L2_ENC_CMD_STOP) {
|
||||||
if (inst->state == VPU_CODEC_STATE_DEINIT)
|
if (inst->state == VPU_CODEC_STATE_DEINIT)
|
||||||
vpu_set_last_buffer_dequeued(inst);
|
vpu_set_last_buffer_dequeued(inst, true);
|
||||||
else
|
else
|
||||||
venc_request_eos(inst);
|
venc_request_eos(inst);
|
||||||
}
|
}
|
||||||
@@ -888,7 +888,7 @@ static void venc_set_last_buffer_dequeued(struct vpu_inst *inst)
|
|||||||
struct venc_t *venc = inst->priv;
|
struct venc_t *venc = inst->priv;
|
||||||
|
|
||||||
if (venc->stopped && list_empty(&venc->frames))
|
if (venc->stopped && list_empty(&venc->frames))
|
||||||
vpu_set_last_buffer_dequeued(inst);
|
vpu_set_last_buffer_dequeued(inst, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void venc_stop_done(struct vpu_inst *inst)
|
static void venc_stop_done(struct vpu_inst *inst)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ int vpu_notify_source_change(struct vpu_inst *inst)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vpu_set_last_buffer_dequeued(struct vpu_inst *inst)
|
int vpu_set_last_buffer_dequeued(struct vpu_inst *inst, bool eos)
|
||||||
{
|
{
|
||||||
struct vb2_queue *q;
|
struct vb2_queue *q;
|
||||||
|
|
||||||
@@ -116,7 +116,8 @@ int vpu_set_last_buffer_dequeued(struct vpu_inst *inst)
|
|||||||
vpu_trace(inst->dev, "last buffer dequeued\n");
|
vpu_trace(inst->dev, "last buffer dequeued\n");
|
||||||
q->last_buffer_dequeued = true;
|
q->last_buffer_dequeued = true;
|
||||||
wake_up(&q->done_wq);
|
wake_up(&q->done_wq);
|
||||||
vpu_notify_eos(inst);
|
if (eos)
|
||||||
|
vpu_notify_eos(inst);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ struct vb2_v4l2_buffer *vpu_find_buf_by_idx(struct vpu_inst *inst, u32 type, u32
|
|||||||
void vpu_v4l2_set_error(struct vpu_inst *inst);
|
void vpu_v4l2_set_error(struct vpu_inst *inst);
|
||||||
int vpu_notify_eos(struct vpu_inst *inst);
|
int vpu_notify_eos(struct vpu_inst *inst);
|
||||||
int vpu_notify_source_change(struct vpu_inst *inst);
|
int vpu_notify_source_change(struct vpu_inst *inst);
|
||||||
int vpu_set_last_buffer_dequeued(struct vpu_inst *inst);
|
int vpu_set_last_buffer_dequeued(struct vpu_inst *inst, bool eos);
|
||||||
void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int type, enum vb2_buffer_state state);
|
void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int type, enum vb2_buffer_state state);
|
||||||
int vpu_get_num_buffers(struct vpu_inst *inst, u32 type);
|
int vpu_get_num_buffers(struct vpu_inst *inst, u32 type);
|
||||||
bool vpu_is_source_empty(struct vpu_inst *inst);
|
bool vpu_is_source_empty(struct vpu_inst *inst);
|
||||||
|
|||||||
Reference in New Issue
Block a user