Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: uvcvideo: document UVC v1.5 ROI

Added documentation of V4L2_CID_UVC_REGION_OF_INTEREST_RECT and
V4L2_CID_UVC_REGION_OF_INTEREST_AUTO.

An example of a userspace implementing this feature can be found at:
https://chromium.googlesource.com/chromiumos/platform2/+/refs/heads/release-R121-15699.B/camera/hal/usb/

Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-17-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Yunke Cao and committed by
Hans Verkuil
7171c9cb 2dc768d7

+64
+64
Documentation/userspace-api/media/drivers/uvcvideo.rst
··· 181 181 UVC_CTRL_DATA_TYPE_BOOLEAN Boolean 182 182 UVC_CTRL_DATA_TYPE_ENUM Enumeration 183 183 UVC_CTRL_DATA_TYPE_BITMASK Bitmask 184 + UVC_CTRL_DATA_TYPE_RECT Rectangular area 184 185 185 186 186 187 UVCIOC_CTRL_QUERY - Query a UVC XU control ··· 256 255 __u8 query Request code to send to the device 257 256 __u16 size Control data size (in bytes) 258 257 __u8 *data Control value 258 + 259 + 260 + Driver-specific V4L2 controls 261 + ----------------------------- 262 + 263 + The uvcvideo driver implements the following UVC-specific controls: 264 + 265 + ``V4L2_CID_UVC_REGION_OF_INTEREST_RECT (struct)`` 266 + This control determines the region of interest (ROI). ROI is a 267 + rectangular area represented by a struct :c:type:`v4l2_rect`. The 268 + rectangle is in global sensor coordinates using pixel units. It is 269 + independent of the field of view, not impacted by any cropping or 270 + scaling. 271 + 272 + Use ``V4L2_CTRL_WHICH_MIN_VAL`` and ``V4L2_CTRL_WHICH_MAX_VAL`` to query 273 + the range of rectangle sizes. 274 + 275 + Setting a ROI allows the camera to optimize the capture for the region. 276 + The value of ``V4L2_CID_REGION_OF_INTEREST_AUTO`` control determines 277 + the detailed behavior. 278 + 279 + An example of use of this control, can be found in the: 280 + `Chrome OS USB camera HAL. 281 + <https://chromium.googlesource.com/chromiumos/platform2/+/refs/heads/release-R121-15699.B/camera/hal/usb/>` 282 + 283 + 284 + ``V4L2_CID_UVC_REGION_OF_INTEREST_AUTO (bitmask)`` 285 + This determines which, if any, on-board features should track to the 286 + Region of Interest specified by the current value of 287 + ``V4L2_CID_UVD__REGION_OF_INTEREST_RECT``. 288 + 289 + Max value is a mask indicating all supported Auto Controls. 290 + 291 + .. flat-table:: 292 + :header-rows: 0 293 + :stub-columns: 0 294 + 295 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_EXPOSURE`` 296 + - Setting this bit causes automatic exposure to track the region of 297 + interest instead of the whole image. 298 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_IRIS`` 299 + - Setting this bit causes automatic iris to track the region of interest 300 + instead of the whole image. 301 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_WHITE_BALANCE`` 302 + - Setting this bit causes automatic white balance to track the region 303 + of interest instead of the whole image. 304 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_FOCUS`` 305 + - Setting this bit causes automatic focus adjustment to track the region 306 + of interest instead of the whole image. 307 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_FACE_DETECT`` 308 + - Setting this bit causes automatic face detection to track the region of 309 + interest instead of the whole image. 310 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_DETECT_AND_TRACK`` 311 + - Setting this bit enables automatic face detection and tracking. The 312 + current value of ``V4L2_CID_REGION_OF_INTEREST_RECT`` may be updated by 313 + the driver. 314 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_IMAGE_STABILIZATION`` 315 + - Setting this bit enables automatic image stabilization. The 316 + current value of ``V4L2_CID_REGION_OF_INTEREST_RECT`` may be updated by 317 + the driver. 318 + * - ``V4L2_UVC_REGION_OF_INTEREST_AUTO_HIGHER_QUALITY`` 319 + - Setting this bit enables automatically capture the specified region 320 + with higher quality if possible.