From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Daniel Scally <dan.scally@ideasonboard.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Avichal Rakesh <arakesh@google.com>,
Jayant Chowdhary <jchowdhary@google.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de,
Michael Grzeschik <m.grzeschik@pengutronix.de>
Subject: [PATCH v7 7/9] usb: gadget: uvc: set nbuffers to minimum STREAMING_MIN_BUFFERS in uvc_queue_setup
Date: Wed, 16 Oct 2024 15:58:12 +0200 [thread overview]
Message-ID: <20240403-uvc_request_length_by_interval-v7-7-e224bb1035f0@pengutronix.de> (raw)
In-Reply-To: <20240403-uvc_request_length_by_interval-v7-0-e224bb1035f0@pengutronix.de>
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>
---
v5 -> v7: -
v4 -> v5:
- using STREAMING_MIN_BUFFERS set the min nbuffers
- renamed the patch since the function changed
- removed the g_ctrl function
- reordered this patch in the series
v1 -> v4: -
---
drivers/usb/gadget/function/uvc.h | 2 ++
drivers/usb/gadget/function/uvc_queue.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/function/uvc.h
index bedb4ef42864f..6f44dd7323150 100644
--- a/drivers/usb/gadget/function/uvc.h
+++ b/drivers/usb/gadget/function/uvc.h
@@ -74,6 +74,8 @@ extern unsigned int uvc_gadget_trace_param;
#define UVCG_REQ_MAX_INT_COUNT 16
#define UVCG_REQ_MAX_ZERO_COUNT (2 * UVCG_REQ_MAX_INT_COUNT)
+#define UVCG_STREAMING_MIN_BUFFERS 2
+
/* ------------------------------------------------------------------------
* Structures
*/
diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c
index 6757a4e25a743..5eaeae3e2441c 100644
--- a/drivers/usb/gadget/function/uvc_queue.c
+++ b/drivers/usb/gadget/function/uvc_queue.c
@@ -21,6 +21,7 @@
#include <media/videobuf2-vmalloc.h>
#include "uvc.h"
+#include "uvc_video.h"
/* ------------------------------------------------------------------------
* Video buffers queue management.
@@ -47,6 +48,8 @@ static int uvc_queue_setup(struct vb2_queue *vq,
if (*nbuffers > UVC_MAX_VIDEO_BUFFERS)
*nbuffers = UVC_MAX_VIDEO_BUFFERS;
+ if (*nbuffers < UVCG_STREAMING_MIN_BUFFERS)
+ *nbuffers = UVCG_STREAMING_MIN_BUFFERS;
*nplanes = 1;
--
2.39.5
next prev parent reply other threads:[~2024-10-16 13:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 13:58 [PATCH v7 0/9] usb: gadget: uvc: effectively fill the udc isoc pipeline with available video buffers and fixes Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 1/9] usb: gadget: uvc: wake pump everytime we update the free list Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 2/9] usb: gadget: uvc: only enqueue zero length requests in potential underrun Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 3/9] usb: gadget: uvc: rework to enqueue in pump worker from encoded queue Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 4/9] usb: gadget: uvc: add g_parm and s_parm for frame interval Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 5/9] usb: gadget: uvc: set req_size and n_requests based on the " Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 6/9] usb: gadget: uvc: set req_length based on payload by nreqs instead of req_size Michael Grzeschik
2024-10-16 13:58 ` Michael Grzeschik [this message]
2024-10-16 13:58 ` [PATCH v7 8/9] usb: gadget: uvc: add trace of enqueued and completed requests Michael Grzeschik
2024-10-16 13:58 ` [PATCH v7 9/9] usb: gadget: uvc: dont call usb_composite_setup_continue when not streaming Michael Grzeschik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240403-uvc_request_length_by_interval-v7-7-e224bb1035f0@pengutronix.de \
--to=m.grzeschik@pengutronix.de \
--cc=arakesh@google.com \
--cc=dan.scally@ideasonboard.com \
--cc=gregkh@linuxfoundation.org \
--cc=jchowdhary@google.com \
--cc=kernel@pengutronix.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®