V4L2 driver about dqueue buffer

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

V4L2 driver about dqueue buffer

2,417 Views
xu_ji1
Contributor V

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

Tags (1)
0 Kudos
13 Replies

2,410 Views
xu_ji1
Contributor V

Is anyone can help?

0 Kudos

2,399 Views
joanxie
NXP TechSupport
NXP TechSupport

what bsp version do you use? try to use the latset version, it seems that latest version fixed this issue already

0 Kudos

2,396 Views
xu_ji1
Contributor V

I used imx-yocto-L4.14.98_2.3.0

which version fixed it?pls give the opensource link

 

Thanks

0 Kudos

2,391 Views
joanxie
NXP TechSupport
NXP TechSupport
0 Kudos

2,386 Views
xu_ji1
Contributor V

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

0 Kudos

2,276 Views
joanxie
NXP TechSupport
NXP TechSupport

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

 

 

Tags (1)
0 Kudos

2,273 Views
xu_ji1
Contributor V

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

 

0 Kudos

2,176 Views
joanxie
NXP TechSupport
NXP TechSupport

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"

 

0 Kudos

2,219 Views
joanxie
NXP TechSupport
NXP TechSupport

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

 

0 Kudos

2,211 Views
xu_ji1
Contributor V

on i.MX8QM or i.MX8QXP mek board

0 Kudos

2,212 Views
xu_ji1
Contributor V

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

0 Kudos

2,368 Views
joanxie
NXP TechSupport
NXP TechSupport

pls send the file link to me

0 Kudos