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 02/12] tests: Always call igt_remove_fb without checking.
Date: Tue,  6 Feb 2018 11:14:07 +0100	[thread overview]
Message-ID: <20180206101417.59979-2-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180206101417.59979-1-maarten.lankhorst@linux.intel.com>

This cleans up the tests slightly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/kms_flip.c          |  3 +--
 tests/kms_panel_fitting.c | 15 +++------------
 tests/kms_plane_scaling.c |  7 +------
 tests/kms_rotation_crc.c  | 16 ++--------------
 tests/kms_setmode.c       | 12 +++---------
 5 files changed, 10 insertions(+), 43 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index b43e77123e7f..3d6fe948d3bb 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1332,8 +1332,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 	igt_info("\n%s: PASSED\n\n", test_name);
 
 out:
-	if (o->fb_ids[2])
-		igt_remove_fb(drm_fd, &o->fb_info[2]);
+	igt_remove_fb(drm_fd, &o->fb_info[2]);
 	igt_remove_fb(drm_fd, &o->fb_info[1]);
 	igt_remove_fb(drm_fd, &o->fb_info[0]);
 
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index e0ca6cca8e6a..b3cee223a8e7 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -51,10 +51,7 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	igt_output_set_pipe(output, pipe);
 
 	/* before allocating, free if any older fb */
-	if (data->fb1.fb_id) {
-		igt_remove_fb(data->drm_fd, &data->fb1);
-		data->fb1.fb_id = 0;
-	}
+	igt_remove_fb(data->drm_fd, &data->fb1);
 
 	/* allocate fb for plane 1 */
 	igt_create_pattern_fb(data->drm_fd,
@@ -83,14 +80,8 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 
-	if (data->fb1.fb_id) {
-		igt_remove_fb(data->drm_fd, &data->fb1);
-		data->fb1.fb_id = 0;
-	}
-	if (data->fb2.fb_id) {
-		igt_remove_fb(data->drm_fd, &data->fb2);
-		data->fb2.fb_id = 0;
-	}
+	igt_remove_fb(data->drm_fd, &data->fb1);
+	igt_remove_fb(data->drm_fd, &data->fb2);
 
 	if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
 		igt_plane_t *primary;
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 208f9262f84b..3171331c96b8 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -62,13 +62,8 @@ static void cleanup_fbs(data_t *data)
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
-		if (!data->fb[i].fb_id)
-			continue;
-
+	for (i = 0; i < ARRAY_SIZE(data->fb); i++)
 		igt_remove_fb(data->drm_fd, &data->fb[i]);
-		data->fb[i].fb_id = 0;
-	}
 }
 
 static void cleanup_crtc(data_t *data)
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f65562bae9eb..4f56d3d65db4 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -174,17 +174,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 static void remove_fbs(data_t *data)
 {
-	if (!data->fb.fb_id)
-		return;
-
 	igt_remove_fb(data->gfx_fd, &data->fb);
 	igt_remove_fb(data->gfx_fd, &data->fb_reference);
 	igt_remove_fb(data->gfx_fd, &data->fb_unrotated);
-
-	if (data->fb_flip.fb_id)
-		igt_remove_fb(data->gfx_fd, &data->fb_flip);
-
-	data->fb_flip.fb_id = data->fb.fb_id = 0;
+	igt_remove_fb(data->gfx_fd, &data->fb_flip);
 }
 
 enum rectangle_type {
@@ -205,12 +198,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 	uint32_t pixel_format = data->override_fmt ?: DRM_FORMAT_XRGB8888;
 	const float flip_opacity = 0.75;
 
-	if (data->fb.fb_id) {
-		igt_plane_set_fb(plane, NULL);
-		igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
-
-		remove_fbs(data);
-	}
+	remove_fbs(data);
 
 	igt_plane_set_rotation(plane, IGT_ROTATION_0);
 
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 06241b191a0f..47d04fb5f7b1 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -361,6 +361,9 @@ static void cleanup_crtcs(struct crtc_config *crtcs, int crtc_count)
 	int i;
 
 	for (i = 0; i < crtc_count; i++) {
+		igt_remove_fb(drm_fd, &crtcs[i].fb_info);
+		drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0, NULL, 0, NULL);
+
 		free(crtcs[i].cconfs);
 	}
 }
@@ -577,15 +580,6 @@ static void test_crtc_config(const struct test_config *tconf,
 	if (ret == 0 && tconf->flags & TEST_TIMINGS)
 		check_timings(crtcs[0].crtc_idx, &crtcs[0].mode);
 
-	for (i = 0; i < crtc_count; i++) {
-		if (crtcs[i].fb_info.fb_id) {
-			drmModeSetCrtc(drm_fd, crtcs[i].crtc_id, 0, 0, 0, NULL,
-					0, NULL);
-			drmModeRmFB(drm_fd, crtcs[i].fb_info.fb_id);
-			crtcs[i].fb_info.fb_id = 0;
-		}
-	}
-
 	return;
 }
 
-- 
2.16.1

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

  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 ` Maarten Lankhorst [this message]
2018-02-07 13:42   ` [igt-dev] [PATCH i-g-t 02/12] tests: Always call igt_remove_fb without checking 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 ` [igt-dev] [PATCH i-g-t 11/12] tests/kms_rotation_crc: Clean up exhaust-fences subtest Maarten Lankhorst
2018-02-12 11:20   ` 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-2-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