[Intel-gfx] [PATCH i-g-t] tests/kms_panel_fitting: Fix plane scaling avoidance on gen7/gen8

Matt Roper matthew.d.roper at intel.com
Fri Aug 30 22:30:23 UTC 2019


Most gen7 and gen8 platforms can't do plane scaling, so we need to
ensure the test doesn't try to do plane scaling on those platforms.  The
legacy non-atomic subtest bakes these platform characteristics into the
test itself since legacy modesetting interfaces don't provide a way to
probe platform capabilities like atomic does.

Maarten previously tried to address this with commit 24c5e0778
("tests/kms_panel_fitting: Do not use scaling on gen7 and gen8, v2."),
but he augmented an existing test for gen9+pipeC which comes too late
since we've already turned on the plane at that point.  We can fix this
by moving the test up higher; not only before we enable panel fitting,
but also before we turn on the sprite.

Note that this still isn't a great subtest since it's very
Intel-specific, despite being part of a generic KMS test that's intended
for all vendors.  A future enhancement might be to try to probe the
platform capabilities with a TEST_ONLY atomic operation before using the
legacy interfaces to actually program them.

While touching the code, I also added some slight restructuring, added
additional comments, and broke up >80 char lines to add clarity to
what's going on.

Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 tests/kms_panel_fitting.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 491e429f..a942294b 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -131,11 +131,10 @@ static void test_panel_fitting(data_t *d)
 		igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
 		igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200);
 		igt_plane_set_position(d->plane2, 100, 100);
-		igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
 
 		/*
-		 * most of gen7 and all of gen8 doesn't support scaling at all.
+		 * Most of gen7 and all of gen8 doesn't support plane scaling
+		 * at all.
 		 *
 		 * gen9 pipe C has only 1 scaler shared with the crtc, which
 		 * means pipe scaling can't work simultaneously with panel
@@ -144,9 +143,24 @@ static void test_panel_fitting(data_t *d)
 		 * Since this is the legacy path, userspace has to know about
 		 * the HW limitations, whereas atomic can ask.
 		 */
-		if (IS_GEN8(devid) || (IS_GEN7(devid) && !IS_IVYBRIDGE(devid)) ||
+		if (IS_GEN8(devid) ||
+		    (IS_GEN7(devid) && !IS_IVYBRIDGE(devid)) ||
 		    (IS_GEN9(devid) && pipe == PIPE_C))
-			igt_plane_set_size(d->plane2, d->fb2.width-200, d->fb2.height-200);
+			/* same as visible area of fb => no scaling */
+			igt_plane_set_size(d->plane2,
+					   d->fb2.width-200,
+					   d->fb2.height-200);
+		else
+			/*
+			 * different than visible area of fb => plane scaling
+			 * active
+			 */
+			igt_plane_set_size(d->plane2,
+					   mode->hdisplay-200,
+					   mode->vdisplay-200);
+
+		/* Plane scaling active (if possible), pfit off */
+		igt_display_commit2(display, COMMIT_UNIVERSAL);
 
 		/* enable panel fitting along with sprite scaling */
 		mode->hdisplay = 1024;
-- 
2.20.1



More information about the Intel-gfx mailing list