igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib
@ 2018-07-16 22:39 Dhinakaran Pandiyan
  2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib Dhinakaran Pandiyan
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Dhinakaran Pandiyan @ 2018-07-16 22:39 UTC (permalink / raw)
  To: igt-dev; +Cc: Dhinakaran Pandiyan, Rodrigo Vivi

Change the function arguments to not rely on test specific data as
the following patches change kms_frontbuffer_tracking to reuse PSR
functions.

v2: Leave --no-psr intact (Rodrigo)
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 tests/kms_psr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index 4eca51da..9e893ed8 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -197,12 +197,12 @@ static bool sink_support(data_t *data)
 		strstr(buf, "Sink_Support: yes\n");
 }
 
-static bool psr_active(data_t *data, bool check_active)
+static bool psr_active(int fd, bool check_active)
 {
 	bool active;
 	char buf[512];
 
-	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
+	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
 
 	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
 		 (strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
@@ -214,7 +214,7 @@ static bool wait_psr_entry(data_t *data)
 	if (data->with_psr_disabled)
 		return true;
 
-	return igt_wait((psr_active(data, true)), 500, 1);
+	return igt_wait((psr_active(data->drm_fd, true)), 500, 1);
 }
 
 static inline void manual(const char *expected)
@@ -303,7 +303,7 @@ static void run_test(data_t *data)
 		expected = "screen GREEN";
 		break;
 	}
-	igt_assert(psr_active(data, false));
+	igt_assert(psr_active(data->drm_fd, false));
 	manual(expected);
 }
 
-- 
2.17.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib
  2018-07-16 22:39 [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Dhinakaran Pandiyan
@ 2018-07-16 22:39 ` Dhinakaran Pandiyan
  2018-07-17  5:07   ` Rodrigo Vivi
  2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 3/3] tests/frontbuffer_tracking: Use the library functions to test PSR Dhinakaran Pandiyan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Dhinakaran Pandiyan @ 2018-07-16 22:39 UTC (permalink / raw)
  To: igt-dev; +Cc: Dhinakaran Pandiyan, Rodrigo Vivi

kms_frontbuffer_tracking and kms_psr test PSR in different ways, let'
fix that by creating common library functions.

v2: Include the new file in meson.build
v3: Leave --no-psr intact (Rodrigo)

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 lib/Makefile.sources |  2 ++
 lib/igt_psr.c        | 40 ++++++++++++++++++++++++++++++++++++++++
 lib/igt_psr.h        | 34 ++++++++++++++++++++++++++++++++++
 lib/meson.build      |  1 +
 tests/kms_psr.c      | 37 +++++++++++++------------------------
 5 files changed, 90 insertions(+), 24 deletions(-)
 create mode 100644 lib/igt_psr.c
 create mode 100644 lib/igt_psr.h

diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index 042c1d3b..14356c94 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -103,6 +103,8 @@ lib_source_list =	 	\
 	igt_kmod.h		\
 	igt_syncobj.c		\
 	igt_syncobj.h		\
+	igt_psr.c		\
+	igt_psr.h		\
 	$(NULL)
 
 .PHONY: version.h.tmp
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
new file mode 100644
index 00000000..c979b0b5
--- /dev/null
+++ b/lib/igt_psr.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include  "igt_psr.h"
+
+bool psr_active(int fd, bool check_active)
+{
+	bool active;
+	char buf[512];
+
+	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
+	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
+		(strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
+	return check_active ? active : !active;
+}
+
+bool psr_wait_entry(int fd)
+{
+	return igt_wait(psr_active(fd, true), 500, 1);
+}
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
new file mode 100644
index 00000000..980f85e0
--- /dev/null
+++ b/lib/igt_psr.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef IGT_PSR_H
+#define IGT_PSR_H
+
+#include "igt_debugfs.h"
+#include "igt_core.h"
+#include "igt_aux.h"
+
+bool psr_wait_entry(int fd);
+bool psr_active(int fd, bool check_active);
+
+#endif
diff --git a/lib/meson.build b/lib/meson.build
index 939167f9..74a5f61e 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -48,6 +48,7 @@ lib_sources = [
 	'uwildmat/uwildmat.c',
 	'igt_kmod.c',
 	'igt_vc4.c',
+	'igt_psr.c',
 ]
 
 lib_deps = [
diff --git a/tests/kms_psr.c b/tests/kms_psr.c
index 9e893ed8..218b3960 100644
--- a/tests/kms_psr.c
+++ b/tests/kms_psr.c
@@ -24,6 +24,7 @@
 
 #include "igt.h"
 #include "igt_sysfs.h"
+#include "igt_psr.h"
 #include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -197,24 +198,12 @@ static bool sink_support(data_t *data)
 		strstr(buf, "Sink_Support: yes\n");
 }
 
-static bool psr_active(int fd, bool check_active)
-{
-	bool active;
-	char buf[512];
-
-	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
-
-	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
-		 (strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
-	return check_active ? active : !active;
-}
-
-static bool wait_psr_entry(data_t *data)
+static bool psr_wait_entry_if_enabled(data_t *data)
 {
 	if (data->with_psr_disabled)
 		return true;
 
-	return igt_wait((psr_active(data->drm_fd, true)), 500, 1);
+	return psr_wait_entry(data->drm_fd);
 }
 
 static inline void manual(const char *expected)
@@ -242,7 +231,7 @@ static void run_test(data_t *data)
 	manual("screen GREEN");
 
 	/* Confirm screen stays Green after PSR got active */
-	igt_assert(wait_psr_entry(data));
+	igt_assert(psr_wait_entry_if_enabled(data));
 	manual("screen GREEN");
 
 	/* Setting a secondary fb/plane */
@@ -255,7 +244,7 @@ static void run_test(data_t *data)
 	else
 		manual("GREEN background with WHITE box");
 
-	igt_assert(wait_psr_entry(data));
+	igt_assert(psr_wait_entry_if_enabled(data));
 	switch (data->op) {
 	case PAGE_FLIP:
 		/* Only in use when testing primary plane */
@@ -437,13 +426,13 @@ int main(int argc, char *argv[])
 
 	igt_subtest("basic") {
 		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(psr_wait_entry_if_enabled(&data));
 		test_cleanup(&data);
 	}
 
 	igt_subtest("no_drrs") {
 		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(psr_wait_entry_if_enabled(&data));
 		igt_assert(drrs_disabled(&data));
 		test_cleanup(&data);
 	}
@@ -452,7 +441,7 @@ int main(int argc, char *argv[])
 		igt_subtest_f("primary_%s", op_str(op)) {
 			data.op = op;
 			setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(psr_wait_entry_if_enabled(&data));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -462,7 +451,7 @@ int main(int argc, char *argv[])
 		igt_subtest_f("sprite_%s", op_str(op)) {
 			data.op = op;
 			setup_test_plane(&data, DRM_PLANE_TYPE_OVERLAY);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(psr_wait_entry_if_enabled(&data));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -472,7 +461,7 @@ int main(int argc, char *argv[])
 		igt_subtest_f("cursor_%s", op_str(op)) {
 			data.op = op;
 			setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(psr_wait_entry_if_enabled(&data));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -481,7 +470,7 @@ int main(int argc, char *argv[])
 	igt_subtest_f("dpms") {
 		data.op = RENDER;
 		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(psr_wait_entry_if_enabled(&data));
 		dpms_off_on(&data);
 		run_test(&data);
 		test_cleanup(&data);
@@ -490,10 +479,10 @@ int main(int argc, char *argv[])
 	igt_subtest_f("suspend") {
 		data.op = PLANE_ONOFF;
 		setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(psr_wait_entry_if_enabled(&data));
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(psr_wait_entry_if_enabled(&data));
 		run_test(&data);
 		test_cleanup(&data);
 	}
-- 
2.17.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [igt-dev] [PATCH i-g-t v2 3/3] tests/frontbuffer_tracking: Use the library functions to test PSR.
  2018-07-16 22:39 [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Dhinakaran Pandiyan
  2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib Dhinakaran Pandiyan
@ 2018-07-16 22:39 ` Dhinakaran Pandiyan
  2018-07-17  5:06 ` [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Rodrigo Vivi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Dhinakaran Pandiyan @ 2018-07-16 22:39 UTC (permalink / raw)
  To: igt-dev; +Cc: Dhinakaran Pandiyan, Rodrigo Vivi

kms_frontbuffer_tracking should test PSR the same way that kms_psr does.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 tests/kms_frontbuffer_tracking.c | 42 ++++----------------------------
 1 file changed, 5 insertions(+), 37 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 116a95bc..1dfd7c1c 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -26,6 +26,7 @@
 
 #include "igt.h"
 #include "igt_sysfs.h"
+#include "igt_psr.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -756,22 +757,6 @@ static bool fbc_is_enabled(int lvl)
 	return strstr(buf, "FBC enabled\n");
 }
 
-static bool psr_is_enabled(void)
-{
-	char buf[256];
-
-	debugfs_read("i915_edp_psr_status", buf);
-	return strstr(buf, "\nHW Enabled & Active bit: yes\n");
-}
-
-static void psr_print_status(void)
-{
-	char buf[256];
-
-	debugfs_read("i915_edp_psr_status", buf);
-	igt_info("PSR status:\n%s\n", buf);
-}
-
 static void drrs_set(unsigned int val)
 {
 	char buf[2];
@@ -949,16 +934,6 @@ static bool fbc_wait_until_enabled(void)
 	return igt_wait(fbc_is_enabled(IGT_LOG_DEBUG), 2000, 1);
 }
 
-static bool psr_wait_until_enabled(void)
-{
-	return igt_wait(psr_is_enabled(), 5000, 1);
-}
-
-static bool psr_wait_until_disabled(void)
-{
-	return igt_wait(!psr_is_enabled(), 5000, 1);
-}
-
 static bool drrs_wait_until_rr_switch_to_low(void)
 {
 	return igt_wait(is_drrs_low(), 5000, 1);
@@ -1659,17 +1634,10 @@ static void do_status_assertions(int flags)
 		igt_assert(!fbc_wait_until_enabled());
 	}
 
-	if (flags & ASSERT_PSR_ENABLED) {
-		if (!psr_wait_until_enabled()) {
-			psr_print_status();
-			igt_assert_f(psr_is_enabled(), "PSR still disabled\n");
-		}
-	} else if (flags & ASSERT_PSR_DISABLED) {
-		if (!psr_wait_until_disabled()) {
-			psr_print_status();
-			igt_assert_f(!psr_is_enabled(), "PSR still enabled\n");
-		}
-	}
+	if (flags & ASSERT_PSR_ENABLED)
+		igt_assert_f(psr_wait_entry(drm.fd), "PSR still disabled\n");
+	else if (flags & ASSERT_PSR_DISABLED)
+		igt_assert_f(psr_active(drm.fd, false), "PSR still enabled\n");
 }
 
 static void __do_assertions(const struct test_mode *t, int flags,
-- 
2.17.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib
  2018-07-16 22:39 [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Dhinakaran Pandiyan
  2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib Dhinakaran Pandiyan
  2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 3/3] tests/frontbuffer_tracking: Use the library functions to test PSR Dhinakaran Pandiyan
@ 2018-07-17  5:06 ` Rodrigo Vivi
  2018-07-17 16:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] " Patchwork
  2018-07-17 20:31 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 8+ messages in thread
From: Rodrigo Vivi @ 2018-07-17  5:06 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev

On Mon, Jul 16, 2018 at 03:39:03PM -0700, Dhinakaran Pandiyan wrote:
> Change the function arguments to not rely on test specific data as
> the following patches change kms_frontbuffer_tracking to reuse PSR
> functions.
> 
> v2: Leave --no-psr intact (Rodrigo)

Thanks...


> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  tests/kms_psr.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/kms_psr.c b/tests/kms_psr.c
> index 4eca51da..9e893ed8 100644
> --- a/tests/kms_psr.c
> +++ b/tests/kms_psr.c
> @@ -197,12 +197,12 @@ static bool sink_support(data_t *data)
>  		strstr(buf, "Sink_Support: yes\n");
>  }
>  
> -static bool psr_active(data_t *data, bool check_active)
> +static bool psr_active(int fd, bool check_active)
>  {
>  	bool active;
>  	char buf[512];
>  
> -	igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf);
> +	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
>  
>  	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
>  		 (strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
> @@ -214,7 +214,7 @@ static bool wait_psr_entry(data_t *data)
>  	if (data->with_psr_disabled)
>  		return true;
>  
> -	return igt_wait((psr_active(data, true)), 500, 1);
> +	return igt_wait((psr_active(data->drm_fd, true)), 500, 1);
>  }
>  
>  static inline void manual(const char *expected)
> @@ -303,7 +303,7 @@ static void run_test(data_t *data)
>  		expected = "screen GREEN";
>  		break;
>  	}
> -	igt_assert(psr_active(data, false));
> +	igt_assert(psr_active(data->drm_fd, false));

I wonder if we shouldn't change it to only get the fd
and here for instance use igt_assert(!psr_active...

anyways this can be in separated patch

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

>  	manual(expected);
>  }
>  
> -- 
> 2.17.1
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib
  2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib Dhinakaran Pandiyan
@ 2018-07-17  5:07   ` Rodrigo Vivi
  2018-07-17 18:57     ` Dhinakaran Pandiyan
  0 siblings, 1 reply; 8+ messages in thread
From: Rodrigo Vivi @ 2018-07-17  5:07 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev

On Mon, Jul 16, 2018 at 03:39:04PM -0700, Dhinakaran Pandiyan wrote:
> kms_frontbuffer_tracking and kms_psr test PSR in different ways, let'
> fix that by creating common library functions.
> 
> v2: Include the new file in meson.build
> v3: Leave --no-psr intact (Rodrigo)
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  lib/Makefile.sources |  2 ++
>  lib/igt_psr.c        | 40 ++++++++++++++++++++++++++++++++++++++++
>  lib/igt_psr.h        | 34 ++++++++++++++++++++++++++++++++++
>  lib/meson.build      |  1 +
>  tests/kms_psr.c      | 37 +++++++++++++------------------------
>  5 files changed, 90 insertions(+), 24 deletions(-)
>  create mode 100644 lib/igt_psr.c
>  create mode 100644 lib/igt_psr.h
> 
> diff --git a/lib/Makefile.sources b/lib/Makefile.sources
> index 042c1d3b..14356c94 100644
> --- a/lib/Makefile.sources
> +++ b/lib/Makefile.sources
> @@ -103,6 +103,8 @@ lib_source_list =	 	\
>  	igt_kmod.h		\
>  	igt_syncobj.c		\
>  	igt_syncobj.h		\
> +	igt_psr.c		\
> +	igt_psr.h		\
>  	$(NULL)
>  
>  .PHONY: version.h.tmp
> diff --git a/lib/igt_psr.c b/lib/igt_psr.c
> new file mode 100644
> index 00000000..c979b0b5
> --- /dev/null
> +++ b/lib/igt_psr.c
> @@ -0,0 +1,40 @@
> +/*
> + * Copyright © 2018 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include  "igt_psr.h"
> +
> +bool psr_active(int fd, bool check_active)
> +{
> +	bool active;
> +	char buf[512];
> +
> +	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
> +	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
> +		(strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
> +	return check_active ? active : !active;
> +}
> +
> +bool psr_wait_entry(int fd)
> +{
> +	return igt_wait(psr_active(fd, true), 500, 1);
> +}
> diff --git a/lib/igt_psr.h b/lib/igt_psr.h
> new file mode 100644
> index 00000000..980f85e0
> --- /dev/null
> +++ b/lib/igt_psr.h
> @@ -0,0 +1,34 @@
> +/*
> + * Copyright © 2018 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#ifndef IGT_PSR_H
> +#define IGT_PSR_H
> +
> +#include "igt_debugfs.h"
> +#include "igt_core.h"
> +#include "igt_aux.h"
> +
> +bool psr_wait_entry(int fd);
> +bool psr_active(int fd, bool check_active);
> +
> +#endif
> diff --git a/lib/meson.build b/lib/meson.build
> index 939167f9..74a5f61e 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -48,6 +48,7 @@ lib_sources = [
>  	'uwildmat/uwildmat.c',
>  	'igt_kmod.c',
>  	'igt_vc4.c',
> +	'igt_psr.c',
>  ]
>  
>  lib_deps = [
> diff --git a/tests/kms_psr.c b/tests/kms_psr.c
> index 9e893ed8..218b3960 100644
> --- a/tests/kms_psr.c
> +++ b/tests/kms_psr.c
> @@ -24,6 +24,7 @@
>  
>  #include "igt.h"
>  #include "igt_sysfs.h"
> +#include "igt_psr.h"
>  #include <errno.h>
>  #include <stdbool.h>
>  #include <stdio.h>
> @@ -197,24 +198,12 @@ static bool sink_support(data_t *data)
>  		strstr(buf, "Sink_Support: yes\n");
>  }
>  
> -static bool psr_active(int fd, bool check_active)
> -{
> -	bool active;
> -	char buf[512];
> -
> -	igt_debugfs_read(fd, "i915_edp_psr_status", buf);
> -
> -	active = strstr(buf, "HW Enabled & Active bit: yes\n") &&
> -		 (strstr(buf, "SRDENT") || strstr(buf, "SLEEP"));
> -	return check_active ? active : !active;
> -}
> -
> -static bool wait_psr_entry(data_t *data)
> +static bool psr_wait_entry_if_enabled(data_t *data)
>  {
>  	if (data->with_psr_disabled)
>  		return true;
>  
> -	return igt_wait((psr_active(data->drm_fd, true)), 500, 1);
> +	return psr_wait_entry(data->drm_fd);
>  }
>  
>  static inline void manual(const char *expected)
> @@ -242,7 +231,7 @@ static void run_test(data_t *data)
>  	manual("screen GREEN");
>  
>  	/* Confirm screen stays Green after PSR got active */
> -	igt_assert(wait_psr_entry(data));
> +	igt_assert(psr_wait_entry_if_enabled(data));
>  	manual("screen GREEN");
>  
>  	/* Setting a secondary fb/plane */
> @@ -255,7 +244,7 @@ static void run_test(data_t *data)
>  	else
>  		manual("GREEN background with WHITE box");
>  
> -	igt_assert(wait_psr_entry(data));
> +	igt_assert(psr_wait_entry_if_enabled(data));
>  	switch (data->op) {
>  	case PAGE_FLIP:
>  		/* Only in use when testing primary plane */
> @@ -437,13 +426,13 @@ int main(int argc, char *argv[])
>  
>  	igt_subtest("basic") {
>  		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(psr_wait_entry_if_enabled(&data));
>  		test_cleanup(&data);
>  	}
>  
>  	igt_subtest("no_drrs") {
>  		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(psr_wait_entry_if_enabled(&data));
>  		igt_assert(drrs_disabled(&data));
>  		test_cleanup(&data);
>  	}
> @@ -452,7 +441,7 @@ int main(int argc, char *argv[])
>  		igt_subtest_f("primary_%s", op_str(op)) {
>  			data.op = op;
>  			setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
> -			igt_assert(wait_psr_entry(&data));
> +			igt_assert(psr_wait_entry_if_enabled(&data));
>  			run_test(&data);
>  			test_cleanup(&data);
>  		}
> @@ -462,7 +451,7 @@ int main(int argc, char *argv[])
>  		igt_subtest_f("sprite_%s", op_str(op)) {
>  			data.op = op;
>  			setup_test_plane(&data, DRM_PLANE_TYPE_OVERLAY);
> -			igt_assert(wait_psr_entry(&data));
> +			igt_assert(psr_wait_entry_if_enabled(&data));
>  			run_test(&data);
>  			test_cleanup(&data);
>  		}
> @@ -472,7 +461,7 @@ int main(int argc, char *argv[])
>  		igt_subtest_f("cursor_%s", op_str(op)) {
>  			data.op = op;
>  			setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
> -			igt_assert(wait_psr_entry(&data));
> +			igt_assert(psr_wait_entry_if_enabled(&data));
>  			run_test(&data);
>  			test_cleanup(&data);
>  		}
> @@ -481,7 +470,7 @@ int main(int argc, char *argv[])
>  	igt_subtest_f("dpms") {
>  		data.op = RENDER;
>  		setup_test_plane(&data, DRM_PLANE_TYPE_PRIMARY);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(psr_wait_entry_if_enabled(&data));
>  		dpms_off_on(&data);
>  		run_test(&data);
>  		test_cleanup(&data);
> @@ -490,10 +479,10 @@ int main(int argc, char *argv[])
>  	igt_subtest_f("suspend") {
>  		data.op = PLANE_ONOFF;
>  		setup_test_plane(&data, DRM_PLANE_TYPE_CURSOR);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(psr_wait_entry_if_enabled(&data));
>  		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>  					      SUSPEND_TEST_NONE);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(psr_wait_entry_if_enabled(&data));
>  		run_test(&data);
>  		test_cleanup(&data);
>  	}
> -- 
> 2.17.1
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] tests/psr: Prepare for moving PSR state checking functions into lib
  2018-07-16 22:39 [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Dhinakaran Pandiyan
                   ` (2 preceding siblings ...)
  2018-07-17  5:06 ` [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Rodrigo Vivi
@ 2018-07-17 16:18 ` Patchwork
  2018-07-17 20:31 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-07-17 16:18 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v2,1/3] tests/psr: Prepare for moving PSR state checking functions into lib
URL   : https://patchwork.freedesktop.org/series/46632/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4501 -> IGTPW_1594 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46632/revisions/1/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1594 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       PASS -> INCOMPLETE (fdo#103713)

    igt@kms_chamelium@hdmi-hpd-fast:
      fi-kbl-7500u:       SKIP -> FAIL (fdo#103841, fdo#102672)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106000)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       DMESG-WARN (fdo#107139, fdo#105128) -> PASS

    igt@kms_busy@basic-flip-b:
      fi-skl-6700hq:      DMESG-WARN (fdo#105998) -> PASS +1

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

    
  fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
  fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139


== Participating hosts (46 -> 41) ==

  Additional (1): fi-cfl-8109u 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-kbl-8809g 


== Build changes ==

    * IGT: IGT_4559 -> IGTPW_1594

  CI_DRM_4501: 692d13f7b75baf0bb8c58b9784569c52d68f01e2 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1594: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1594/
  IGT_4559: 6d341aac2124836443ce74e8e97a4508ac8d5095 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1594/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib
  2018-07-17  5:07   ` Rodrigo Vivi
@ 2018-07-17 18:57     ` Dhinakaran Pandiyan
  0 siblings, 0 replies; 8+ messages in thread
From: Dhinakaran Pandiyan @ 2018-07-17 18:57 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: igt-dev

On Mon, 2018-07-16 at 22:07 -0700, Rodrigo Vivi wrote:
> On Mon, Jul 16, 2018 at 03:39:04PM -0700, Dhinakaran Pandiyan wrote:
> > 
> > kms_frontbuffer_tracking and kms_psr test PSR in different ways,
> > let'
> > fix that by creating common library functions.
> > 
> > v2: Include the new file in meson.build
> > v3: Leave --no-psr intact (Rodrigo)
> > 
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 

I have pushed the series, thanks for the review

-DK

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v2,1/3] tests/psr: Prepare for moving PSR state checking functions into lib
  2018-07-16 22:39 [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Dhinakaran Pandiyan
                   ` (3 preceding siblings ...)
  2018-07-17 16:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] " Patchwork
@ 2018-07-17 20:31 ` Patchwork
  4 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-07-17 20:31 UTC (permalink / raw)
  To: Dhinakaran Pandiyan; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v2,1/3] tests/psr: Prepare for moving PSR state checking functions into lib
URL   : https://patchwork.freedesktop.org/series/46632/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4559_full -> IGTPW_1594_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1594_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1594_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/46632/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1594_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-blt:
      shard-kbl:          PASS -> SKIP +1

    
== Known issues ==

  Here are the changes found in IGTPW_1594_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_schedule@pi-ringfull-bsd1:
      shard-kbl:          NOTRUN -> FAIL (fdo#103158) +3

    igt@gem_pwrite_snooped:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-kbl:          NOTRUN -> FAIL (fdo#106641)
      shard-snb:          PASS -> FAIL (fdo#106641)

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#105189) +1

    igt@kms_flip@plain-flip-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368) +1

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166)

    igt@kms_setmode@basic:
      shard-kbl:          PASS -> FAIL (fdo#99912)

    igt@kms_sysfs_edid_timing:
      shard-kbl:          NOTRUN -> FAIL (fdo#100047)

    
    ==== Possible fixes ====

    igt@gem_cs_tlb@render:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@kms_draw_crc@draw-method-rgb565-blt-ytiled:
      shard-glk:          FAIL (fdo#103184) -> PASS +1

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +1

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

    igt@perf_pmu@rc6-runtime-pm-long:
      shard-apl:          FAIL (fdo#105010) -> PASS
      shard-glk:          FAIL (fdo#105010) -> PASS

    
  fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
  fdo#105010 https://bugs.freedesktop.org/show_bug.cgi?id=105010
  fdo#105189 https://bugs.freedesktop.org/show_bug.cgi?id=105189
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4559 -> IGTPW_1594
    * Linux: CI_DRM_4499 -> CI_DRM_4501

  CI_DRM_4499: 30c05928fc8cdb8bbbf052fec71f484654cf2a49 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4501: 692d13f7b75baf0bb8c58b9784569c52d68f01e2 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1594: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1594/
  IGT_4559: 6d341aac2124836443ce74e8e97a4508ac8d5095 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1594/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-17 20:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16 22:39 [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Dhinakaran Pandiyan
2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 2/3] tests/psr: Move PSR state test functions to lib Dhinakaran Pandiyan
2018-07-17  5:07   ` Rodrigo Vivi
2018-07-17 18:57     ` Dhinakaran Pandiyan
2018-07-16 22:39 ` [igt-dev] [PATCH i-g-t v2 3/3] tests/frontbuffer_tracking: Use the library functions to test PSR Dhinakaran Pandiyan
2018-07-17  5:06 ` [igt-dev] [PATCH i-g-t v2 1/3] tests/psr: Prepare for moving PSR state checking functions into lib Rodrigo Vivi
2018-07-17 16:18 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/3] " Patchwork
2018-07-17 20:31 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).