i.MX6_IPU_TVIN_Application_Notes patch cause problem in QT application
According to “i.MX6_IPU_TVIN_Application_Notes” document I changed Linux kernel (4.1.36) in order to have capability of resync the video stream when vertical sync is lost but some problems appeared. I run declarative-camera which is one of QT examples, also I set environment variables QT_GSTREAMER_CAMERABIN_VIDEOSRC to imxv4l2src and QT_GSTREAMER_CAMERABIN_VIDEOSINK to imxipuvideosink the below errors generated when video vsync lost by a noise or unplug and plug the video connector:
** CRITICAL **: gst_audio_format_from_string: assertion 'format != NULL' failed
ERROR: v4l2 capture: slave not found!
Unable to query the parameter info: QCameraImageProcessingControl::WhiteBalancePreset : "Invalid argument"
Unable to query the parameter info: QCameraImageProcessingControl::ColorTemperature : "Invalid argument"
Unable to query the parameter info: QCameraImageProcessingControl::ContrastAdjustment : "Invalid argument"
Unable to query the parameter info: QCameraImageProcessingControl::SaturationAdjustment : "Invalid argument"
Unable to query the parameter info: QCameraImageProcessingControl::BrightnessAdjustment : "Invalid argument"
Unable to query the parameter info: QCameraImageProcessingControl::SharpeningAdjustment : "Invalid argument"
ERROR: v4l2 capture: unsupported ioctrl!
(Chopper:173): GStreamer-CRITICAL **: Registering meta implementation 'GstImxV4l2Meta' without init function
ERROR: v4l2 capture: mxc_streamon buffer need ping pong at least two buffers
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
CameraBin error: "Internal data stream error."
ERROR: v4l2 capture: unsupported ioctrl!
The main problem is “mxc_streamon buffer need ping pong at least two buffers” and the video freeze on screen but the QT application is alive and not crashed.
Instead of running QT declarative-camera If I use gstreamer command, like below:
gst-launch-1.0 imxv4l2videosrc ! imxipuvideosink
it works fine, even if I unplug and plug the video connector.
When I investigated this problem more carefully, I found that the problem comes from mxc_reset_stream function, list_for_each_entry(frame, &tmp_queue, queue) cause infinite loop and one of IMX6Q’s CPU cores reached to 100% which is natural due to infinite loop, instead when gstreamer used it just iterate 5 times or so and as I mentioned before it works fine.
So, I changed list_for_each_entry like below:
int index=0;
struct list_head *start = &tmp_queue;
struct list_head *ptr = start;
do
{
frame = list_entry(ptr, struct mxc_v4l_frame, queue);
frame->buffer.flags |= V4L2_BUF_FLAG_QUEUED;
ptr = ptr->next;
index++;
}while(ptr!= start && ptr!=NULL && ptr!= (ptr->next) );
After this modification infinite loop gone but after 3 times of vsync lost “cam->working_q” became 1 hence
mxc_streamon buffer need ping pong at least two buffers happen.
In case of using gstreamer, “cam->working_q” never be less than 2 and it works just fine.
Without this patch QT works fine like gstreamer but I had video scrolling.
Extra Info:
Linux : 4.1.36
QT: 5.9.2 or 5.11.1
I appreciate any help or clue to solve this problem
Yours,
Hi Ali
kernel 4.1.36 is not supported by nxp, one can try with linux from
official source.codeaurora.org/external/imx/linux-imx repository
Linux documentation
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Dear ,
Thanks for your reply, I have a look at suggested Linux kernel imx_4.14.98_2.0.0_ga ./drivers/media/platform/mxc/capture/mxc_v4l2_capture.c it seems that there is no mxc_stream_reset or any function in adv7180 which report lost of vsync lock.
Also I check all of files which is in ./drivers/media/platform/mxc/capture/ directory and check them to find differences with my linux kernel (4.1.36) it seems that imx_4.14.98_2.0.0_ga doesn't use "i.MX6_IPU_TVIN_Application_Notes" but it has a lot of differences between imx_4.14.98_2.0.0_ga and 4.1.36.
Are you sure that imx_4.14.98_2.0.0_ga solved the video scrolling issue?
Hi Ali Sarlak ,
The mxc_v4l2_capture.c has some special code for buffer map, it improves performance for IPU usage, but it is not common V4l2 capture driver. So when using QT, I think you need check the buffer use case.