Message ID | 20240403-uvc_request_length_by_interval-v4-0-ca22f334226e@pengutronix.de (mailing list archive) |
---|---|
Headers | show |
Series | usb: gadget: uvc: effectively fill the udc isoc pipeline with available video buffers | expand |
On Tue, Aug 13, 2024 at 11:09:24AM +0200, Michael Grzeschik wrote: > This patch series is improving the size calculation and allocation of > the uvc requests. Using the selected frame duration of the stream it is > possible to calculate the number of requests based on the interval > length. > > It also precalculates the request length based on the actual per frame > size for compressed formats. > > For this calculations to work it was needed to rework the request > queueing by moving the encoding to one extra thread (in this case we > chose the qbuf) context. > > Next it was needed to move the actual request enqueueing to one extra > thread which is kept busy to fill the isoc queue in the udc. > > As a final step the series is increasing the minimum amount of > v4l2 buffers to 4 and allocates at least the amount of usb_requests > to store them in the usb gadgte isoc pipeline. > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > --- > Changes in v4: > - fixed exit path in uvc_enqueue_buffer on loop break > - Link to v3: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v3-0-4da7033dd488@pengutronix.de I just took v3 in my tree, should I drop them? thanks, greg k-h
On Tue, Aug 13, 2024 at 11:56:09AM +0200, Greg Kroah-Hartman wrote: > On Tue, Aug 13, 2024 at 11:09:24AM +0200, Michael Grzeschik wrote: > > This patch series is improving the size calculation and allocation of > > the uvc requests. Using the selected frame duration of the stream it is > > possible to calculate the number of requests based on the interval > > length. > > > > It also precalculates the request length based on the actual per frame > > size for compressed formats. > > > > For this calculations to work it was needed to rework the request > > queueing by moving the encoding to one extra thread (in this case we > > chose the qbuf) context. > > > > Next it was needed to move the actual request enqueueing to one extra > > thread which is kept busy to fill the isoc queue in the udc. > > > > As a final step the series is increasing the minimum amount of > > v4l2 buffers to 4 and allocates at least the amount of usb_requests > > to store them in the usb gadgte isoc pipeline. > > > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > > --- > > Changes in v4: > > - fixed exit path in uvc_enqueue_buffer on loop break > > - Link to v3: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v3-0-4da7033dd488@pengutronix.de > > I just took v3 in my tree, should I drop them? Oops, emails crossed. I'll go drop these now... greg k-h
This patch series is improving the size calculation and allocation of the uvc requests. Using the selected frame duration of the stream it is possible to calculate the number of requests based on the interval length. It also precalculates the request length based on the actual per frame size for compressed formats. For this calculations to work it was needed to rework the request queueing by moving the encoding to one extra thread (in this case we chose the qbuf) context. Next it was needed to move the actual request enqueueing to one extra thread which is kept busy to fill the isoc queue in the udc. As a final step the series is increasing the minimum amount of v4l2 buffers to 4 and allocates at least the amount of usb_requests to store them in the usb gadgte isoc pipeline. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> --- Changes in v4: - fixed exit path in uvc_enqueue_buffer on loop break - Link to v3: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v3-0-4da7033dd488@pengutronix.de Changes in v3: - Added more patches necessary to properly rework the request queueing - Link to v2: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v2-0-12690f7a2eff@pengutronix.de Changes in v2: - added header size into calculation of request size - Link to v1: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v1-0-9436c4716233@pengutronix.de --- Michael Grzeschik (10): usb: gadget: uvc: always set interrupt on zero length requests usb: gadget: uvc: only enqueue zero length requests in potential underrun usb: gadget: uvc: remove pump worker and enqueue all buffers per frame in qbuf usb: gadget: uvc: rework to enqueue in pump worker from encoded queue usb: gadget: uvc: remove uvc_video_ep_queue_initial_requests usb: gadget: uvc: set req_size once when the vb2 queue is calculated usb: gadget: uvc: add g_parm and s_parm for frame interval usb: gadget: uvc: set req_size and n_requests based on the frame interval usb: gadget: uvc: set req_length based on payload by nreqs instead of req_size usb: gadget: uvc: add min g_ctrl vidioc and set min buffs to 4 drivers/usb/gadget/function/f_uvc.c | 3 +- drivers/usb/gadget/function/uvc.h | 14 +- drivers/usb/gadget/function/uvc_queue.c | 52 +++++-- drivers/usb/gadget/function/uvc_queue.h | 1 + drivers/usb/gadget/function/uvc_v4l2.c | 67 ++++++++- drivers/usb/gadget/function/uvc_video.c | 243 +++++++++++++------------------- drivers/usb/gadget/function/uvc_video.h | 1 + 7 files changed, 221 insertions(+), 160 deletions(-) --- base-commit: 38343be0bf9a7d7ef0d160da5f2db887a0e29b62 change-id: 20240403-uvc_request_length_by_interval-a7efd587d963 Best regards,