kmsview: Add connector command line argument
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 12 Feb 2017 14:45:45 +0000 (16:45 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 13 Feb 2017 07:55:05 +0000 (09:55 +0200)
The argument allows specifying which connector to display on. When not
set, the current behaviour is preserved.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
utils/kmsview.cpp

index 6f236a11254e446bc20a5ceeffccf83bcaf9dc1b..04d005dc242b5f01fe38020b3ec9e6cb5173d798 100644 (file)
@@ -24,9 +24,10 @@ static void read_frame(ifstream& is, DumbFramebuffer* fb, Crtc* crtc, Plane* pla
 }
 
 static const char* usage_str =
-               "Usage: kmsview [-t <ms>] <file> <width> <height> <fourcc>\n\n"
+               "Usage: kmsview [options] <file> <width> <height> <fourcc>\n\n"
                "Options:\n"
-               "  -t, --time        Milliseconds to sleep between frames\n"
+               "  -c, --connector <name>       Output connector\n"
+               "  -t, --time <ms>              Milliseconds to sleep between frames\n"
                ;
 
 static void usage()
@@ -38,8 +39,13 @@ int main(int argc, char** argv)
 {
        uint32_t time = 0;
        string dev_path = "/dev/dri/card0";
+       string conn_name;
 
        OptionSet optionset = {
+               Option("c|connector=", [&conn_name](string s)
+               {
+                       conn_name = s;
+               }),
                Option("|device=", [&dev_path](string s)
                {
                        dev_path = s;
@@ -81,7 +87,7 @@ int main(int argc, char** argv)
        Card card(dev_path);
        ResourceManager res(card);
 
-       auto conn = res.reserve_connector();
+       auto conn = res.reserve_connector(conn_name);
        auto crtc = res.reserve_crtc(conn);
        auto plane = res.reserve_overlay_plane(crtc, pixfmt);
        FAIL_IF(!plane, "available plane not found");