* Re: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
@ 2026-11-22 23:58 Bob Summerwill
0 siblings, 0 replies; 3+ messages in thread
From: Bob Summerwill @ 2026-11-22 23:58 UTC (permalink / raw)
To: fernandezfernandezpol
Cc: laurent.pinchart, linux-kernel, linux-media, linux-usb
Hi,
Field confirmation of this series' diagnosis from a stock, unpatched
kernel, in case it is useful when considering the patches.
Device: Logitech HD Pro Webcam C920, 046d:08e5, bcdDevice 0.21,
directly connected on USB 2.0 (no hub).
Kernel: 7.2.15 (Arch "linux-omarchy" build). The camera has no
device-table entry here, so it rides the generic UVC catch-all and
uvc_no_drop_param is at its default of 1 (deliver error frames).
Behaviour matches the commit message exactly: intermittent gray
bands over the picture in applications using strict JPEG decoding.
Setting the module parameter nodrop=0 -- the global equivalent of
this series' UVC_QUIRK_DROP_STREAM_ERR -- makes the artifacts
disappear entirely. With it in place, 300-frame MJPEG captures at
both 1280x720 and 1920x1080 sustain ~27 fps, with per-frame mean
luminance stable to within 1/255 across the burst. The camera has
been in daily use since, artifact-free.
To be explicit: this is confirmation of the failure mode and of the
workaround on the affected hardware, not a Tested-by for the series
itself -- I have not built these patches. I am happy to do a real
out-of-tree build against 7.2.15 and follow up with a proper
Tested-by if that would help the series along.
Bob Summerwill
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] media: uvcvideo: add quirks for per-device stream error handling
@ 2026-06-29 16:38 Pol Fernández Fernández
2026-06-29 16:38 ` [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Pol Fernández Fernández
0 siblings, 1 reply; 3+ messages in thread
From: Pol Fernández Fernández @ 2026-06-29 16:38 UTC (permalink / raw)
To: linux-media
Cc: laurent.pinchart, linux-usb, linux-kernel,
Pol Fernández Fernández
The UVC_STREAM_ERR bit in the payload header signals that the device
could not deliver a frame correctly. By default, uvcvideo delivers
these frames to userspace with V4L2_BUF_FLAG_ERROR when uvc_no_drop_param
is set (the default). Applications that rely on strict JPEG decoders
(e.g. libjpeg) will display gray bands for the incomplete portion of
the image, since libjpeg fills undecodable MCU rows with a neutral gray
when the EOI marker is missing.
Add UVC_QUIRK_DROP_STREAM_ERR to force-drop frames flagged with
UVC_STREAM_ERR for specific devices, regardless of the uvc_no_drop_param
module parameter. This ensures applications never receive truncated frames
from devices known to set UVC_STREAM_ERR on genuine encoding errors.
The existing uvc_queue_to_stream() helper is used to reach the device
quirks from within uvc_queue_buffer_complete().
Additionally, uvcvideo unconditionally overrides the camera's probed
wCompQuality with the maximum value returned by GET_MAX. For devices
whose firmware treats wCompQuality=0 as an adaptive encoding mode (where
the encoder adjusts quality dynamically to fit within the available USB
bandwidth), this override increases encoding pressure and can contribute
to UVC_STREAM_ERR events. Add UVC_QUIRK_NO_FORCE_QUALITY to preserve
the camera's default quality value during probe negotiation.
Signed-off-by: Pol Fernández Fernández <fernandezfernandezpol@gmail.com>
---
drivers/media/usb/uvc/uvc_queue.c | 3 ++-
drivers/media/usb/uvc/uvc_video.c | 3 ++-
drivers/media/usb/uvc/uvcvideo.h | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index XXXXXXX..XXXXXXX 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -81,6 +81,8 @@
#define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000
#define UVC_QUIRK_MJPEG_NO_EOF 0x00020000
#define UVC_QUIRK_MSXU_META 0x00040000
+#define UVC_QUIRK_DROP_STREAM_ERR 0x00080000
+#define UVC_QUIRK_NO_FORCE_QUALITY 0x00100000
/* Format flags */
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -451,7 +451,8 @@ int uvc_probe_video(struct uvc_streaming *stream,
if (ret < 0)
goto done;
- probe->wCompQuality = probe_max.wCompQuality;
+ if (!(stream->dev->quirks & UVC_QUIRK_NO_FORCE_QUALITY))
+ probe->wCompQuality = probe_max.wCompQuality;
}
for (i = 0; i < 2; ++i) {
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -357,7 +357,8 @@ static void uvc_queue_buffer_complete(struct kref *ref)
struct vb2_buffer *vb = &buf->buf.vb2_buf;
struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue);
- if (buf->error && !uvc_no_drop_param) {
+ if (buf->error && (!uvc_no_drop_param ||
+ (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
uvc_queue_buffer_requeue(queue, buf);
return;
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
2026-06-29 16:38 [PATCH 1/2] media: uvcvideo: add quirks for per-device stream error handling Pol Fernández Fernández
@ 2026-06-29 16:38 ` Pol Fernández Fernández
2026-08-16 5:20 ` kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: Pol Fernández Fernández @ 2026-06-29 16:38 UTC (permalink / raw)
To: linux-media
Cc: laurent.pinchart, linux-usb, linux-kernel,
Pol Fernández Fernández
The Logitech HD Pro Webcam C920 variant with USB ID 046d:08e5 is not
present in the device ID table and is matched only by the generic UVC
catch-all entry, receiving no device-specific quirks.
This device intermittently sends MJPEG frames at 1920x1080/30fps
without the EOI (0xFF 0xD9) End of Image marker, correctly signaling
the incomplete frame via UVC_STREAM_ERR in the UVC payload header.
Applications using strict JPEG decoders (libjpeg) display the corrupted
portion as a gray band covering the remainder of the frame. The issue
does not occur on Windows.
Two contributing factors were identified:
1. The C920 (08e5) operates at the USB 2.0 High Speed isochronous
ceiling (wMaxPacketSize = 3x1024 = 3072 bytes, altsetting 11).
The camera firmware has an intermittent bug where it occasionally
fails to finalize a JPEG frame and signals this correctly via
UVC_STREAM_ERR. No USB-level isochronous packet failures were
observed (iso_frame_desc.status was always 0).
2. uvcvideo forces wCompQuality to the maximum value returned by
GET_MAX during probe negotiation (61 for this device, on a
firmware-specific scale). The camera's default value from GET_CUR
is 0, which this firmware uses to indicate adaptive encoding mode.
Forcing maximum quality increases encoder pressure and raises the
frequency of UVC_STREAM_ERR events.
Add a device table entry with:
- UVC_QUIRK_RESTORE_CTRLS_ON_INIT and UVC_QUIRK_INVALID_DEVICE_SOF,
consistent with the existing entry for the related 046d:082d variant
of the same camera family.
- UVC_QUIRK_NO_FORCE_QUALITY to preserve wCompQuality=0 (adaptive
mode) during probe negotiation rather than overriding it with the
maximum value.
- UVC_QUIRK_DROP_STREAM_ERR to ensure frames flagged with
UVC_STREAM_ERR are silently dropped rather than delivered to
userspace as truncated JPEG data.
Tested on Linux 7.0.0 at 1920x1080 MJPEG 30fps. With this fix, 0
truncated frames were observed in 300-frame capture sequences
(previously 1-2% of frames were affected).
Signed-off-by: Pol Fernández Fernández <fernandezfernandezpol@gmail.com>
---
drivers/media/usb/uvc/uvc_driver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2729,6 +2729,18 @@
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_INFO_QUIRK(UVC_QUIRK_NO_RESET_RESUME) },
+ /* Logitech HD Pro Webcam C920 (variant 08e5) */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x046d,
+ .idProduct = 0x08e5,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 0,
+ .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_RESTORE_CTRLS_ON_INIT
+ | UVC_QUIRK_INVALID_DEVICE_SOF
+ | UVC_QUIRK_NO_FORCE_QUALITY
+ | UVC_QUIRK_DROP_STREAM_ERR) },
/* Chicony CNF7129 (Asus EEE 100HE) */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
2026-06-29 16:38 ` [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Pol Fernández Fernández
@ 2026-08-16 5:20 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-08-16 5:20 UTC (permalink / raw)
To: Pol Fernández Fernández, linux-media
Cc: oe-kbuild-all, laurent.pinchart, linux-usb, linux-kernel,
Pol Fernández Fernández
Hi Pol,
kernel test robot noticed the following build errors:
[auto build test ERROR on linuxtv-media-pending/master]
[also build test ERROR on media-tree/master sailus-media-tree/master linus/master v7.2-rc7 next-20260721]
[cannot apply to sailus-media-tree/streams]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pol-Fern-ndez-Fern-ndez/media-uvcvideo-add-device-entry-for-Logitech-C920-046d-08e5/20260814-213320
base: https://git.linuxtv.org/media-ci/media-pending.git master
patch link: https://lore.kernel.org/r/20260629163805.37879-2-fernandezfernandezpol%40gmail.com
patch subject: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260816/202608160712.l89JPkSj-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260816/202608160712.l89JPkSj-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608160712.l89JPkSj-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/media/usb/uvc/uvc_queue.c: In function 'uvc_queue_buffer_complete':
>> drivers/media/usb/uvc/uvc_queue.c:360:14: error: implicit declaration of function 'uvc_queue_to_stream'; did you mean 'uvc_queue_streaming'? [-Wimplicit-function-declaration]
360 | (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
| ^~~~~~~~~~~~~~~~~~~
| uvc_queue_streaming
>> drivers/media/usb/uvc/uvc_queue.c:360:40: error: invalid type argument of '->' (have 'int')
360 | (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
| ^~
vim +360 drivers/media/usb/uvc/uvc_queue.c
352
353 static void uvc_queue_buffer_complete(struct kref *ref)
354 {
355 struct uvc_buffer *buf = container_of(ref, struct uvc_buffer, ref);
356 struct vb2_buffer *vb = &buf->buf.vb2_buf;
357 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue);
358
359 if (buf->error && (!uvc_no_drop_param ||
> 360 (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
361 uvc_queue_buffer_requeue(queue, buf);
362 return;
363 }
364
365 buf->state = buf->error ? UVC_BUF_STATE_ERROR : UVC_BUF_STATE_DONE;
366 vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused);
367 vb2_buffer_done(&buf->buf.vb2_buf, buf->error ? VB2_BUF_STATE_ERROR :
368 VB2_BUF_STATE_DONE);
369 }
370
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-22 23:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 23:58 [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Bob Summerwill
-- strict thread matches above, loose matches on Subject: below --
2026-06-29 16:38 [PATCH 1/2] media: uvcvideo: add quirks for per-device stream error handling Pol Fernández Fernández
2026-06-29 16:38 ` [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Pol Fernández Fernández
2026-08-16 5:20 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox