mbox series

[0/2] v4l2-mem2mem: add job_write() to support encoders

Message ID 20181214154316.62011-1-hverkuil-cisco@xs4all.nl (mailing list archive)
Headers show
Series v4l2-mem2mem: add job_write() to support encoders | expand

Message

Hans Verkuil Dec. 14, 2018, 3:43 p.m. UTC
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>

The m2m framework is not quite symmetrical: decoders can process multiple
output buffers in job_ready until enough buffers have arrived so a frame
can be decoded.

However, encoders do not have an equivalent where multiple capture buffers
can be used to write the compressed frame. They expect that the provided
capture buffer is always large enough to contain the full compressed
frame.

This patch adds a job_write() callback and a v4l2_m2m_job_writing()
function to tell the m2m framework that the job isn't finished but that
it is waiting for more capture buffers so it can write the remaining
compressed data to the buffers.

The first patch adds the support for this to the m2m framework, the
second patch adapts vicodec to use it.

Let me know if there are any comments! It would be even better if this
could be tested in a real stateful encoder.

Regards,

	Hans

Hans Verkuil (2):
  v4l2-mem2mem: add job_write callback
  vicodec: add encoder support to write to multiple buffers

 drivers/media/platform/vicodec/vicodec-core.c | 91 +++++++++++++++----
 drivers/media/v4l2-core/v4l2-mem2mem.c        | 61 +++++++++++--
 include/media/v4l2-mem2mem.h                  | 27 +++++-
 3 files changed, 152 insertions(+), 27 deletions(-)