[igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Add support for C8 pixel format

Ville Syrjala ville.syrjala at linux.intel.com
Thu May 16 16:59:14 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Expose C8 support by utilizing pixman's rgb332 support.
By using rgb332 we don't have to worry too much about
how to populate the LUT, though for now we still leave
that responsibility to individual tests. If desired we
could make igt_kms generate a suitable LUT when the test
itself didn't bother. But meh for now.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_fb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index c6e18397b754..9d4f905e169e 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -98,6 +98,12 @@ static const struct format_desc_struct {
 	  .num_planes = 1, .plane_bpp = { 16, },
 	  .hsub = 1, .vsub = 1,
 	},
+	{ .name = "C8", .depth = -1, .drm_id = DRM_FORMAT_C8,
+	  .cairo_id = CAIRO_FORMAT_INVALID,
+	  .pixman_id = PIXMAN_r3g3b2,
+	  .num_planes = 1, .plane_bpp = { 8, },
+	  .hsub = 1, .vsub = 1,
+	},
 	{ .name = "XRGB1555", .depth = -1, .drm_id = DRM_FORMAT_XRGB1555,
 	  .cairo_id = CAIRO_FORMAT_INVALID,
 	  .pixman_id = PIXMAN_x1r5g5b5,
@@ -3233,6 +3239,15 @@ bool igt_fb_supported_format(uint32_t drm_format)
 {
 	const struct format_desc_struct *f;
 
+	/*
+	 * C8 needs a LUT which (at least for the time being)
+	 * is the responsibility of each test. Not all tests
+	 * have the required code so let's keep C8 hidden from
+	 * most eyes.
+	 */
+	if (drm_format == DRM_FORMAT_C8)
+		return false;
+
 	for_each_format(f)
 		if (f->drm_id == drm_format)
 			return (f->cairo_id != CAIRO_FORMAT_INVALID) ||
-- 
2.21.0



More information about the igt-dev mailing list