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 3/3] tests/kms_plane: Test C8 pixel format
Date: Thu, 16 May 2019 19:59:15 +0300	[thread overview]
Message-ID: <20190516165915.2324-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190516165915.2324-1-ville.syrjala@linux.intel.com>

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

Now that igt_fb has rudimentary C8 support let's test it.
We have to generate a custom palette for it of course.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_plane.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 471bcbeb8f77..6f30a95efc7a 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -389,6 +389,39 @@ static void set_legacy_lut(data_t *data, enum pipe pipe,
 	free(lut);
 }
 
+static bool set_c8_legacy_lut(data_t *data, enum pipe pipe,
+			      uint16_t mask)
+{
+	igt_pipe_t *pipe_obj = &data->display.pipes[pipe];
+	drmModeCrtc *crtc;
+	uint16_t *r, *g, *b;
+	int i, lut_size;
+
+	crtc = drmModeGetCrtc(data->drm_fd, pipe_obj->crtc_id);
+	lut_size = crtc->gamma_size;
+	drmModeFreeCrtc(crtc);
+
+	if (lut_size != 256)
+		return false;
+
+	r = malloc(sizeof(uint16_t) * 3 * lut_size);
+	g = r + lut_size;
+	b = g + lut_size;
+
+	/* igt_fb uses RGB332 for C8 */
+	for (i = 0; i < lut_size; i++) {
+		r[i] = (((i & 0xe0) >> 5) * 0xffff / 0x7) & mask;
+		g[i] = (((i & 0x1c) >> 2) * 0xffff / 0x7) & mask;
+		b[i] = (((i & 0x03) >> 0) * 0xffff / 0x3) & mask;
+	}
+
+	igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, pipe_obj->crtc_id,
+					  lut_size, r, g, b), 0);
+
+	free(r);
+
+	return true;
+}
 
 static void test_format_plane_color(data_t *data, enum pipe pipe,
 				    igt_plane_t *plane,
@@ -532,8 +565,13 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 		    modifier == ref_modifier)
 			continue;
 
-		if (!igt_fb_supported_format(format))
-			continue;
+		if (format == DRM_FORMAT_C8) {
+			if (!set_c8_legacy_lut(data, pipe, 0xfc00))
+				continue;
+		} else {
+			if (!igt_fb_supported_format(format))
+				continue;
+		}
 
 		igt_info("Testing format " IGT_FORMAT_FMT " / modifier 0x%" PRIx64 " on %s.%u\n",
 			 IGT_FORMAT_ARGS(format), modifier,
@@ -552,6 +590,9 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
 			}
 		}
 
+		if (format == DRM_FORMAT_C8)
+			set_legacy_lut(data, pipe, 0xfc00);
+
 		if (crc_mismatch_count)
 			igt_warn("CRC mismatches with format " IGT_FORMAT_FMT " on %s.%u with %d/%d solid colors tested (0x%X)\n",
 				 IGT_FORMAT_ARGS(format), kmstest_pipe_name(pipe),
-- 
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-05-16 16:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 16:59 [igt-dev] [PATCH i-g-t 1/3] tests/kms_available_modes_crc: Remove C8 test Ville Syrjala
2019-05-16 16:59 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Add support for C8 pixel format Ville Syrjala
2019-05-16 16:59 ` Ville Syrjala [this message]
2019-05-28 10:59   ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_plane: Test " Maarten Lankhorst
2019-05-16 17:25 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/kms_available_modes_crc: Remove C8 test Patchwork
2019-05-16 23:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-05-28 13:06   ` Ville Syrjälä

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=20190516165915.2324-3-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