diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-05-16 13:37:57 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-05-16 13:39:01 +0300 |
commit | ad7d39e1490817064675e148ec8e4cbec9cd5206 (patch) | |
tree | 4925328e74f50cffa83bd07c946df3efc9dbd144 /tests | |
parent | 765d7f1ad031276dfba42fd8cc53dbcd2a0aa928 (diff) |
testpat: add dmt & cea parameters
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testpat.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/testpat.cpp b/tests/testpat.cpp index a6c4bf9..b2d7b12 100644 --- a/tests/testpat.cpp +++ b/tests/testpat.cpp @@ -4,6 +4,7 @@ #include <set> #include "kms++.h" +#include "modedb.h" #include "test.h" #include "opts.h" @@ -35,6 +36,9 @@ struct OutputInfo vector<PlaneInfo> planes; }; +static bool s_use_dmt; +static bool s_use_cea; + static set<Crtc*> s_used_crtcs; static set<Plane*> s_used_planes; @@ -153,7 +157,31 @@ static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output) bool ilace = sm[5].matched ? true : false; unsigned refresh = sm[6].matched ? stoul(sm[6]) : 0; - output.mode = output.connector->get_mode(w, h, refresh, ilace); + 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) { + 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) { + try { + output.mode = find_cea(w, h, refresh, ilace); + found_mode = true; + printf("Found mode from CEA\n"); + } catch (exception& e) { } + } + + if (!found_mode) + throw invalid_argument("Mode not found"); } static void parse_plane(Card& card, const string& plane_str, const OutputInfo& output, PlaneInfo& pinfo) @@ -258,6 +286,8 @@ static const char* usage_str = " -r, --crtc=CRTC CRTC is [<crtc>:]<w>x<h>[@<Hz>]\n" " -p, --plane=PLANE PLANE is [<plane>:][<x>,<y>-]<w>x<h>\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" "\n" "<connector>, <crtc> and <plane> can be given by id (<id>) or index (@<idx>).\n" "<connector> can also be given by name.\n" @@ -327,6 +357,14 @@ static vector<Arg> parse_cmdline(int argc, char **argv) { args.push_back(Arg { ObjectType::Framebuffer, s }); }), + Option("|dmt", []() + { + s_use_dmt = true; + }), + Option("|cea", []() + { + s_use_cea = true; + }), Option("h|help", [&]() { usage(); |