This series adds support for decoding multi-slice H264 frames along with support for V4L2_DEC_CMD_FLUSH and V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF.
This has only been compile-tested. Jernej, can you test with ffmpeg? This series is based on https://www.spinics.net/lists/linux-media/msg158081.html plus ideas from https://www.spinics.net/lists/linux-media/msg158625.html. Changes since v3: - Fix two 'unused variable' warnings in patch 2. - Dropped patch 6/8 since this is no longer needed. - Combined patches 7/8 and 8/8. - Dropped an unnecessary cast in 8/8. Changes since v2: - Move the code to detect if a capture buffer is done to the v4l2-mem2mem core framework. - Move the first-slice detection to the core as well. - Add a new v4l2_m2m_buf_done_and_job_finish() function that finishes a job taking held capture buffers into account. Marking buffers as done and finishing the job has to be done with job_spinlock held to avoid race conditions with v4l2_m2m_ioctl_stateless_decoder_cmd(). - v4l2_m2m_ioctl_stateless_decoder_cmd takes the job_spinlock to prevent race conditions. Regards, Hans Hans Verkuil (4): vb2: add V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF v4l2-mem2mem: support held capture buffers videodev2.h: add V4L2_DEC_CMD_FLUSH v4l2-mem2mem: add new_frame detection Jernej Skrabec (2): media: v4l2-mem2mem: add stateless_(try_)decoder_cmd ioctl helpers media: cedrus: h264: Support multiple slices per frame Documentation/media/uapi/v4l/buffer.rst | 13 ++ .../media/uapi/v4l/vidioc-decoder-cmd.rst | 10 +- .../media/uapi/v4l/vidioc-reqbufs.rst | 6 + .../media/videodev2.h.rst.exceptions | 1 + .../media/common/videobuf2/videobuf2-v4l2.c | 12 +- drivers/media/v4l2-core/v4l2-mem2mem.c | 190 +++++++++++++++--- .../staging/media/sunxi/cedrus/cedrus_h264.c | 12 +- .../staging/media/sunxi/cedrus/cedrus_hw.c | 16 +- .../staging/media/sunxi/cedrus/cedrus_video.c | 14 ++ include/media/v4l2-mem2mem.h | 44 +++- include/media/videobuf2-core.h | 3 + include/media/videobuf2-v4l2.h | 5 + include/uapi/linux/videodev2.h | 14 +- 13 files changed, 282 insertions(+), 58 deletions(-) -- 2.23.0