v4l2: Enhancement to send video alignment info for padding requirements in propose allocation

Nicolas Dufresne nicolas at ndufresne.ca
Tue May 6 15:18:07 UTC 2025


Hi,

Le mardi 06 mai 2025 à 09:54 +0000, Pratik Pachange (QUIC) a écrit :
> 
> 
> Hi
> 
> Our video driver expects buffer size to be aligned to 4096 bytes (4 KB). The expected sizeimage is returned in S_FMT
> ioctl call by the driver. But in gst_v4l2_object_extrapolate_info (), the info->size value is updated as per the width
> and height returned by driver 

Apparently that was to work around a bug on the Pi (in 2017). I don't remember much, its related to this archived issue
report:

https://bugzilla.gnome.org/show_bug.cgi?id=775564

The driver would report what was "probably" aligned size, but then in bytesused, it would report the actual pixel data
surface. Feel free to propose a patch. You can't just revert that old change, since otherwise the pool will consider
your raw frames truncated and will drop them. This probably need a proper split so that we correctly populate maxsize vs
size in GstMemory.

regards,
Nicolas

> 
> For a particular resolution and format (mostly NV12), we expect that the difference in actual buffer size and the size
> expected by the video driver be provided as padding in propose allocation, so that the upstream plugin can allocate
> buffer as per the driver requirement. 
> 
> For example, for resolution 1920x540, driver returns width and height as 1920x544  (height is 32 bytes aligned) and
> sizeimage as 1568768.
> As per NV12 format, the actual buffer size for this resolution is 1920x544x3/2 = 1566720. But driver expects buffer
> size of 1568768 (4KB alignment of 1566720).
> So, this difference of the expected buffer size and actual buffer size should be provided as padding requirement in
> propose allocation.
>  
>  
> Thanks
> Pratik
>  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20250506/330ac3f3/attachment.htm>


More information about the gstreamer-devel mailing list