diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2015-03-24 13:30:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-10 09:11:05 -0400 |
commit | 582d887211612c197fc8ea9435503f9b278ce76f (patch) | |
tree | d0052724c2ddb1707c521fb7afb17f3001535516 /drivers/media/platform | |
parent | 5c76c2c3e2783886975ff536c50d9c446e0ecb6e (diff) |
[media] coda: fix fill bitstream errors in nonstreaming case
When queueing a buffer into the bitstream fails, it has to be requeued
in the videobuf2 queue before streaming starts, but while streaming it
should be returned to userspace with an error.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 11 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 6 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda.h | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 23041587c898..d39789d59d17 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c | |||
@@ -218,7 +218,7 @@ static bool coda_bitstream_try_queue(struct coda_ctx *ctx, | |||
218 | return true; | 218 | return true; |
219 | } | 219 | } |
220 | 220 | ||
221 | void coda_fill_bitstream(struct coda_ctx *ctx) | 221 | void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming) |
222 | { | 222 | { |
223 | struct vb2_buffer *src_buf; | 223 | struct vb2_buffer *src_buf; |
224 | struct coda_buffer_meta *meta; | 224 | struct coda_buffer_meta *meta; |
@@ -239,9 +239,12 @@ void coda_fill_bitstream(struct coda_ctx *ctx) | |||
239 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG && | 239 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG && |
240 | !coda_jpeg_check_buffer(ctx, src_buf)) { | 240 | !coda_jpeg_check_buffer(ctx, src_buf)) { |
241 | v4l2_err(&ctx->dev->v4l2_dev, | 241 | v4l2_err(&ctx->dev->v4l2_dev, |
242 | "dropping invalid JPEG frame\n"); | 242 | "dropping invalid JPEG frame %d\n", |
243 | ctx->qsequence); | ||
243 | src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); | 244 | src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); |
244 | v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); | 245 | v4l2_m2m_buf_done(src_buf, streaming ? |
246 | VB2_BUF_STATE_ERROR : | ||
247 | VB2_BUF_STATE_QUEUED); | ||
245 | continue; | 248 | continue; |
246 | } | 249 | } |
247 | 250 | ||
@@ -1648,7 +1651,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx) | |||
1648 | 1651 | ||
1649 | /* Try to copy source buffer contents into the bitstream ringbuffer */ | 1652 | /* Try to copy source buffer contents into the bitstream ringbuffer */ |
1650 | mutex_lock(&ctx->bitstream_mutex); | 1653 | mutex_lock(&ctx->bitstream_mutex); |
1651 | coda_fill_bitstream(ctx); | 1654 | coda_fill_bitstream(ctx, true); |
1652 | mutex_unlock(&ctx->bitstream_mutex); | 1655 | mutex_unlock(&ctx->bitstream_mutex); |
1653 | 1656 | ||
1654 | if (coda_get_bitstream_payload(ctx) < 512 && | 1657 | if (coda_get_bitstream_payload(ctx) < 512 && |
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index c8811b7fa137..8e6fe0200117 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c | |||
@@ -1192,7 +1192,7 @@ static void coda_buf_queue(struct vb2_buffer *vb) | |||
1192 | mutex_lock(&ctx->bitstream_mutex); | 1192 | mutex_lock(&ctx->bitstream_mutex); |
1193 | v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); | 1193 | v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); |
1194 | if (vb2_is_streaming(vb->vb2_queue)) | 1194 | if (vb2_is_streaming(vb->vb2_queue)) |
1195 | coda_fill_bitstream(ctx); | 1195 | coda_fill_bitstream(ctx, true); |
1196 | mutex_unlock(&ctx->bitstream_mutex); | 1196 | mutex_unlock(&ctx->bitstream_mutex); |
1197 | } else { | 1197 | } else { |
1198 | v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); | 1198 | v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); |
@@ -1252,9 +1252,9 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count) | |||
1252 | if (q_data_src->fourcc == V4L2_PIX_FMT_H264 || | 1252 | if (q_data_src->fourcc == V4L2_PIX_FMT_H264 || |
1253 | (q_data_src->fourcc == V4L2_PIX_FMT_JPEG && | 1253 | (q_data_src->fourcc == V4L2_PIX_FMT_JPEG && |
1254 | ctx->dev->devtype->product == CODA_7541)) { | 1254 | ctx->dev->devtype->product == CODA_7541)) { |
1255 | /* copy the buffers that where queued before streamon */ | 1255 | /* copy the buffers that were queued before streamon */ |
1256 | mutex_lock(&ctx->bitstream_mutex); | 1256 | mutex_lock(&ctx->bitstream_mutex); |
1257 | coda_fill_bitstream(ctx); | 1257 | coda_fill_bitstream(ctx, false); |
1258 | mutex_unlock(&ctx->bitstream_mutex); | 1258 | mutex_unlock(&ctx->bitstream_mutex); |
1259 | 1259 | ||
1260 | if (coda_get_bitstream_payload(ctx) < 512) { | 1260 | if (coda_get_bitstream_payload(ctx) < 512) { |
diff --git a/drivers/media/platform/coda/coda.h b/drivers/media/platform/coda/coda.h index 2b59e1660e58..970f0b345c4e 100644 --- a/drivers/media/platform/coda/coda.h +++ b/drivers/media/platform/coda/coda.h | |||
@@ -256,7 +256,7 @@ int coda_decoder_queue_init(void *priv, struct vb2_queue *src_vq, | |||
256 | 256 | ||
257 | int coda_hw_reset(struct coda_ctx *ctx); | 257 | int coda_hw_reset(struct coda_ctx *ctx); |
258 | 258 | ||
259 | void coda_fill_bitstream(struct coda_ctx *ctx); | 259 | void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming); |
260 | 260 | ||
261 | void coda_set_gdi_regs(struct coda_ctx *ctx); | 261 | void coda_set_gdi_regs(struct coda_ctx *ctx); |
262 | 262 | ||