diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2022-06-30 15:21:57 +0200 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2023-10-24 09:44:21 +0200 |
commit | 8134deb31f5220922f8dd5ea9a0e0bfb6f85a487 (patch) | |
tree | acca64bd5bd05d478381a9188475febc96b3e969 | |
parent | 236766b0b3eda0271fd378af52afc19d6f8e1531 (diff) | |
download | libdrm-8134deb31f5220922f8dd5ea9a0e0bfb6f85a487.tar.gz libdrm-8134deb31f5220922f8dd5ea9a0e0bfb6f85a487.tar.bz2 libdrm-8134deb31f5220922f8dd5ea9a0e0bfb6f85a487.zip |
util: store number of colors for indexed formats
Store the number of available colors for color-indexed frame
buffer formats in the format_info[] array. This avoids the need of test
code for having to use switch statements all the time to obtain the
number of colors, or to check if a mode is color-indexed or not.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
v5:
- Add Reviewed-by,
v4:
- No changes,
v3:
- Add Acked-by,
v2:
- New.
-rw-r--r-- | tests/util/format.c | 8 | ||||
-rw-r--r-- | tests/util/format.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/util/format.c b/tests/util/format.c index b3d2abdc..b99cc9c3 100644 --- a/tests/util/format.c +++ b/tests/util/format.c @@ -40,10 +40,10 @@ static const struct util_format_info format_info[] = { /* Indexed */ - { DRM_FORMAT_C1, "C1" }, - { DRM_FORMAT_C2, "C2" }, - { DRM_FORMAT_C4, "C4" }, - { DRM_FORMAT_C8, "C8" }, + { DRM_FORMAT_C1, "C1", .ncolors = 2 }, + { DRM_FORMAT_C2, "C2", .ncolors = 4 }, + { DRM_FORMAT_C4, "C4", .ncolors = 16 }, + { DRM_FORMAT_C8, "C8", .ncolors = 256 }, /* YUV packed */ { DRM_FORMAT_UYVY, "UYVY", MAKE_YUV_INFO(YUV_YCbCr | YUV_CY, 2, 2, 2) }, { DRM_FORMAT_VYUY, "VYUY", MAKE_YUV_INFO(YUV_YCrCb | YUV_CY, 2, 2, 2) }, diff --git a/tests/util/format.h b/tests/util/format.h index 2ce1c021..b847c9f2 100644 --- a/tests/util/format.h +++ b/tests/util/format.h @@ -55,6 +55,7 @@ struct util_yuv_info { struct util_format_info { uint32_t format; const char *name; + unsigned int ncolors; const struct util_rgb_info rgb; const struct util_yuv_info yuv; }; |