Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: uvc: set nbuffers to minimum STREAMING_MIN_BUFFERS in uvc_queue_setup

We set the minimum amount of v4l2 buffers that is possibly be pending
to UVCG_STREAMING_MIN_BUFFERS which is two. This way the driver will
always have at least one frame pending to be encoded while the other
is being enqueued in the hardware.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v7-7-e224bb1035f0@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Michael Grzeschik and committed by
Greg Kroah-Hartman
1dc2527c 98ad0329

+5
+2
drivers/usb/gadget/function/uvc.h
··· 74 74 #define UVCG_REQ_MAX_INT_COUNT 16 75 75 #define UVCG_REQ_MAX_ZERO_COUNT (2 * UVCG_REQ_MAX_INT_COUNT) 76 76 77 + #define UVCG_STREAMING_MIN_BUFFERS 2 78 + 77 79 /* ------------------------------------------------------------------------ 78 80 * Structures 79 81 */
+3
drivers/usb/gadget/function/uvc_queue.c
··· 21 21 #include <media/videobuf2-vmalloc.h> 22 22 23 23 #include "uvc.h" 24 + #include "uvc_video.h" 24 25 25 26 /* ------------------------------------------------------------------------ 26 27 * Video buffers queue management. ··· 48 47 49 48 if (*nbuffers > UVC_MAX_VIDEO_BUFFERS) 50 49 *nbuffers = UVC_MAX_VIDEO_BUFFERS; 50 + if (*nbuffers < UVCG_STREAMING_MIN_BUFFERS) 51 + *nbuffers = UVCG_STREAMING_MIN_BUFFERS; 51 52 52 53 *nplanes = 1; 53 54