public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_available_modes_crc: Fix handling of test comparisons
Date: Mon,  5 Nov 2018 13:32:04 +0200	[thread overview]
Message-ID: <1541417524-15032-1-git-send-email-juhapekka.heikkila@gmail.com> (raw)
In-Reply-To: <1541244532-3421-1-git-send-email-juhapekka.heikkila@gmail.com>

Fixed handling of single plane modes so used bpp never get to
be 0 and ease off crc comparison a bit with gamma tables as
idea of this test is to see found modes are able to initialize.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106641
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106701
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 tests/kms_available_modes_crc.c | 78 ++++++++++++++++++++++++-----------------
 1 file changed, 45 insertions(+), 33 deletions(-)

diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index 45a4775..69b3306 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -54,6 +54,12 @@ typedef struct {
 
 	igt_crc_t cursor_crc;
 	igt_crc_t fullscreen_crc;
+
+	/*
+	 * If there's unknown format setting up mode can fail
+	 * without failing entire test.
+	 */
+	bool allow_fail;
 } data_t;
 
 
@@ -133,19 +139,10 @@ static const struct {
 	{ DRM_FORMAT_RGB565, 0, BYTES_PP_2, 0xffff},
 	{ DRM_FORMAT_XRGB8888, 0, BYTES_PP_4, 0xffffffff},
 	{ DRM_FORMAT_XBGR8888, 0, BYTES_PP_4, 0xffffffff},
-
-	/*
-	 * following two are skipped because blending seems to work
-	 * incorrectly with exception of AR24 on cursor plane.
-	 * Test still creates the planes, just filling plane
-	 * and getting crc is skipped.
-	 */
-	{ DRM_FORMAT_ARGB8888, 0, SKIP4, 0xffffffff},
-	{ DRM_FORMAT_ABGR8888, 0, SKIP4, 0x00ffffff},
-
+	{ DRM_FORMAT_ARGB8888, 0, BYTES_PP_4, 0xffffffff},
+	{ DRM_FORMAT_ABGR8888, 0, BYTES_PP_4, 0x00ffffff},
 	{ DRM_FORMAT_XRGB2101010, 0, BYTES_PP_4, 0xffffffff},
 	{ DRM_FORMAT_XBGR2101010, 0, BYTES_PP_4, 0xffffffff},
-
 	{ DRM_FORMAT_YUYV, 0, BYTES_PP_4, 0x80eb80eb},
 	{ DRM_FORMAT_YVYU, 0, BYTES_PP_4, 0x80eb80eb},
 	{ DRM_FORMAT_VYUY, 0, BYTES_PP_4, 0xeb80eb80},
@@ -164,7 +161,7 @@ static const struct {
 #ifdef DRM_FORMAT_P016
 	{ DRM_FORMAT_P016, 0, P010, 0x8000eb00},
 #endif
-	{ 0, 0, 0, 0 }
+	{ 0, 0, SKIP4, 0 }
 };
 
 /*
@@ -221,24 +218,9 @@ static bool fill_in_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 		writesize = data->size+data->size/2;
 		break;
 	case SKIP4:
-		if (fillers[i].fourcc == DRM_FORMAT_ARGB8888 &&
-		    plane->type == DRM_PLANE_TYPE_CURSOR) {
-		/*
-		 * special for cursor plane where blending works correctly.
-		 */
-			ptemp_32_buf = (unsigned int*)data->buf;
-			for (c = 0; c < data->size/4; c++)
-				ptemp_32_buf[c] = fillers[i].value;
-			writesize = data->size;
-			break;
-		}
-		igt_info("Format %s CRC comparison skipped by design.\n",
-			 (char*)&fillers[i].fourcc);
-
-		return false;
 	default:
-		igt_info("Unsupported mode for test %s\n",
-			 (char*)&fillers[i].fourcc);
+		igt_info("Unsupported mode for testing CRC %.4s\n",
+			 (char*)&format);
 		return false;
 	}
 
@@ -261,6 +243,8 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 	int bpp = 0;
 	int i;
 
+	data->allow_fail = false;
+
 	mode = igt_output_get_mode(output);
 	if (plane->type != DRM_PLANE_TYPE_CURSOR) {
 		w = mode->hdisplay;
@@ -289,6 +273,8 @@ static bool setup_fb(data_t *data, igt_output_t *output, igt_plane_t *plane,
 		break;
 
 	case SKIP4:
+		data->allow_fail = true;
+		/* fall through */
 	case BYTES_PP_4:
 		bpp = 32;
 		break;
@@ -412,7 +398,8 @@ test_one_mode(data_t* data, igt_output_t *output, igt_plane_t* plane,
 					igt_warn("crc mismatch. target %.8s, result %.8s.\n", crccompare[0], crccompare[1]);
 					free(crccompare[0]);
 					free(crccompare[1]);
-					rVal++;
+					if (!data->allow_fail)
+						rVal++;
 				}
 			} else {
 				if (!igt_check_crc_equal(&current_crc,
@@ -422,14 +409,15 @@ test_one_mode(data_t* data, igt_output_t *output, igt_plane_t* plane,
 					igt_warn("crc mismatch. target %.8s, result %.8s.\n", crccompare[0], crccompare[1]);
 					free(crccompare[0]);
 					free(crccompare[1]);
-					rVal++;
+					if (!data->allow_fail)
+						rVal++;
 				}
 			}
 		}
 		remove_fb(data, output, plane);
 		return rVal;
 	}
-	return 1;
+	return data->allow_fail?0:1;
 }
 
 
@@ -438,16 +426,31 @@ test_available_modes(data_t* data)
 {
 	igt_output_t *output;
 	igt_plane_t *plane;
+	igt_pipe_t *pipe_obj;
 	int modeindex;
 	enum pipe pipe;
-	int invalids = 0;
+	int invalids = 0, i, lut_size;
+	uint16_t *lut;
 	drmModePlane *modePlane;
+	drmModeCrtc *crtc;
 	char planetype[3][8] = {"OVERLAY\0", "PRIMARY\0", "CURSOR\0" };
 
 	for_each_pipe_with_valid_output(&data->display, pipe, output) {
 		igt_output_set_pipe(output, pipe);
 		igt_display_commit2(&data->display, data->commit);
 
+		pipe_obj = &data->display.pipes[pipe];
+		crtc = drmModeGetCrtc(data->gfx_fd, pipe_obj->crtc_id);
+		lut_size = crtc->gamma_size;
+		drmModeFreeCrtc(crtc);
+		lut = malloc(sizeof(uint16_t) * lut_size);
+
+		for (i = 0; i < lut_size; i++)
+			lut[i] = (i * 0xffff / (lut_size - 1)) & 0xfc00;
+
+		drmModeCrtcSetGamma(data->gfx_fd, pipe_obj->crtc_id,
+				    lut_size, lut, lut, lut);
+
 		data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
 						  INTEL_PIPE_CRC_SOURCE_AUTO);
 
@@ -484,6 +487,15 @@ test_available_modes(data_t* data)
 		igt_pipe_crc_stop(data->pipe_crc);
 		igt_pipe_crc_free(data->pipe_crc);
 		igt_display_commit2(&data->display, data->commit);
+
+		for (i = 0; i < lut_size; i++)
+			lut[i] = i * 0xffff / (lut_size - 1);
+
+		drmModeCrtcSetGamma(data->gfx_fd, pipe_obj->crtc_id,
+				    lut_size, lut, lut, lut);
+		free(lut);
+
+		igt_output_set_pipe(output, PIPE_ANY);
 	}
 	igt_assert(invalids == 0);
 }
-- 
2.7.4

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

  parent reply	other threads:[~2018-11-05 11:32 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03 11:28 [igt-dev] [PATCH i-g-t] tests/kms_available_modes_crc: Fix handling of unknown single plane modes Juha-Pekka Heikkila
2018-11-03 12:09 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-11-03 13:00 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-11-03 14:28 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-11-03 15:18 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-11-05  9:54 ` [igt-dev] [PATCH i-g-t] " Maarten Lankhorst
2018-11-05 11:24   ` Juha-Pekka Heikkila
2018-11-05 12:42     ` Maarten Lankhorst
2018-11-05 13:29       ` Juha-Pekka Heikkila
2018-11-05 11:32 ` Juha-Pekka Heikkila [this message]
2018-11-05 12:19   ` [igt-dev] [PATCH i-g-t] tests/kms_available_modes_crc: Fix handling of test comparisons Maarten Lankhorst
2018-12-13 11:16   ` Juha-Pekka Heikkila
2018-12-14 13:01     ` Juha-Pekka Heikkila
2018-12-18 14:40       ` Juha-Pekka Heikkila
2018-12-19 13:41         ` Juha-Pekka Heikkila
2019-01-23 19:40           ` Dhinakaran Pandiyan
2019-01-23 19:41           ` Dhinakaran Pandiyan
2019-01-23 19:42           ` Dhinakaran Pandiyan
2019-01-23 19:50           ` Pandiyan, Dhinakaran
2019-01-29 14:01             ` Juha-Pekka Heikkila
2018-11-05 12:10 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev2) Patchwork
2018-11-08 11:51 ` Patchwork
2018-11-08 12:48 ` Patchwork
2018-11-08 12:51 ` Patchwork
2018-11-08 12:57 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-11-08 20:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-11-09  6:44 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2018-11-09 12:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-12-13 11:56 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev3) Patchwork
2018-12-13 13:22 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-12-13 14:37 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev4) Patchwork
2018-12-13 18:32 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev5) Patchwork
2018-12-13 18:45 ` [igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev4) Patchwork
2018-12-13 18:47 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev6) Patchwork
2018-12-13 22:27 ` [igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev5) Patchwork
2018-12-13 23:16 ` [igt-dev] ✓ Fi.CI.IGT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev6) Patchwork
2018-12-14 13:25 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev7) Patchwork
2018-12-14 15:12 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-12-18 14:58 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev8) Patchwork
2018-12-18 20:38 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-12-19 14:04 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_available_modes_crc: Fix handling of unknown single plane modes (rev9) Patchwork
2018-12-19 15:05 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-01-25 12:30 [igt-dev] [PATCH i-g-t] tests/kms_available_modes_crc: Fix handling of test comparisons Juha-Pekka Heikkila
2019-01-28 11:43 ` Juha-Pekka Heikkila
2019-01-30  6:40 ` Dhinakaran Pandiyan
2019-01-30 11:25   ` Juha-Pekka Heikkila
2019-01-30 18:23     ` Dhinakaran Pandiyan
2019-02-05 15:18       ` Juha-Pekka Heikkila
2019-02-05 22:01         ` Dhinakaran Pandiyan

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=1541417524-15032-1-git-send-email-juhapekka.heikkila@gmail.com \
    --to=juhapekka.heikkila@gmail.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