public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH 09/10] tests/kms_plane_multiple/tgl: PCU messaging test
Date: Mon, 15 Jul 2019 14:51:35 -0700	[thread overview]
Message-ID: <20190715215136.21744-10-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20190715215136.21744-1-lucas.demarchi@intel.com>

From: Karthik B S <karthik.b.s@intel.com>

Add a subtest that gives flips which alternate between least bandwidth
requirement and highest bandwidth requirement.

Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Karthik B S <karthik.b.s@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 tests/kms_plane_multiple.c | 178 ++++++++++++++++++++++++++++++-------
 1 file changed, 148 insertions(+), 30 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 81ed45dd..2c726fda 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -34,6 +34,11 @@ IGT_TEST_DESCRIPTION("Test atomic mode setting with multiple planes.");
 
 #define SIZE_PLANE      256
 #define SIZE_CURSOR     128
+#define SIZE_PLANE_LOW	 10
+#define SIZE_PANE	  5
+#define SMALL_SCREEN	  0
+#define FULL_SCREEN	  1
+#define TEST_PCU_ALGO	  1
 #define LOOP_FOREVER     -1
 
 typedef struct {
@@ -48,9 +53,17 @@ typedef struct {
 	igt_crc_t ref_crc;
 	igt_pipe_crc_t *pipe_crc;
 	igt_plane_t **plane;
+	unsigned int flag;
 	struct igt_fb *fb;
 } data_t;
 
+enum bandwidth {
+	BW_PRIMARY_LOW,
+	BW_PRIMARY_HIGH,
+	BW_PRIMARY_LOW2,
+	BW_HIGH,
+	BW_INVALID,
+};
 /* Command line parameters. */
 struct {
 	int iterations;
@@ -97,7 +110,7 @@ static void test_fini(data_t *data, igt_output_t *output, int n_planes)
 
 static void
 get_reference_crc(data_t *data, igt_output_t *output, enum pipe pipe,
-	      color_t *color, uint64_t tiling)
+	      color_t *color, uint64_t tiling, int BW)
 {
 	drmModeModeInfo *mode;
 	igt_plane_t *primary;
@@ -110,7 +123,9 @@ get_reference_crc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	mode = igt_output_get_mode(output);
 
-	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+	igt_create_color_fb(data->drm_fd,
+			    BW ? mode->hdisplay : SIZE_PLANE_LOW,
+			    BW ? mode->vdisplay : SIZE_PLANE_LOW,
 			    DRM_FORMAT_XRGB8888,
 			    LOCAL_DRM_FORMAT_MOD_NONE,
 			    color->red, color->green, color->blue,
@@ -281,6 +296,76 @@ prepare_planes(data_t *data, enum pipe pipe_id, color_t *color,
  *     The resulting CRC should be identical to the reference CRC
  */
 
+static void
+prepare_planes2(data_t *data, enum pipe pipe_id, color_t *color,
+	       uint64_t tiling, int max_planes, igt_output_t *output,
+	       enum bandwidth bandwidth)
+{
+	drmModeModeInfo *mode;
+	int hsize, vsize;
+	int i;
+	cairo_t *cr;
+
+	igt_output_set_pipe(output, pipe_id);
+	mode = igt_output_get_mode(output);
+
+	switch (bandwidth) {
+	case BW_PRIMARY_LOW:
+	case BW_PRIMARY_LOW2:
+		hsize = SIZE_PLANE_LOW;
+		vsize = SIZE_PLANE_LOW;
+		break;
+	case BW_PRIMARY_HIGH:
+	case BW_HIGH:
+		hsize = mode->hdisplay;
+		vsize = mode->vdisplay;
+		break;
+	default:
+		igt_warn("Invalid BW\n");
+	}
+
+	for (i = 0; i < max_planes; i++) {
+		igt_plane_t *plane = igt_output_get_plane(output, i);
+		uint32_t format = DRM_FORMAT_XRGB8888;
+
+		if (plane->type == DRM_PLANE_TYPE_CURSOR) {
+			format = DRM_FORMAT_ARGB8888;
+			tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+			hsize = SIZE_CURSOR;
+			vsize = SIZE_CURSOR;
+		}
+
+		data->plane[i] = plane;
+		igt_create_color_fb(data->drm_fd,
+				    hsize, vsize,
+				    format, tiling,
+				    color->red, color->green,
+				    color->blue,
+				    &data->fb[i]);
+		igt_plane_set_position(data->plane[i], 0, 0);
+
+		hsize -= SIZE_PANE;
+
+		/* Create black color holes in all planes other than the cursor
+		 * and the topmost plane, so that all planes put together
+		 * produces a solid blue screen that matches with
+		 * the reference CRC.
+		 */
+		if (i < (max_planes - 2) && bandwidth == BW_HIGH) {
+			cr = igt_get_cairo_ctx(data->drm_fd, &data->fb[i]);
+			igt_paint_color(cr, 0, 0, hsize, vsize, 0.0, 0.0, 0.0);
+			igt_put_cairo_ctx(data->drm_fd, &data->fb[i], cr);
+		}
+
+		igt_plane_set_fb(data->plane[i], &data->fb[i]);
+
+		if (bandwidth != BW_HIGH &&
+		    plane->type == DRM_PLANE_TYPE_PRIMARY)
+			break;
+
+	}
+}
+
 static void
 test_plane_position_with_output(data_t *data, enum pipe pipe,
 				igt_output_t *output, int n_planes,
@@ -306,46 +391,67 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	test_init(data, pipe, n_planes);
 
-	get_reference_crc(data, output, pipe, &blue, tiling);
+	if (data->flag == TEST_PCU_ALGO) {
+		for (i = BW_PRIMARY_LOW; i < BW_INVALID; i++) {
+			if (i == BW_PRIMARY_LOW || i == BW_PRIMARY_LOW2)
+				get_reference_crc(data, output, pipe, &blue,
+						tiling, SMALL_SCREEN);
+			else
+				get_reference_crc(data, output, pipe, &blue,
+						tiling, FULL_SCREEN);
+
+			/* Find out how many planes are allowed simultaneously */
+			do {
+				c++;
+				prepare_planes(data, pipe, &blue, tiling, c, output);
+				err = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
 
-	/* Find out how many planes are allowed simultaneously */
-	do {
-		c++;
-		prepare_planes(data, pipe, &blue, tiling, c, output);
-		err = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
+				for_each_plane_on_pipe(&data->display, pipe, plane)
+					igt_plane_set_fb(plane, NULL);
 
-		for_each_plane_on_pipe(&data->display, pipe, plane)
-			igt_plane_set_fb(plane, NULL);
+				for (int x = 0; x < c; x++)
+					igt_remove_fb(data->drm_fd, &data->fb[x]);
+			} while (!err && c < n_planes);
 
-		for (int x = 0; x < c; x++)
-			igt_remove_fb(data->drm_fd, &data->fb[x]);
-	} while (!err && c < n_planes);
+			if (err)
+				c--;
 
-	if (err)
-		c--;
+			igt_info("Testing connector %s using pipe %s with %d planes %s with seed %d\n",
+					igt_output_name(output), kmstest_pipe_name(pipe), c,
+					info, opt.seed);
 
-	igt_info("Testing connector %s using pipe %s with %d planes %s with seed %d\n",
-		 igt_output_name(output), kmstest_pipe_name(pipe), c,
-		 info, opt.seed);
+			prepare_planes2(data, pipe, &blue, tiling,
+					n_planes, output, i);
+			igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-	i = 0;
-	while (i < iterations || loop_forever) {
-		/* randomize planes and set up the holes */
-		prepare_planes(data, pipe, &blue, tiling, c, output);
+			igt_pipe_crc_get_current(data->display.drm_fd,
+					data->pipe_crc, &crc);
 
-		igt_display_commit2(&data->display, COMMIT_ATOMIC);
+			igt_assert_crc_equal(&data->ref_crc, &crc);
+		}
+	} else {
+		i = 0;
+		get_reference_crc(data, output, pipe, &blue, tiling, FULL_SCREEN);
+
+		while (i < iterations || loop_forever) {
+			prepare_planes(data, pipe, &blue, tiling,
+				       n_planes, output);
 
-		igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, &crc);
+			igt_display_commit2(&data->display, COMMIT_ATOMIC);
 
-		for_each_plane_on_pipe(&data->display, pipe, plane)
-			igt_plane_set_fb(plane, NULL);
+			igt_pipe_crc_get_current(data->display.drm_fd,
+						 data->pipe_crc, &crc);
 
-		for (int x = 0; x < c; x++)
-			igt_remove_fb(data->drm_fd, &data->fb[x]);
+			for_each_plane_on_pipe(&data->display, pipe, plane)
+				igt_plane_set_fb(plane, NULL);
 
-		igt_assert_crc_equal(&data->ref_crc, &crc);
+			for (int x = 0; x < c; x++)
+				igt_remove_fb(data->drm_fd, &data->fb[x]);
 
-		i++;
+			igt_assert_crc_equal(&data->ref_crc, &crc);
+
+			i++;
+		}
 	}
 
 	test_fini(data, output, n_planes);
@@ -355,8 +461,12 @@ static void
 test_plane_position(data_t *data, enum pipe pipe, uint64_t tiling)
 {
 	igt_output_t *output;
+	int devid = intel_get_drm_devid(data->drm_fd);
 	int n_planes = data->display.pipes[pipe].n_planes;
 
+	if (data->flag == TEST_PCU_ALGO)
+		igt_require(AT_LEAST_GEN(devid, 12));
+
 	output = igt_get_single_output_for_pipe(&data->display, pipe);
 	igt_require(output);
 
@@ -377,6 +487,14 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)
 		igt_require(data->display.pipes[pipe].n_planes > 0);
 	}
 
+
+	data->flag = TEST_PCU_ALGO;
+
+	igt_subtest_f("atomic-pipe-%s-tiling-none_pcu", kmstest_pipe_name(pipe))
+		test_plane_position(data, pipe, LOCAL_DRM_FORMAT_MOD_NONE);
+
+	data->flag = 0;
+
 	igt_subtest_f("atomic-pipe-%s-tiling-x", kmstest_pipe_name(pipe))
 		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED);
 
-- 
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-07-15 21:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 21:51 [igt-dev] [PATCH 00/10] Add support for Tiger Lake Lucas De Marchi
2019-07-15 21:51 ` [igt-dev] [PATCH 01/10] lib: sync i915_pciids.h with kernel Lucas De Marchi
2019-07-19  6:20   ` Arkadiusz Hiler
2019-07-15 21:51 ` [igt-dev] [PATCH 02/10] lib/tgl: Add Tigerlake platform definition Lucas De Marchi
2019-07-19  6:21   ` Arkadiusz Hiler
2019-07-15 21:51 ` [igt-dev] [PATCH 03/10] gem_ctx_isolation.c/tgl - Gen12 enabling for context isolation test Lucas De Marchi
2019-07-15 21:51 ` [igt-dev] [PATCH 04/10] lib/tgl: Add TGL PCI IDs to match table Lucas De Marchi
2019-07-19  6:21   ` Arkadiusz Hiler
2019-07-15 21:51 ` [igt-dev] [PATCH 05/10] lib/instdone.c/tgl: Add Gen12 support Lucas De Marchi
2019-07-15 21:51 ` [igt-dev] [PATCH 06/10] lib/gpgpu_fill/tgl: Implement gpgpu_fillfunc for TGL Lucas De Marchi
2019-07-15 21:51 ` [igt-dev] [PATCH 07/10] lib/media_fill/tgl: Implement media_fillfunc " Lucas De Marchi
2019-07-15 21:51 ` [igt-dev] [PATCH 08/10] tests/fb/tgl: Yf tiling does not exist on gen-12 Lucas De Marchi
2019-07-19 12:27   ` Ville Syrjälä
2019-07-15 21:51 ` Lucas De Marchi [this message]
2019-07-19 12:54   ` [igt-dev] [PATCH 09/10] tests/kms_plane_multiple/tgl: PCU messaging test Ville Syrjälä
2019-07-22  8:37     ` B S, Karthik
2019-07-22 16:46       ` Lucas De Marchi
2019-07-23  2:44         ` B S, Karthik
2019-08-02 10:43   ` Kahola, Mika
2019-07-15 21:51 ` [igt-dev] [PATCH 10/10] tests/kms_plane_multiple/tgl: Set highest mode for " Lucas De Marchi
2019-08-02 10:44   ` Kahola, Mika
2019-07-15 22:42 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add support for Tiger Lake 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=20190715215136.21744-10-lucas.demarchi@intel.com \
    --to=lucas.demarchi@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