linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: uvc: Don't recompute frame size unnecessarily
@ 2019-12-18 20:48 Laurent Pinchart
  2020-01-22 10:11 ` Kieran Bingham
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2019-12-18 20:48 UTC (permalink / raw)
  To: linux-media; +Cc: Sergey Zakharchenko

uvc_fixup_video_ctrl() needs the frame size for bandwidth calculation,
which it computes from the frame width, height and bpp. The same
calculation is done earlier and the resulting value is stored in
dwMaxVideoFrameBufferSize. Reuse it instead of recomputing it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/usb/uvc/uvc_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 8fa77a81dd7f..a269aeaa9ecc 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -178,7 +178,7 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
 		 * high-speed devices) per second and add the UVC header size
 		 * (assumed to be 12 bytes long).
 		 */
-		bandwidth = frame->wWidth * frame->wHeight / 8 * format->bpp;
+		bandwidth = frame->dwMaxVideoFrameBufferSize;
 		bandwidth *= 10000000 / interval + 1;
 		bandwidth /= 1000;
 		if (stream->dev->udev->speed == USB_SPEED_HIGH)
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-22 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 20:48 [PATCH] media: uvc: Don't recompute frame size unnecessarily Laurent Pinchart
2020-01-22 10:11 ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).