[libcamera-devel] PinePhone needs S_FRAME_INTERVAL

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Jul 5 00:28:56 CEST 2022


Hi Pavel,

On Tue, Jul 05, 2022 at 12:15:49AM +0200, Pavel Machek wrote:
> Hi!
> 
> It looks I solved another mystery: Top resolution was not available,
> and depending on order of commands, sometimes 1280x720 was not
> available, either.
> 
> So I took a look into megapixels, and mystery solved -- libcamera is
> not setting frame intervals at all.
> 
> AFAICT that needs to happen. PinePhone needs lower fps for top
> resolution, but an use high fps for lower resolutions...
> 
> This is obviosly a hack, but we need something like that.

VIDIOC_SUBDEV_S_FRAME_INTERVAL is deprecated for camera sensors and
should never have been used. Frame rates are controlled through the
pixel clock and the horizontal and vertical blanking values. If a sensor
driver requires VIDIOC_SUBDEV_S_FRAME_INTERVAL, then it should be fixed.

> commit 66616c78007c08fcd3fde66888c2210a392b184e
> Author: Pavel Machek <pavel at ucw.cz>
> Date:   Mon Jul 4 23:54:22 2022 +0200
> 
>     S_FRAME_INTERVAL is needed, or things don't work.
> 
> index fba90e20..0ee6ac30 100644
> --- a/src/libcamera/v4l2_subdevice.cpp
> +++ b/src/libcamera/v4l2_subdevice.cpp
> @@ -452,6 +452,21 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format,
>  			     Whence whence)
>  {
>  	struct v4l2_subdev_format subdevFmt = {};
> +
> +	{
> +	  struct v4l2_subdev_frame_interval interval = {};
> +                interval.pad = 0;
> +                interval.interval.numerator = 1;
> +                interval.interval.denominator = 10;
> +                if (int ret = ioctl(VIDIOC_SUBDEV_S_FRAME_INTERVAL,
> +                           &interval) == -1) {
> +			LOG(V4L2, Error)
> +			  << "Unable to set frame interval on pad " << pad
> +			  << ": " << strerror(-ret);
> +                        return ret;
> +                }
> +
> +	}
>  	subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE
>  			: V4L2_SUBDEV_FORMAT_TRY;
>  	subdevFmt.pad = pad;
> 

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list