screen scroll issue and mxc_v4l_dqueue timeout error on imx6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

screen scroll issue and mxc_v4l_dqueue timeout error on imx6

1,461 Views
majamassarini
Contributor I

We are using TW9900 on our board with iMX6 (based on L4.1.15_1.2.0_ga).
Driver for TW9900 was developed starting from code found in adv7180.c.
We have screen scroll issue as well explained in this application note: i.MX6_IPU_TVIN_Application_Notes.pdf but we can't apply the suggested patches since our kernel is 4 and not 3.
In our application we are using gstreamer and when we detect a scroll issue we restart the gstreamer process; this is a bad solution in many ways and we would like to improve it.


We would like to solve the scroll issue at driver level, maybe you have patches for the latest kernel?

Another good option to us would be change the gstreamer pipeline status from PLAYING to PAUSE (instead of restarting the all process); but when pausing gstreamer we got an error from the driver which stops gstreamer from working properly.

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

We have read suggestions in the linked application note on dqueue errors but it seems to us that none of them applies in our environment.
One more strange thing is that we can pause a gstreamer pipeline like the following one (others too):

# imxv4l2videosrc ! imxipuvideotransform deinterlace=1 ! imxg2dvideosink framebuffer=/dev/fb1

But we can't pause the gstreamer pipeline we really need:

# imxv4l2videosrc ! tee name=t t. ! queue ! imxipuvideotransform deinterlace=1 ! imxg2dvideosink framebuffer=/dev/fb1 t. ! queue ! videorate ! video/x-raw,framerate=15/1 ! imxipuvideotransform deinterlace=1 ! video/x-raw,width=320,height=240 ! videoscale method=1 ! video/x-raw ! v4l2sink device=/dev/video1

The gstreamer debug error is (and the driver error is... ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0)

ERROR imxv4l2bufferpool v4l2_buffer_pool.c:247:gst_imx_v4l2_buffer_pool_acquire_buffer:<imxv4l2bufferpool0> VIDIOC_DQBUF failed: Timer expired
WARN basesrc gstbasesrc.c:2950:gst_base_src_loop:<imxv4l2videosrc0> error: Internal data stream error.
WARN basesrc gstbasesrc.c:2950:gst_base_src_loop:<imxv4l2videosrc0> error: streaming stopped, reason error (-5)

I hope you can suggest us a way to address one of those issue.

Thanks,

Maja

Labels (3)
0 Kudos
3 Replies

1,029 Views
majamassarini
Contributor I

In the hope to be useful to someone else I share with you patch and pipe that goes around the problem explained above.

The working pipe is the following:

"imxv4l2videosrc fps-n=15 ! video/x-raw,format=(string)UYVY,width=720,heigth=576,interlace-mode=interleaved ! tee name=t t. !  queue max-size-buffers=2 flush-on-eos=true ! imxipuvideotransform deinterlace=1 ! imxg2dvideosink framebuffer=/dev/fb1 t. !  queue max-size-buffers=2 flush-on-eos=true ! imxipuvideotransform ! video/x-raw,format=(string)I420,interlace-mode=interleaved ! videorate ! video/x-raw, framerate=15/1 ! v4l2sink device=/dev/video1"

To make this pipe work I wrote the following patch (it's not a fix but a workaround to a bug)

diff -Naur gstreamer-imx-0.12.3-a/src/v4l2src/v4l2src.c gstreamer-imx-0.12.3-b/src/v4l2src/v4l2src.c
--- gstreamer-imx-0.12.3-a/src/v4l2src/v4l2src.c 2016-11-14 11:56:14.000000000 +0100
+++ gstreamer-imx-0.12.3-b/src/v4l2src/v4l2src.c 2018-03-13 10:35:59.047733450 +0100
@@ -262,7 +262,7 @@
available_format_caps = gst_caps_from_string("video/x-raw, format = { UYVY, I420 }");
allowed_src_caps = gst_pad_get_allowed_caps(GST_BASE_SRC_PAD(v4l2src));

- /* Apply intersection to get caps with a valid pixelformat */
+ // Apply intersection to get caps with a valid pixelformat
allowed_format_caps = gst_caps_intersect(allowed_src_caps, available_format_caps);
GST_DEBUG_OBJECT(v4l2src, "allowed src caps: %" GST_PTR_FORMAT " -> allowed formats: %" GST_PTR_FORMAT, (gpointer)allowed_src_caps, (gpointer)allowed_format_caps);

@@ -470,13 +470,19 @@
struct v4l2_format fmt;

fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+/*
if (ioctl(GST_IMX_FD_OBJECT_GET_FD(v4l2src->fd_obj_v4l), VIDIOC_G_FMT, &fmt) < 0)
{
GST_ERROR_OBJECT(v4l2src, "VIDIOC_G_FMT failed: %s", strerror(errno));
return NULL;
}
+*/

- /* switch/case table taken from gst-plugins-good/sys/v4l2/gstv4l2object.c */
+ GST_DEBUG_OBJECT(v4l2src, "mm -- caps_for_current_setup, forcing pixelformat at UYVY (interleaved)");
+ gst_fmt = GST_VIDEO_FORMAT_UYVY;
+
+/*
+ // switch/case table taken from gst-plugins-good/sys/v4l2/gstv4l2object.c
switch (fmt.fmt.pix.pixelformat)
{
case V4L2_PIX_FMT_GREY:
@@ -592,9 +598,12 @@
default:
gst_fmt = gst_video_format_from_fourcc(fmt.fmt.pix.pixelformat);
}
+*/

pixel_format = gst_video_format_to_string(gst_fmt);

+ interlace_mode = "interleaved";
+/*
if (v4l2src->is_tvin && !fmt.fmt.pix.field)
{
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
@@ -612,6 +621,7 @@
default:
interlace_mode = "progressive";
}
+*/

return gst_caps_new_simple("video/x-raw",
"format", G_TYPE_STRING, pixel_format,

When I made this pipe work I wrote a new pipe using h264. There were a lot of errors solved by a patch like the one above:

Pipe:

"imxv4l2videosrc fps-n=25 ! video/x-raw,format=(string)UYVY,width=720,heigth=576,interlace-mode=interleaved ! tee name=t t. ! queue max-size-buffers=2 flush-on-eos=true ! imxipuvideotransform ! imxg2dvideosink framebuffer=/dev/fb1 t. ! queue max-size-buffers=2 flush-on-eos=true ! videorate ! video/x-raw,format=(string)UYVY,width=720,heigth=576,interlace-mode=interleaved,framerate=25/1 ! imxipuvideotransform ! video/x-raw,format=(string)I420,interlace-mode=interleaved,framerate=25/1,width=720,height=576 ! imxvpuenc_h264 quant-param=30 idr-interval=10 ! video/x-h264, stream-format=byte-stream, alignment=au, framerate=25/1 ! tee name=tt tt. ! queue max-size-buffers=2 flush-on-eos=true ! h264parse ! rtph264pay config-interval=1 ! udpsink host=172.20.35.183 port=5000 tt. ! v4l2sink device=/dev/video1"

Patch:

diff -Naur gst-plugins-good-1.10.2-a/sys/v4l2/gstv4l2sink.c gst-plugins-good-1.10.2-b/sys/v4l2/gstv4l2sink.c
--- gst-plugins-good-1.10.2-a/sys/v4l2/gstv4l2sink.c 2016-11-04 18:07:09.000000000 +0100
+++ gst-plugins-good-1.10.2-b/sys/v4l2/gstv4l2sink.c 2018-03-14 11:25:35.263027778 +0100
@@ -487,7 +487,27 @@
}


- return gst_v4l2_object_get_caps (v4l2sink->v4l2object, filter);
+ //return gst_v4l2_object_get_caps (v4l2sink->v4l2object, filter);
+
+
+ GstCaps *caps;
+
+ GST_INFO_OBJECT(v4l2sink, "get caps filter %" GST_PTR_FORMAT, (gpointer)filter);
+
+ caps = gst_caps_from_string(
+ "video/x-raw"
+ ", format = (string) { UYVY, I420 }"
+ ", width = (gint) [ 16, MAX ]"
+ ", height = (gint) [ 16, MAX ]"
+ ", interlace-mode = (string) { progressive, interleaved }"
+ ", framerate = (fraction) [ 0/1, 100/1 ]"
+ ", pixel-aspect-ratio = (fraction) [ 0/1, 100/1 ]"
+ ";"
+ );
+
+ GST_INFO_OBJECT(v4l2sink, "get caps %" GST_PTR_FORMAT, (gpointer)caps);
+
+ return caps;
}

static gboolean

0 Kudos

1,029 Views
majamassarini
Contributor I

We will try and we let you know, thanks!

0 Kudos

1,029 Views
igorpadykov
NXP Employee
NXP Employee

Hi Maja

seems used plugins are gstreamer-imx plugins, supported on community

meta-freescale Info Page 

Also one can try with nxp gstreamer plugins imx-gst described in attached

Linux Guide sect.7 Multimedia. Difference between both options are described in

Yocto/gstreamer – Gateworks 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos