Re: [PATCH v9 27/36] media: subdev: Add [GS]_ROUTING subdev ioctls and operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/10/2021 11:57, Tomi Valkeinen wrote:
From: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

Add support for subdev internal routing. A route is defined as a single
stream from a sink pad to a source pad.

The userspace can configure the routing via two new ioctls,
VIDIOC_SUBDEV_G_ROUTING and VIDIOC_SUBDEV_S_ROUTING, and subdevs can
implement the functionality with v4l2_subdev_pad_ops.set_routing().

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx>

<snip>

diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index 658106f5b5dc..5ba409db47ff 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -188,6 +188,61 @@ struct v4l2_subdev_capability {
  /* The v4l2 sub-device video device node is registered in read-only mode. */
  #define V4L2_SUBDEV_CAP_RO_SUBDEV		0x00000001
+/*
+ * Is the route active? An active route will start when streaming is enabled
+ * on a video node.
+ */
+#define V4L2_SUBDEV_ROUTE_FL_ACTIVE		(1 << 0)
+
+/*
+ * Is the route immutable, i.e. can it be activated and inactivated?
+ * Set by the driver.
+ */
+#define V4L2_SUBDEV_ROUTE_FL_IMMUTABLE		(1 << 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		(1 << 2)

I think we should have one more flag.

IMMUTABLE means that the route cannot be inactivated (or activated, but a route that's always inactive doesn't make sense), and even if it's not mentioned above, I think IMMUTABLE also means the route cannot be removed from the routing table, or changed in any way.

We should have a new flag that indicates that the route must exist, but it can be activated/inactivated. V4L2_SUBDEV_ROUTE_FL_STATIC? V4L2_SUBDEV_ROUTE_FL_IMMUTABLE would be a "superset" of V4L2_SUBDEV_ROUTE_FL_STATIC.

Or maybe we should have neither... Both are a bit challenging, as the routing system depends on user defined stream identifiers, which in practice means that only sensors might have IMMUTABLE or STATIC source routes. For every other subdev in the pipeline the userspace must be able to change the stream identifiers.

Perhaps just V4L2_SUBDEV_ROUTE_FL_SOURCE would be enough, which would also imply STATIC.

 Tomi



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux