Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest
Date: Tue,  6 Feb 2018 11:14:16 +0100	[thread overview]
Message-ID: <20180206101417.59979-11-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180206101417.59979-1-maarten.lankhorst@linux.intel.com>

This seems to open code igt_calc_fb_size and igt_create_fb, just use both.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_rotation_crc.c | 67 +++++++++---------------------------------------
 1 file changed, 12 insertions(+), 55 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 9242ddee5feb..18c3e13431db 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -388,31 +388,28 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 }
 
 static void test_plane_rotation_exhaust_fences(data_t *data,
+					       enum pipe pipe,
 					       igt_output_t *output,
 					       igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
 	uint32_t format = DRM_FORMAT_XRGB8888;
-	int bpp = igt_drm_format_to_bpp(format);
 	int fd = data->gfx_fd;
 	drmModeModeInfo *mode;
 	struct igt_fb fb[MAX_FENCES+1] = {};
 	unsigned int stride, size, w, h;
-	uint32_t gem_handle;
 	uint64_t total_aperture_size, total_fbs_size;
-	int i, ret;
+	int i;
 
 	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
+	prepare_crtc(data, output, pipe, plane);
 	mode = igt_output_get_mode(output);
 	w = mode->hdisplay;
 	h = mode->vdisplay;
 
-	for (stride = 512; stride < (w * bpp / 8); stride *= 2)
-		;
-	for (size = 1024*1024; size < stride * h; size *= 2)
-		;
+	igt_calc_fb_size(fd, w, h, format, tiling, &size, &stride);
 
 	/*
 	 * Make sure there is atleast 90% of the available GTT space left
@@ -422,59 +419,20 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 	total_aperture_size = gem_available_aperture_size(fd);
 	igt_require(total_fbs_size < total_aperture_size * 0.9);
 
-	igt_plane_set_fb(plane, NULL);
-	igt_display_commit2(display, COMMIT_ATOMIC);
-
 	for (i = 0; i < MAX_FENCES + 1; i++) {
-		gem_handle = gem_create(fd, size);
-		ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride);
-		if (ret) {
-			igt_warn("failed to set tiling\n");
-			goto err_alloc;
-		}
-
-		ret = (__kms_addfb(fd, gem_handle, w, h, stride,
-		       format, tiling, NULL,
-		       LOCAL_DRM_MODE_FB_MODIFIERS,
-		       &fb[i].fb_id));
-		if (ret) {
-			igt_warn("failed to create framebuffer\n");
-			goto err_alloc;
-		}
-
-		fb[i].width = w;
-		fb[i].height = h;
-		fb[i].gem_handle = gem_handle;
+		igt_create_fb(fd, w, h, format, tiling, &fb[i]);
 
 		igt_plane_set_fb(plane, &fb[i]);
 		igt_plane_set_rotation(plane, IGT_ROTATION_0);
-
 		igt_display_commit2(display, COMMIT_ATOMIC);
-		if (ret) {
-			igt_warn("failed to commit unrotated fb\n");
-			goto err_commit;
-		}
 
 		igt_plane_set_rotation(plane, IGT_ROTATION_90);
 		igt_plane_set_size(plane, h, w);
-
 		igt_display_commit2(display, COMMIT_ATOMIC);
-		if (ret) {
-			igt_warn("failed to commit hardware rotated fb: %i\n", ret);
-			goto err_commit;
-		}
 	}
 
-err_alloc:
-	if (ret)
-		gem_close(fd, gem_handle);
-
-	i--;
-err_commit:
-	for (; i >= 0; i--)
+	for (i = 0; i < MAX_FENCES + 1; i++)
 		igt_remove_fb(fd, &fb[i]);
-
-	igt_assert_eq(ret, 0);
 }
 
 static const char *plane_test_str(unsigned plane)
@@ -622,24 +580,23 @@ igt_main
 		}
 	}
 
+	/*
+	 * exhaust-fences should be last test, if it fails we may OOM in
+	 * the following subtests otherwise.
+	 */
 	igt_subtest_f("exhaust-fences") {
 		enum pipe pipe;
 		igt_output_t *output;
-		int valid_tests = 0;
 
 		igt_require(gen >= 9);
+		igt_display_require_output(&data.display);
 
 		for_each_pipe_with_valid_output(&data.display, pipe, output) {
 			igt_plane_t *primary = &data.display.pipes[pipe].planes[0];
-			prepare_crtc(&data, output, pipe, primary);
 
-			test_plane_rotation_exhaust_fences(&data, output, primary);
-
-			valid_tests++;
+			test_plane_rotation_exhaust_fences(&data, pipe, output, primary);
 			break;
 		}
-
-		igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 	}
 
 	igt_fixture {
-- 
2.16.1

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

  parent reply	other threads:[~2018-02-06 10:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 10:14 [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking Maarten Lankhorst
2018-02-07 13:42   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 03/12] lib/igt_fb: Add igt_fb_supported_format() Maarten Lankhorst
2018-02-08  8:08   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 04/12] lib/igt_fb: Remove igt_get_all_cairo_formats() Maarten Lankhorst
2018-02-08  8:15   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 05/12] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain Maarten Lankhorst
2018-02-06 16:11   ` Ville Syrjälä
2018-02-06 16:30     ` Maarten Lankhorst
2018-02-07 11:47     ` [igt-dev] [PATCH i-g-t] lib/igt_debugfs: Add igt_pipe_crc_get_single and igt_pipe_crc_drain, v2 Maarten Lankhorst
2018-02-08 11:15       ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 06/12] tests/kms_rotation_crc: Fix bad-tiling testcase Maarten Lankhorst
2018-02-08 12:08   ` Mika Kahola
2018-02-08 12:12     ` Maarten Lankhorst
2018-02-08 12:19   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 07/12] tests/kms_rotation_crc: Move bad_format parameter to test_plane_rotation Maarten Lankhorst
2018-02-08 13:07   ` Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 08/12] tests/kms_rotation_crc: Always run the flip tests when available Maarten Lankhorst
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 09/12] tests/kms_rotation_crc: Remove primary-rotation-90-Y-tiled Maarten Lankhorst
2018-02-09  8:25   ` Kahola, Mika
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 10/12] tests/kms_rotation_crc: Perform lazy cleanup and require atomic Maarten Lankhorst
2018-02-09  9:39   ` Kahola, Mika
2018-02-06 10:14 ` Maarten Lankhorst [this message]
2018-02-12 11:20   ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Mika Kahola
2018-02-06 10:14 ` [igt-dev] [PATCH i-g-t 12/12] tests/kms_rotation_crc: Test all pixel formats on all planes Maarten Lankhorst
2018-02-08  3:33   ` Srinivas, Vidya
2018-02-12 13:09   ` Mika Kahola
2018-02-12 14:20     ` Maarten Lankhorst
2018-02-06 11:25 ` [igt-dev] ✗ Fi.CI.BAT: warning for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust Patchwork
2018-02-07 13:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
2018-02-07 13:39 ` [igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust Mika Kahola
2018-02-07 16:36 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev2) Patchwork
2018-02-09 16:33 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/12] lib/igt_fb: Make igt_remove_fb more robust (rev3) Patchwork
2018-02-09 18:21 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20180206101417.59979-11-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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