Message ID | 20211130141815.892354-2-tomi.valkeinen@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series | v4l-utils: support multiplexed streams | expand |
Hi Tomi, Thank you for the patch. On Tue, Nov 30, 2021 at 04:18:12PM +0200, Tomi Valkeinen wrote: > Update the Linux kernel headers for multiplexed streams. I suppose the patch is for testing only, and will be regenerated once the API is merged in the kernel, before merging it in v4l-utils. It should then use the sync-with-kernel.sh script to pull in all kernel header changes. > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> > --- > include/linux/v4l2-subdev.h | 88 ++++++++++++++++++++++++++++++++++--- > 1 file changed, 81 insertions(+), 7 deletions(-) > > diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h > index 658106f5..480891db 100644 > --- a/include/linux/v4l2-subdev.h > +++ b/include/linux/v4l2-subdev.h > @@ -44,13 +44,15 @@ enum v4l2_subdev_format_whence { > * @which: format type (from enum v4l2_subdev_format_whence) > * @pad: pad number, as reported by the media API > * @format: media bus format (format code and frame size) > + * @stream: stream number, defined in subdev routing > * @reserved: drivers and applications must zero this array > */ > struct v4l2_subdev_format { > __u32 which; > __u32 pad; > struct v4l2_mbus_framefmt format; > - __u32 reserved[8]; > + __u32 stream; > + __u32 reserved[7]; > }; > > /** > @@ -58,13 +60,15 @@ struct v4l2_subdev_format { > * @which: format type (from enum v4l2_subdev_format_whence) > * @pad: pad number, as reported by the media API > * @rect: pad crop rectangle boundaries > + * @stream: stream number, defined in subdev routing > * @reserved: drivers and applications must zero this array > */ > struct v4l2_subdev_crop { > __u32 which; > __u32 pad; > struct v4l2_rect rect; > - __u32 reserved[8]; > + __u32 stream; > + __u32 reserved[7]; > }; > > #define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE 0x00000001 > @@ -80,6 +84,7 @@ struct v4l2_subdev_crop { > * @code: format code (MEDIA_BUS_FMT_ definitions) > * @which: format type (from enum v4l2_subdev_format_whence) > * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*) > + * @stream: stream number, defined in subdev routing > * @reserved: drivers and applications must zero this array > */ > struct v4l2_subdev_mbus_code_enum { > @@ -88,7 +93,8 @@ struct v4l2_subdev_mbus_code_enum { > __u32 code; > __u32 which; > __u32 flags; > - __u32 reserved[7]; > + __u32 stream; > + __u32 reserved[6]; > }; > > /** > @@ -101,6 +107,7 @@ struct v4l2_subdev_mbus_code_enum { > * @min_height: minimum frame height, in pixels > * @max_height: maximum frame height, in pixels > * @which: format type (from enum v4l2_subdev_format_whence) > + * @stream: stream number, defined in subdev routing > * @reserved: drivers and applications must zero this array > */ > struct v4l2_subdev_frame_size_enum { > @@ -112,19 +119,22 @@ struct v4l2_subdev_frame_size_enum { > __u32 min_height; > __u32 max_height; > __u32 which; > - __u32 reserved[8]; > + __u32 stream; > + __u32 reserved[7]; > }; > > /** > * struct v4l2_subdev_frame_interval - Pad-level frame rate > * @pad: pad number, as reported by the media API > * @interval: frame interval in seconds > + * @stream: stream number, defined in subdev routing > * @reserved: drivers and applications must zero this array > */ > struct v4l2_subdev_frame_interval { > __u32 pad; > struct v4l2_fract interval; > - __u32 reserved[9]; > + __u32 stream; > + __u32 reserved[8]; > }; > > /** > @@ -136,6 +146,7 @@ struct v4l2_subdev_frame_interval { > * @height: frame height in pixels > * @interval: frame interval in seconds > * @which: format type (from enum v4l2_subdev_format_whence) > + * @stream: stream number, defined in subdev routing > * @reserved: drivers and applications must zero this array > */ > struct v4l2_subdev_frame_interval_enum { > @@ -146,7 +157,8 @@ struct v4l2_subdev_frame_interval_enum { > __u32 height; > struct v4l2_fract interval; > __u32 which; > - __u32 reserved[8]; > + __u32 stream; > + __u32 reserved[7]; > }; > > /** > @@ -158,6 +170,7 @@ struct v4l2_subdev_frame_interval_enum { > * defined in v4l2-common.h; V4L2_SEL_TGT_* . > * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. > * @r: coordinates of the selection window > + * @stream: stream number, defined in subdev routing > * @reserved: for future use, set to zero for now > * > * Hardware may use multiple helper windows to process a video stream. > @@ -170,7 +183,8 @@ struct v4l2_subdev_selection { > __u32 target; > __u32 flags; > struct v4l2_rect r; > - __u32 reserved[8]; > + __u32 stream; > + __u32 reserved[7]; > }; > > /** > @@ -188,6 +202,64 @@ struct v4l2_subdev_capability { > /* The v4l2 sub-device video device node is registered in read-only mode. */ > #define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001 > > +/* The v4l2 sub-device supports multiplexed streams. */ > +#define V4L2_SUBDEV_CAP_MPLEXED 0x00000002 > + > +/* > + * Is the route active? An active route will start when streaming is enabled > + * on a video node. > + */ > +#define V4L2_SUBDEV_ROUTE_FL_ACTIVE _BITUL(0) > + > +/* > + * Is the route immutable, i.e. can it be activated and inactivated? > + * Set by the driver. > + */ > +#define V4L2_SUBDEV_ROUTE_FL_IMMUTABLE _BITUL(1) > + > +/* > + * Is the route a source endpoint? A source endpoint route refers to a stream > + * generated internally by the subdevice (usually a sensor), and thus there > + * is no sink-side endpoint for the route. The sink_pad and sink_stream > + * fields are unused. > + * Set by the driver. > + */ > +#define V4L2_SUBDEV_ROUTE_FL_SOURCE _BITUL(2) > + > +/** > + * struct v4l2_subdev_route - A route inside a subdev > + * > + * @sink_pad: the sink pad index > + * @sink_stream: the sink stream identifier > + * @source_pad: the source pad index > + * @source_stream: the source stream identifier > + * @flags: route flags V4L2_SUBDEV_ROUTE_FL_* > + * @reserved: drivers and applications must zero this array > + */ > +struct v4l2_subdev_route { > + __u32 sink_pad; > + __u32 sink_stream; > + __u32 source_pad; > + __u32 source_stream; > + __u32 flags; > + __u32 reserved[5]; > +}; > + > +/** > + * 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 > + * @routes: pointer to the routes array > + * @reserved: drivers and applications must zero this array > + */ > +struct v4l2_subdev_routing { > + __u32 which; > + __u32 num_routes; > + __u64 routes; > + __u32 reserved[6]; > +}; > + > /* Backwards compatibility define --- to be removed */ > #define v4l2_subdev_edid v4l2_edid > > @@ -203,6 +275,8 @@ struct v4l2_subdev_capability { > #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) > #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) > #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) > +#define VIDIOC_SUBDEV_G_ROUTING _IOWR('V', 38, struct v4l2_subdev_routing) > +#define VIDIOC_SUBDEV_S_ROUTING _IOWR('V', 39, struct v4l2_subdev_routing) > /* The following ioctls are identical to the ioctls in videodev2.h */ > #define VIDIOC_SUBDEV_G_STD _IOR('V', 23, v4l2_std_id) > #define VIDIOC_SUBDEV_S_STD _IOW('V', 24, v4l2_std_id)
On 01/12/2021 19:50, Laurent Pinchart wrote: > Hi Tomi, > > Thank you for the patch. > > On Tue, Nov 30, 2021 at 04:18:12PM +0200, Tomi Valkeinen wrote: >> Update the Linux kernel headers for multiplexed streams. > > I suppose the patch is for testing only, and will be regenerated once > the API is merged in the kernel, before merging it in v4l-utils. It > should then use the sync-with-kernel.sh script to pull in all kernel > header changes. You're right. I should have mentioned that this series is not for merging. Tomi
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h index 658106f5..480891db 100644 --- a/include/linux/v4l2-subdev.h +++ b/include/linux/v4l2-subdev.h @@ -44,13 +44,15 @@ enum v4l2_subdev_format_whence { * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @format: media bus format (format code and frame size) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_format { __u32 which; __u32 pad; struct v4l2_mbus_framefmt format; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** @@ -58,13 +60,15 @@ struct v4l2_subdev_format { * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @rect: pad crop rectangle boundaries + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_crop { __u32 which; __u32 pad; struct v4l2_rect rect; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; #define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE 0x00000001 @@ -80,6 +84,7 @@ struct v4l2_subdev_crop { * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_mbus_code_enum { @@ -88,7 +93,8 @@ struct v4l2_subdev_mbus_code_enum { __u32 code; __u32 which; __u32 flags; - __u32 reserved[7]; + __u32 stream; + __u32 reserved[6]; }; /** @@ -101,6 +107,7 @@ struct v4l2_subdev_mbus_code_enum { * @min_height: minimum frame height, in pixels * @max_height: maximum frame height, in pixels * @which: format type (from enum v4l2_subdev_format_whence) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_size_enum { @@ -112,19 +119,22 @@ struct v4l2_subdev_frame_size_enum { __u32 min_height; __u32 max_height; __u32 which; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** * struct v4l2_subdev_frame_interval - Pad-level frame rate * @pad: pad number, as reported by the media API * @interval: frame interval in seconds + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_interval { __u32 pad; struct v4l2_fract interval; - __u32 reserved[9]; + __u32 stream; + __u32 reserved[8]; }; /** @@ -136,6 +146,7 @@ struct v4l2_subdev_frame_interval { * @height: frame height in pixels * @interval: frame interval in seconds * @which: format type (from enum v4l2_subdev_format_whence) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_interval_enum { @@ -146,7 +157,8 @@ struct v4l2_subdev_frame_interval_enum { __u32 height; struct v4l2_fract interval; __u32 which; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** @@ -158,6 +170,7 @@ struct v4l2_subdev_frame_interval_enum { * defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of the selection window + * @stream: stream number, defined in subdev routing * @reserved: for future use, set to zero for now * * Hardware may use multiple helper windows to process a video stream. @@ -170,7 +183,8 @@ struct v4l2_subdev_selection { __u32 target; __u32 flags; struct v4l2_rect r; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** @@ -188,6 +202,64 @@ struct v4l2_subdev_capability { /* The v4l2 sub-device video device node is registered in read-only mode. */ #define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001 +/* The v4l2 sub-device supports multiplexed streams. */ +#define V4L2_SUBDEV_CAP_MPLEXED 0x00000002 + +/* + * Is the route active? An active route will start when streaming is enabled + * on a video node. + */ +#define V4L2_SUBDEV_ROUTE_FL_ACTIVE _BITUL(0) + +/* + * Is the route immutable, i.e. can it be activated and inactivated? + * Set by the driver. + */ +#define V4L2_SUBDEV_ROUTE_FL_IMMUTABLE _BITUL(1) + +/* + * Is the route a source endpoint? A source endpoint route refers to a stream + * generated internally by the subdevice (usually a sensor), and thus there + * is no sink-side endpoint for the route. The sink_pad and sink_stream + * fields are unused. + * Set by the driver. + */ +#define V4L2_SUBDEV_ROUTE_FL_SOURCE _BITUL(2) + +/** + * struct v4l2_subdev_route - A route inside a subdev + * + * @sink_pad: the sink pad index + * @sink_stream: the sink stream identifier + * @source_pad: the source pad index + * @source_stream: the source stream identifier + * @flags: route flags V4L2_SUBDEV_ROUTE_FL_* + * @reserved: drivers and applications must zero this array + */ +struct v4l2_subdev_route { + __u32 sink_pad; + __u32 sink_stream; + __u32 source_pad; + __u32 source_stream; + __u32 flags; + __u32 reserved[5]; +}; + +/** + * 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 + * @routes: pointer to the routes array + * @reserved: drivers and applications must zero this array + */ +struct v4l2_subdev_routing { + __u32 which; + __u32 num_routes; + __u64 routes; + __u32 reserved[6]; +}; + /* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid @@ -203,6 +275,8 @@ struct v4l2_subdev_capability { #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) +#define VIDIOC_SUBDEV_G_ROUTING _IOWR('V', 38, struct v4l2_subdev_routing) +#define VIDIOC_SUBDEV_S_ROUTING _IOWR('V', 39, struct v4l2_subdev_routing) /* The following ioctls are identical to the ioctls in videodev2.h */ #define VIDIOC_SUBDEV_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_SUBDEV_S_STD _IOW('V', 24, v4l2_std_id)
Update the Linux kernel headers for multiplexed streams. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> --- include/linux/v4l2-subdev.h | 88 ++++++++++++++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 7 deletions(-)