[igt-dev] [PATCH i-g-t] tests/kms_frontbuffer_tracking: Fix Y alignment in the scaledprimary subtest.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Mar 19 14:23:30 UTC 2018


This is hidden behind the other kms_frontbuffer_tracking failures,
but is its own fail.

On gen9/gen10 we fail the scaledprimary tests because FBC refuses
to be enabled with "plane Y offset is misaligned".
Looking at the kernel, this is a workaround for FIFO underruns
which can be tested as well. Test that with the right alignment, FBC
is enabled and with misalignment FBC is disabled on <= gen10.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_frontbuffer_tracking.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index e4da706b0631..495a3a49566c 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -2751,10 +2751,21 @@ static void scaledprimary_subtest(const struct test_mode *t)
 	struct igt_fb new_fb, *old_fb;
 	struct modeset_params *params = pick_params(t);
 	struct fb_region *reg = &params->primary;
+	int gen = intel_gen(intel_get_drm_devid(drm.fd)) >= 9;
+	int src_y_upscale = reg->h / 4;
 
-	igt_require_f(intel_gen(intel_get_drm_devid(drm.fd)) >= 9,
+	igt_require_f(gen >= 9,
 		      "Can't test primary plane scaling before gen 9\n");
 
+	/*
+	 * On gen <= 10 HW, FBC is not enabled on a plane with a Y offset
+	 * that isn't divisible by 4, because it causes FIFO underruns.
+	 */
+	if (gen <= 10)
+		src_y_upscale = ALIGN(src_y_upscale, 4);
+	else /* Lets misalign, to see if we trigger the underrun. */
+		src_y_upscale = ALIGN(src_y_upscale, 4) + 3;
+
 	prepare_subtest(t, NULL);
 
 	old_fb = reg->fb;
@@ -2801,11 +2812,20 @@ static void scaledprimary_subtest(const struct test_mode *t)
 
 	/* Destination doesn't fill the entire CRTC, upscaling. */
 	igt_fb_set_position(&new_fb, reg->plane,
-			    reg->x + reg->w / 4, reg->y + reg->h / 4);
+			    reg->x + reg->w / 4, reg->y + src_y_upscale);
 	igt_fb_set_size(&new_fb, reg->plane, reg->w / 2, reg->h / 2);
 	igt_display_commit2(&drm.display, COMMIT_UNIVERSAL);
 	do_assertions(DONT_ASSERT_CRC);
 
+	/* Check that with a wrong alignment FBC is disabled. */
+	if (gen <= 10) {
+		igt_fb_set_position(&new_fb, reg->plane,
+				reg->x + reg->w / 4, reg->y + src_y_upscale + 3);
+		igt_fb_set_size(&new_fb, reg->plane, reg->w / 2, reg->h / 2);
+		igt_display_commit2(&drm.display, COMMIT_UNIVERSAL);
+		do_assertions(DONT_ASSERT_CRC | ASSERT_FBC_DISABLED);
+	}
+
 	/* Back to the good and old blue fb. */
 	igt_plane_set_fb(reg->plane, old_fb);
 	igt_plane_set_position(params->primary.plane, 0, 0);
-- 
2.16.2



More information about the igt-dev mailing list