diff options
| author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-03-28 11:00:09 +0200 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-03-28 11:00:09 +0200 |
| commit | 9f7fd01b5d5bd064723888d3df1b4964da4946be (patch) | |
| tree | 05c6ade0ad7c3b48a78aa33a7e09ee2f15beb936 /kms++/src/pixelformats.cpp | |
| parent | 9673348fffea7490a85b4a15882e3ec41b62dc29 (diff) | |
kmstest: Support format names in addition to fourcc
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Diffstat (limited to 'kms++/src/pixelformats.cpp')
| -rw-r--r-- | kms++/src/pixelformats.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kms++/src/pixelformats.cpp b/kms++/src/pixelformats.cpp index 559aa38..847c8a6 100644 --- a/kms++/src/pixelformats.cpp +++ b/kms++/src/pixelformats.cpp @@ -992,6 +992,16 @@ std::string pixel_format_to_fourcc_str(PixelFormat f) return fourcc_to_str(format_info_array.at(f).drm_fourcc); } +PixelFormat find_pixel_format_by_name(const std::string& name) +{ + for (const auto& [fmt, pfi] : format_info_array) { + if (pfi.name == name) + return fmt; + } + + throw invalid_argument("Unsupported pixelformat"); +} + static constexpr uint32_t _div_round_up(uint32_t a, uint32_t b) { return (a + b - 1) / b; |
