From patchwork Wed Apr 24 15:22:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 792201 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9CD115FA63 for ; Wed, 24 Apr 2024 15:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972162; cv=none; b=uxU1iZXTSVmkrn0T7rugwRjmZnsaWfFijJ9cFxMe79JUT3Yf5zFbQWhwX6H4hWDUbT+SPt6mxTaMl1Gjl6FhpNfdlJdaEIqCKdjHnRzkPZ0r0u7Or/30oD0AMh9f7dU7R3UbmM6lHaSkxKtDNgAjEjrv4kfXccnwtV7MJG9RGKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972162; c=relaxed/simple; bh=JvpVIbRcBVZazrqLdp24EqEeBTPEgfsJgeK5MM5z6Zw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rGFMiml792z+bVB8xpuKPKRKDILPTYT1JJPR2WyKXYopFmmmhC/pzQPDwkAfe8hkq++tTWL4Gr2BiFxCr0tNp7boKkqFEa6qpUrX6HsfjrGc8GjEClBprZS+f+TAJ4Iq8sa6q3TMgL9zOWnXaWVpieiQ4qVaLjskEoUBhkHbyrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=mCSebmxK; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mCSebmxK" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8153182A; Wed, 24 Apr 2024 17:21:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972106; bh=JvpVIbRcBVZazrqLdp24EqEeBTPEgfsJgeK5MM5z6Zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mCSebmxK5NwKiUI74heZni0L1UgLir38h5xkUZT1bWwJ0S94hPOOqz23HX+KMAcXW mOekVKCip+A4gCBm6+ugv1yAQkzohThNJCSar+YvN4+dEA/uQmhVAHpnu0yIWbrUrs vDpMDYmsfr6RML908qVnHcZhOtscz60Km1/gy5pc= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny Subject: [v4l-utils] [PATCH v2 1/7] v4l-utils: sync-with-kernel Date: Wed, 24 Apr 2024 18:22:24 +0300 Message-ID: <20240424152230.31923-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Update v4l-utils to the kernel headers coming from the Unicam v11 branch. Signed-off-by: Laurent Pinchart --- contrib/freebsd/include/linux/videodev2.h | 26 ++++++++++++++++++++++- contrib/test/ioctl_32.h | 4 ++-- contrib/test/ioctl_64.h | 4 ++-- include/linux/dvb/frontend.h | 2 +- include/linux/media-bus-format.h | 9 ++++++++ include/linux/v4l2-mediabus.h | 18 ++++++++++------ include/linux/v4l2-subdev.h | 13 +++++++++--- include/linux/videodev2.h | 26 ++++++++++++++++++++++- lib/include/libdvbv5/dvb-frontend.h | 2 +- utils/common/v4l2-pix-formats.h | 9 ++++++++ utils/v4l2-tracer/retrace-gen.cpp | 14 +++++++++++- utils/v4l2-tracer/trace-gen.cpp | 5 ++++- utils/v4l2-tracer/v4l2-tracer-info-gen.h | 3 +++ 13 files changed, 116 insertions(+), 19 deletions(-) diff --git a/contrib/freebsd/include/linux/videodev2.h b/contrib/freebsd/include/linux/videodev2.h index 4815944b0b8c..752035421389 100644 --- a/contrib/freebsd/include/linux/videodev2.h +++ b/contrib/freebsd/include/linux/videodev2.h @@ -606,6 +606,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW14 packed */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ @@ -846,6 +848,18 @@ struct v4l2_pix_format { #define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */ #define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */ +/* + * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when + * adding new ones! + */ +#define V4L2_META_FMT_GENERIC_8 v4l2_fourcc('M', 'E', 'T', '8') /* Generic 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_10 v4l2_fourcc('M', 'C', '1', 'A') /* 10-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_12 v4l2_fourcc('M', 'C', '1', 'C') /* 12-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_14 v4l2_fourcc('M', 'C', '1', 'E') /* 14-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_16 v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_20 v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_24 v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe @@ -876,6 +890,7 @@ struct v4l2_fmtdesc { #define V4L2_FMT_FLAG_CSC_YCBCR_ENC 0x0080 #define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_ENC #define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100 +#define V4L2_FMT_FLAG_META_LINE_BASED 0x0200 /* Frame Size and frame rate enumeration */ /* @@ -1824,7 +1839,7 @@ struct v4l2_ext_control { struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info; struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display; void *ptr; - }; + } __attribute__ ((packed)); } __attribute__ ((packed)); struct v4l2_ext_controls { @@ -2394,10 +2409,19 @@ struct v4l2_sdr_format { * struct v4l2_meta_format - metadata format definition * @dataformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data + * @width: number of data units of data per line (valid for line + * based formats only, see format documentation) + * @height: number of lines of data per buffer (valid for line based + * formats only) + * @bytesperline: offset between the beginnings of two adjacent lines in + * bytes (valid for line based formats only) */ struct v4l2_meta_format { uint32_t dataformat; uint32_t buffersize; + uint32_t width; + uint32_t height; + uint32_t bytesperline; } __attribute__ ((packed)); /** diff --git a/contrib/test/ioctl_32.h b/contrib/test/ioctl_32.h index 97f58676fce1..42997b76cf8d 100644 --- a/contrib/test/ioctl_32.h +++ b/contrib/test/ioctl_32.h @@ -103,7 +103,7 @@ #define CMD32_VIDIOC_SUBDEV_G_EDID 0xc0245628 #define CMD32_VIDIOC_SUBDEV_G_FMT 0xc0585604 #define CMD32_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615 -#define CMD32_VIDIOC_SUBDEV_G_ROUTING 0xc0285626 +#define CMD32_VIDIOC_SUBDEV_G_ROUTING 0xc0405626 #define CMD32_VIDIOC_SUBDEV_G_SELECTION 0xc040563d #define CMD32_VIDIOC_SUBDEV_G_STD 0x80085617 #define CMD32_VIDIOC_SUBDEV_QUERYCAP 0x80405600 @@ -115,7 +115,7 @@ #define CMD32_VIDIOC_SUBDEV_S_EDID 0xc0245629 #define CMD32_VIDIOC_SUBDEV_S_FMT 0xc0585605 #define CMD32_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616 -#define CMD32_VIDIOC_SUBDEV_S_ROUTING 0xc0285627 +#define CMD32_VIDIOC_SUBDEV_S_ROUTING 0xc0405627 #define CMD32_VIDIOC_SUBDEV_S_SELECTION 0xc040563e #define CMD32_VIDIOC_SUBDEV_S_STD 0x40085618 #define CMD32_VIDIOC_SUBSCRIBE_EVENT 0x4020565a diff --git a/contrib/test/ioctl_64.h b/contrib/test/ioctl_64.h index 2bad335dab60..8539622cf329 100644 --- a/contrib/test/ioctl_64.h +++ b/contrib/test/ioctl_64.h @@ -103,7 +103,7 @@ #define CMD64_VIDIOC_SUBDEV_G_EDID 0xc0285628 #define CMD64_VIDIOC_SUBDEV_G_FMT 0xc0585604 #define CMD64_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615 -#define CMD64_VIDIOC_SUBDEV_G_ROUTING 0xc0285626 +#define CMD64_VIDIOC_SUBDEV_G_ROUTING 0xc0405626 #define CMD64_VIDIOC_SUBDEV_G_SELECTION 0xc040563d #define CMD64_VIDIOC_SUBDEV_G_STD 0x80085617 #define CMD64_VIDIOC_SUBDEV_QUERYCAP 0x80405600 @@ -115,7 +115,7 @@ #define CMD64_VIDIOC_SUBDEV_S_EDID 0xc0285629 #define CMD64_VIDIOC_SUBDEV_S_FMT 0xc0585605 #define CMD64_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616 -#define CMD64_VIDIOC_SUBDEV_S_ROUTING 0xc0285627 +#define CMD64_VIDIOC_SUBDEV_S_ROUTING 0xc0405627 #define CMD64_VIDIOC_SUBDEV_S_SELECTION 0xc040563e #define CMD64_VIDIOC_SUBDEV_S_STD 0x40085618 #define CMD64_VIDIOC_SUBSCRIBE_EVENT 0x4020565a diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index 392171a7d651..844762889343 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h @@ -854,7 +854,7 @@ struct dtv_stats { union { __u64 uvalue; /* for counters and relative scales */ __s64 svalue; /* for 0.001 dB measures */ - }; + } __attribute__ ((packed)); } __attribute__ ((packed)); diff --git a/include/linux/media-bus-format.h b/include/linux/media-bus-format.h index f05f747e444d..d4c1d991014b 100644 --- a/include/linux/media-bus-format.h +++ b/include/linux/media-bus-format.h @@ -174,4 +174,13 @@ */ #define MEDIA_BUS_FMT_METADATA_FIXED 0x7001 +/* Generic line based metadata formats for serial buses. Next is 0x8008. */ +#define MEDIA_BUS_FMT_META_8 0x8001 +#define MEDIA_BUS_FMT_META_10 0x8002 +#define MEDIA_BUS_FMT_META_12 0x8003 +#define MEDIA_BUS_FMT_META_14 0x8004 +#define MEDIA_BUS_FMT_META_16 0x8005 +#define MEDIA_BUS_FMT_META_20 0x8006 +#define MEDIA_BUS_FMT_META_24 0x8007 + #endif /* __LINUX_MEDIA_BUS_FORMAT_H */ diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h index 2c318de10485..097ef73924f8 100644 --- a/include/linux/v4l2-mediabus.h +++ b/include/linux/v4l2-mediabus.h @@ -19,12 +19,18 @@ * @width: image width * @height: image height * @code: data format code (from enum v4l2_mbus_pixelcode) - * @field: used interlacing type (from enum v4l2_field) - * @colorspace: colorspace of the data (from enum v4l2_colorspace) - * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding) - * @hsv_enc: HSV encoding of the data (from enum v4l2_hsv_encoding) - * @quantization: quantization of the data (from enum v4l2_quantization) - * @xfer_func: transfer function of the data (from enum v4l2_xfer_func) + * @field: used interlacing type (from enum v4l2_field), zero for metadata + * mbus codes + * @colorspace: colorspace of the data (from enum v4l2_colorspace), zero on + * metadata mbus codes + * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding), zero + * for metadata mbus codes + * @hsv_enc: HSV encoding of the data (from enum v4l2_hsv_encoding), zero for + * metadata mbus codes + * @quantization: quantization of the data (from enum v4l2_quantization), zero + * for metadata mbus codes + * @xfer_func: transfer function of the data (from enum v4l2_xfer_func), zero + * for metadata mbus codes * @flags: flags (V4L2_MBUS_FRAMEFMT_*) * @reserved: reserved bytes that can be later used */ diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h index 7048c51581c6..6a39128d0606 100644 --- a/include/linux/v4l2-subdev.h +++ b/include/linux/v4l2-subdev.h @@ -50,6 +50,10 @@ struct v4l2_subdev_format { * @rect: pad crop rectangle boundaries * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array + * + * The subdev crop API is an obsolete interface and may be removed in the + * future. It is superseded by the selection API. No new extensions to this + * structure will be accepted. */ struct v4l2_subdev_crop { __u32 which; @@ -224,15 +228,18 @@ struct v4l2_subdev_route { * struct v4l2_subdev_routing - Subdev routing information * * @which: configuration type (from enum v4l2_subdev_format_whence) - * @num_routes: the total number of routes in the routes array + * @len_routes: the length of the routes array, in routes * @routes: pointer to the routes array + * @num_routes: the total number of routes, possibly more than fits in the + * routes array * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_routing { __u32 which; - __u32 num_routes; + __u32 len_routes; __u64 routes; - __u32 reserved[6]; + __u32 num_routes; + __u32 reserved[11]; }; /* diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index b21e7f2c67cd..34cc419b6b5a 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -572,6 +572,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW14 packed */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ @@ -812,6 +814,18 @@ struct v4l2_pix_format { #define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */ #define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */ +/* + * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when + * adding new ones! + */ +#define V4L2_META_FMT_GENERIC_8 v4l2_fourcc('M', 'E', 'T', '8') /* Generic 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_10 v4l2_fourcc('M', 'C', '1', 'A') /* 10-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_12 v4l2_fourcc('M', 'C', '1', 'C') /* 12-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_14 v4l2_fourcc('M', 'C', '1', 'E') /* 14-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_16 v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_20 v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_24 v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe @@ -842,6 +856,7 @@ struct v4l2_fmtdesc { #define V4L2_FMT_FLAG_CSC_YCBCR_ENC 0x0080 #define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_ENC #define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100 +#define V4L2_FMT_FLAG_META_LINE_BASED 0x0200 /* Frame Size and frame rate enumeration */ /* @@ -1790,7 +1805,7 @@ struct v4l2_ext_control { struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info; struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display; void *ptr; - }; + } __attribute__ ((packed)); } __attribute__ ((packed)); struct v4l2_ext_controls { @@ -2360,10 +2375,19 @@ struct v4l2_sdr_format { * struct v4l2_meta_format - metadata format definition * @dataformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data + * @width: number of data units of data per line (valid for line + * based formats only, see format documentation) + * @height: number of lines of data per buffer (valid for line based + * formats only) + * @bytesperline: offset between the beginnings of two adjacent lines in + * bytes (valid for line based formats only) */ struct v4l2_meta_format { __u32 dataformat; __u32 buffersize; + __u32 width; + __u32 height; + __u32 bytesperline; } __attribute__ ((packed)); /** diff --git a/lib/include/libdvbv5/dvb-frontend.h b/lib/include/libdvbv5/dvb-frontend.h index 392171a7d651..844762889343 100644 --- a/lib/include/libdvbv5/dvb-frontend.h +++ b/lib/include/libdvbv5/dvb-frontend.h @@ -854,7 +854,7 @@ struct dtv_stats { union { __u64 uvalue; /* for counters and relative scales */ __s64 svalue; /* for 0.001 dB measures */ - }; + } __attribute__ ((packed)); } __attribute__ ((packed)); diff --git a/utils/common/v4l2-pix-formats.h b/utils/common/v4l2-pix-formats.h index e8d2e441fdfc..96a11f34f53c 100644 --- a/utils/common/v4l2-pix-formats.h +++ b/utils/common/v4l2-pix-formats.h @@ -52,6 +52,8 @@ case V4L2_PIX_FMT_Y10BPACK: return "10-bit Greyscale (Packed)"; case V4L2_PIX_FMT_Y10P: return "10-bit Greyscale (MIPI Packed)"; case V4L2_PIX_FMT_IPU3_Y10: return "10-bit greyscale (IPU3 Packed)"; + case V4L2_PIX_FMT_Y12P: return "12-bit Greyscale (MIPI Packed)"; + case V4L2_PIX_FMT_Y14P: return "14-bit Greyscale (MIPI Packed)"; case V4L2_PIX_FMT_Y8I: return "Interleaved 8-bit Greyscale"; case V4L2_PIX_FMT_Y12I: return "Interleaved 12-bit Greyscale"; case V4L2_PIX_FMT_Z16: return "16-bit Depth"; @@ -192,6 +194,13 @@ case V4L2_PIX_FMT_Y210: return "10-bit YUYV Packed"; case V4L2_PIX_FMT_Y212: return "12-bit YUYV Packed"; case V4L2_PIX_FMT_Y216: return "16-bit YUYV Packed"; + case V4L2_META_FMT_GENERIC_8: return "8-bit Generic Metadata"; + case V4L2_META_FMT_GENERIC_CSI2_10: return "8-bit Generic Meta, 10b CSI-2"; + case V4L2_META_FMT_GENERIC_CSI2_12: return "8-bit Generic Meta, 12b CSI-2"; + case V4L2_META_FMT_GENERIC_CSI2_14: return "8-bit Generic Meta, 14b CSI-2"; + case V4L2_META_FMT_GENERIC_CSI2_16: return "8-bit Generic Meta, 16b CSI-2"; + case V4L2_META_FMT_GENERIC_CSI2_20: return "8-bit Generic Meta, 20b CSI-2"; + case V4L2_META_FMT_GENERIC_CSI2_24: return "8-bit Generic Meta, 24b CSI-2"; case V4L2_PIX_FMT_MJPEG: return "Motion-JPEG"; case V4L2_PIX_FMT_JPEG: return "JFIF JPEG"; case V4L2_PIX_FMT_DV: return "1394"; diff --git a/utils/v4l2-tracer/retrace-gen.cpp b/utils/v4l2-tracer/retrace-gen.cpp index 08ed96164c28..52323a0b0d4d 100644 --- a/utils/v4l2-tracer/retrace-gen.cpp +++ b/utils/v4l2-tracer/retrace-gen.cpp @@ -4101,7 +4101,7 @@ struct v4l2_ext_control *retrace_v4l2_ext_control_gen(json_object *parent_obj, s //struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info; //struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display; //void *ptr; - //end of union }; + //end of union } __attribute__ ((packed)); return p; } struct v4l2_ext_controls *retrace_v4l2_ext_controls_gen(json_object *parent_obj, std::string key_name = "") @@ -4930,6 +4930,18 @@ struct v4l2_meta_format *retrace_v4l2_meta_format_gen(json_object *parent_obj, s if (json_object_object_get_ex(v4l2_meta_format_obj, "buffersize", &buffersize_obj)) p->buffersize = (__u32) json_object_get_int64(buffersize_obj); + json_object *width_obj; + if (json_object_object_get_ex(v4l2_meta_format_obj, "width", &width_obj)) + p->width = (__u32) json_object_get_int64(width_obj); + + json_object *height_obj; + if (json_object_object_get_ex(v4l2_meta_format_obj, "height", &height_obj)) + p->height = (__u32) json_object_get_int64(height_obj); + + json_object *bytesperline_obj; + if (json_object_object_get_ex(v4l2_meta_format_obj, "bytesperline", &bytesperline_obj)) + p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj); + return p; } struct v4l2_format *retrace_v4l2_format_gen(json_object *parent_obj, std::string key_name = "") diff --git a/utils/v4l2-tracer/trace-gen.cpp b/utils/v4l2-tracer/trace-gen.cpp index fd58d9182905..c1075e771078 100644 --- a/utils/v4l2-tracer/trace-gen.cpp +++ b/utils/v4l2-tracer/trace-gen.cpp @@ -2245,7 +2245,7 @@ void trace_v4l2_ext_control_gen(void *arg, json_object *parent_obj, std::string //struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info; //struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display; //void *ptr; - //end of union }; + //end of union } __attribute__ ((packed)); if (key_name.empty()) json_object_object_add(parent_obj, "v4l2_ext_control", v4l2_ext_control_obj); @@ -2736,6 +2736,9 @@ void trace_v4l2_meta_format_gen(void *arg, json_object *parent_obj, std::string json_object_object_add(v4l2_meta_format_obj, "dataformat", json_object_new_int64(p->dataformat)); json_object_object_add(v4l2_meta_format_obj, "buffersize", json_object_new_int64(p->buffersize)); + json_object_object_add(v4l2_meta_format_obj, "width", json_object_new_int64(p->width)); + json_object_object_add(v4l2_meta_format_obj, "height", json_object_new_int64(p->height)); + json_object_object_add(v4l2_meta_format_obj, "bytesperline", json_object_new_int64(p->bytesperline)); if (key_name.empty()) json_object_object_add(parent_obj, "v4l2_meta_format", v4l2_meta_format_obj); diff --git a/utils/v4l2-tracer/v4l2-tracer-info-gen.h b/utils/v4l2-tracer/v4l2-tracer-info-gen.h index 022c435c34cf..1ed43074407e 100644 --- a/utils/v4l2-tracer/v4l2-tracer-info-gen.h +++ b/utils/v4l2-tracer/v4l2-tracer-info-gen.h @@ -1288,6 +1288,8 @@ constexpr val_def v4l2_pix_fmt_val_def[] = { { V4L2_PIX_FMT_Y10BPACK, "V4L2_PIX_FMT_Y10BPACK" }, { V4L2_PIX_FMT_Y10P, "V4L2_PIX_FMT_Y10P" }, { V4L2_PIX_FMT_IPU3_Y10, "V4L2_PIX_FMT_IPU3_Y10" }, + { V4L2_PIX_FMT_Y12P, "V4L2_PIX_FMT_Y12P" }, + { V4L2_PIX_FMT_Y14P, "V4L2_PIX_FMT_Y14P" }, { V4L2_PIX_FMT_PAL8, "V4L2_PIX_FMT_PAL8" }, { V4L2_PIX_FMT_UV8, "V4L2_PIX_FMT_UV8" }, { V4L2_PIX_FMT_YUYV, "V4L2_PIX_FMT_YUYV" }, @@ -1482,6 +1484,7 @@ constexpr flag_def v4l2_fmt_flag_def[] = { { V4L2_FMT_FLAG_CSC_YCBCR_ENC, "V4L2_FMT_FLAG_CSC_YCBCR_ENC" }, { V4L2_FMT_FLAG_CSC_HSV_ENC, "V4L2_FMT_FLAG_CSC_HSV_ENC" }, { V4L2_FMT_FLAG_CSC_QUANTIZATION, "V4L2_FMT_FLAG_CSC_QUANTIZATION" }, + { V4L2_FMT_FLAG_META_LINE_BASED, "V4L2_FMT_FLAG_META_LINE_BASED" }, { 0, "" } }; From patchwork Wed Apr 24 15:22:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 791734 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94CDC15FD04 for ; Wed, 24 Apr 2024 15:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972163; cv=none; b=hV9s5F3otZgNwraV45qGW89ngtWWlGaHu743nTGbnXqZFyJiTPzbQiXTC5oZAvUVVfnFnsc/CklIMwluJvCxtT6Ad1gbV7VD8HO7HtfkckuA/DOejnaUhgeBvBIPku8fSLDT6Wl0JE1TPUc2HHtMMVXlMZdHFa2HrradseE6nqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972163; c=relaxed/simple; bh=hupgmJIHD3vLdEzoo2acwODFOKaoBBeqMuY60keLcYk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qXoi2xjT80ekWdgTzqek/ejFL/7vaeWezB3sg8OQHfVF1Ctr6jEeus0KRRcBnBqbIqC0ubBaBdYaqteWoPRytjrSlYP7DnqhaEjTFnHXAC3obtmtZx+/dunD7L3Ch2ARK7/uVTg5uLgY+sBeQwbjbqqZf4PatfliOqukW0EEh/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=wgdkYFnZ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="wgdkYFnZ" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5917DEA5; Wed, 24 Apr 2024 17:21:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972107; bh=hupgmJIHD3vLdEzoo2acwODFOKaoBBeqMuY60keLcYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wgdkYFnZRfP0B0jCQjqwEzwWS83d7V0z8we9tU4aP3exX50atMCHbmOtDpF1+mFiL 8oRibErplM4ecqi/llK6zLKkM1tC4hg4l4IUwfB7D0NjZFaN4hcuKpVP1uHQEYcWI/ SB3WMXCmRK6rR6TrrkD3jEO7gF710+NXS4drG88Y= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny , Sakari Ailus Subject: [v4l-utils] [PATCH v2 2/7] utils: media-ctl: Support changed routing API Date: Wed, 24 Apr 2024 18:22:25 +0300 Message-ID: <20240424152230.31923-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sakari Ailus Set len_routes of struct v4l2_subdev_routing. ENOSPC error code is no longer used, i.e. having room for fewer routes than exist in the configuration is not considered an error anymore. Signed-off-by: Sakari Ailus --- utils/media-ctl/libv4l2subdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c index c614f4a2e0fd..e0df686e01c7 100644 --- a/utils/media-ctl/libv4l2subdev.c +++ b/utils/media-ctl/libv4l2subdev.c @@ -258,7 +258,7 @@ int v4l2_subdev_get_routing(struct media_entity *entity, } ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_ROUTING, &routing); - if (ret == -1 && errno != ENOSPC) + if (ret == -1) return -errno; if (!routing.num_routes) { @@ -272,6 +272,7 @@ int v4l2_subdev_get_routing(struct media_entity *entity, return -ENOMEM; routing.routes = (uintptr_t)r; + routing.len_routes = routing.num_routes; ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_ROUTING, &routing); if (ret) { free(r); @@ -292,6 +293,7 @@ int v4l2_subdev_set_routing(struct media_entity *entity, .which = V4L2_SUBDEV_FORMAT_ACTIVE, .routes = (uintptr_t)routes, .num_routes = num_routes, + .len_routes = num_routes, }; int ret; From patchwork Wed Apr 24 15:22:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 792200 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F23016078F for ; Wed, 24 Apr 2024 15:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972165; cv=none; b=SZTWPchuaZjcwEkMcBle0L2zummgvKs4KbBenaTFg/lkXymZaP6Yt/gWtMSFpAPjVnDszAJps5mwcLH9tMyjucrubn0VMuSoq1k1IFQL40xUImCAwZRR+FSF+g6sH0hZnXyIlYfGyo1X982a1LmXu3mSwxZT76sCqCRnnNWwT/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972165; c=relaxed/simple; bh=AaCNvpYDtkKRXfQqDZxRKaGAy+RWTu2/wC1yzxHsrsI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sgVY5dVvfirEeLh/vUSWxhDllVpM6chYtdnXs69OHEvqXBN+YKdWXPl2L0K+qUYGlVjaNx0gdtjWst8dwcVCnxCOjlk9d6kTYVXFfZ+/sWLf+Tt44T2PxJViOWHamtsq+GunEI9okYTuOGLSgo2/qQcbaYu0y65Bk2pCZIvnxgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=PPRW5j9p; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PPRW5j9p" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2A798EBB; Wed, 24 Apr 2024 17:21:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972108; bh=AaCNvpYDtkKRXfQqDZxRKaGAy+RWTu2/wC1yzxHsrsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPRW5j9pEGm5A6bPDnzszSyBMxNAlMtTLtqcPPT0nQ5AoTLpDIw96R/B15kBbfECS fZE9kAsFUXoF1yL6Xvdg8GPztW4HjGfDcEBS5CdqFnOpGhntbV06yOVCmdOMh9fPLY iYJOi3cxTv2sLCjBTRl5lAANoaaAoU52pxLBO8PA= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny Subject: [v4l-utils] [PATCH v2 3/7] v4l2-compliance: Support the changed routing API Date: Wed, 24 Apr 2024 18:22:26 +0300 Message-ID: <20240424152230.31923-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Set len_routes of struct v4l2_subdev_routing. ENOSPC error code is no longer used, i.e. having room for fewer routes than exist in the configuration is not considered an error anymore. Signed-off-by: Laurent Pinchart --- utils/v4l2-compliance/v4l2-compliance.cpp | 12 +++++++----- utils/v4l2-compliance/v4l2-test-subdevs.cpp | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index fd7e7d76e214..144f961842c6 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -1272,15 +1272,17 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ for (unsigned which = V4L2_SUBDEV_FORMAT_TRY; which <= V4L2_SUBDEV_FORMAT_ACTIVE; which++) { + struct v4l2_subdev_routing &routing = sd_routing[which]; - sd_routing[which].which = which; - sd_routing[which].routes = (uintptr_t)sd_routes[which]; - sd_routing[which].num_routes = NUM_ROUTES_MAX; + routing.which = which; + routing.routes = (uintptr_t)sd_routes[which]; + routing.len_routes = NUM_ROUTES_MAX; + routing.num_routes = 0; - ret = doioctl(&node, VIDIOC_SUBDEV_G_ROUTING, &sd_routing[which]); + ret = doioctl(&node, VIDIOC_SUBDEV_G_ROUTING, &routing); if (ret) { fail("VIDIOC_SUBDEV_G_ROUTING: failed to get routing\n"); - sd_routing[which].num_routes = 0; + routing.num_routes = 0; } } } diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp index da304a8caa8a..41eaf77112f0 100644 --- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp +++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp @@ -587,17 +587,15 @@ int testSubDevRouting(struct node *node, unsigned which) routing.which = which; routing.routes = (uintptr_t)&routes; + routing.len_routes = 0; routing.num_routes = 0; memset(routing.reserved, 0xff, sizeof(routing.reserved)); - /* - * First test that G_ROUTING either returns success, or ENOSPC and - * updates num_routes. - */ + /* First test that G_ROUTING returns success even when len_routes is 0. */ ret = doioctl(node, VIDIOC_SUBDEV_G_ROUTING, &routing); - fail_on_test(ret && ret != ENOSPC); - fail_on_test(ret == ENOSPC && routing.num_routes == 0); + fail_on_test(ret); + fail_on_test(routing.num_routes > NUM_ROUTES_MAX); fail_on_test(check_0(routing.reserved, sizeof(routing.reserved))); if (!routing.num_routes) @@ -609,7 +607,8 @@ int testSubDevRouting(struct node *node, unsigned which) */ uint32_t num_routes = routing.num_routes; - routing.num_routes = num_routes + 1; + routing.len_routes = NUM_ROUTES_MAX; + routing.num_routes = 0; fail_on_test(doioctl(node, VIDIOC_SUBDEV_G_ROUTING, &routing)); fail_on_test(routing.num_routes != num_routes); @@ -633,10 +632,14 @@ int testSubDevRouting(struct node *node, unsigned which) } } - /* Set the same routes back, which should always succeed. */ + /* + * Set the same routes back, which should always succeed and report the + * same number of routes. + */ memset(routing.reserved, 0xff, sizeof(routing.reserved)); fail_on_test(doioctl(node, VIDIOC_SUBDEV_S_ROUTING, &routing)); + fail_on_test(routing.num_routes != num_routes); fail_on_test(check_0(routing.reserved, sizeof(routing.reserved))); /* Test setting invalid pads */ From patchwork Wed Apr 24 15:22:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 791733 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB59B160873 for ; Wed, 24 Apr 2024 15:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972167; cv=none; b=L6XgFQpOZcJtq1hgiK+t3SIskRGYuunKd8QM97m4eig1JoiCc5t5MKeRbS9mWBEoFeLcmV6l9iyDkRnQVjZw9abcCAGNofCi9zzahJNeuauduuFeNwiLqwSbYEQVyvwTf8grTB5WbbANUhdmNQPTF/hTRtLpSJI0FOobgYKxzVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972167; c=relaxed/simple; bh=sJNrqvWwyRhl0VoBpq2vFdfD40L3zzAl0advP0i08G4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LpmVm1IfJ5ku48fRZPV2PjFB/GU2wOt2+QhpbnskuWTvkG3XgWFYJPZKW/iJ8Epw2g8n9u2EuuQdCFAOvFIfXD99rxjCLnEQV+NYl7xH8GuMYjYm34msawnJkhdRlIe9zsJfkHG0zcz4IZtoQHVHsUMaLN7aY19OiKAPud2n1K8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ovQGRFrz; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ovQGRFrz" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F0FDB114D; Wed, 24 Apr 2024 17:21:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972109; bh=sJNrqvWwyRhl0VoBpq2vFdfD40L3zzAl0advP0i08G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovQGRFrzGGh8Ue/NGnWz4WuLJVdY/DH+4xmLvMUgV0VV5fVfAWSpFpqQBhXu9zLbu 4lWN4zTRndewJTY2tuQ1dkA0rIAyQ8lH12Q1lxX+SEof9m+rWcBvATtcK6dTT6EtN9 MlM3HqDKqN7JYhs9oFZn/ttjctg8sZ9nENQzaWJk= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny Subject: [v4l-utils] [PATCH v2 4/7] v4l2-compliance: Add tests for V4L2_FMT_FLAG_META_LINE_BASED flag Date: Wed, 24 Apr 2024 18:22:27 +0300 Message-ID: <20240424152230.31923-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The metadata API supports a new flag, V4L2_FMT_FLAG_META_LINE_BASED. It can be set for metadata formats only, and is the only flag that can be set for metadata formats. When set, the width, height and bytesperline fields must not be zero. Add corresponding tests. Signed-off-by: Laurent Pinchart --- utils/v4l2-compliance/v4l2-test-formats.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 423567fe573b..5507e45ef3dd 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -281,12 +281,23 @@ static int testEnumFormatsType(struct node *node, unsigned type) V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL | V4L2_FMT_FLAG_CSC_COLORSPACE | V4L2_FMT_FLAG_CSC_YCBCR_ENC | V4L2_FMT_FLAG_CSC_HSV_ENC | - V4L2_FMT_FLAG_CSC_QUANTIZATION | V4L2_FMT_FLAG_CSC_XFER_FUNC)) + V4L2_FMT_FLAG_CSC_QUANTIZATION | V4L2_FMT_FLAG_CSC_XFER_FUNC | + V4L2_FMT_FLAG_META_LINE_BASED)) return fail("unknown flag %08x returned\n", fmtdesc.flags); if (!(fmtdesc.flags & V4L2_FMT_FLAG_COMPRESSED)) fail_on_test(fmtdesc.flags & (V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM | V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL)); + + // Checks for metadata formats. + // The META_LINE_BASED flag can be set for metadata formats only. + if (type == V4L2_BUF_TYPE_META_OUTPUT || type == V4L2_BUF_TYPE_META_CAPTURE) + fail_on_test(fmtdesc.flags & ~V4L2_FMT_FLAG_META_LINE_BASED); + // Only the META_LINE_BASED flag is valid for metadata formats. + if (fmtdesc.flags & V4L2_FMT_FLAG_META_LINE_BASED) + fail_on_test(type != V4L2_BUF_TYPE_META_OUTPUT && + type != V4L2_BUF_TYPE_META_CAPTURE); + ret = testEnumFrameSizes(node, fmtdesc.pixelformat); if (ret) fail_on_test(node->codec_mask & STATEFUL_ENCODER); @@ -590,6 +601,10 @@ static int testFormatsType(struct node *node, int ret, unsigned type, struct v4 return fail("dataformat %08x (%s) for buftype %d not reported by ENUM_FMT\n", meta.dataformat, fcc2s(meta.dataformat).c_str(), type); fail_on_test(meta.buffersize == 0); + if (map.at(meta.dataformat) & V4L2_FMT_FLAG_META_LINE_BASED) { + fail_on_test(!meta.width || !meta.height); + fail_on_test(!meta.bytesperline); + } break; case V4L2_BUF_TYPE_PRIVATE: break; From patchwork Wed Apr 24 15:22:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 792199 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 586C715F41B for ; Wed, 24 Apr 2024 15:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972167; cv=none; b=KwdSTZhZLLfKLuXWq9SQVLIGUj/tLrmj4BrfnCOCHI/1FkN77cHPHbE8ohdKSDDiLk/604BPrrlKeAz3r8rLUXg2NsCxa/ca7BmQc7E1pROIodw8i7+U21alb2HG2l15dPxFKI2oMub14Sfxuho+LOilOlh4sLPoEeaZNYzEIc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972167; c=relaxed/simple; bh=hu0zJ/QFEMLEU6RuYsFNrt8WLJaHK6I/J8PfmvjXz4M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VtVsC85PLUhqNQgRtG2RO4wsFzbyLaf7q0mGrA2qz/WLV5JKbDe5XVi7AwwyxYIpnVBgqzbDq7Jis+aQrTXzz8eH3qrHjCxlGGaUlFd6J6keK0PAyYBJzCCTUQ2KZfBHuGYEDWwijBpe3gJAg3V/wAS23YAzVLtFk2OUs15ZLYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=PEJLZ8iJ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PEJLZ8iJ" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CBD0D674; Wed, 24 Apr 2024 17:21:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972109; bh=hu0zJ/QFEMLEU6RuYsFNrt8WLJaHK6I/J8PfmvjXz4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEJLZ8iJkMjcuyJzP6fceeImCm2qUdIDCZT+4iNYoH1l3GVC/dDuuMco9HGd2+kSW f+4l87bbZxdMj3TN8WTGlPhVJSQfBxatP8Dt846TwrQ2EvtRtKWmUudh/d27guIf1W 9yiX0004C5TSO0rnLosqzTiGvcWrrEBFXOAflwQw= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny Subject: [v4l-utils] [PATCH v2 5/7] v4l-utils: sync-with-kernel Date: Wed, 24 Apr 2024 18:22:28 +0300 Message-ID: <20240424152230.31923-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Update v4l-utils to the kernel headers from the internal pads series. Signed-off-by: Laurent Pinchart --- include/linux/media.h | 1 + include/linux/v4l2-subdev.h | 5 +++++ utils/v4l2-tracer/v4l2-tracer-info-gen.h | 1 + 3 files changed, 7 insertions(+) diff --git a/include/linux/media.h b/include/linux/media.h index b5a77bbf4062..4a733b9beb27 100644 --- a/include/linux/media.h +++ b/include/linux/media.h @@ -206,6 +206,7 @@ struct media_entity_desc { #define MEDIA_PAD_FL_SINK (1U << 0) #define MEDIA_PAD_FL_SOURCE (1U << 1) #define MEDIA_PAD_FL_MUST_CONNECT (1U << 2) +#define MEDIA_PAD_FL_INTERNAL (1U << 3) struct media_pad_desc { __u32 entity; /* entity ID */ diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h index 6a39128d0606..c6f1228d43b1 100644 --- a/include/linux/v4l2-subdev.h +++ b/include/linux/v4l2-subdev.h @@ -204,6 +204,11 @@ struct v4l2_subdev_capability { * on a video node. */ #define V4L2_SUBDEV_ROUTE_FL_ACTIVE (1U << 0) +/* + * Is the route immutable. The ACTIVE flag of an immutable route may not be + * changed. + */ +#define V4L2_SUBDEV_ROUTE_FL_IMMUTABLE (1U << 1) /** * struct v4l2_subdev_route - A route inside a subdev diff --git a/utils/v4l2-tracer/v4l2-tracer-info-gen.h b/utils/v4l2-tracer/v4l2-tracer-info-gen.h index 1ed43074407e..51eeb7b7ec60 100644 --- a/utils/v4l2-tracer/v4l2-tracer-info-gen.h +++ b/utils/v4l2-tracer/v4l2-tracer-info-gen.h @@ -1852,6 +1852,7 @@ constexpr flag_def media_pad_flag_def[] = { { MEDIA_PAD_FL_SINK, "MEDIA_PAD_FL_SINK" }, { MEDIA_PAD_FL_SOURCE, "MEDIA_PAD_FL_SOURCE" }, { MEDIA_PAD_FL_MUST_CONNECT, "MEDIA_PAD_FL_MUST_CONNECT" }, + { MEDIA_PAD_FL_INTERNAL, "MEDIA_PAD_FL_INTERNAL" }, { 0, "" } }; From patchwork Wed Apr 24 15:22:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 791732 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9FD715F41B for ; Wed, 24 Apr 2024 15:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972170; cv=none; b=CBT/LR2mJ6ZdyhYcCBTVxfdM41EnzQ0LBjdCZU3kYvJmOP5FqpRW1jIus42RLFC8riPUe994E5Tvz4foQq4hYgv99E0x84IfUZPSfSNXZz5Y89xrejvh+fH+gniRXC4P0bK7Qb7/IvemzSmSx2lq9UayD3jViQE0HOrcNtkvLLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972170; c=relaxed/simple; bh=A+zb2D2LGp8GxzkvjLvhtvagR4efkimO58aCnLGHKFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sect3VTDpszoSBKtYIWu8itkX9KPBdCSvJjROWUCpEFeZWibY7DEZC5B1XFo987SmZPCvW6pn7M7RS56oLPOz1/VAiT9KUv/OoBec9lz1iU0wnqErM4qSLWQwXeSi1fJZrln+xCek5XCENC4KBSRsQWpqhRt6IrSiOELm2KLWPA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Rtmgl9iu; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Rtmgl9iu" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9B5261153; Wed, 24 Apr 2024 17:21:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972110; bh=A+zb2D2LGp8GxzkvjLvhtvagR4efkimO58aCnLGHKFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rtmgl9iuXEwaq1Po5N+rmp0v3p0+xO+aSVTM8zEJxssVp2/HrsJL/2dP8W9kfCSpF ppRS+VLvufC/sQf7QM0k4eL96pkKPTWkLe3gG1JGMmJvg2wUw55wWO3AzvDt19Rw33 X1wJ3nze0Bjm2GFdKA/c0ZlHADZ4bxpmTr1rlZZ8= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny , Sakari Ailus Subject: [v4l-utils] [PATCH v2 6/7] utils: media-ctl: Print the INTERNAL pad flag Date: Wed, 24 Apr 2024 18:22:29 +0300 Message-ID: <20240424152230.31923-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sakari Ailus Add the INTERNAL pad flag to the list of known flags, to print it by name instead of numerical value. Signed-off-by: Sakari Ailus Signed-off-by: Laurent Pinchart --- utils/media-ctl/media-ctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c index 1a9e393ac1f3..510479d83de4 100644 --- a/utils/media-ctl/media-ctl.c +++ b/utils/media-ctl/media-ctl.c @@ -517,6 +517,7 @@ static void media_print_topology_text_entity(struct media_device *media, { MEDIA_PAD_FL_SINK, "SINK" }, { MEDIA_PAD_FL_SOURCE, "SOURCE" }, { MEDIA_PAD_FL_MUST_CONNECT, "MUST_CONNECT" }, + { MEDIA_PAD_FL_INTERNAL, "INTERNAL" }, }; const struct media_entity_desc *info = media_entity_get_info(entity); const char *devname = media_entity_get_devname(entity); From patchwork Wed Apr 24 15:22:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 792198 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EED315FA7D for ; Wed, 24 Apr 2024 15:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972170; cv=none; b=Qz4Ekm9ha86b5ss1Z3HSppI9QEkzqSdFRhsIam0uMVHw24dr3Zlr1xZ7Wi2QXdghfnbZ+vd0NJ/usMWGvvwEbOcZ7ecAZClV7UF9UXgkKHYjQQ3Y4pVCmavU/ulqUZqPaIpOLcdGPV1RVl6pjeoVQohds5ywDmWT1jvwaebp6As= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713972170; c=relaxed/simple; bh=Qjm5GViy46c+dXK/HLSygH+ymC2VafUHsnqBL808heg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DRasWx+PmsvdVhBbR1LRcZUZpnn7r7fp7epRnW2kexZGvyR36I12ht3Zm5xwyh3UHFX9lJLolAF3eoU/9DG+ktEl0tinCnWtGkXbubgdIVrhoG8Q+94IxeV351vDJ8JzB4vnQW38AEOW7FjvGGH65D/QI4nhpMruJJuajtgNRHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=bKVS7RP8; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bKVS7RP8" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 820BE11D6; Wed, 24 Apr 2024 17:21:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713972111; bh=Qjm5GViy46c+dXK/HLSygH+ymC2VafUHsnqBL808heg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKVS7RP8KffuIv0Laa0YaTrWGVgMAM07xXTzuJD66oI1E7L+cAGGjRw+GAPX0FKW+ hIxCNp+gQVmJtSchCKmGAMPGvxITG7AhaDDc5tz2zET1vmJHMqOfMI/JetYIb04gkh HhVOIHbWNfhtmPO+8sXNP2wr1WcrfatfBlwOQApo= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Sakari Ailus , Tomi Valkeinen , Hans Verkuil , Gregor Jasny Subject: [v4l-utils] [PATCH v2 7/7] v4l2-compliance: Test IMMUTABLE route flag Date: Wed, 24 Apr 2024 18:22:30 +0300 Message-ID: <20240424152230.31923-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> References: <20240424152230.31923-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Accept the new V4L2_SUBDEV_ROUTE_FL_IMMUTABLE route flag when testing routing, and verify that immutable routes are active as mandated by the routing API specification. Signed-off-by: Laurent Pinchart --- utils/v4l2-compliance/v4l2-test-subdevs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp index 41eaf77112f0..409e82dae480 100644 --- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp +++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp @@ -579,7 +579,8 @@ int testSubDevSelection(struct node *node, unsigned which, unsigned pad, unsigne int testSubDevRouting(struct node *node, unsigned which) { - const uint32_t all_route_flags_mask = V4L2_SUBDEV_ROUTE_FL_ACTIVE; + const uint32_t all_route_flags_mask = V4L2_SUBDEV_ROUTE_FL_ACTIVE + | V4L2_SUBDEV_ROUTE_FL_IMMUTABLE; struct v4l2_subdev_routing routing = {}; struct v4l2_subdev_route routes[NUM_ROUTES_MAX] = {}; unsigned int i; @@ -629,6 +630,8 @@ int testSubDevRouting(struct node *node, unsigned which) fail_on_test(!(sink->flags & MEDIA_PAD_FL_SINK)); fail_on_test(!(source->flags & MEDIA_PAD_FL_SOURCE)); fail_on_test(route->flags & ~all_route_flags_mask); + fail_on_test((route->flags & V4L2_SUBDEV_ROUTE_FL_IMMUTABLE) && + !(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE)); } }