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>
Thu, 7 Aug 2014 05:26:26 +0000 (14:26 +0900)
commit393d0d3247f73758ffd4c2aad0a22f2d2674949d
tree90241d601f85a3e31afa6146d99a71756b04e8b2
parent5f3b354f3191d4463e95af6ca699ad10864d7651
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