Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_atomic_transition: Do not timeout when number of sprites is huge, v3.
Date: Fri,  2 Nov 2018 09:39:29 +0100	[thread overview]
Message-ID: <20181102083929.25734-1-maarten.lankhorst@linux.intel.com> (raw)

We mostly care about the plane type, because sometimes the driver may
do silly things when only a cursor is enabled for example, so we reduce
the number of tests. This puts an upper bound on the number of plane
combinations being tested, which is nice for gen11.

Changes since v1:
- Make 2 groups for overlay planes, and randomly put planes in either group.
Changes since v2:
- Include igt_rand.h to compiler error.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_atomic_transition.c | 44 +++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 65ff75493990..6d9ad075b0bb 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -22,6 +22,7 @@
  */
 
 #include "igt.h"
+#include "igt_rand.h"
 #include "drmtest.h"
 #include "sw_sync.h"
 #include <errno.h>
@@ -41,7 +42,7 @@
 
 struct plane_parms {
 	struct igt_fb *fb;
-	uint32_t width, height;
+	uint32_t width, height, mask;
 };
 
 /* globals for fence support */
@@ -131,7 +132,7 @@ wm_setup_plane(igt_display_t *display, enum pipe pipe,
 	for_each_plane_on_pipe(display, pipe, plane) {
 		int i = plane->index;
 
-		if (!((1 << plane->index) & mask)) {
+		if (mask && (parms[i].mask & mask)) {
 			if (plane->values[IGT_PLANE_FB_ID])
 				igt_plane_set_fb(plane, NULL);
 			continue;
@@ -192,13 +193,16 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
 			struct igt_fb *primary_fb,
 			struct igt_fb *argb_fb,
 			struct igt_fb *sprite_fb,
-			struct plane_parms *parms)
+			struct plane_parms *parms,
+			unsigned *iter_max)
 {
 	uint64_t cursor_width, cursor_height;
 	unsigned sprite_width, sprite_height, prev_w, prev_h;
 	bool max_sprite_width, max_sprite_height, alpha = true;
 	uint32_t n_planes = display->pipes[pipe].n_planes;
+	uint32_t n_overlays = 0, overlays[n_planes];
 	igt_plane_t *plane;
+	uint32_t iter_mask = 3;
 
 	do_or_die(drmGetCap(display->drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width));
 	if (cursor_width >= mode->hdisplay)
@@ -215,12 +219,37 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
 			parms[i].fb = primary_fb;
 			parms[i].width = mode->hdisplay;
 			parms[i].height = mode->vdisplay;
+			parms[i].mask = 1 << 0;
 		} else if (plane->type == DRM_PLANE_TYPE_CURSOR) {
 			parms[i].fb = argb_fb;
 			parms[i].width = cursor_width;
 			parms[i].height = cursor_height;
-		} else
+			parms[i].mask = 1 << 1;
+		} else {
 			parms[i].fb = sprite_fb;
+			parms[i].mask = 1 << 2;
+
+			iter_mask |= 1 << 2;
+
+			overlays[n_overlays++] = i;
+		}
+	}
+
+	if (n_overlays >= 2) {
+		uint32_t i;
+
+		/*
+		 * Create 2 groups for overlays, make sure 1 plane is put
+		 * in each then spread the rest out.
+		 */
+		iter_mask |= 1 << 3;
+		parms[overlays[n_overlays - 1]].mask = 1 << 3;
+
+		for (i = 1; i < n_overlays - 1; i++) {
+			int val = hars_petruska_f54_1_random_unsafe_max(2);
+
+			parms[overlays[i]].mask = 1 << (2 + val);
+		}
 	}
 
 	igt_create_fb(display->drm_fd, cursor_width, cursor_height,
@@ -229,7 +258,8 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
 	igt_create_fb(display->drm_fd, cursor_width, cursor_height,
 		      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE, sprite_fb);
 
-	if (n_planes < 3)
+	*iter_max = iter_mask + 1;
+	if (!n_overlays)
 		return;
 
 	/*
@@ -390,7 +420,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	drmModeModeInfo *mode, override_mode;
 	igt_plane_t *plane;
 	igt_pipe_t *pipe_obj = &display->pipes[pipe];
-	uint32_t iter_max = 1 << pipe_obj->n_planes, i;
+	uint32_t iter_max, i;
 	struct plane_parms parms[pipe_obj->n_planes];
 	unsigned flags = 0;
 	int ret;
@@ -428,7 +458,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	setup_parms(display, pipe, mode, &fb, &argb_fb, &sprite_fb, parms);
+	setup_parms(display, pipe, mode, &fb, &argb_fb, &sprite_fb, parms, &iter_max);
 
 	/*
 	 * In some configurations the tests may not run to completion with all
-- 
2.19.1

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

             reply	other threads:[~2018-11-02  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02  8:39 Maarten Lankhorst [this message]
2018-11-02  9:13 ` [igt-dev] [PATCH i-g-t] tests/kms_atomic_transition: Do not timeout when number of sprites is huge, v3 Daniel Vetter
2018-11-02  9:15 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-11-02 10:40 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20181102083929.25734-1-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@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