[libcamera-devel] Are camera sensor drivers required to support VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl?

Andrey Konovalov andrey.konovalov at linaro.org
Thu Oct 17 12:34:45 CEST 2019


Hi,

(The current) libcamera wouldn't work with sensors which don't support VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl:
1) to "enumerate all media bus codes and frame sizes supported by the subdevice on a pad",
    V4L2Subdevice::formats() calls V4L2Subdevice::enumPadSizes()
2) V4L2Subdevice::enumPadSizes() calls ioctl(VIDIOC_SUBDEV_ENUM_FRAME_SIZE, &sizeEnum), and the sensor driver
    which doesn't implement the enum_frame_size entry in v4l2_subdev_pad_ops returns -EINVAL for the very first pad.
3) V4L2Subdevice::enumPadSizes() returns the empty vector of the sizes supported by the pad w/o logging any error.
4) V4L2Subdevice::formats() sees sizes.empty()==TRUE, and returns the empty list of the formats supported by the sensor.

Many camera sensor drivers don't support VIDIOC_SUBDEV_ENUM_FRAME_SIZE, but do implement
VIDIOC_SUBDEV_[G,S]_FMT(which=V4L2_SUBDEV_FORMAT_TRY). The recently submitted to lkml drivers included.

What is the right way to fix that?
Add VIDIOC_SUBDEV_ENUM_FRAME_SIZE to all the sensor drivers?
Or extend libcamera's V4L2Subdevice::enumPadSizes() to use the VIDIOC_SUBDEV_[G,S]_FMT(which=V4L2_SUBDEV_FORMAT_TRY)
  to find out the sizes supported by the sensor when VIDIOC_SUBDEV_ENUM_FRAME_SIZE is not implemented?
(Or maybe the both?)

Thanks,
Andrey


More information about the libcamera-devel mailing list