[igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: Add support for 10bpc ARGB/ABGR

Ville Syrjala ville.syrjala at linux.intel.com
Thu Oct 3 19:58:54 UTC 2019


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

Hook up conversion routines for 10bpc ARGB/ABGR formats.
Cairo only has the RGB30 without alpha so we'll do the
rendering with floats and use pixman to convert.

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

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index db789ae79458..8b47cf975598 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -175,6 +175,18 @@ static const struct format_desc_struct {
 	  .num_planes = 1, .plane_bpp = { 32, },
 	  .hsub = 1, .vsub = 1,
 	},
+	{ .name = "ARGB2101010", .depth = 30, .drm_id = DRM_FORMAT_ARGB2101010,
+	  .cairo_id = CAIRO_FORMAT_INVALID,
+	  .pixman_id = PIXMAN_a2r10g10b10,
+	  .num_planes = 1, .plane_bpp = { 32, },
+	  .hsub = 1, .vsub = 1,
+	},
+	{ .name = "ABGR2101010", .depth = -1, .drm_id = DRM_FORMAT_ABGR2101010,
+	  .cairo_id = CAIRO_FORMAT_INVALID,
+	  .pixman_id = PIXMAN_a2b10g10r10,
+	  .num_planes = 1, .plane_bpp = { 32, },
+	  .hsub = 1, .vsub = 1,
+	},
 	{ .name = "XRGB16161616F", .depth = -1, .drm_id = DRM_FORMAT_XRGB16161616F,
 	  .cairo_id = CAIRO_FORMAT_RGBA128F,
 	  .num_planes = 1, .plane_bpp = { 64, },
@@ -313,6 +325,7 @@ static const struct format_desc_struct {
 	},
 	{ .name = "IGT-FLOAT", .depth = -1, .drm_id = IGT_FORMAT_FLOAT,
 	  .cairo_id = CAIRO_FORMAT_INVALID,
+	  .pixman_id = PIXMAN_rgba_float,
 	  .num_planes = 1, .plane_bpp = { 128 },
 	},
 };
@@ -3110,6 +3123,10 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 		default:
 			igt_assert_f(0, "Unsupported format %u", f->cairo_id);
 		}
+	} else if (PIXMAN_FORMAT_A(f->pixman_id) &&
+		   PIXMAN_FORMAT_R(f->pixman_id) > 8) {
+		cairo_id = CAIRO_FORMAT_RGBA128F;
+		drm_format = IGT_FORMAT_FLOAT;
 	} else if (PIXMAN_FORMAT_A(f->pixman_id)) {
 		cairo_id = CAIRO_FORMAT_ARGB32;
 		drm_format = DRM_FORMAT_ARGB8888;
-- 
2.21.0



More information about the igt-dev mailing list