[Intel-gfx] [PATCH igt 08/10] kms_frontbuffer_tracking: expand badstride and stridechange

Paulo Zanoni paulo.r.zanoni at intel.com
Fri Nov 13 09:12:49 PST 2015


Make those subtests try to change the stride using multiple APIs so we
can catch errors that affect full modesets, fast modesets and page
flips.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
---
 tests/kms_frontbuffer_tracking.c | 52 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 48 insertions(+), 4 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 25e6afd..436f1ec 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -2898,24 +2898,47 @@ static void try_invalid_strides(void)
  */
 static void badstride_subtest(const struct test_mode *t)
 {
-	struct igt_fb wide_fb;
+	struct igt_fb wide_fb, *old_fb;
 	struct modeset_params *params = pick_params(t);
+	int rc;
 
 	try_invalid_strides();
 
 	prepare_subtest(t, NULL);
 
+	old_fb = params->fb.fb;
+
 	create_fb(t->format, params->fb.fb->width + 4096, params->fb.fb->height,
 		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &wide_fb);
 	igt_assert(wide_fb.stride > 16384);
 
 	fill_fb(&wide_fb, COLOR_PRIM_BG);
 
+	/* Try a simple modeset with the new fb. */
 	params->fb.fb = &wide_fb;
 	set_mode_for_params(params);
+	do_assertions(ASSERT_FBC_DISABLED);
+
+	/* Go back to the old fb so FBC works again. */
+	params->fb.fb = old_fb;
+	set_mode_for_params(params);
+	do_assertions(0);
 
+	/* We're doing the equivalent of a modeset, but with the planes API. */
+	params->fb.fb = &wide_fb;
+	set_prim_plane_for_params(params);
 	do_assertions(ASSERT_FBC_DISABLED);
 
+	params->fb.fb = old_fb;
+	set_mode_for_params(params);
+	do_assertions(0);
+
+	/* We can't use the page flip IOCTL to flip to a buffer with a different
+	 * stride. */
+	rc = drmModePageFlip(drm.fd, params->crtc_id, wide_fb.fb_id, 0, NULL);
+	igt_assert(rc == -EINVAL);
+	do_assertions(0);
+
 	igt_remove_fb(drm.fd, &wide_fb);
 }
 
@@ -2941,22 +2964,43 @@ static void badstride_subtest(const struct test_mode *t)
  */
 static void stridechange_subtest(const struct test_mode *t)
 {
-	struct igt_fb new_fb;
+	struct igt_fb new_fb, *old_fb;
 	struct modeset_params *params = pick_params(t);
+	int rc;
 
 	prepare_subtest(t, NULL);
 
+	old_fb = params->fb.fb;
+
 	create_fb(t->format, params->fb.fb->width + 512, params->fb.fb->height,
 		  LOCAL_I915_FORMAT_MOD_X_TILED, t->plane, &new_fb);
 	fill_fb(&new_fb, COLOR_PRIM_BG);
 
+	/* We can't assert that FBC will be enabled since there may not be
+	 * enough space for the CFB, but we can check the CRC. */
 	params->fb.fb = &new_fb;
 	set_mode_for_params(params);
+	do_assertions(DONT_ASSERT_FEATURE_STATUS);
 
-	/* We can't assert that FBC will be enabled since there may not be
-	 * enough space for the CFB, but we can check the CRC. */
+	/* Go back to the fb that can have FBC. */
+	params->fb.fb = old_fb;
+	set_mode_for_params(params);
+	do_assertions(0);
+
+	/* This operation is the same as above, but with the planes API. */
+	params->fb.fb = &new_fb;
+	set_prim_plane_for_params(params);
 	do_assertions(DONT_ASSERT_FEATURE_STATUS);
 
+	params->fb.fb = old_fb;
+	set_prim_plane_for_params(params);
+	do_assertions(0);
+
+	/* We just can't page flip with a new stride. */
+	rc = drmModePageFlip(drm.fd, params->crtc_id, new_fb.fb_id, 0, NULL);
+	igt_assert(rc == -EINVAL);
+	do_assertions(0);
+
 	igt_remove_fb(drm.fd, &new_fb);
 }
 
-- 
2.6.2



More information about the Intel-gfx mailing list