[PATCH 1/2] libcamera: v4l2_videodevice: Fix devices which set both V4L2_CAP_VIDEO and V4L2_CAP_META
Sakari Ailus
sakari.ailus at linux.intel.com
Tue Apr 30 22:13:24 CEST 2024
Hi Hans,
Thanks for the patch.
On Tue, Apr 30, 2024 at 07:17:27PM +0200, Hans de Goede wrote:
> The /dev/video# nodes of the IPU6 driver set both V4L2_CAP_VIDEO_CAPTURE
> and V4L2_CAP_META_CAPTURE.
>
> This was resulting in V4L2VideoDevice::getFormat() / tryFormat() /
> setFormat() calling the metadata related ioctls instead of the videocap
> ioctls causing things to not work.
>
> Fix this by making V4L2Capability::isMeta() return false when the device
> also has one of the video capabilities.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
> include/libcamera/internal/v4l2_videodevice.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
> index d157a447..5816c18d 100644
> --- a/include/libcamera/internal/v4l2_videodevice.h
> +++ b/include/libcamera/internal/v4l2_videodevice.h
> @@ -92,6 +92,10 @@ struct V4L2Capability final : v4l2_capability {
> }
> bool isMeta() const
> {
> + /* Treat devs which combine video and meta as video not meta */
> + if (isVideo())
> + return false;
> +
> return device_caps() & (V4L2_CAP_META_CAPTURE |
> V4L2_CAP_META_OUTPUT);
> }
It looks like to me that some rework will be needed in determining the
buffer type for a video node. The current code assumes there is just one
and that it's directly derived from device capabilities. Unicam might be
the only CSI-2 receiver with metadata support for which this applies.
But I guess this is ok for now.
Reviewed-by: Sakari Ailus <sakari.ailus at linux.intel.com>
Cc Stanislaw, too.
--
Regards,
Sakari Ailus
More information about the libcamera-devel
mailing list