upstream: [media] vb2: if bytesused is 0, then fill with output buffer length
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 7 Apr 2014 11:57:48 +0000 (08:57 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:56:09 +0000 (11:56 +0900)
commit84ff103b2d7bce68f57f2ef30ff1ef00d71198a1
tree6e3d2c91c8849bd6bb1b8e3303cdb9e28a96f819
parente23af393138545e0f755a65586a82fd76e03a071
upstream: [media] vb2: if bytesused is 0, then fill with output buffer length

The application should really always fill in bytesused for output
buffers, unfortunately the vb2 framework never checked for that.

So for single planar formats replace a bytesused of 0 by the length
of the buffer, and for multiplanar format do the same if bytesused is
0 for ALL planes.

This seems to be what the user really intended if v4l2_buffer was
just memset to 0.

I'm afraid that just checking for this and returning an error would
break too many applications. Quite a few drivers never check for bytesused
at all and just use the buffer length instead.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/videobuf2-core.c