From 84a1a15027023e8b888853772b6efc9a4d5f5b88 Mon Sep 17 00:00:00 2001 From: Adrian Fiergolski Date: Fri, 29 Jan 2021 13:06:24 +0100 Subject: [PATCH 1/2] Patch v4l-utils adding support for v4l2 video routing in the kernel. Signed-off-by: Adrian Fiergolski --- ...-the-Kernel-headers-for-routing-oper.patch | 75 +++++ ...-ctl-add-ROUTING-get-and-set-options.patch | 303 ++++++++++++++++++ ...-linux-xlnx-kernel-v2020.1-for-routi.patch | 161 ++++++++++ .../v4l2apps/v4l-utils_%.bbappend | 6 + 4 files changed, 545 insertions(+) create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Synchronize-with-the-Kernel-headers-for-routing-oper.patch create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0002-v4l2-ctl-add-ROUTING-get-and-set-options.patch create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0003-Synchronise-with-linux-xlnx-kernel-v2020.1-for-routi.patch create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Synchronize-with-the-Kernel-headers-for-routing-oper.patch b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Synchronize-with-the-Kernel-headers-for-routing-oper.patch new file mode 100644 index 000000000..fecafc3cc --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Synchronize-with-the-Kernel-headers-for-routing-oper.patch @@ -0,0 +1,75 @@ +From efbc55c03f7dc5943312e16eb479ebf496fad221 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= + +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 +--- + 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 + diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0002-v4l2-ctl-add-ROUTING-get-and-set-options.patch b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0002-v4l2-ctl-add-ROUTING-get-and-set-options.patch new file mode 100644 index 000000000..2f0a9e1c1 --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0002-v4l2-ctl-add-ROUTING-get-and-set-options.patch @@ -0,0 +1,303 @@ +From f3f0d9d433894ce7a9ea1c615b978b0896e73daf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= + +Date: Tue, 12 Dec 2017 02:04:24 +0000 +Subject: [PATCH 2/3] v4l2-ctl: add ROUTING get and set options +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Niklas Söderlund +--- + utils/v4l2-ctl/Android.mk | 2 +- + utils/v4l2-ctl/Makefile.am | 2 +- + utils/v4l2-ctl/v4l2-ctl-routing.cpp | 154 ++++++++++++++++++++++++++++ + utils/v4l2-ctl/v4l2-ctl.cpp | 10 ++ + utils/v4l2-ctl/v4l2-ctl.h | 9 ++ + 5 files changed, 175 insertions(+), 2 deletions(-) + create mode 100644 utils/v4l2-ctl/v4l2-ctl-routing.cpp + +diff --git a/utils/v4l2-ctl/Android.mk b/utils/v4l2-ctl/Android.mk +index 1eab3cd2..2fef78af 100644 +--- a/utils/v4l2-ctl/Android.mk ++++ b/utils/v4l2-ctl/Android.mk +@@ -22,5 +22,5 @@ LOCAL_SRC_FILES := \ + v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \ + v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ + v4l2-ctl-meta.cpp v4l2-ctl-subdev.cpp v4l2-info.cpp media-info.cpp \ +- v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c codec-fwht.c ++ v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c codec-fwht.c v4l2-ctl-routing.cpp + include $(BUILD_EXECUTABLE) +diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am +index f612e0ee..31746fcc 100644 +--- a/utils/v4l2-ctl/Makefile.am ++++ b/utils/v4l2-ctl/Makefile.am +@@ -7,7 +7,7 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp + v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \ + v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ + v4l2-ctl-subdev.cpp v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c v4l2-ctl-meta.cpp \ +- media-info.cpp v4l2-info.cpp codec-fwht.c codec-v4l2-fwht.c ++ media-info.cpp v4l2-info.cpp codec-fwht.c codec-v4l2-fwht.c v4l2-ctl-routing.cpp + v4l2_ctl_CPPFLAGS = -I$(top_srcdir)/utils/common + + media-bus-format-names.h: ../../include/linux/media-bus-format.h +diff --git a/utils/v4l2-ctl/v4l2-ctl-routing.cpp b/utils/v4l2-ctl/v4l2-ctl-routing.cpp +new file mode 100644 +index 00000000..55a2e449 +--- /dev/null ++++ b/utils/v4l2-ctl/v4l2-ctl-routing.cpp +@@ -0,0 +1,154 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "v4l2-ctl.h" ++ ++#include ++ ++/* ++ * The max value comes from a check in the kernel source code ++ * drivers/media/v4l2-core/v4l2-ioctl.c check_array_args() ++ */ ++#define NUM_ROUTES_MAX 256 ++ ++#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) ++ ++struct v4l2_subdev_routing routing; ++struct v4l2_subdev_route routes[NUM_ROUTES_MAX]; ++ ++struct flag_name { ++ __u32 flag; ++ const char *name; ++}; ++ ++static void print_flags(const struct flag_name *flag_names, unsigned int num_entries, __u32 flags) ++{ ++ bool first = true; ++ unsigned int i; ++ ++ for (i = 0; i < num_entries; i++) { ++ if (!(flags & flag_names[i].flag)) ++ continue; ++ if (!first) ++ printf(","); ++ printf("%s", flag_names[i].name); ++ flags &= ~flag_names[i].flag; ++ first = false; ++ } ++ ++ if (flags) { ++ if (!first) ++ printf(","); ++ printf("0x%x", flags); ++ } ++} ++ ++static void print_routes(const struct v4l2_subdev_routing *r) ++{ ++ unsigned int i; ++ ++ static const struct flag_name route_flags[] = { ++ { V4L2_SUBDEV_ROUTE_FL_ACTIVE, "ENABLED" }, ++ { V4L2_SUBDEV_ROUTE_FL_IMMUTABLE, "IMMUTABLE" }, ++ }; ++ ++ for (i = 0; i < r->num_routes; i++) { ++ printf("%d/%d -> %d/%d [", ++ r->routes[i].sink_pad, r->routes[i].sink_stream, ++ r->routes[i].source_pad, r->routes[i].source_stream); ++ print_flags(route_flags, ARRAY_SIZE(route_flags), r->routes[i].flags); ++ printf("]\n"); ++ } ++} ++ ++void routing_usage(void) ++{ ++ printf("\nRoute options:\n" ++ " --get-routing Print the route topology\n" ++ " --set-routing routes Comma-separated list of route descriptors to setup\n" ++ "\n" ++ "Routes are defined as\n" ++ " routes = route { ',' route } ;\n" ++ " route = sink '->' source '[' flags ']' ;\n" ++ " sink = sink-pad '/' sink-stream ;\n" ++ " source = source-pad '/' source-stream ;\n" ++ "\n" ++ "where the fields are\n" ++ " sink-pad = Pad numeric identifier for sink\n" ++ " sink-stream = Stream numeric identifier for sink\n" ++ " source-pad = Pad numeric identifier for source\n" ++ " source-stream = Stream numeric identifier for source\n" ++ " flags = Route flags (0: inactive, 1: active)\n" ++ ); ++} ++ ++/******************************************************/ ++ ++void routing_cmd(int ch, char *optarg) ++{ ++ struct v4l2_subdev_route *r; ++ char *end, *ref, *tok; ++ unsigned int flags; ++ ++ switch (ch) { ++ case OptSetRouting: ++ memset(&routing, 0, sizeof(routing)); ++ memset(routes, 0, sizeof(routes[0]) * NUM_ROUTES_MAX); ++ routing.num_routes = 0; ++ routing.routes = routes; ++ ++ if (!optarg) ++ break; ++ ++ r = routing.routes; ++ ref = end = strdup(optarg); ++ while ((tok = strsep(&end, ",")) != NULL) { ++ if (sscanf(tok, "%u/%u -> %u/%u [%u]", ++ &r->sink_pad, &r->sink_stream, ++ &r->source_pad, &r->source_stream, ++ &flags) != 5 || (flags != 0 && flags != 1)) { ++ free(ref); ++ fprintf(stderr, "Invalid route information specified\n"); ++ routing_usage(); ++ exit(1); ++ } ++ ++ if (flags == 1) ++ r->flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE; ++ ++ r++; ++ routing.num_routes++; ++ } ++ free(ref); ++ ++ break; ++ } ++} ++ ++void routing_set(int fd) ++{ ++ if (options[OptSetRouting]) { ++ if (doioctl(fd, VIDIOC_SUBDEV_S_ROUTING, &routing) == 0) ++ printf("Routing set\n"); ++ } ++} ++ ++void routing_get(int fd) ++{ ++ if (options[OptGetRouting]) { ++ memset(&routing, 0, sizeof(routing)); ++ memset(routes, 0, sizeof(routes[0]) * NUM_ROUTES_MAX); ++ routing.num_routes = NUM_ROUTES_MAX; ++ routing.routes = routes; ++ ++ if (doioctl(fd, VIDIOC_SUBDEV_G_ROUTING, &routing) == 0) ++ print_routes(&routing); ++ } ++} +diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp +index cbe31c84..8cc11d88 100644 +--- a/utils/v4l2-ctl/v4l2-ctl.cpp ++++ b/utils/v4l2-ctl/v4l2-ctl.cpp +@@ -96,6 +96,7 @@ static struct option long_options[] = { + {"help-misc", no_argument, 0, OptHelpMisc}, + {"help-streaming", no_argument, 0, OptHelpStreaming}, + {"help-edid", no_argument, 0, OptHelpEdid}, ++ {"help-routing", no_argument, 0, OptHelpRouting}, + {"help-all", no_argument, 0, OptHelpAll}, + #ifndef NO_LIBV4L2 + {"wrapper", no_argument, 0, OptUseWrapper}, +@@ -236,6 +237,8 @@ static struct option long_options[] = { + {"get-edid", optional_argument, 0, OptGetEdid}, + {"info-edid", optional_argument, 0, OptInfoEdid}, + {"fix-edid-checksums", no_argument, 0, OptFixEdidChecksums}, ++ {"set-routing", required_argument, 0, OptSetRouting}, ++ {"get-routing", no_argument, 0, OptGetRouting}, + {"tuner-index", required_argument, 0, OptTunerIndex}, + {"list-buffers", no_argument, 0, OptListBuffers}, + {"list-buffers-out", no_argument, 0, OptListBuffersOut}, +@@ -303,6 +306,7 @@ static void usage_all(void) + misc_usage(); + streaming_usage(); + edid_usage(); ++ routing_usage(); + } + + int test_ioctl(int fd, int cmd, void *arg) +@@ -1177,6 +1181,9 @@ int main(int argc, char **argv) + case OptHelpEdid: + edid_usage(); + return 0; ++ case OptHelpRouting: ++ routing_usage(); ++ return 0; + case OptHelpAll: + usage_all(); + return 0; +@@ -1236,6 +1243,7 @@ int main(int argc, char **argv) + misc_cmd(ch, optarg); + streaming_cmd(ch, optarg); + edid_cmd(ch, optarg); ++ routing_cmd(ch, optarg); + break; + } + } +@@ -1429,6 +1437,7 @@ int main(int argc, char **argv) + selection_set(c_fd); + misc_set(c_fd); + edid_set(c_fd); ++ routing_set(fd); + + /* Get options */ + +@@ -1446,6 +1455,7 @@ int main(int argc, char **argv) + selection_get(c_fd); + misc_get(c_fd); + edid_get(c_fd); ++ routing_get(fd); + + /* List options */ + +diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h +index f4170e76..3df65fdb 100644 +--- a/utils/v4l2-ctl/v4l2-ctl.h ++++ b/utils/v4l2-ctl/v4l2-ctl.h +@@ -197,6 +197,8 @@ enum Option { + OptGetEdid, + OptInfoEdid, + OptFixEdidChecksums, ++ OptSetRouting, ++ OptGetRouting, + OptFreqSeek, + OptEncoderCmd, + OptTryEncoderCmd, +@@ -262,6 +264,7 @@ enum Option { + OptHelpMisc, + OptHelpStreaming, + OptHelpEdid, ++ OptHelpRouting, + OptHelpAll, + OptLast = 512 + }; +@@ -428,6 +431,12 @@ void edid_cmd(int ch, char *optarg); + void edid_set(cv4l_fd &fd); + void edid_get(cv4l_fd &fd); + ++// v4l2-ctl-routing.cpp ++void routing_usage(void); ++void routing_cmd(int ch, char *optarg); ++void routing_set(int fd); ++void routing_get(int fd); ++ + /* v4l2-ctl-modes.cpp */ + bool calc_cvt_modeline(int image_width, int image_height, + int refresh_rate, int reduced_blanking, +-- +2.30.0 + diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0003-Synchronise-with-linux-xlnx-kernel-v2020.1-for-routi.patch b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0003-Synchronise-with-linux-xlnx-kernel-v2020.1-for-routi.patch new file mode 100644 index 000000000..df071e775 --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0003-Synchronise-with-linux-xlnx-kernel-v2020.1-for-routi.patch @@ -0,0 +1,161 @@ +From d1fd58d819a25cb6983833084b0d2dd72a57e19a Mon Sep 17 00:00:00 2001 +From: Adrian Fiergolski +Date: Thu, 28 Jan 2021 17:17:09 +0100 +Subject: [PATCH 3/3] Synchronise with linux-xlnx kernel v2020.1 for routing + operations. + +Signed-off-by: Adrian Fiergolski +--- + include/linux/v4l2-subdev.h | 30 ++++------------ + utils/v4l2-ctl/v4l2-ctl-routing.cpp | 53 +++-------------------------- + 2 files changed, 10 insertions(+), 73 deletions(-) + +diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h +index af069bf..440afc0 100644 +--- a/include/linux/v4l2-subdev.h ++++ b/include/linux/v4l2-subdev.h +@@ -155,42 +155,24 @@ 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. ++ * @sink: the sink pad ++ * @source: the source pad + */ + struct v4l2_subdev_route { +- __u32 sink_pad; +- __u32 sink_stream; +- __u32 source_pad; +- __u32 source_stream; +- __u32 flags; +- __u32 reserved[5]; ++ __u32 sink; ++ __u32 source; + }; + + /** + * struct v4l2_subdev_routing - Routing information +- * @routes: the routes array + * @num_routes: the total number of routes in the routes array ++ * @routes: the routes array + */ + struct v4l2_subdev_routing { +- struct v4l2_subdev_route *routes; + __u32 num_routes; +- __u32 reserved[5]; ++ struct v4l2_subdev_route *routes; + }; + + /* Backwards compatibility define --- to be removed */ +diff --git a/utils/v4l2-ctl/v4l2-ctl-routing.cpp b/utils/v4l2-ctl/v4l2-ctl-routing.cpp +index 55a2e44..333f60e 100644 +--- a/utils/v4l2-ctl/v4l2-ctl-routing.cpp ++++ b/utils/v4l2-ctl/v4l2-ctl-routing.cpp +@@ -23,48 +23,12 @@ + struct v4l2_subdev_routing routing; + struct v4l2_subdev_route routes[NUM_ROUTES_MAX]; + +-struct flag_name { +- __u32 flag; +- const char *name; +-}; +- +-static void print_flags(const struct flag_name *flag_names, unsigned int num_entries, __u32 flags) +-{ +- bool first = true; +- unsigned int i; +- +- for (i = 0; i < num_entries; i++) { +- if (!(flags & flag_names[i].flag)) +- continue; +- if (!first) +- printf(","); +- printf("%s", flag_names[i].name); +- flags &= ~flag_names[i].flag; +- first = false; +- } +- +- if (flags) { +- if (!first) +- printf(","); +- printf("0x%x", flags); +- } +-} +- + static void print_routes(const struct v4l2_subdev_routing *r) + { + unsigned int i; + +- static const struct flag_name route_flags[] = { +- { V4L2_SUBDEV_ROUTE_FL_ACTIVE, "ENABLED" }, +- { V4L2_SUBDEV_ROUTE_FL_IMMUTABLE, "IMMUTABLE" }, +- }; +- + for (i = 0; i < r->num_routes; i++) { +- printf("%d/%d -> %d/%d [", +- r->routes[i].sink_pad, r->routes[i].sink_stream, +- r->routes[i].source_pad, r->routes[i].source_stream); +- print_flags(route_flags, ARRAY_SIZE(route_flags), r->routes[i].flags); +- printf("]\n"); ++ printf("%u -> %u\n", r->routes[i].sink, r->routes[i].source); + } + } + +@@ -77,15 +41,12 @@ void routing_usage(void) + "Routes are defined as\n" + " routes = route { ',' route } ;\n" + " route = sink '->' source '[' flags ']' ;\n" +- " sink = sink-pad '/' sink-stream ;\n" +- " source = source-pad '/' source-stream ;\n" ++ " sink = sink-pad ;\n" ++ " source = source-pad ;\n" + "\n" + "where the fields are\n" + " sink-pad = Pad numeric identifier for sink\n" +- " sink-stream = Stream numeric identifier for sink\n" + " source-pad = Pad numeric identifier for source\n" +- " source-stream = Stream numeric identifier for source\n" +- " flags = Route flags (0: inactive, 1: active)\n" + ); + } + +@@ -110,19 +71,13 @@ void routing_cmd(int ch, char *optarg) + r = routing.routes; + ref = end = strdup(optarg); + while ((tok = strsep(&end, ",")) != NULL) { +- if (sscanf(tok, "%u/%u -> %u/%u [%u]", +- &r->sink_pad, &r->sink_stream, +- &r->source_pad, &r->source_stream, +- &flags) != 5 || (flags != 0 && flags != 1)) { ++ if (sscanf(tok, "%u -> %u", &r->sink, &r->source) != 2) { + free(ref); + fprintf(stderr, "Invalid route information specified\n"); + routing_usage(); + exit(1); + } + +- if (flags == 1) +- r->flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE; +- + r++; + routing.num_routes++; + } +-- +2.30.0 + diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend new file mode 100644 index 000000000..484d70fb3 --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS_prepend_zynqmp := "${THISDIR}/files:" + +SRC_URI_append = "file://0001-Synchronize-with-the-Kernel-headers-for-routing-oper.patch \ + file://0002-v4l2-ctl-add-ROUTING-get-and-set-options.patch \ + file://0003-Synchronise-with-linux-xlnx-kernel-v2020.1-for-routi.patch \ + " From e3407ddf77af8da035411e71f0abacc10b647990 Mon Sep 17 00:00:00 2001 From: Adrian Fiergolski Date: Fri, 29 Jan 2021 13:08:11 +0100 Subject: [PATCH 2/2] Add to v4l-utils Xilinx specific and FIXED pixel formats, raw colour space support. Signed-off-by: Adrian Fiergolski --- .../0001-Add-RAW-colour-space-support.patch | 24 +++++++++ .../0001-Add-Xilinx-specific-formats.patch | 51 +++++++++++++++++++ ...1-Add-support-for-FIXED-pixel-format.patch | 24 +++++++++ .../v4l2apps/v4l-utils_%.bbappend | 3 ++ 4 files changed, 102 insertions(+) create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-RAW-colour-space-support.patch create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-Xilinx-specific-formats.patch create mode 100644 meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-support-for-FIXED-pixel-format.patch diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-RAW-colour-space-support.patch b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-RAW-colour-space-support.patch new file mode 100644 index 000000000..0496567ef --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-RAW-colour-space-support.patch @@ -0,0 +1,24 @@ +From 430486b98c964f3fae07094f3ba72944c3529d53 Mon Sep 17 00:00:00 2001 +From: Adrian Fiergolski +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 + diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-Xilinx-specific-formats.patch b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-Xilinx-specific-formats.patch new file mode 100644 index 000000000..de6aff17f --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-Xilinx-specific-formats.patch @@ -0,0 +1,51 @@ +From 4b3c1a79ccfdf0abae10afee0b51584ed8fbcf68 Mon Sep 17 00:00:00 2001 +From: Adrian Fiergolski +Date: Thu, 28 Jan 2021 17:01:06 +0100 +Subject: [PATCH] Add Xilinx specific formats. + +Signed-off-by: Adrian Fiergolski +--- + 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 + diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-support-for-FIXED-pixel-format.patch b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-support-for-FIXED-pixel-format.patch new file mode 100644 index 000000000..e0d206495 --- /dev/null +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/files/0001-Add-support-for-FIXED-pixel-format.patch @@ -0,0 +1,24 @@ +From b21f01fc21c3071706540c13d4631bb1ea44c657 Mon Sep 17 00:00:00 2001 +From: Adrian Fiergolski +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 + diff --git a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend index 484d70fb3..ac784f63b 100644 --- a/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend +++ b/meta-xilinx-bsp/recipes-multimedia/v4l2apps/v4l-utils_%.bbappend @@ -3,4 +3,7 @@ FILESEXTRAPATHS_prepend_zynqmp := "${THISDIR}/files:" SRC_URI_append = "file://0001-Synchronize-with-the-Kernel-headers-for-routing-oper.patch \ file://0002-v4l2-ctl-add-ROUTING-get-and-set-options.patch \ file://0003-Synchronise-with-linux-xlnx-kernel-v2020.1-for-routi.patch \ + file://0001-Add-Xilinx-specific-formats.patch \ + file://0001-Add-support-for-FIXED-pixel-format.patch \ + file://0001-Add-RAW-colour-space-support.patch \ "