]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blobdiff - tests/testpat.cpp
tests/testpat: Add -m flag
[android/external-libkmsxx.git] / tests / testpat.cpp
index 52e97134f729770ac3a7839c49b1ac20a1dc41b0..13fea9e8e24e5caa898bdaa00155184c196664c8 100644 (file)
@@ -4,13 +4,19 @@
 #include "kms++.h"
 
 #include "test.h"
+#include "cmdoptions.h"
 
 using namespace std;
 using namespace kms;
 
-int main()
+static map<string, CmdOption> options = {
+       { "m", HAS_PARAM("Set display mode, for example 1920x1080") },
+};
+
+int main(int argc, char **argv)
 {
        Card card;
+       CmdOptions opts(argc, argv, options);
 
        if (card.master() == false)
                printf("Not DRM master, modeset may fail\n");
@@ -30,6 +36,9 @@ int main()
 
                auto mode = conn->get_default_mode();
 
+               if (opts.is_set("m"))
+                       mode = conn->get_mode(opts.opt_param("m"));
+
                auto fb = new DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, PixelFormat::XRGB8888);
                draw_test_pattern(*fb);
                fbs.push_back(fb);