forked from Minki/linux
usb: gadget: uvc: increase worker prio to WQ_HIGHPRI
This patch is changing the simple workqueue in the gadget driver to be allocated as async_wq with a higher priority. The pump worker, that is filling the usb requests, will have a higher priority and will not be scheduled away so often while the video stream is handled. This will lead to fewer streaming underruns. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Link: https://lore.kernel.org/r/20220907215818.2670097-1-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d818320ea2
commit
9b91a65230
@ -897,10 +897,14 @@ static void uvc_function_unbind(struct usb_configuration *c,
|
||||
{
|
||||
struct usb_composite_dev *cdev = c->cdev;
|
||||
struct uvc_device *uvc = to_uvc(f);
|
||||
struct uvc_video *video = &uvc->video;
|
||||
long wait_ret = 1;
|
||||
|
||||
uvcg_info(f, "%s()\n", __func__);
|
||||
|
||||
if (video->async_wq)
|
||||
destroy_workqueue(video->async_wq);
|
||||
|
||||
/*
|
||||
* If we know we're connected via v4l2, then there should be a cleanup
|
||||
* of the device from userspace either via UVC_EVENT_DISCONNECT or
|
||||
|
@ -88,6 +88,7 @@ struct uvc_video {
|
||||
struct usb_ep *ep;
|
||||
|
||||
struct work_struct pump;
|
||||
struct workqueue_struct *async_wq;
|
||||
|
||||
/* Frame parameters */
|
||||
u8 bpp;
|
||||
|
@ -170,7 +170,7 @@ uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
|
||||
return ret;
|
||||
|
||||
if (uvc->state == UVC_STATE_STREAMING)
|
||||
schedule_work(&video->pump);
|
||||
queue_work(video->async_wq, &video->pump);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
|
||||
spin_unlock_irqrestore(&video->req_lock, flags);
|
||||
|
||||
if (uvc->state == UVC_STATE_STREAMING)
|
||||
schedule_work(&video->pump);
|
||||
queue_work(video->async_wq, &video->pump);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -485,7 +485,7 @@ int uvcg_video_enable(struct uvc_video *video, int enable)
|
||||
|
||||
video->req_int_count = 0;
|
||||
|
||||
schedule_work(&video->pump);
|
||||
queue_work(video->async_wq, &video->pump);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -499,6 +499,11 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
|
||||
spin_lock_init(&video->req_lock);
|
||||
INIT_WORK(&video->pump, uvcg_video_pump);
|
||||
|
||||
/* Allocate a work queue for asynchronous video pump handler. */
|
||||
video->async_wq = alloc_workqueue("uvcgadget", WQ_UNBOUND | WQ_HIGHPRI, 0);
|
||||
if (!video->async_wq)
|
||||
return -EINVAL;
|
||||
|
||||
video->uvc = uvc;
|
||||
video->fcc = V4L2_PIX_FMT_YUYV;
|
||||
video->bpp = 16;
|
||||
|
Loading…
Reference in New Issue
Block a user