[igt-dev] [PATCH i-g-t 3/4] lib/kms: Commit primary plane props with COMMIT_LEGACY

Ville Syrjala ville.syrjala at linux.intel.com
Fri Apr 16 17:48:40 UTC 2021


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

Currently COMMIT_LEGACY for the primary plane only issues the
setcrtc ioctl, leaving all other plane properties unchanged
even if they were flagged as needing an update. Let's issue
the appropriate setprop ioctls in addition to the setcrtc to
make sure the plane state really reflects what was requested.

Without this the prop values can leak between tests. Eg. on
skl/derivatives running one of the failing kms_plane_alpha_blend
subtests first, and following it up with kms_cursor_crc (which
only uses legacy commits) causes crc mismatches since the
primary plane alpha is still left at some stale value despite
igt_plane_reset() trying to reset it back to 1.0.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_kms.c | 56 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 23 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 08d429a8190a..e007a76f12e8 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2660,6 +2660,36 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
 	   (1ULL << IGT_PLANE_CRTC_ID) | \
 	   (1ULL << IGT_PLANE_IN_FENCE_FD)))
 
+static int plane_commit_props(igt_plane_t *plane,
+			      igt_pipe_t *pipe,
+			      bool fail_on_error)
+{
+	igt_display_t *display = pipe->display;
+	uint64_t changed_mask;
+	int ret, i;
+
+	changed_mask = plane->changed & LEGACY_PLANE_COMMIT_MASK;
+
+	for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
+		if (!(changed_mask & (1 << i)))
+			continue;
+
+		LOG(display, "SetProp plane %s.%d \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
+			kmstest_pipe_name(pipe->pipe), plane->index, igt_plane_prop_names[i],
+			plane->values[i], plane->values[i]);
+
+		igt_assert(plane->props[i]);
+
+		ret = igt_plane_set_property(plane,
+					     plane->props[i],
+					     plane->values[i]);
+
+		CHECK_RETURN(ret, fail_on_error);
+	}
+
+	return 0;
+}
+
 /*
  * Commit position and fb changes to a DRM plane via the SetPlane ioctl; if the
  * DRM call to program the plane fails, we'll either fail immediately (for
@@ -2672,7 +2702,7 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 {
 	igt_display_t *display = pipe->display;
 	uint32_t fb_id, crtc_id;
-	int ret, i;
+	int ret;
 	uint32_t src_x;
 	uint32_t src_y;
 	uint32_t src_w;
@@ -2681,7 +2711,6 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 	int32_t crtc_y;
 	uint32_t crtc_w;
 	uint32_t crtc_h;
-	uint64_t changed_mask;
 	bool setplane =
 		igt_plane_is_prop_changed(plane, IGT_PLANE_FB_ID) ||
 		plane->changed & IGT_PLANE_COORD_CHANGED_MASK;
@@ -2742,26 +2771,7 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 		CHECK_RETURN(ret, fail_on_error);
 	}
 
-	changed_mask = plane->changed & LEGACY_PLANE_COMMIT_MASK;
-
-	for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) {
-		if (!(changed_mask & (1 << i)))
-			continue;
-
-		LOG(display, "SetProp plane %s.%d \"%s\" to 0x%"PRIx64"/%"PRIi64"\n",
-			kmstest_pipe_name(pipe->pipe), plane->index, igt_plane_prop_names[i],
-			plane->values[i], plane->values[i]);
-
-		igt_assert(plane->props[i]);
-
-		ret = igt_plane_set_property(plane,
-					     plane->props[i],
-					     plane->values[i]);
-
-		CHECK_RETURN(ret, fail_on_error);
-	}
-
-	return 0;
+	return plane_commit_props(plane, pipe, fail_on_error);
 }
 
 /*
@@ -2886,7 +2896,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
 
 	CHECK_RETURN(ret, fail_on_error);
 
-	return 0;
+	return plane_commit_props(primary, pipe, fail_on_error);
 }
 
 static int igt_plane_fixup_rotation(igt_plane_t *plane,
-- 
2.26.3



More information about the igt-dev mailing list