[1/1] media: uvcvideo: Mark buffer error where overflow
diff mbox series

Message ID 20191025163012.18225-2-kai.heng.feng@canonical.com
State New
Headers show
Series
  • [1/1] media: uvcvideo: Mark buffer error where overflow
Related show

Commit Message

Kai-Heng Feng Oct. 25, 2019, 4:30 p.m. UTC
From: Baoyou Xie <baoyou.xie@linaro.org>

BugLink: https://bugs.launchpad.net/bugs/1849871

Some cameras post inaccurate frame where next frame data overlap
it. this results in screen flicker, and it need to be prevented.

So this patch marks the buffer error to discard the frame where
buffer overflow.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit dfc1648c576719b5a2701805aab1e208789d5969)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/media/usb/uvc/uvc_video.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Connor Kuehl Oct. 31, 2019, 10:57 p.m. UTC | #1
On 10/25/19 9:30 AM, Kai-Heng Feng wrote:
> From: Baoyou Xie <baoyou.xie@linaro.org>
> 
> BugLink: https://bugs.launchpad.net/bugs/1849871
> 
> Some cameras post inaccurate frame where next frame data overlap
> it. this results in screen flicker, and it need to be prevented.
> 
> So this patch marks the buffer error to discard the frame where
> buffer overflow.
> 
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> (cherry picked from commit dfc1648c576719b5a2701805aab1e208789d5969)
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Acked-by: Connor Kuehl <connor.kuehl@canonical.com>

> ---
>   drivers/media/usb/uvc/uvc_video.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 31d428c6bd20..924974125714 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1089,6 +1089,7 @@ static void uvc_video_decode_data(struct uvc_streaming *stream,
>   	/* Complete the current frame if the buffer size was exceeded. */
>   	if (len > maxlen) {
>   		uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
> +		buf->error = 1;
>   		buf->state = UVC_BUF_STATE_READY;
>   	}
>   }
>
Stefan Bader Nov. 7, 2019, 4:30 p.m. UTC | #2
On 25.10.19 18:30, Kai-Heng Feng wrote:
> From: Baoyou Xie <baoyou.xie@linaro.org>
> 
> BugLink: https://bugs.launchpad.net/bugs/1849871
> 
> Some cameras post inaccurate frame where next frame data overlap
> it. this results in screen flicker, and it need to be prevented.
> 
> So this patch marks the buffer error to discard the frame where
> buffer overflow.
> 
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> (cherry picked from commit dfc1648c576719b5a2701805aab1e208789d5969)
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  drivers/media/usb/uvc/uvc_video.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 31d428c6bd20..924974125714 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1089,6 +1089,7 @@ static void uvc_video_decode_data(struct uvc_streaming *stream,
>  	/* Complete the current frame if the buffer size was exceeded. */
>  	if (len > maxlen) {
>  		uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
> +		buf->error = 1;
>  		buf->state = UVC_BUF_STATE_READY;
>  	}
>  }
>

Patch
diff mbox series

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 31d428c6bd20..924974125714 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1089,6 +1089,7 @@  static void uvc_video_decode_data(struct uvc_streaming *stream,
 	/* Complete the current frame if the buffer size was exceeded. */
 	if (len > maxlen) {
 		uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
+		buf->error = 1;
 		buf->state = UVC_BUF_STATE_READY;
 	}
 }