modetest: switch usage to proper options grammar
authorNeil Armstrong <neil.armstrong@linaro.org>
Wed, 18 Jan 2023 13:28:35 +0000 (14:28 +0100)
committerDmitry Baryshkov <dbaryshkov@gmail.com>
Wed, 15 Nov 2023 09:11:48 +0000 (09:11 +0000)
It was unclear how #mode could be used, so fixup the usage string and print
the struct grammar of the -s and -P options to clarify the usage.

The following grammar was compiled:
<plane_topology> ::= <plane_id> "@" <crtc_id> ":" <width> "x" <height> ( <plane_offsets> )?
<plane_offsets> ::= "+" <x_offset> "+" <y_offset> ( <plane_scale> )?
<plane_scale> ::= "*" <scale> ( <plane_format> )?
<plane_format> ::= "@" <format>

<mode_topology> ::= <connector_id> ( "," <connector_id> )* ( "@" <crtc_id> )? ":" <mode_selection> ( "@" <format> )?
<mode_selection> ::=  <indexed_mode> | <named_mode> | <custom_mode>
<indexed_mode> ::=  "#" <mode_index>
<named_mode> ::=  <width> "x" <height> ( "-" <vrefresh> )?
<custom_mode> ::=  <hdisplay> "," <hsyncstart> "," <hsyncend> "," <htotal> "," <vdisplay> "," <vsyncstart> "," <vsyncend> "," <vtotal>  "-" <vrefresh>
<property>  ::= <object_id> ":" <property_name> ":" <value>

<plane_id> ::= [0-9]+
<crtc_id> ::= [0-9]+
<width> ::= [0-9]+
<height> ::= [0-9]+
<x_offset> ::= [0-9]+
<y_offset> ::= [0-9]+
<scale> ::= [0-9]+ ( "." [0-9]+ )
<format> ::= ( [A-Z] | [0-9] )+
<connector_id> ::= [0-9]+
<mode_index> ::= [0-9]+
<hdisplay> ::= [0-9]+
<hsyncstart> ::= [0-9]+
<hsyncend> ::= [0-9]+
<htotal> ::= [0-9]+
<vdisplay> ::= [0-9]+
<vsyncstart> ::= [0-9]+
<vsyncend> ::= [0-9]+
<vtotal> ::= [0-9]+
<object_id> ::= [0-9]+
<vrefresh> ::= [0-9]+
<property_name> ::= ( [A-Z] | [0-9] | "_" )+
<value> ::= [0-9]+

with the https://bnfplayground.pauliankline.com/ service

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
tests/modetest/modetest.c

index cc96015..d9e761e 100644 (file)
@@ -2137,13 +2137,16 @@ static void usage(char *name)
        fprintf(stderr, "\t-p\tlist CRTCs and planes (pipes)\n");
 
        fprintf(stderr, "\n Test options:\n\n");
-       fprintf(stderr, "\t-P <plane_id>@<crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>]\tset a plane\n");
-       fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:[#<mode index>]<mode>[-<vrefresh>][@<format>]\tset a mode\n");
-       fprintf(stderr, "\t\tcustom mode can be specified as <hdisplay>,<hsyncstart>,<hsyncend>,<htotal>,<vdisplay>,<vsyncstart>,<vsyncend>,<vtotal>\n");
+       fprintf(stderr, "\t-P <plane_id>@<crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>]\tset a plane, see 'plane-topology'\n");
+       fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:mode[@<format>]\tset a mode, see 'mode-topology'\n");
+       fprintf(stderr, "\t\twhere mode can be specified as:\n");
+       fprintf(stderr, "\t\t<hdisp>x<vdisp>[-<vrefresh>]\n");
+       fprintf(stderr, "\t\t<hdisp>,<hss>,<hse>,<htot>,<vdisp>,<vss>,<vse>,<vtot>-<vrefresh>\n");
+       fprintf(stderr, "\t\t#<mode index>\n");
        fprintf(stderr, "\t-C\ttest hw cursor\n");
        fprintf(stderr, "\t-v\ttest vsynced page flipping\n");
        fprintf(stderr, "\t-r\tset the preferred mode for all connectors\n");
-       fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property\n");
+       fprintf(stderr, "\t-w <obj_id>:<prop_name>:<value>\tset property, see 'property'\n");
        fprintf(stderr, "\t-a \tuse atomic API\n");
        fprintf(stderr, "\t-F pattern1,pattern2\tspecify fill patterns\n");
        fprintf(stderr, "\t-o <desired file path> \t Dump writeback output buffer to file\n");
@@ -2154,6 +2157,25 @@ static void usage(char *name)
        fprintf(stderr, "\t-D device\tuse the given device\n");
 
        fprintf(stderr, "\n\tDefault is to dump all info.\n");
+
+       fprintf(stderr, "\n");
+       fprintf(stderr, "Plane Topology is defined as:\n");
+       fprintf(stderr, "\tplane-topology\t::= plane-id '@' crtc-id ':' width 'x' height ( <plane-offsets> )? ;\n");
+       fprintf(stderr, "\tplane-offsets\t::= '+' x-offset '+' y-offset ( <plane-scale> )? ;\n");
+       fprintf(stderr, "\tplane-scale\t::= '*' scale ( <plane-format> )? ;\n");
+       fprintf(stderr, "\tplane-format\t::= '@' format ;\n");
+
+       fprintf(stderr, "\n");
+       fprintf(stderr, "Mode Topology is defined as:\n");
+       fprintf(stderr, "\tmode-topology\t::= connector-id ( ',' connector-id )* ( '@' crtc-id )? ':' <mode-selection> ( '@' format )? ;\n");
+       fprintf(stderr, "\tmode-selection\t::=  <indexed-mode> | <named-mode> | <custom-mode> ;\n");
+       fprintf(stderr, "\tindexed-mode\t::=  '#' mode-index ;\n");
+       fprintf(stderr, "\tnamed-mode\t::=  width 'x' height ( '-' vrefresh )? ;\n");
+       fprintf(stderr, "\tcustom-mode\t::=  hdisplay ',' hsyncstart ',' hsyncend ',' htotal ',' vdisplay ',' vsyncstart ',' vsyncend ',' vtotal '-' vrefresh ;\n");
+
+       fprintf(stderr, "\n");
+       fprintf(stderr, "Property is defined as:\n");
+       fprintf(stderr, "\tproperty\t::= object-id ':' property-name ':' value ;\n");
        exit(0);
 }