From 3bcfe786ba9ff87fe8e3c1972164660cb8c1d293 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Apr 19 2024 11:29:34 +0000 Subject: usb: gadget: uvc: mark incomplete frames with UVC_STREAM_ERR (stable-fixes). --- diff --git a/patches.suse/usb-gadget-uvc-mark-incomplete-frames-with-UVC_STREA.patch b/patches.suse/usb-gadget-uvc-mark-incomplete-frames-with-UVC_STREA.patch new file mode 100644 index 0000000..88b8b38 --- /dev/null +++ b/patches.suse/usb-gadget-uvc-mark-incomplete-frames-with-UVC_STREA.patch @@ -0,0 +1,39 @@ +From 2a3b7af120477d0571b815ccb8600cafd5ebf02f Mon Sep 17 00:00:00 2001 +From: Michael Grzeschik +Date: Wed, 14 Feb 2024 00:37:55 +0100 +Subject: [PATCH] usb: gadget: uvc: mark incomplete frames with UVC_STREAM_ERR +Git-commit: 2a3b7af120477d0571b815ccb8600cafd5ebf02f +Patch-mainline: v6.9-rc1 +References: stable-fixes + +If an frame was transmitted incomplete to the host, we set the +UVC_STREAM_ERR bit in the header for the last request that is going +to be queued. This way the host will know that it should drop the +frame instead of trying to display the corrupted content. + +Signed-off-by: Michael Grzeschik +Link: https://lore.kernel.org/r/20240214-uvc-error-tag-v1-2-37659a3877fe@pengutronix.de +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/usb/gadget/function/uvc_video.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c +index d677d7daa187..d41f5f31dadd 100644 +--- a/drivers/usb/gadget/function/uvc_video.c ++++ b/drivers/usb/gadget/function/uvc_video.c +@@ -35,6 +35,9 @@ uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf, + + data[1] = UVC_STREAM_EOH | video->fid; + ++ if (video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) ++ data[1] |= UVC_STREAM_ERR; ++ + if (video->queue.buf_used == 0 && ts.tv_sec) { + /* dwClockFrequency is 48 MHz */ + u32 pts = ((u64)ts.tv_sec * USEC_PER_SEC + ts.tv_nsec / NSEC_PER_USEC) * 48; +-- +2.43.0 + diff --git a/series.conf b/series.conf index 80c2f0b..b91c8aa 100644 --- a/series.conf +++ b/series.conf @@ -20400,6 +20400,7 @@ patches.suse/xhci-remove-unnecessary-event_ring_deq-parameter-fro.patch patches.suse/xhci-update-event-ring-dequeue-pointer-position-to-c.patch patches.suse/xhci-add-helper-that-checks-for-unhandled-events-on-.patch + patches.suse/usb-gadget-uvc-mark-incomplete-frames-with-UVC_STREA.patch patches.suse/usb-typec-ucsi-Update-connector-cap-and-status.patch patches.suse/usb-xhci-Add-error-handling-in-xhci_map_urb_for_dma.patch patches.suse/usb-typec-ucsi-Clean-up-UCSI_CABLE_PROP-macros.patch