llittle/big edian with v4l2 format

Nicolas Dufresne nicolas at ndufresne.ca
Mon Jun 26 11:37:13 UTC 2017


Le lundi 26 juin 2017 à 14:04 +0800, Jacob Chen a écrit :
> Hi all,
> 
> 
> I'm writing a v4l2-m2m driver for a 2d grapphic acceleration unit in
> an arm soc and I use gstreamer v4l2transform as userspace for test.
> 
> When i test it with below pipeline, i get a wrong picture.
> 
> gst-launch-1.0 -v videotestsrc ! "video/x-raw,format=BGRA,
> width=1920,height=1080,framerate=30/1" ! \ v4l2video0convert output-
> io-mode=dmabuf capture-io-mode=dmabuf ! \ "video/x-raw,format=NV12,
> width=640,height=720,framerate=30/1, pixel-aspect-ratio=8/9" !
> kmssink
> 
> 
> After studys, i think the problem is gstreamer always use big endian
> for color.
> 
> 
> It seems in kmssink, the format will be converted according to
> endian.
> https://github.com/GStreamer/gst-plugins-
> bad/blob/d373c4478be2f9887032f2e18501aa80e41f097b/sys/kms/gstkmsutils
> .c#L45

This is specific to DRM, since DRM color formats, unlike V4L2 and GST
color format, are represented as if you loaded the color into a 32bit
register. All formats in GStreamer and V4L2 are defined as big endian
(array order). Please fix your driver. This mistake existed in older
version of Samsung MFC converter, and is fixed in upstream kernel. The
GstV4l2Transform as also been tested on Freescale and Exynos 5 driver
for all color formats combinations.

regards,
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170626/28e98651/attachment-0001.sig>


More information about the gstreamer-devel mailing list