Re: usb video capture issue due to uvc_complete callback spends more time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 28, 2013 at 03:23:46PM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Thu, Mar 28, 2013 at 08:53:03PM +0800, Ming Lei wrote:
> > On Thu, Mar 28, 2013 at 8:30 PM, B, Ravi <ravibabu@xxxxxx> wrote:
> > >
> > > For example, in one iteration I have observed, the time taken by
> > > uvc_video_decode_isoc() was 2175 usec. In this maximum amount of
> > > time was consumed by uvc_video_decode_data() around 1792 usec.
> > 
> > uvc_video_decode_data() is basically a memcpy() from coherent buffer to
> > normal buffer.
> 
> if that's the case, this should show, right ?
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 3394c34..fdba0b7 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1490,12 +1490,7 @@ static int uvc_init_video_isoc(struct uvc_streaming *stream,
>  		urb->context = stream;
>  		urb->pipe = usb_rcvisocpipe(stream->dev->udev,
>  				ep->desc.bEndpointAddress);
> -#ifndef CONFIG_DMA_NONCOHERENT
> -		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
> -		urb->transfer_dma = stream->urb_dma[i];
> -#else
>  		urb->transfer_flags = URB_ISO_ASAP;
> -#endif
>  		urb->interval = ep->desc.bInterval;
>  		urb->transfer_buffer = stream->urb_buffer[i];
>  		urb->complete = uvc_video_complete;
> @@ -1555,10 +1550,6 @@ static int uvc_init_video_bulk(struct uvc_streaming *stream,
>  		usb_fill_bulk_urb(urb, stream->dev->udev, pipe,
>  			stream->urb_buffer[i], size, uvc_video_complete,
>  			stream);
> -#ifndef CONFIG_DMA_NONCOHERENT
> -		urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
> -		urb->transfer_dma = stream->urb_dma[i];
> -#endif
>  
>  		stream->urb[i] = urb;
>  	}

actually this is more correct I guess:

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 3394c34..5c0e3a6 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1387,14 +1387,8 @@ static int uvc_alloc_urb_buffers(struct uvc_streaming *stream,
 	for (; npackets > 1; npackets /= 2) {
 		for (i = 0; i < UVC_URBS; ++i) {
 			stream->urb_size = psize * npackets;
-#ifndef CONFIG_DMA_NONCOHERENT
-			stream->urb_buffer[i] = usb_alloc_coherent(
-				stream->dev->udev, stream->urb_size,
-				gfp_flags | __GFP_NOWARN, &stream->urb_dma[i]);
-#else
 			stream->urb_buffer[i] =
 			    kmalloc(stream->urb_size, gfp_flags | __GFP_NOWARN);
-#endif
 			if (!stream->urb_buffer[i]) {
 				uvc_free_urb_buffers(stream);
 				break;
@@ -1490,12 +1484,7 @@ static int uvc_init_video_isoc(struct uvc_streaming *stream,
 		urb->context = stream;
 		urb->pipe = usb_rcvisocpipe(stream->dev->udev,
 				ep->desc.bEndpointAddress);
-#ifndef CONFIG_DMA_NONCOHERENT
-		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
-		urb->transfer_dma = stream->urb_dma[i];
-#else
 		urb->transfer_flags = URB_ISO_ASAP;
-#endif
 		urb->interval = ep->desc.bInterval;
 		urb->transfer_buffer = stream->urb_buffer[i];
 		urb->complete = uvc_video_complete;
@@ -1555,10 +1544,6 @@ static int uvc_init_video_bulk(struct uvc_streaming *stream,
 		usb_fill_bulk_urb(urb, stream->dev->udev, pipe,
 			stream->urb_buffer[i], size, uvc_video_complete,
 			stream);
-#ifndef CONFIG_DMA_NONCOHERENT
-		urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
-		urb->transfer_dma = stream->urb_dma[i];
-#endif
 
 		stream->urb[i] = urb;
 	}

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux