public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: ville.syrjala@intel.com, martin.peres@intel.com,
	stanislav.lisovskiy@intel.com
Subject: [igt-dev] [PATCH i-g-t v1 2/3] igt/tests: Remove redundant code in kms_atomic_transition
Date: Fri, 29 Mar 2019 13:29:00 +0200	[thread overview]
Message-ID: <20190329112901.27830-3-stanislav.lisovskiy@intel.com> (raw)
In-Reply-To: <20190329112901.27830-1-stanislav.lisovskiy@intel.com>

Removed unneeded overlays variable, changed the parms
initialization cycle that it initializes also iter_mask
and parms[i].mask at the same time, fullfiling the same
requirements(i.e always use primary, cursor and one sprite
plane, for the rest parms[i].mask is randomized).

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 tests/kms_atomic_transition.c | 38 ++++++++++++-----------------------
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 638fe17e..ed271532 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -212,9 +212,9 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
 	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];
+	uint32_t n_overlays;
 	igt_plane_t *plane;
-	uint32_t iter_mask = 3;
+	uint32_t iter_mask;
 
 	do_or_die(drmGetCap(display->drm_fd, DRM_CAP_CURSOR_WIDTH, &cursor_width));
 	if (cursor_width >= mode->hdisplay)
@@ -224,6 +224,9 @@ static void setup_parms(igt_display_t *display, enum pipe pipe,
 	if (cursor_height >= mode->vdisplay)
 		cursor_height = mode->vdisplay;
 
+	n_overlays = 0;
+	iter_mask = 0;
+
 	for_each_plane_on_pipe(display, pipe, plane) {
 		int i = plane->index;
 
@@ -231,36 +234,21 @@ 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;
-			parms[i].mask = 1 << 1;
 		} else {
 			parms[i].fb = sprite_fb;
-			parms[i].mask = 1 << 2;
-
-			iter_mask |= 1 << 2;
-
-			overlays[n_overlays++] = i;
+			n_overlays++;
 		}
-	}
-
-	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);
+		iter_mask |= 1 << i;
+		if (i <= 2) {
+			/* always leave one plane as in original algorithm */
+			parms[i].mask = 1 << i;
+		}
+		else {
+			parms[i].mask = hars_petruska_f54_1_random_unsafe_max(2) << i;
 		}
 	}
 
-- 
2.17.1

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

  parent reply	other threads:[~2019-03-29 11:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29 11:28 [igt-dev] [PATCH i-g-t v1 0/3] kms_atomic_transition improvements Stanislav Lisovskiy
2019-03-29 11:28 ` [igt-dev] [PATCH i-g-t v1 1/3] igt/tests/kms_atomic_transition: Skip transition, if no changes done Stanislav Lisovskiy
2019-03-29 11:29 ` Stanislav Lisovskiy [this message]
2019-03-29 11:29 ` [igt-dev] [PATCH i-g-t v1 3/3] igt/tests: Tolerate if kernel can't have all planes Stanislav Lisovskiy
2019-04-01  7:28   ` Daniel Vetter
2019-04-01  7:30     ` Daniel Vetter
2019-04-01  7:40   ` Daniel Vetter
2019-03-29 12:18 ` [igt-dev] ✓ Fi.CI.BAT: success for kms_atomic_transition improvements Patchwork
2019-03-29 14:58 ` [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=20190329112901.27830-3-stanislav.lisovskiy@intel.com \
    --to=stanislav.lisovskiy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@intel.com \
    --cc=ville.syrjala@intel.com \
    /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