The MFC driver interprets a buffer with bytesused equal to 0 as a special case indicating end-of-stream. After vb2: fix bytesused == 0 handling (8a75ffb) patch videobuf2 modified the value of bytesused if it was 0. The VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag was added to videobuf2 to keep backward compatibility. Signed-off-by: Kamil Debski <k.debski@xxxxxxxxxxx> --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 03204fd..89c148b 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -820,6 +820,13 @@ static int s5p_mfc_open(struct file *file) ret = -ENOENT; goto err_queue_init; } + /* One of means to indicate end-of-stream for MFC is to set the + * bytesused == 0. However by default videobuf2 handles videobuf + * equal to 0 as a special case and changes its value to the size + * of the buffer. Set the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag so + * that videobuf2 will keep the value of bytesused intact. + */ + q->io_flags = VB2_FILEIO_ALLOW_ZERO_BYTESUSED; q->mem_ops = &vb2_dma_contig_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ret = vb2_queue_init(q); @@ -842,6 +849,10 @@ static int s5p_mfc_open(struct file *file) ret = -ENOENT; goto err_queue_init; } + /* Set the VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag, for more information + * please see the comment above. + */ + q->io_flags = VB2_FILEIO_ALLOW_ZERO_BYTESUSED; q->mem_ops = &vb2_dma_contig_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; ret = vb2_queue_init(q); -- 1.7.9.5 -- 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