Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4l-utils: add support for video routing and Xilinx formats #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 430486b98c964f3fae07094f3ba72944c3529d53 Mon Sep 17 00:00:00 2001
From: Adrian Fiergolski <[email protected]>
Date: Thu, 28 Jan 2021 17:04:58 +0100
Subject: [PATCH] Add RAW colour space support.

---
utils/media-ctl/libv4l2subdev.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index 9372a78..a0746d7 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -968,6 +968,7 @@ static struct {
{ "oprgb", V4L2_COLORSPACE_OPRGB },
{ "bt2020", V4L2_COLORSPACE_BT2020 },
{ "dcip3", V4L2_COLORSPACE_DCI_P3 },
+ { "raw", V4L2_COLORSPACE_RAW },
};

const char *v4l2_subdev_colorspace_to_string(enum v4l2_colorspace colorspace)
--
2.30.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 4b3c1a79ccfdf0abae10afee0b51584ed8fbcf68 Mon Sep 17 00:00:00 2001
From: Adrian Fiergolski <[email protected]>
Date: Thu, 28 Jan 2021 17:01:06 +0100
Subject: [PATCH] Add Xilinx specific formats.

Signed-off-by: Adrian Fiergolski <[email protected]>
---
include/linux/media-bus-format.h | 16 ++++++++++++++++
utils/media-ctl/libv4l2subdev.c | 1 +
2 files changed, 17 insertions(+)

diff --git a/include/linux/media-bus-format.h b/include/linux/media-bus-format.h
index d6a5a3b..76f24dc 100644
--- a/include/linux/media-bus-format.h
+++ b/include/linux/media-bus-format.h
@@ -153,4 +153,20 @@
/* HSV - next is 0x6002 */
#define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001

+/* RGB: Xilinx Specific - next is 0x1103 */
+#define MEDIA_BUS_FMT_RBG101010_1X30 0x1100
+#define MEDIA_BUS_FMT_RBG121212_1X36 0x1101
+#define MEDIA_BUS_FMT_RBG161616_1X48 0x1102
+
+/* YUV: Xilinx Specific - next is 0x2109 */
+#define MEDIA_BUS_FMT_VYYUYY8_1X24 0x2100
+#define MEDIA_BUS_FMT_VYYUYY10_4X20 0x2101
+#define MEDIA_BUS_FMT_VUY10_1X30 0x2102
+#define MEDIA_BUS_FMT_UYYVYY12_4X24 0x2103
+#define MEDIA_BUS_FMT_VUY12_1X36 0x2104
+#define MEDIA_BUS_FMT_Y16_1X16 0x2105
+#define MEDIA_BUS_FMT_UYYVYY16_4X32 0x2106
+#define MEDIA_BUS_FMT_VUY16_1X48 0x2107
+#define MEDIA_BUS_FMT_UYVY16_2X32 0x2108
+
#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index a989efb..ebe3318 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -858,6 +858,7 @@ static const struct {
{ "Y8", MEDIA_BUS_FMT_Y8_1X8},
{ "Y10", MEDIA_BUS_FMT_Y10_1X10 },
{ "Y12", MEDIA_BUS_FMT_Y12_1X12 },
+ { "Y16", MEDIA_BUS_FMT_Y16_1X16 },
{ "YUYV", MEDIA_BUS_FMT_YUYV8_1X16 },
{ "YUYV1_5X8", MEDIA_BUS_FMT_YUYV8_1_5X8 },
{ "YUYV2X8", MEDIA_BUS_FMT_YUYV8_2X8 },
--
2.30.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From b21f01fc21c3071706540c13d4631bb1ea44c657 Mon Sep 17 00:00:00 2001
From: Adrian Fiergolski <[email protected]>
Date: Thu, 28 Jan 2021 17:03:58 +0100
Subject: [PATCH] Add support for FIXED pixel format.

---
utils/media-ctl/libv4l2subdev.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index ebe3318..9372a78 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -855,6 +855,7 @@ static const struct {
enum v4l2_mbus_pixelcode code;
} mbus_formats[] = {
#include "media-bus-format-names.h"
+ { "FIXED", MEDIA_BUS_FMT_FIXED},
{ "Y8", MEDIA_BUS_FMT_Y8_1X8},
{ "Y10", MEDIA_BUS_FMT_Y10_1X10 },
{ "Y12", MEDIA_BUS_FMT_Y12_1X12 },
--
2.30.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
From efbc55c03f7dc5943312e16eb479ebf496fad221 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?=
<[email protected]>
Date: Tue, 12 Dec 2017 02:03:46 +0000
Subject: [PATCH 1/2] Synchronize with the Kernel headers for routing
operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Niklas Söderlund <[email protected]>
---
include/linux/v4l2-subdev.h | 40 +++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 03970ce3..af069bfb 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -155,6 +155,44 @@ struct v4l2_subdev_selection {
__u32 reserved[8];
};

+#define V4L2_SUBDEV_ROUTE_FL_ACTIVE (1 << 0)
+#define V4L2_SUBDEV_ROUTE_FL_IMMUTABLE (1 << 1)
+
+/**
+ * struct v4l2_subdev_route - A signal route inside a subdev
+ * @sink_pad: the sink pad
+ * @sink_stream: the sink stream
+ * @source_pad: the source pad
+ * @source_stream: the source stream
+ * @flags: route flags:
+ *
+ * V4L2_SUBDEV_ROUTE_FL_ACTIVE: Is the stream in use or not? An
+ * active stream will start when streaming is enabled on a video
+ * node. Set by the user.
+ *
+ * V4L2_SUBDEV_ROUTE_FL_IMMUTABLE: Is the stream immutable, i.e.
+ * can it be activated and inactivated? Set by the driver.
+ */
+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 - Routing information
+ * @routes: the routes array
+ * @num_routes: the total number of routes in the routes array
+ */
+struct v4l2_subdev_routing {
+ struct v4l2_subdev_route *routes;
+ __u32 num_routes;
+ __u32 reserved[5];
+};
+
/* Backwards compatibility define --- to be removed */
#define v4l2_subdev_edid v4l2_edid

@@ -181,5 +219,7 @@ struct v4l2_subdev_selection {
#define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
#define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
#define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
+#define VIDIOC_SUBDEV_G_ROUTING _IOWR('V', 38, struct v4l2_subdev_routing)
+#define VIDIOC_SUBDEV_S_ROUTING _IOWR('V', 39, struct v4l2_subdev_routing)

#endif
--
2.30.0

Loading