Support ancillary links
cover Support ancillary links
Hi all
This series just fixes up the two places I could spot in v4l-utils that looked like they needed support for ancillary links [1] to be handled.
Patch 1 adds the new Macro directly; the git logs have that file updated as a sync from the newest version of the kernel, but as it's not upstream yet that's not something I can do; hope that's ok.
Thanks
Dan
[1] https://lore.kernel.org/linux-media/[email protected]/
Daniel Scally (3):
v4l-utils: Add MEDIA_LNK_FL_ANCILLARY_LINK macro
mc_nextgen_test: Display ancillary links
v4l2-compliance: Account for ancillary links
contrib/test/mc_nextgen_test.c | 61 +++++++++++++++-------- include/linux/media.h | 1 + utils/v4l2-compliance/v4l2-test-media.cpp | 6 ++- 3 files changed, 44 insertions(+), 24 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 v4l-utils: Add MEDIA_LNK_FL_ANCILLARY_LINK macro
Add a macro to describe the new type of media link in the kernel.
--- include/linux/media.h | 1 + 1 file changed, 1 insertion(+)
include/linux/media.h +1 -0
@@ -222,6 +222,7 @@ struct media_pad_desc {#define MEDIA_LNK_FL_LINK_TYPE (0xf << 28)# define MEDIA_LNK_FL_DATA_LINK (0 << 28)# define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) +# define MEDIA_LNK_FL_ANCILLARY_LINK (2 << 28)struct media_link_desc {struct media_pad_desc source;
Signature · 1 line
2.25.1
PATCH 2/3 mc_nextgen_test: Display ancillary links
In reply to Daniel ScallyAdd an argument to toggle display of ancillary links in the output of mc_nextgen_test. Update media_show_links() to account for the extra type of link and display them if configured by the right option.
The optargs table is reformatted, since with the new option name it doesn't really fit in the original indentations.
---
Alternatively the ancillary-links could be "ancl-links" or something to try and make it fit in the existing structure, but that seemed much uglier.
contrib/test/mc_nextgen_test.c | 61 ++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 22 deletions(-)
contrib/test/mc_nextgen_test.c +39 -22
@@ -47,17 +47,18 @@ const char *argp_program_bug_address = "Mauro Carvalho Chehab <[email protected]static const char doc[] ="\nA testing tool for the MC next geneneration API\n" ;static const struct argp_option options[] = { - {"entities" ,'e' ,0 ,0 ,"show entities" ,0 }, - {"interfaces" ,'i' ,0 ,0 ,"show pads" ,0 }, - {"data-links" ,'l' ,0 ,0 ,"show data links" ,0 }, - {"intf-links" ,'I' ,0 ,0 ,"show interface links" ,0 }, - {"dot" ,'D' ,0 ,0 ,"show in Graphviz format" ,0 }, - {"max_tsout" ,'t' ,"NUM_TSOUT" ,0 ,"max number of DTV TS out entities/interfaces in graphviz output (default: 5)" ,0 }, - {"device" ,'d' ,"DEVICE" ,0 ,"media controller device (default: /dev/media0" ,0 }, - - {"help" ,'?' ,0 ,0 ,"Give this help list" ,-1 }, - {"usage" ,-3 ,0 ,0 ,"Give a short usage message" }, - {"version" ,'V' ,0 ,0 ,"Print program version" ,-1 }, + {"entities" ,'e' ,0 ,0 ,"show entities" ,0 }, + {"interfaces" ,'i' ,0 ,0 ,"show pads" ,0 }, + {"data-links" ,'l' ,0 ,0 ,"show data links" ,0 }, + {"intf-links" ,'I' ,0 ,0 ,"show interface links" ,0 }, + {"ancillary-links" ,'a' ,0 ,0 ,"show ancillary links" ,0 }, + {"dot" ,'D' ,0 ,0 ,"show in Graphviz format" ,0 }, + {"max_tsout" ,'t' ,"NUM_TSOUT" ,0 ,"max number of DTV TS out entities/interfaces in graphviz output (default: 5)" ,0 }, + {"device" ,'d' ,"DEVICE" ,0 ,"media controller device (default: /dev/media0" ,0 }, + + {"help" ,'?' ,0 ,0 ,"Give this help list" ,-1 }, + {"usage" ,-3 ,0 ,0 ,"Give a short usage message" }, + {"version" ,'V' ,0 ,0 ,"Print program version" ,-1 }, {0 ,0 ,0 ,0 ,0 ,0 } };
@@ -65,6 +66,7 @@ static int show_entities = 0;static int show_interfaces =0 ;static int show_data_links =0 ;static int show_intf_links =0 ; +static int show_ancillary_links =0 ;static int show_dot =0 ;static int max_tsout =5 ;static char media_device[256 ] ="/dev/media0" ;
@@ -90,6 +92,9 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state)case 'I' : show_intf_links++;break ; +case 'a' : + show_ancillary_links++; +break ;case 'D' : show_dot++;break ;
@@ -659,29 +664,41 @@ static void media_show_links(struct media_controller *mc)struct media_v2_link *link = &links[i];char *obj, *source_obj, *sink_obj; - color =BLUE ; -if (media_type (link->source_id) ==MEDIA_GRAPH_PAD ) { +__u32 type = link->flags &MEDIA_LNK_FL_LINK_TYPE ; + + color =CYAN ; +switch (type) { +case MEDIA_LNK_FL_DATA_LINK :if (!show_data_links)continue ; - color =CYAN ; - } -if (media_type (link->source_id) ==MEDIA_GRAPH_INTF_DEVNODE ) { +show (color,0 ,"data" ); + +break ; +case MEDIA_LNK_FL_INTERFACE_LINK :if (!show_intf_links)continue ; + + color =BLUE ; +show (color,0 ,"interface" ); + +break ; +case MEDIA_LNK_FL_ANCILLARY_LINK : +if (!show_ancillary_links) +continue ; + + color =MAGENTA ; +show (color,0 ,"ancillary" ); +break ; } obj =objname (link->id,'#' ); source_obj =objname (link->source_id,'#' ); sink_obj =objname (link->sink_id,'#' ); -if ((link->flags &MEDIA_LNK_FL_LINK_TYPE ) ==MEDIA_LNK_FL_INTERFACE_LINK ) -show (color,0 ,"interface " ); -else -show (color,0 ,"data " );show (color,0 ,"link %s: %s %s %s" , obj, source_obj, - ((link->flags &MEDIA_LNK_FL_LINK_TYPE ) ==MEDIA_LNK_FL_INTERFACE_LINK ) ?"<=>" :"=>" , + ((type) ==MEDIA_LNK_FL_DATA_LINK ) ?"=>" :"<=>" , sink_obj);if (link->flags &MEDIA_LNK_FL_IMMUTABLE )show (color,0 ," [IMMUTABLE]" );
@@ -1117,7 +1134,7 @@ int main(int argc, char *argv[])if (show_interfaces)media_show_interfaces (mc); -if (show_data_links || show_intf_links) +if (show_data_links || show_intf_links || show_ancillary_links)media_show_links (mc); }
Signature · 1 line
2.25.1
PATCH 3/3 v4l2-compliance: Account for ancillary links
In reply to Daniel ScallyUpdate v4l2-compliance to account for ancillary links, since there are a couple of places in it that explicitly assume only two types of links exist.
--- utils/v4l2-compliance/v4l2-test-media.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
utils/v4l2-compliance/v4l2-test-media.cpp +4 -2
@@ -261,7 +261,8 @@ int testMediaTopology(struct node *node) for (unsigned i = 0; i < topology.num_links; i++) { media_v2_link &link = v2_links[i]; - bool is_iface = link.flags & MEDIA_LNK_FL_LINK_TYPE; + bool is_iface = (link.flags & MEDIA_LNK_FL_LINK_TYPE) == + MEDIA_LNK_FL_INTERFACE_LINK ? true : false; fail_on_test(check_0(link.reserved, sizeof(link.reserved))); fail_on_test(!link.id);
@@ -460,7 +461,8 @@ int testMediaEnum(struct node *node) link_disabled = links.links[i]; // This ioctl only returns data links - fail_on_test(fl & MEDIA_LNK_FL_LINK_TYPE); + fail_on_test((fl & MEDIA_LNK_FL_LINK_TYPE) != + MEDIA_LNK_FL_DATA_LINK); fail_on_test(links.links[i].sink.entity == links.links[i].source.entity); if (is_sink) { fail_on_test(links.links[i].sink.index >= ent.pads);
Signature · 1 line
2.25.1