On Tue, Apr 09, 2024 at 11:24:56PM +0200, Michael Grzeschik wrote:
This patch series is improving the size calculation and allocation of the uvc requests. Using the currenlty setup frame duration of the stream it is possible to calculate the number of requests based on the interval length.
The basic concept here is right. But unfortunatly we found out that together with Patch [1] and the current zero length request pump mechanism [2] and [3] this is not working as expected. The conclusion that we can not queue more than one frame at once into the hw led to [1]. The current implementation of zero length reqeusts which will be queued while we are waiting for the frame to finish transferring will enlarge the frame duration. Since every zero-length request is still taking up at least one frame interval of 125 us. This longer frameduration of each enqueued will therefor decrease the absolut framerate. Therefor to properly make those patches work, we will have to get rid of the zero length pump mechanism again and make sure that the whole business logic of what to be queued and when will only be done in the pump worker. It is possible to let the dwc3 udc run dry, as we are actively waiting for the frame to finish, the last request in the prepared and started list will stop the current dwc3 stream and therfor no underruns will occur with the next ep_queue. Also keeping the prepared list and doing the preparation in any case of the pump worker is still a good point we need to keep. With all these pending patches the whole uvc saga of underruns and flickering videostreams should come to an end™. I already started with this but would be happy to see Avichal and others to review the patches when they are ready in my eyes. mgr [1] https://lore.kernel.org/all/20240324-uvc-gadget-errorcheck-v1-1-5538c57bbeba@xxxxxxxxxxxxxx/ [2] https://lore.kernel.org/all/99384044-0d14-4ebe-9109-8a5557e64449@xxxxxxxxxx/ [3] https://lore.kernel.org/all/20230508231103.1621375-1-arakesh@xxxxxxxxxx/
Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> --- Michael Grzeschik (3): usb: gadget: function: 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 drivers/usb/gadget/function/uvc.h | 1 + drivers/usb/gadget/function/uvc_queue.c | 30 ++++++++++++++----- drivers/usb/gadget/function/uvc_v4l2.c | 52 +++++++++++++++++++++++++++++++++ drivers/usb/gadget/function/uvc_video.c | 17 ++--------- 4 files changed, 79 insertions(+), 21 deletions(-) --- base-commit: 3295f1b866bfbcabd625511968e8a5c541f9ab32 change-id: 20240403-uvc_request_length_by_interval-a7efd587d963 Best regards, -- Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
-- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Attachment:
signature.asc
Description: PGP signature