From 51055ced0e0e849051f5aaf3620724e16ef25d6d Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Tue, 4 Feb 2025 08:45:14 +0200 Subject: kmstest: Add test pattern parameters Add new parameters: --pattern=PAT --rec=REC --range=RANGE Signed-off-by: Tomi Valkeinen --- utils/kmstest.cpp | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'utils/kmstest.cpp') diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index 7c733da..0a8ca22 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -70,6 +70,7 @@ static bool s_cvt_v2; static bool s_cvt_vid_opt; static unsigned s_max_flips; static bool s_print_crc; +static TestPatternOptions s_pattern_options; __attribute__((unused)) static void print_regex_match(smatch sm) { @@ -408,6 +409,9 @@ static const char* usage_str = " --flip[=max] Do page flipping for each output with an optional maximum flips count\n" " --sync Synchronize page flipping\n" " --crc Print CRC16 for framebuffer contents\n" + " -T, --pattern=PAT test, white, black, red, green, blue, smpte\n" + " --rec=REC bt601, bt709, bt2020\n" + " --range=RANGE limited, full\n" "\n" ", and can be given by index () or id (@).\n" " can also be given by name.\n" @@ -511,6 +515,35 @@ static vector parse_cmdline(int argc, char** argv) Option("|crc", []() { s_print_crc = true; }), + Option("T|pattern=", [&](string s) { + s_pattern_options.pattern = s; + }), + Option("|rec=", [&](string s) { + s = to_lower(s); + + if (s == "bt601") + s_pattern_options.rec = RecStandard::BT601; + else if (s == "bt709") + s_pattern_options.rec = RecStandard::BT709; + else if (s == "bt2020") + s_pattern_options.rec = RecStandard::BT2020; + else { + usage(); + exit(-1); + } + }), + Option("|range=", [&](string s) { + s = to_lower(s); + + if (s == "limited") + s_pattern_options.range = ColorRange::Limited; + else if (s == "full") + s_pattern_options.range = ColorRange::Full; + else { + usage(); + exit(-1); + } + }), Option("h|help", [&]() { usage(); exit(-1); @@ -771,11 +804,11 @@ static void draw_test_patterns(const vector& outputs) { for (const OutputInfo& o : outputs) { for (auto fb : o.legacy_fbs) - draw_test_pattern(*fb); + draw_test_pattern(*fb, s_pattern_options); for (const PlaneInfo& p : o.planes) for (auto fb : p.fbs) - draw_test_pattern(*fb); + draw_test_pattern(*fb, s_pattern_options); } } -- cgit v1.2.3