From 124b7feb0eeff964978842322f0b1e6faab1f742 Mon Sep 17 00:00:00 2001 From: William Wu Date: Thu, 18 Jun 2020 18:26:35 +0800 Subject: [PATCH] usb: gadget: uvc: allow zero bytesused for rockchip uvc For rockchip platforms, the userspace uvc application use bytesused == 0 as a way to indicate that the data is all zero and unused. In that case, the uvc driver should use the allow_zero_bytesused flag to keep bytesused 0 rather than use the buf actual size instead. This can help to preview 1080P@MJPG faster. Change-Id: Ic4d561f18e85d759b5a2405db4f6fb48533e1781 Signed-off-by: William Wu --- drivers/usb/gadget/function/uvc_queue.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c index 9e33d5206d54..a404108c3e4f 100644 --- a/drivers/usb/gadget/function/uvc_queue.c +++ b/drivers/usb/gadget/function/uvc_queue.c @@ -124,6 +124,14 @@ int uvcg_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, queue->queue.mem_ops = &vb2_vmalloc_memops; queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC | V4L2_BUF_FLAG_TSTAMP_SRC_EOF; + /* + * For rockchip platform, the userspace uvc application + * use bytesused == 0 as a way to indicate that the data + * is all zero and unused. + */ +#ifdef CONFIG_ARCH_ROCKCHIP + queue->queue.allow_zero_bytesused = 1; +#endif ret = vb2_queue_init(&queue->queue); if (ret) return ret;