From e4fbf01b40343b20753d96f72d6d16869b8a3131 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 11 Oct 2016 11:17:04 +0300 Subject: kmstest: add --cvt option Signed-off-by: Tomi Valkeinen --- utils/kmstest.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'utils/kmstest.cpp') diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index 52e4614..a88d092 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -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 bool s_cvt; +static bool s_cvt_v2; +static bool s_cvt_vid_opt; static set s_used_crtcs; static set s_used_planes; @@ -146,10 +150,17 @@ static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output) bool found_mode = false; - try { - output.mode = output.connector->get_mode(w, h, refresh, ilace); + if (s_cvt) { + output.mode = videomode_from_cvt(w, h, refresh, ilace, s_cvt_v2, s_cvt_vid_opt); found_mode = true; - } catch (exception& e) { } + } + + if (!found_mode) { + try { + output.mode = output.connector->get_mode(w, h, refresh, ilace); + found_mode = true; + } catch (exception& e) { } + } if (!found_mode && s_use_dmt) { try { @@ -344,6 +355,7 @@ static const char* usage_str = " -f, --fb=FB FB is [x][-][<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" @@ -432,6 +444,19 @@ static vector parse_cmdline(int argc, char **argv) { 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(); -- cgit v1.2.3