Commit 6c0f5d23 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

media: coda: store unmasked fifo position in meta

Storing the unmasked kfifo->in position as meta->start and ->end allows
to more easily compare a point past meta->end with the current
kfifo->in.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 649cfc2b
...@@ -299,8 +299,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list) ...@@ -299,8 +299,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list)
} }
/* Buffer start position */ /* Buffer start position */
start = ctx->bitstream_fifo.kfifo.in & start = ctx->bitstream_fifo.kfifo.in;
ctx->bitstream_fifo.kfifo.mask;
if (coda_bitstream_try_queue(ctx, src_buf)) { if (coda_bitstream_try_queue(ctx, src_buf)) {
/* /*
...@@ -315,8 +314,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list) ...@@ -315,8 +314,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list)
meta->timecode = src_buf->timecode; meta->timecode = src_buf->timecode;
meta->timestamp = src_buf->vb2_buf.timestamp; meta->timestamp = src_buf->vb2_buf.timestamp;
meta->start = start; meta->start = start;
meta->end = ctx->bitstream_fifo.kfifo.in & meta->end = ctx->bitstream_fifo.kfifo.in;
ctx->bitstream_fifo.kfifo.mask;
spin_lock_irqsave(&ctx->buffer_meta_lock, spin_lock_irqsave(&ctx->buffer_meta_lock,
flags); flags);
list_add_tail(&meta->list, list_add_tail(&meta->list,
...@@ -1980,8 +1978,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx) ...@@ -1980,8 +1978,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
if (meta && ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG) { if (meta && ctx->codec->src_fourcc == V4L2_PIX_FMT_JPEG) {
/* If this is the last buffer in the bitstream, add padding */ /* If this is the last buffer in the bitstream, add padding */
if (meta->end == (ctx->bitstream_fifo.kfifo.in & if (meta->end == ctx->bitstream_fifo.kfifo.in) {
ctx->bitstream_fifo.kfifo.mask)) {
static unsigned char buf[512]; static unsigned char buf[512];
unsigned int pad; unsigned int pad;
......
...@@ -1298,7 +1298,6 @@ static int coda_job_ready(void *m2m_priv) ...@@ -1298,7 +1298,6 @@ static int coda_job_ready(void *m2m_priv)
return 0; return 0;
} }
if (!src_bufs && !stream_end && if (!src_bufs && !stream_end &&
(coda_get_bitstream_payload(ctx) < 512)) { (coda_get_bitstream_payload(ctx) < 512)) {
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
......
...@@ -145,8 +145,8 @@ struct coda_buffer_meta { ...@@ -145,8 +145,8 @@ struct coda_buffer_meta {
u32 sequence; u32 sequence;
struct v4l2_timecode timecode; struct v4l2_timecode timecode;
u64 timestamp; u64 timestamp;
u32 start; unsigned int start;
u32 end; unsigned int end;
}; };
/* Per-queue, driver-specific private data */ /* Per-queue, driver-specific private data */
......
...@@ -97,8 +97,8 @@ DECLARE_EVENT_CLASS(coda_buf_meta_class, ...@@ -97,8 +97,8 @@ DECLARE_EVENT_CLASS(coda_buf_meta_class,
TP_fast_assign( TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor; __entry->minor = ctx->fh.vdev->minor;
__entry->index = buf->vb2_buf.index; __entry->index = buf->vb2_buf.index;
__entry->start = meta->start; __entry->start = meta->start & ctx->bitstream_fifo.kfifo.mask;
__entry->end = meta->end; __entry->end = meta->end & ctx->bitstream_fifo.kfifo.mask;
__entry->ctx = ctx->idx; __entry->ctx = ctx->idx;
), ),
...@@ -127,8 +127,10 @@ DECLARE_EVENT_CLASS(coda_meta_class, ...@@ -127,8 +127,10 @@ DECLARE_EVENT_CLASS(coda_meta_class,
TP_fast_assign( TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor; __entry->minor = ctx->fh.vdev->minor;
__entry->start = meta ? meta->start : 0; __entry->start = meta ? (meta->start &
__entry->end = meta ? meta->end : 0; ctx->bitstream_fifo.kfifo.mask) : 0;
__entry->end = meta ? (meta->end &
ctx->bitstream_fifo.kfifo.mask) : 0;
__entry->ctx = ctx->idx; __entry->ctx = ctx->idx;
), ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment