1. 16 Jun, 2024 3 commits
    • Ricardo Ribalda's avatar
      media: uvcvideo: Quirk for invalid dev_sof in Logitech C922 · 9183c6f1
      Ricardo Ribalda authored
      Logitech C922 internal SOF does not increases at a stable rate of 1kHz.
      This causes that the device_sof and the host_sof run at different rates,
      breaking the clock domain conversion algorithm. Eg:
      
      30 (6) [-] none 30 614400 B 21.245557 21.395214 34.133 fps ts mono/SoE
      31 (7) [-] none 31 614400 B 21.275327 21.427246 33.591 fps ts mono/SoE
      32 (0) [-] none 32 614400 B 21.304739 21.459256 34.000 fps ts mono/SoE
      33 (1) [-] none 33 614400 B 21.334324 21.495274 33.801 fps ts mono/SoE
      * 34 (2) [-] none 34 614400 B 21.529237 21.527297 5.130 fps ts mono/SoE
      * 35 (3) [-] none 35 614400 B 21.649416 21.559306 8.321 fps ts mono/SoE
      36 (4) [-] none 36 614400 B 21.678789 21.595320 34.045 fps ts mono/SoE
      ...
      99 (3) [-] none 99 614400 B 23.542226 23.696352 33.541 fps ts mono/SoE
      100 (4) [-] none 100 614400 B 23.571578 23.728404 34.069 fps ts mono/SoE
      101 (5) [-] none 101 614400 B 23.601425 23.760420 33.504 fps ts mono/SoE
      * 102 (6) [-] none 102 614400 B 23.798324 23.796428 5.079 fps ts mono/SoE
      * 103 (7) [-] none 103 614400 B 23.916271 23.828450 8.478 fps ts mono/SoE
      104 (0) [-] none 104 614400 B 23.945720 23.860479 33.957 fps ts mono/SoE
      
      Instead of disabling completely the hardware timestamping for such
      hardware we take the assumption that the packet handling jitter is
      under 2ms and use the host_sof as dev_sof.
      
      We can think of the UVC hardware clock as a system with a coarse clock
      (the SOF) and a fine clock (the PTS). The coarse clock can be replaced
      with a clock on the same frequency, if the jitter of such clock is
      smaller than its sampling rate. That way we can save some of the
      precision of the fine clock.
      
      To probe this point we have run three experiments on the Logitech C922.
      On that experiment we run the camera at 33fps and we analyse the
      difference in msec between a frame and its predecessor. If we display
      the histogram of that value, a thinner histogram will mean a better
      meassurement. The results for:
      - original hw timestamp: https://ibb.co/D1HJJ4x
      - pure software timestamp: https://ibb.co/QC9MgVK
      - modified hw timestamp: https://ibb.co/8s9dBdk
      
      This bug in the camera firmware has been confirmed by the vendor.
      
      lsusb -v
      
      Bus 001 Device 044: ID 046d:085c Logitech, Inc. C922 Pro Stream Webcam
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass          239 Miscellaneous Device
        bDeviceSubClass         2
        bDeviceProtocol         1 Interface Association
        bMaxPacketSize0        64
        idVendor           0x046d Logitech, Inc.
        idProduct          0x085c C922 Pro Stream Webcam
        bcdDevice            0.16
        iManufacturer           0
        iProduct                2 C922 Pro Stream Webcam
        iSerial                 1 80B912DF
        bNumConfigurations      1
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Signed-off-by: default avatarOleksandr Natalenko <oleksandr@natalenko.name>
      Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
      Link: https://lore.kernel.org/r/20240323-resend-hwtimestamp-v10-3-b08e590d97c7@chromium.orgSigned-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      9183c6f1
    • Ricardo Ribalda's avatar
      media: uvcvideo: Ignore empty TS packets · 5cd7c25f
      Ricardo Ribalda authored
      Some SunplusIT cameras took a borderline interpretation of the UVC 1.5
      standard, and fill the PTS and SCR fields with invalid data if the
      package does not contain data.
      
      "STC must be captured when the first video data of a video frame is put
      on the USB bus."
      
      Some SunplusIT devices send, e.g.,
      
      buffer: 0xa7755c00 len 000012 header:0x8c stc 00000000 sof 0000 pts 00000000
      buffer: 0xa7755c00 len 000012 header:0x8c stc 00000000 sof 0000 pts 00000000
      buffer: 0xa7755c00 len 000668 header:0x8c stc 73779dba sof 070c pts 7376d37a
      
      While the UVC specification meant that the first two packets shouldn't
      have had the SCR bit set in the header.
      
      This borderline/buggy interpretation has been implemented in a variety
      of devices, from directly SunplusIT and from other OEMs that rebrand
      SunplusIT products. So quirking based on VID:PID will be problematic.
      
      All the affected modules have the following extension unit:
      VideoControl Interface Descriptor:
        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d221d}
      
      But the vendor plans to use that GUID in the future and fix the bug,
      this means that we should use heuristic to figure out the broken
      packets.
      
      This patch takes care of this.
      
      lsusb of one of the affected cameras:
      
      Bus 001 Device 003: ID 1bcf:2a01 Sunplus Innovation Technology Inc.
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.01
        bDeviceClass          239 Miscellaneous Device
        bDeviceSubClass         2 ?
        bDeviceProtocol         1 Interface Association
        bMaxPacketSize0        64
        idVendor           0x1bcf Sunplus Innovation Technology Inc.
        idProduct          0x2a01
        bcdDevice            0.02
        iManufacturer           1 SunplusIT Inc
        iProduct                2 HanChen Wise Camera
        iSerial                 3 01.00.00
        bNumConfigurations      1
      Tested-by: default avatarHungNien Chen <hn.chen@sunplusit.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
      Link: https://lore.kernel.org/r/20240323-resend-hwtimestamp-v10-2-b08e590d97c7@chromium.orgSigned-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      5cd7c25f
    • Ricardo Ribalda's avatar
      media: uvcvideo: Support timestamp lists of any size · a0df8d94
      Ricardo Ribalda authored
      The tail of the list lives at the position before the head. This is
      mathematically noted as:
      ```
      (head-1) mod size.
      ```
      Unfortunately C, does not have a modulus operator, but a remainder
      operator (%).
      The reminder operation has a different result than the modulus if
      (head -1) is a negative number and size is not a power of two.
      
      Adding size to (head-1) allows the code to run with any value of size.
      
      This does not change the current behaviour of the driver, as the size is
      always a power of two, but avoid tedious debugging if we ever change its
      size.
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Link: https://lore.kernel.org/r/20240323-resend-hwtimestamp-v10-1-b08e590d97c7@chromium.orgSigned-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      a0df8d94
  2. 15 Jun, 2024 24 commits
  3. 14 Jun, 2024 1 commit
  4. 13 Jun, 2024 2 commits
  5. 10 Jun, 2024 8 commits
  6. 09 Jun, 2024 2 commits
    • Linus Torvalds's avatar
      Linux 6.10-rc3 · 83a7eefe
      Linus Torvalds authored
      83a7eefe
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v6.10-2-2024-06-09' of... · b8481381
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v6.10-2-2024-06-09' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Update copies of kernel headers, which resulted in support for the
         new 'mseal' syscall, SUBVOL statx return mask bit, RISC-V and PPC
         prctls, fcntl's DUPFD_QUERY, POSTED_MSI_NOTIFICATION IRQ vector,
         'map_shadow_stack' syscall for x86-32.
      
       - Revert perf.data record memory allocation optimization that ended up
         causing a regression, work is being done to re-introduce it in the
         next merge window.
      
       - Fix handling of minimal vmlinux.h file used with BPF's CO-RE when
         interrupting the build.
      
      * tag 'perf-tools-fixes-for-v6.10-2-2024-06-09' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
        perf bpf: Fix handling of minimal vmlinux.h file when interrupting the build
        Revert "perf record: Reduce memory for recording PERF_RECORD_LOST_SAMPLES event"
        tools headers arm64: Sync arm64's cputype.h with the kernel sources
        tools headers uapi: Sync linux/stat.h with the kernel sources to pick STATX_SUBVOL
        tools headers UAPI: Update i915_drm.h with the kernel sources
        tools headers UAPI: Sync kvm headers with the kernel sources
        tools arch x86: Sync the msr-index.h copy with the kernel sources
        tools headers: Update the syscall tables and unistd.h, mostly to support the new 'mseal' syscall
        perf trace beauty: Update the arch/x86/include/asm/irq_vectors.h copy with the kernel sources to pick POSTED_MSI_NOTIFICATION
        perf beauty: Update copy of linux/socket.h with the kernel sources
        tools headers UAPI: Sync fcntl.h with the kernel sources to pick F_DUPFD_QUERY
        tools headers UAPI: Sync linux/prctl.h with the kernel sources
        tools include UAPI: Sync linux/stat.h with the kernel sources
      b8481381