]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blobdiff - utils/kmstest.cpp
modedb_dmt: update table
[android/external-libkmsxx.git] / utils / kmstest.cpp
index 52e4614f9f49f8ea45b223aa520ef9de927aa269..cfec7804bc2184ba88e5c8ff7607ea7de945605f 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <kms++/kms++.h>
 #include <kms++/modedb.h>
 
 #include <kms++/kms++.h>
 #include <kms++/modedb.h>
+#include <kms++/mode_cvt.h>
 
 #include <kms++util/kms++util.h>
 
 
 #include <kms++util/kms++util.h>
 
@@ -45,6 +46,9 @@ static bool s_use_cea;
 static unsigned s_num_buffers = 1;
 static bool s_flip_mode;
 static bool s_flip_sync;
 static unsigned s_num_buffers = 1;
 static bool s_flip_mode;
 static bool s_flip_sync;
+static bool s_cvt;
+static bool s_cvt_v2;
+static bool s_cvt_vid_opt;
 
 static set<Crtc*> s_used_crtcs;
 static set<Plane*> s_used_planes;
 
 static set<Crtc*> s_used_crtcs;
 static set<Plane*> s_used_planes;
@@ -144,31 +148,27 @@ static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output)
                bool ilace = sm[5].matched ? true : false;
                float refresh = sm[6].matched ? stof(sm[6]) : 0;
 
                bool ilace = sm[5].matched ? true : false;
                float refresh = sm[6].matched ? stof(sm[6]) : 0;
 
-               bool found_mode = false;
-
-               try {
-                       output.mode = output.connector->get_mode(w, h, refresh, ilace);
-                       found_mode = true;
-               } catch (exception& e) { }
-
-               if (!found_mode && s_use_dmt) {
+               if (s_cvt) {
+                       output.mode = videomode_from_cvt(w, h, refresh, ilace, s_cvt_v2, s_cvt_vid_opt);
+               } else if (s_use_dmt) {
                        try {
                                output.mode = find_dmt(w, h, refresh, ilace);
                        try {
                                output.mode = find_dmt(w, h, refresh, ilace);
-                               found_mode = true;
-                               printf("Found mode from DMT\n");
-                       } catch (exception& e) { }
-               }
-
-               if (!found_mode && s_use_cea) {
+                       } catch (exception& e) {
+                               EXIT("Mode not found from DMT tables\n");
+                       }
+               } else if (s_use_cea) {
                        try {
                                output.mode = find_cea(w, h, refresh, ilace);
                        try {
                                output.mode = find_cea(w, h, refresh, ilace);
-                               found_mode = true;
-                               printf("Found mode from CEA\n");
-                       } catch (exception& e) { }
+                       } catch (exception& e) {
+                               EXIT("Mode not found from CEA tables\n");
+                       }
+               } else {
+                       try {
+                               output.mode = output.connector->get_mode(w, h, refresh, ilace);
+                       } catch (exception& e) {
+                               EXIT("Mode not found from the connector\n");
+                       }
                }
                }
-
-               if (!found_mode)
-                       throw invalid_argument("Mode not found");
        } else if (regex_match(crtc_str, sm, modeline_re)) {
                if (sm[2].matched) {
                        bool use_id = sm[1].length() == 1;
        } else if (regex_match(crtc_str, sm, modeline_re)) {
                if (sm[2].matched) {
                        bool use_id = sm[1].length() == 1;
@@ -344,6 +344,7 @@ static const char* usage_str =
                "  -f, --fb=FB               FB is [<w>x<h>][-][<4cc>]\n"
                "      --dmt                 Search for the given mode from DMT tables\n"
                "      --cea                 Search for the given mode from CEA tables\n"
                "  -f, --fb=FB               FB is [<w>x<h>][-][<4cc>]\n"
                "      --dmt                 Search for the given mode from DMT tables\n"
                "      --cea                 Search for the given mode from CEA tables\n"
+               "      --cvt=CVT             Create videomode with CVT. CVT is 'v1', 'v2' or 'v2o'\n"
                "      --flip                Do page flipping for each output\n"
                "      --sync                Synchronize page flipping\n"
                "\n"
                "      --flip                Do page flipping for each output\n"
                "      --sync                Synchronize page flipping\n"
                "\n"
@@ -432,6 +433,19 @@ static vector<Arg> parse_cmdline(int argc, char **argv)
                {
                        s_flip_sync = true;
                }),
                {
                        s_flip_sync = true;
                }),
+               Option("|cvt=", [&](string s)
+               {
+                       if (s == "v1")
+                               s_cvt = true;
+                       else if (s == "v2")
+                               s_cvt = s_cvt_v2 = true;
+                       else if (s == "v2o")
+                               s_cvt = s_cvt_v2 = s_cvt_vid_opt = true;
+                       else {
+                               usage();
+                               exit(-1);
+                       }
+               }),
                Option("h|help", [&]()
                {
                        usage();
                Option("h|help", [&]()
                {
                        usage();