usb: gadget: uvc_video: add worker to handle the frame pumping
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 usb: gadget: uvc_video: add worker to handle the frame pumping
This patch moves the function uvc_video_pump to be a separate schedule worker. This way the completion handler of each usb request and every direct caller of the pump has only to schedule the worker instead of doing the request handling by itself.
Moving the request handling to only one thread solves the locking problems between the three queueing cases.
Many drivers handle the completion handlers directly in their interrupt handlers. This patch also reduces the workload on each interrupt.
---
v1 -> v2: - only trigger the worker when in streaming state
drivers/usb/gadget/function/uvc.h | 2 + drivers/usb/gadget/function/uvc_v4l2.c | 5 +- drivers/usb/gadget/function/uvc_video.c | 78 +++++-------------------- drivers/usb/gadget/function/uvc_video.h | 2 - 4 files changed, 22 insertions(+), 65 deletions(-)
drivers/usb/gadget/function/uvc.h +2 -0
@@ -77,6 +77,8 @@ struct uvc_video {struct uvc_device *uvc;struct usb_ep *ep; +struct work_struct pump; +/* Frame parameters */ u8 bpp;u32 fcc;
drivers/usb/gadget/function/uvc_v4l2.c +4 -1
@@ -169,7 +169,10 @@ uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)if (ret <0 )return ret; -return uvcg_video_pump (video); +if (uvc->state ==UVC_STATE_STREAMING ) +schedule_work (&video->pump); + +return ret; } static int
drivers/usb/gadget/function/uvc_video.c +16 -62
150 lines not on this page · raw message
drivers/usb/gadget/function/uvc_video.h +0 -2
@@ -14,8 +14,6 @@struct uvc_video ; -int uvcg_video_pump (struct uvc_video *video); -int uvcg_video_enable (struct uvc_video *video,int enable);int uvcg_video_init (struct uvc_video *video,struct uvc_device *uvc);
Signature · 1 line
2.26.2