diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2019-06-18 12:45:21 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-06-24 14:31:50 -0400 |
commit | e7fd95849b3c25ae1604ba2788e63fe6570ba0ff (patch) | |
tree | a0025d3e7d49812c57b6b0596976aada1aa056f9 /drivers/media/platform/coda/coda-common.c | |
parent | f74c0a29eca57e0024d31d41cbc4fc3d020bb42a (diff) | |
download | kernel_replicant_linux-e7fd95849b3c25ae1604ba2788e63fe6570ba0ff.tar.gz kernel_replicant_linux-e7fd95849b3c25ae1604ba2788e63fe6570ba0ff.tar.bz2 kernel_replicant_linux-e7fd95849b3c25ae1604ba2788e63fe6570ba0ff.zip |
media: coda: flush bitstream ring buffer on decoder restart
The bitstream ringbuffer might be in an underrun state after draining,
or it might still contain unread data if the previous decoder stop
command was flagged as immediate. Flush the bitstream ring buffer
during V4L2_DEC_CMD_START to get into a well defined state. Also fill
the bitstream with buffers that have been queued during draining,
to resume decoding immediately.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 1f1eb9685bc4..0f5e6dcded99 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -1052,6 +1052,7 @@ static int coda_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *dc) { struct coda_ctx *ctx = fh_to_ctx(fh); + struct coda_dev *dev = ctx->dev; struct vb2_queue *dst_vq; int ret; @@ -1061,10 +1062,16 @@ static int coda_decoder_cmd(struct file *file, void *fh, switch (dc->cmd) { case V4L2_DEC_CMD_START: + mutex_lock(&ctx->bitstream_mutex); + mutex_lock(&dev->coda_mutex); + coda_bitstream_flush(ctx); + mutex_unlock(&dev->coda_mutex); dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); vb2_clear_last_buffer_dequeued(dst_vq); ctx->bit_stream_param &= ~CODA_BIT_STREAM_END_FLAG; + coda_fill_bitstream(ctx, NULL); + mutex_unlock(&ctx->bitstream_mutex); break; case V4L2_DEC_CMD_STOP: /* Set the stream-end flag on this context */ |