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 v3 1/4] tests/kms_panel_fitting: Test cleanups.
Date: Tue, 27 Feb 2018 09:52:29 +0100	[thread overview]
Message-ID: <20180227085232.54025-2-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180227085232.54025-1-maarten.lankhorst@linux.intel.com>

Use igt_display_reset() to reset the state, instead of doing it at the
end of each subtest. Also remove the usage of a file, and instead allocate
a test pattern like the other tests do.
We now also have a way to find out if panel fitting property is supported
without performing a kmstest call.

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

diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index b3cee223a8e7..1f087ecc82a0 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -37,17 +37,21 @@ typedef struct {
 
 	igt_plane_t *plane1;
 	igt_plane_t *plane2;
-	igt_plane_t *plane3;
-	igt_plane_t *plane4;
 } data_t;
 
-#define FILE_NAME   "1080p-left.png"
+static void cleanup_crtc(data_t *data)
+{
+	igt_display_reset(&data->display);
+	igt_remove_fb(data->drm_fd, &data->fb1);
+	igt_remove_fb(data->drm_fd, &data->fb2);
+}
 
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 			igt_plane_t *plane, drmModeModeInfo *mode, enum igt_commit_style s)
 {
 	igt_display_t *display = &data->display;
 
+	igt_output_override_mode(output, mode);
 	igt_output_set_pipe(output, pipe);
 
 	/* before allocating, free if any older fb */
@@ -76,26 +80,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	igt_display_commit2(display, s);
 }
 
-static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
-{
-	igt_display_t *display = &data->display;
-
-	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;
-
-		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-		igt_plane_set_fb(primary, NULL);
-	}
-
-	igt_plane_set_fb(plane, NULL);
-	igt_output_set_pipe(output, PIPE_ANY);
-
-	igt_display_commit2(display, COMMIT_UNIVERSAL);
-}
-
 static void test_panel_fitting(data_t *d)
 {
 	igt_display_t *display = &d->display;
@@ -105,30 +89,21 @@ static void test_panel_fitting(data_t *d)
 
 	for_each_pipe_with_valid_output(display, pipe, output) {
 		drmModeModeInfo *mode, native_mode;
-		bool scaling_mode_set;
-
-		scaling_mode_set = kmstest_get_property(d->drm_fd,
-			output->config.connector->connector_id,
-			DRM_MODE_OBJECT_CONNECTOR,
-			"scaling mode",
-			NULL,
-			NULL,
-			NULL);
 
 		/* Check that the "scaling mode" property has been set. */
-		if (!scaling_mode_set)
+		if (!igt_output_has_prop(output, IGT_CONNECTOR_SCALING_MODE))
 			continue;
 
+		cleanup_crtc(d);
 		igt_output_set_pipe(output, pipe);
 
 		mode = igt_output_get_mode(output);
 		native_mode = *mode;
 
 		/* allocate fb2 with image */
-		igt_create_image_fb(d->drm_fd, 0, 0,
-				    DRM_FORMAT_XRGB8888,
-				    LOCAL_DRM_FORMAT_MOD_NONE,
-				    FILE_NAME, &d->fb2);
+		igt_create_pattern_fb(d->drm_fd, mode->hdisplay / 2, mode->vdisplay / 2,
+				      DRM_FORMAT_XRGB8888,
+				      LOCAL_DRM_FORMAT_MOD_NONE, &d->fb2);
 
 		/* Set up display to enable panel fitting */
 		mode->hdisplay = 640;
@@ -163,12 +138,7 @@ static void test_panel_fitting(data_t *d)
 		mode->vdisplay = 768;
 		prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_LEGACY);
 
-		/* back to single plane mode */
-		igt_plane_set_fb(d->plane2, NULL);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
 		valid_tests++;
-		cleanup_crtc(d, output, d->plane1);
 	}
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
@@ -180,9 +150,8 @@ test_panel_fitting_fastset(igt_display_t *display, const enum pipe pipe, igt_out
 	drmModeModeInfo mode;
 	struct igt_fb red, green, blue;
 
-	igt_assert(kmstest_get_connector_default_mode(display->drm_fd, output->config.connector, &mode));
+	mode = *igt_output_get_mode(output);
 
-	igt_output_override_mode(output, &mode);
 	igt_output_set_pipe(output, pipe);
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
@@ -221,18 +190,11 @@ test_panel_fitting_fastset(igt_display_t *display, const enum pipe pipe, igt_out
 	igt_output_override_mode(output, &mode);
 	igt_plane_set_fb(primary, &green);
 	igt_display_commit_atomic(display, 0, NULL);
-
-	/* Restore normal mode */
-	igt_plane_set_fb(primary, &blue);
-	igt_output_override_mode(output, NULL);
-	igt_display_commit_atomic(display, 0, NULL);
-
-	igt_plane_set_fb(primary, NULL);
-	igt_output_set_pipe(output, PIPE_NONE);
 }
 
-static void test_atomic_fastset(igt_display_t *display)
+static void test_atomic_fastset(data_t *data)
 {
+	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	enum pipe pipe;
 	int valid_tests = 0;
@@ -246,9 +208,10 @@ static void test_atomic_fastset(igt_display_t *display)
 	igt_require(intel_gen(intel_get_drm_devid(display->drm_fd)) >= 5);
 
 	for_each_pipe_with_valid_output(display, pipe, output) {
-		if (!output->props[IGT_CONNECTOR_SCALING_MODE])
+		if (!igt_output_has_prop(output, IGT_CONNECTOR_SCALING_MODE))
 			continue;
 
+		cleanup_crtc(data);
 		test_panel_fitting_fastset(display, pipe, output);
 		valid_tests++;
 	}
@@ -264,13 +227,14 @@ igt_main
 
 		data.drm_fd = drm_open_driver(DRIVER_ANY);
 		igt_display_init(&data.display, data.drm_fd);
+		igt_display_require_output(&data.display);
 	}
 
 	igt_subtest("legacy")
 		test_panel_fitting(&data);
 
 	igt_subtest("atomic-fastset")
-		test_atomic_fastset(&data.display);
+		test_atomic_fastset(&data);
 
 	igt_fixture
 		igt_display_fini(&data.display);
-- 
2.16.2

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

  reply	other threads:[~2018-02-27  8:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27  8:52 [igt-dev] [PATCH i-g-t v3 0/4] kms_panel_fitting and kms_frontbuffer_tracking cleanups Maarten Lankhorst
2018-02-27  8:52 ` Maarten Lankhorst [this message]
2018-03-05 13:45   ` [igt-dev] [PATCH i-g-t v3 1/4] tests/kms_panel_fitting: Test cleanups Arkadiusz Hiler
2018-02-27  8:52 ` [igt-dev] [PATCH i-g-t v3 2/4] lib/igt_kms: Fix igt_plane_reset to handle cursor planes correctly too Maarten Lankhorst
2018-03-05 13:48   ` Arkadiusz Hiler
2018-02-27  8:52 ` [igt-dev] [PATCH i-g-t v3 3/4] tests/kms_frontbuffer_tracking: Convert test to use igt_display, v3 Maarten Lankhorst
2018-03-07 15:17   ` Arkadiusz Hiler
2018-03-07 15:26     ` Arkadiusz Hiler
2018-03-07 16:40       ` Maarten Lankhorst
2018-03-08  8:57   ` Arkadiusz Hiler
2018-03-12 13:09     ` Maarten Lankhorst
2018-02-27  8:52 ` [igt-dev] [PATCH i-g-t v3 4/4] tests/kms_frontbuffer_tracking: Remove redundant modesets during subtest start Maarten Lankhorst
2018-03-01 15:33   ` Maarten Lankhorst
2018-03-21 19:47     ` Paulo Zanoni
2018-04-05 16:31       ` Paulo Zanoni
2018-04-05 19:21         ` Maarten Lankhorst
2018-04-05 19:30           ` Paulo Zanoni
2018-04-05 19:44             ` Daniel Vetter
2018-02-27  9:15 ` [igt-dev] ✓ Fi.CI.BAT: success for kms_panel_fitting and kms_frontbuffer_tracking cleanups. (rev3) Patchwork
2018-02-27 10:00 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-03-06 11:21 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2018-03-06 15: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=20180227085232.54025-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