diff mbox

coda: use VB2_FILEIO_ALLOW_ZERO_BYTESUSED flag

Message ID 1418985387-16580-1-git-send-email-k.debski@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kamil Debski Dec. 19, 2014, 10:36 a.m. UTC
The coda 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@samsung.com>
---
 drivers/media/platform/coda/coda-common.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Philipp Zabel Dec. 19, 2014, 10:56 a.m. UTC | #1
Hi Kamil,

Am Freitag, den 19.12.2014, 11:36 +0100 schrieb Kamil Debski:
> The coda 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@samsung.com>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

thanks
Philipp

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 42b4630..6c67e6d 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1491,6 +1491,13 @@  static int coda_queue_init(struct coda_ctx *ctx, struct vb2_queue *vq)
 	vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
 	vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	vq->lock = &ctx->dev->dev_mutex;
+	/* One of means to indicate end-of-stream for coda 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.
+	 */
+	vq->io_flags = VB2_FILEIO_ALLOW_ZERO_BYTESUSED;
 
 	return vb2_queue_init(vq);
 }