public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 2/2] lib/igt_fb: Add support for 10bpc ARGB/ABGR
Date: Mon,  7 Oct 2019 17:15:24 +0300	[thread overview]
Message-ID: <20191007141524.21938-1-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20191003195854.18208-2-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@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.

v2: Deal with pixman < 0.36.0

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_fb.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index db789ae79458..6b674c1bcd02 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -80,6 +80,10 @@
 #define cairo_format_t int
 #endif
 
+#if PIXMAN_VERSION < PIXMAN_VERSION_ENCODE(0, 36, 0)
+#define PIXMAN_rgba_float PIXMAN_invalid
+#endif
+
 /* drm fourcc/cairo format maps */
 static const struct format_desc_struct {
 	const char *name;
@@ -175,6 +179,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 +329,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 +3127,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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-10-07 14:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 19:58 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: Fix XBGB->XBGR typo Ville Syrjala
2019-10-03 19:58 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: Add support for 10bpc ARGB/ABGR Ville Syrjala
2019-10-03 20:09   ` Chris Wilson
2019-10-07 14:15   ` Ville Syrjala [this message]
2019-10-03 20:04 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: Fix XBGB->XBGR typo Chris Wilson
2019-10-03 20:52 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] " Patchwork
2019-10-04 12:38   ` Ville Syrjälä
2019-10-07 15:15 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_fb: Fix XBGB->XBGR typo (rev2) Patchwork
2019-10-07 19:27 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191007141524.21938-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox