public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: [igt-dev] [PATCH i-g-t v4 6/7] test/psr: Add a generic function to setup each test
Date: Thu, 17 Jan 2019 15:59:48 -0800	[thread overview]
Message-ID: <20190117235949.20026-6-jose.souza@intel.com> (raw)
In-Reply-To: <20190117235949.20026-1-jose.souza@intel.com>

When the PSR2 tests were added it will be necessary switch between
PSR versions, so lets add test_setup() and make it call
setup_test_plane() and assert if PSR is active as it is the base for
every test.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 tests/kms_psr.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index c31dc317..8f2ef89c 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -60,6 +60,7 @@ typedef struct {
 	int drm_fd;
 	int debugfs_fd;
 	enum operations op;
+	int test_plane_id;
 	uint32_t devid;
 	uint32_t crtc_id;
 	igt_display_t display;
@@ -366,6 +367,12 @@ static void setup_test_plane(data_t *data, int test_plane)
 	igt_display_commit(&data->display);
 }
 
+static void test_setup(data_t *data)
+{
+	setup_test_plane(data, data->test_plane_id);
+	igt_assert(psr_wait_entry_if_enabled(data));
+}
+
 static void dpms_off_on(data_t *data)
 {
 	kmstest_set_connector_dpms(data->drm_fd, data->output->config.connector,
@@ -424,14 +431,14 @@ int main(int argc, char *argv[])
 	}
 
 	igt_subtest("basic") {
-		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(psr_wait_entry_if_enabled(&data));
+		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+		test_setup(&data);
 		test_cleanup(&data);
 	}
 
 	igt_subtest("no_drrs") {
-		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(psr_wait_entry_if_enabled(&data));
+		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+		test_setup(&data);
 		igt_assert(drrs_disabled(&data));
 		test_cleanup(&data);
 	}
@@ -439,8 +446,8 @@ int main(int argc, char *argv[])
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
 		igt_subtest_f("primary_%s", op_str(op)) {
 			data.op = op;
-			setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-			igt_assert(psr_wait_entry_if_enabled(&data));
+			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+			test_setup(&data);
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -449,8 +456,8 @@ int main(int argc, char *argv[])
 	for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
 		igt_subtest_f("sprite_%s", op_str(op)) {
 			data.op = op;
-			setup_test_plane(&data, DRM_PLANE_TYPE_OVERLAY);
-			igt_assert(psr_wait_entry_if_enabled(&data));
+			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
+			test_setup(&data);
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -459,8 +466,8 @@ int main(int argc, char *argv[])
 	for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) {
 		igt_subtest_f("cursor_%s", op_str(op)) {
 			data.op = op;
-			setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
-			igt_assert(psr_wait_entry_if_enabled(&data));
+			data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
+			test_setup(&data);
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -468,8 +475,8 @@ int main(int argc, char *argv[])
 
 	igt_subtest_f("dpms") {
 		data.op = RENDER;
-		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(psr_wait_entry_if_enabled(&data));
+		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+		test_setup(&data);
 		dpms_off_on(&data);
 		run_test(&data);
 		test_cleanup(&data);
@@ -477,8 +484,8 @@ int main(int argc, char *argv[])
 
 	igt_subtest_f("suspend") {
 		data.op = PLANE_ONOFF;
-		setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
-		igt_assert(psr_wait_entry_if_enabled(&data));
+		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
+		test_setup(&data);
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		igt_assert(psr_wait_entry_if_enabled(&data));
-- 
2.20.1

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

  parent reply	other threads:[~2019-01-17 23:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 23:59 [igt-dev] [PATCH i-g-t v4 1/7] lib/psr: Add support to new modified i915_edp_psr_status output José Roberto de Souza
2019-01-17 23:59 ` [igt-dev] [PATCH i-g-t v4 2/7] lib/psr: Only care about DEEP_SLEEP state for PSR2 José Roberto de Souza
2019-01-17 23:59 ` [igt-dev] [PATCH i-g-t v4 3/7] lib/psr: Rename psr_wait_exit to psr_wait_update José Roberto de Souza
2019-01-17 23:59 ` [igt-dev] [PATCH i-g-t v4 4/7] lib/psr: Make psr_wait_entry and psr_wait_update aware of the PSR version tested José Roberto de Souza
2019-01-17 23:59 ` [igt-dev] [PATCH i-g-t v4 5/7] lib/psr: Add PSR2 support to the remaning psr functions José Roberto de Souza
2019-01-17 23:59 ` José Roberto de Souza [this message]
2019-01-17 23:59 ` [igt-dev] [PATCH i-g-t v4 7/7] tests/psr: Add the same test coverage that we have for PSR1 to PSR2 José Roberto de Souza
2019-01-22 22:02   ` Dhinakaran Pandiyan
2019-01-22 22:11     ` Souza, Jose
2019-01-18  0:26 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,v4,1/7] lib/psr: Add support to new modified i915_edp_psr_status output Patchwork
2019-01-18 18:32 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v4,1/7] lib/psr: Add support to new modified i915_edp_psr_status output (rev2) Patchwork
2019-01-18 21:57 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20190117235949.20026-6-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=dhinakaran.pandiyan@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