On 04/04/2022 18:35, Philipp Zabel wrote: > The V4L2 specification states: > > "If the application sets this to 0 for an output stream, then bytesused > will be set to the size of the buffer (see the length field of this > struct) by the driver." > > Since we set allow_zero_bytesused, we have to handle this ourselves. > > Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> > --- > drivers/media/platform/chips-media/coda-bit.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/chips-media/coda-bit.c b/drivers/media/platform/chips-media/coda-bit.c > index c484c008ab02..705a179ea8f0 100644 > --- a/drivers/media/platform/chips-media/coda-bit.c > +++ b/drivers/media/platform/chips-media/coda-bit.c > @@ -381,6 +381,9 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list) > /* Dump empty buffers */ > if (!vb2_get_plane_payload(&src_buf->vb2_buf, 0)) { > src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); > + vb2_set_plane_payload(&src_buf->vb2_buf, 0, > + vb2_plane_size(&src_buf->vb2_buf, > + 0)); Would it be possible to stop using allow_zero_bytesused altogether? Are there still applications that rely on zero-sized output buffers to stop the decoder? I'm not actually sure that I want this in the driver, perhaps v4l2-compliance can be modified to turn a fail into a warn if the driver is the coda driver. Patching the driver is hiding the fact that the coda driver does something non-standard for legacy reasons. It doesn't make sense either to change bytesused to the buffer size since there really is nothing in the buffer. v4l2-compliance already has checks for two drivers, search for is_vivid and is_uvcvideo. I'm skipping this patch for now. Regards, Hans > v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); > continue; > }