From 9f7fd01b5d5bd064723888d3df1b4964da4946be Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 28 Mar 2025 11:00:09 +0200 Subject: kmstest: Support format names in addition to fourcc Signed-off-by: Tomi Valkeinen --- utils/kmstest.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'utils/kmstest.cpp') diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index 0a8ca22..c6cf129 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -351,7 +351,7 @@ static void parse_fb(Card& card, const string& fb_str, OutputInfo* output, Plane // 400x400-NV12 const regex fb_re("(?:(\\d+)x(\\d+))?" // 400x400 "(?:-)?" // - - "(\\w\\w\\w\\w)?"); // NV12 + "(\\w+)?"); // NV12 smatch sm; if (!regex_match(fb_str, sm, fb_re)) @@ -361,8 +361,13 @@ static void parse_fb(Card& card, const string& fb_str, OutputInfo* output, Plane w = stoul(sm[1]); if (sm[2].matched) h = stoul(sm[2]); - if (sm[3].matched) - format = fourcc_str_to_pixel_format(sm[3]); + if (sm[3].matched) { + try { + format = find_pixel_format_by_name(sm[3]); + } catch (const invalid_argument& e) { + format = fourcc_str_to_pixel_format(sm[3]); + } + } } vector v; @@ -400,7 +405,7 @@ static const char* usage_str = " or\n" " [:],////,////[,i]\n" " -p, --plane=PLANE PLANE is [:][,-]x\n" - " -f, --fb=FB FB is [x][-][<4cc>]\n" + " -f, --fb=FB FB is [x][-][|<4cc>]\n" " -v, --view=VIEW VIEW is ,-x\n" " -P, --property=PROP=VAL Set PROP to VAL in the previous DRM object\n" " --dmt Search for the given mode from DMT tables\n" -- cgit v1.2.3