Hello,
On i.MX8 the V4L2 driver dqueue used
static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking)
and if application used blocking mode,data not fill in dqueue buffer it will blocking
ret = wait_event_interruptible(q->done_wq, !list_empty(&q->done_list) || !q->streaming || q->error);
But On i.MX6 the V4L2 driver is
static int mxc_v4l_dqueue(cam_data *cam, struct v4l2_buffer *buf)
It blocking mode has system timeout,when time out it will return,application will not blocking
if (!wait_event_interruptible_timeout(cam->enc_queue, cam->enc_counter != 0, 10 * HZ)) { pr_err("ERROR: v4l2 capture: mxc_v4l_dqueue timeout " "enc_counter %x\n", cam->enc_counter); return -ETIME;
I want to ask does i.MX8 V4L2 dqueue driver can use func wait_event_interruptible_timeout?
add timeout in blocking mode make application not block.
If can pls give patch to modify.
Thanks
Is anyone can help?
what bsp version do you use? try to use the latset version, it seems that latest version fixed this issue already
I used imx-yocto-L4.14.98_2.3.0
which version fixed it?pls give the opensource link
Thanks
I mean 5.4.47_2.2.0
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_5.4.47_2.2.0
Hello,
I found in 5.4.47_2.2.0 also used
wait_event_interruptible
May I modify in my BSP like this:
/* ret = wait_event_interruptible(q->done_wq,
!list_empty(&q->done_list) || !q->streaming ||
q->error); */
ret = wait_event_interruptible_timeout(q->done_wq,
!list_empty(&q->done_list) || !q->streaming ||
q->error, 5 * HZ);
/*
* We need to reevaluate both conditions again after reacquiring
* the locks or return an error if one occurred.
*/
call_void_qop(q, wait_finish, q);
if (!ret) {
dprintk(1, "sleep was interrupted\n");
return -ETIME;
}
/* if (ret) {
dprintk(1, "sleep was interrupted\n");
return ret;
} */
Is there any side effect?
Thanks
have you tested your code? do you mean if you didn't add these code, you found the code would stuck and without any return? as I known, you will get warning if the timeout exists
If the code is wait_event_interruptible there will stuck and without any return,
if the code is wait_event_interruptible_timeout when timeout there will return
I checked the source code, wait_event_interruptible will return the value, and tell the queue, it will wait until get signal and condition to true, and the function will check the return value and wait it, and wait_event_interruptible_timeout is has time limitation,it seems the driver here wants to sleep until wake_up, if you change from wait_event_interruptible to wait_event_interruptible_timeout, maybe will broke the process, I'm not sure of this and don't find any one do this
"https://source.codeaurora.org/external/imx/linux-imx/tree/include/linux/wait.h?h=imx_5.4.47_2.2.0"
I don't think that adding these code can fix the root issue, how could I reproduce this on nxp board? as I known the latest bsp fix warn: wait_event_interruptible_timeout issue, but I don't know what root issue you have
on i.MX8QM or i.MX8QXP mek board
you can used unit test image capture demo app on NXP mek board test,when you start capture camera image then pull out the camera,at this time no image data thansfer,the capture app will hung can not stop normally
pls send the file link to me