summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/function/uvc_queue.h
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2021-06-28 17:53:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-27 15:59:19 +0200
commite81e7f9a0eb9536d5976acf5d95290338032a198 (patch)
treeb6b77525a913fa96cc5271252257439647637bda /drivers/usb/gadget/function/uvc_queue.h
parentb9b82d3d0dbc45ee6b4817c7a7275a65152301f5 (diff)
usb: gadget: uvc: add scatter gather support
This patch adds support for scatter gather transfers. If the underlying gadgets sg_supported == true, then the videeobuf2-dma-sg is used and the encode routine maps all scatter entries to separate scatterlists for the usb gadget. When streaming 1080p with request size of 1024 times 3 bytes top shows a difference of about 6.4% CPU load applying this patch: PID USER PR NI VIRT RES %CPU %MEM TIME+ S COMMAND 64 root 0 -20 0.0m 0.0m 7.7 0.0 0:01.25 I [kworker/u5:0-uvcvideo] 83 root 0 -20 0.0m 0.0m 4.5 0.0 0:03.71 I [kworker/u5:3-uvcvideo] 307 root -51 0 0.0m 0.0m 3.8 0.0 0:01.05 S [irq/51-dwc3] vs. 64 root 0 -20 0.0m 0.0m 5.8 0.0 0:01.79 I [kworker/u5:0-uvcvideo] 306 root -51 0 0.0m 0.0m 3.2 0.0 0:01.97 S [irq/51-dwc3] 82 root 0 -20 0.0m 0.0m 0.6 0.0 0:01.86 I [kworker/u5:1-uvcvideo] Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Link: https://lore.kernel.org/r/20210628155311.16762-5-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/uvc_queue.h')
-rw-r--r--drivers/usb/gadget/function/uvc_queue.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/uvc_queue.h b/drivers/usb/gadget/function/uvc_queue.h
index 2f0fff769843..05360a0767f6 100644
--- a/drivers/usb/gadget/function/uvc_queue.h
+++ b/drivers/usb/gadget/function/uvc_queue.h
@@ -34,6 +34,9 @@ struct uvc_buffer {
enum uvc_buffer_state state;
void *mem;
+ struct sg_table *sgt;
+ struct scatterlist *sg;
+ unsigned int offset;
unsigned int length;
unsigned int bytesused;
};
@@ -50,6 +53,8 @@ struct uvc_video_queue {
unsigned int buf_used;
+ bool use_sg;
+
spinlock_t irqlock; /* Protects flags and irqqueue */
struct list_head irqqueue;
};
@@ -59,7 +64,7 @@ static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
return vb2_is_streaming(&queue->queue);
}
-int uvcg_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
+int uvcg_queue_init(struct uvc_video_queue *queue, struct device *dev, enum v4l2_buf_type type,
struct mutex *lock);
void uvcg_free_buffers(struct uvc_video_queue *queue);