diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-10-11 11:21:13 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-10-11 11:24:00 +0300 |
commit | 5d85e5db06a40d74c8e62bff0f82c8ce40abb230 (patch) | |
tree | 81e89b2ea90dfbd7864ee1b8e228c408a0af159f | |
parent | e4fbf01b40343b20753d96f72d6d16869b8a3131 (diff) |
kmstest: be explicit about mode selection
Instead of searching through the dmt and cea tables (if user has given
the option), lets be more explicit about it. Only look for the mode from
a single source, and fail if not found there.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | utils/kmstest.cpp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index a88d092..cfec780 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -148,38 +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 found_mode = false; - if (s_cvt) { output.mode = videomode_from_cvt(w, h, refresh, ilace, s_cvt_v2, s_cvt_vid_opt); - found_mode = true; - } - - 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) { + } else if (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) { + } 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); - 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; |