Why gstreamer pipeline fails when using v4l2src format as BGR and io-mode as dmabuf?

Why gstreamer pipeline fails when using v4l2src format as BGR and io-mode as dmabuf?

I am using gstreamer version 1.8.3 on ubunutu 16.04 LTS.
I am trying to run a pipeline using gst-launch-1.0 with the following
command on terminal.(which streams webcam video in my laptop)
Command:
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=BGR ! videoconvert
! autovideosink --gst-debug=2

But the same pipeline works if I change the format=YUY2.
Working Command:
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=YUY2 ! videoconvert
! autovideosink --gst-debug=2

From the debug messages I found that mmap fails when using BGR format and
dmabuf.

I suspected the size of data to mmap. In case of BGR it was 2.7 MB to mmap
and in case of YUY2 it was 1.8 MB for one frame buffer.
So I hardcorded the BGR size to 1.8 MB just before doing mmap. Then mmap did
not throw any errors but obviously pipeline broke at some other point since
it will make data invalid.

Can someone help me on this issue? I want to build a pipeline with BGR
format as output from v4l2src and it should use dmabuf as io-mode.

Re: Why gstreamer pipeline fails when using v4l2src format as BGR and io-mode as dmabuf?

I am using gstreamer version 1.8.3 on ubunutu 16.04 LTS.
I am trying to run a pipeline using gst-launch-1.0 with the following
command on terminal.(which streams webcam video in my laptop)
Command:
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=BGR ! videoconvert
! autovideosink --gst-debug=2

Packed BGR 24bit is a libv4l2 emulated format. It is rarely supported by HW. DmABuf can only be used with HW supported formats.

But the same pipeline works if I change the format=YUY2.
Working Command:
gst-launch-1.0 -v v4l2src io-mode=4 ! video/x-raw,format=YUY2 ! videoconvert
! autovideosink --gst-debug=2

From the debug messages I found that mmap fails when using BGR format and
dmabuf.

I suspected the size of data to mmap. In case of BGR it was 2.7 MB to mmap
and in case of YUY2 it was 1.8 MB for one frame buffer.
So I hardcorded the BGR size to 1.8 MB just before doing mmap. Then mmap did
not throw any errors but obviously pipeline broke at some other point since
it will make data invalid.

Can someone help me on this issue? I want to build a pipeline with BGR
format as output from v4l2src and it should use dmabuf as io-mode.