GNOME Bugzilla – Bug 733501
v4l2: Fully support v4l2_plane.data_offset
Last modified: 2017-11-03 20:30:26 UTC
This parameter is not well documented in V4L2 hence was not fully implemented. It's mostly implemented for DMABUF, but ignored for MMAP. <hverkuil> 08:06:12> stormer: please don't ignore data_offset. You can test with this driver: http://git.linuxtv.org/cgit.cgi/hverkuil/media_tree.git/log/?h=vivid <hverkuil> 08:06:23> modprobe vivid multiplanar=2 <hverkuil> 08:06:41> Select the NV16 pixformat and plane 0 will have a data_offset of 128. <hverkuil> 08:07:00> for both input (video0) and output (video1). <hverkuil> 08:07:52> remember: bytesused *includes* data_offset, so the actual size of the image is bytesused-data_offset.
As all real drivers has been implementing it wrong (GStreamer is no different), upstream is reconsidering the part about bytesused. It may not include the offset anymore. No upstream driver except vivid is using this at the moment, and proprietary or out of tree drivers using it we found all missed that bytesused includes the offset.
Ok, this is now implemented by Venus (Qualcomm 8016 / DB420c) for encoding VP8.
Created attachment 362932 [details] [review] v4l2allocator: Add support for data_offset In MPLANE mode, the driver may set data_offset, which represent some padding at the start of the buffer used internally. This portion of the data need to be skipped, though it is included in bytesused. This patch removes frame size sanity check as the method used will no longer work. This check was simply there to help detect broken kernel drivers. It would be re-implement by estimating the plane size, which is not totally trivial and may be too much work for a simple debug check.
Attachment 362932 [details] pushed as 57d7ae8 - v4l2allocator: Add support for data_offset