media: vivid: Extend FPS rates offered by simulated webcam
authorMax Staudt <mstaudt@chromium.org>
Fri, 14 Apr 2023 07:24:19 +0000 (16:24 +0900)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 25 May 2023 14:21:20 +0000 (16:21 +0200)
commitf0b4a2c037c0ab1affdf0937aee84314ab9c4fee
tree4c9938db0c5b8f9e7f86d7561ca8319474eae321
parente1d2ccc2cdd6333584aa3d5386dc667d0837c48f
media: vivid: Extend FPS rates offered by simulated webcam

This adds an option for higher frame rates from a simulated webcam.

Currently, vivid emulates (amongst other things) a webcam with somewhat
limited bandwidth - higher resolutions deliver fewer frames per second.

$ yavta --enum-formats -c /dev/video0
Device /dev/video0 opened.
Device `vivid' on `platform:vivid-000' (driver 'vivid') supports video, capture, without mplanes.
- Available formats:
Format 0: YUYV (56595559)
Type: Video capture (1)
Name: YUYV 4:2:2
Frame size: 320x180 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30, 1/40, 1/50, 1/60)
Frame size: 640x360 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30, 1/40)
Frame size: 640x480 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25)
Frame size: 1280x720 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25)
Frame size: 1920x1080 (1/1, 1/2, 1/4, 1/5)
Frame size: 3840x2160 (1/1, 1/2)

In some test cases, it is useful to allow for higher frame rates, as
configurations such as 720p@30 FPS have become commonplace now.

This patch allows:
   0- 719p - 120fps
 720-1079p - 60fps
1080-2159p - 30fps
     2160p - 15fps

$ yavta --enum-formats -c /dev/video0
Device /dev/video0 opened.
Device `vivid' on `platform:vivid-000' (driver 'vivid') supports video, capture, without mplanes.
- Available formats:
Format 0: YUYV (56595559)
Type: Video capture (1)
Name: YUYV 4:2:2
Frame size: 320x180 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30, 1/40, 1/50, 1/60, 1/120)
Frame size: 640x360 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30, 1/40, 1/50, 1/60, 1/120)
Frame size: 640x480 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30, 1/40, 1/50, 1/60, 1/120)
Frame size: 1280x720 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30, 1/40, 1/50, 1/60)
Frame size: 1920x1080 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15, 1/25, 1/30)
Frame size: 3840x2160 (1/1, 1/2, 1/4, 1/5, 1/10, 2/25, 1/15)

Passes: v4l2-compliance 1.25.0-5039 from v4l-utils git ccc08732823f

Signed-off-by: Max Staudt <mstaudt@chromium.org>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: unsigned -> unsigned int]
drivers/media/test-drivers/vivid/vivid-vid-cap.c