Am Montag, den 17.06.2013, 16:59 +0200 schrieb Philipp Zabel: > This patch enables decoding of h.264 and mpeg4 streams on CODA7541. > Queued output buffers are immediately copied into the bitstream > ringbuffer. A device_run can be scheduled whenever there is either > enough compressed bitstream data, or the CODA is in stream end mode. > > Each successful device_run, data is read from the bitstream ringbuffer > and a frame is decoded into a free internal framebuffer. Depending on > reordering, a possibly previously decoded frame is marked as display > frame, and at the same time the display frame from the previous run > is copied out into a capture buffer by the rotator hardware. > > The dequeued capture buffers are counted to send the EOS signal to > userspace with the last frame. When userspace sends the decoder stop > command or enqueues an empty output buffer, the stream end flag is > set to allow decoding the remaining frames in the bitstream > ringbuffer. > > The enum_fmt/try_fmt functions return fixed capture buffer sizes > while the output queue is streaming, to allow better autonegotiation > in userspace. > > A per-context buffer mutex is used to lock the picture run against > buffer dequeueing: if a job gets queued, then streamoff dequeues > the last buffer, and then device_run is called, bail out. For that > the interrupt handler has to be threaded. > > Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> > --- > drivers/media/platform/coda.c | 785 ++++++++++++++++++++++++++++++++++++++---- > drivers/media/platform/coda.h | 84 +++++ > 2 files changed, 811 insertions(+), 58 deletions(-) > > diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c > index e8b3708..16f1726 100644 > --- a/drivers/media/platform/coda.c > +++ b/drivers/media/platform/coda.c [...] > @@ -938,6 +1185,8 @@ static void coda_device_run(void *m2m_priv) > /* 1 second timeout in case CODA locks up */ > schedule_delayed_work(&dev->timeout, HZ); > > + if (ctx->inst_type == CODA_INST_DECODER) > + coda_kfifo_sync_to_device_full(ctx); > coda_command_async(ctx, CODA_COMMAND_PIC_RUN); > } > > @@ -963,6 +1212,15 @@ static int coda_job_ready(void *m2m_priv) > return 0; > } > > + if (ctx->prescan_failed || > + ((coda_get_bitstream_payload(ctx) < 512) && > + !(ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG))) { > + v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, > + "%d: not ready: not enough bitstream data.\n", This of course is only valid for decoder contexts: --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -1618,7 +1618,8 @@ static int coda_job_ready(void *m2m_priv) } if (ctx->prescan_failed || - ((coda_get_bitstream_payload(ctx) < 512) && + ((ctx->inst_type == CODA_INST_DECODER) && + (coda_get_bitstream_payload(ctx) < 512) && !(ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG))) { v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, "%d: not ready: not enough bitstream data.\n", > + ctx->idx); > + return 0; > + } > + > if (ctx->aborting) { > v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, > "not ready: aborting\n"); [...] regards Philipp -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html