public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library.
@ 2017-02-13 23:43 Jim Bride
  2017-02-13 23:43 ` [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives Jim Bride
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jim Bride @ 2017-02-13 23:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni, Rodrigo Vivi

Factor out some code that was replicated in three test utilities into
some new IGT library functions so that we are checking PSR status in
a consistent fashion across all of our PSR tests.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 lib/Makefile.sources |   2 +
 lib/igt.h            |   1 +
 lib/igt_psr.c        | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_psr.h        |  38 +++++++++++++
 4 files changed, 188 insertions(+)
 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 6348487..0a8835b 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -83,6 +83,8 @@ lib_source_list =	 	\
 	uwildmat/uwildmat.c	\
 	igt_kmod.c		\
 	igt_kmod.h		\
+	igt_psr.c		\
+	igt_psr.h		\
 	$(NULL)
 
 if HAVE_CHAMELIUM
diff --git a/lib/igt.h b/lib/igt.h
index a97923e..7f52d6c 100644
--- a/lib/igt.h
+++ b/lib/igt.h
@@ -37,6 +37,7 @@
 #include "igt_gt.h"
 #include "igt_kms.h"
 #include "igt_pm.h"
+#include "igt_psr.h"
 #include "igt_stats.h"
 #include "igt_chamelium.h"
 #include "instdone.h"
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
new file mode 100644
index 0000000..833a9d6
--- /dev/null
+++ b/lib/igt_psr.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright © 2017 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.h"
+#include <stdio.h>
+#include <stdbool.h>
+#include <sys/types.h>
+#include <string.h>
+
+/**
+ * SECTION:igt_psr
+ * @short_description: Panel Self Refresh helpers
+ * @title: Panel Self Refresh
+ * @include: igt.h
+ *
+ * This library provides various helpers to enable Panel Self Refresh,
+ * as well as to check the state of PSR on the system (enabled vs.
+ * disabled, active vs. inactive) or to wait for PSR to be active
+ * or inactive.
+ */
+
+/**
+ * igt_psr_possible:
+ *
+ * Returns true if both the source and sink support PSR.
+ */
+bool igt_psr_possible(void)
+{
+	char buf[512];
+
+	igt_debugfs_read("i915_edp_psr_status", buf);
+
+	return strstr(buf, "Source_OK: yes\n") &&
+		strstr(buf, "Sink_Support: yes\n");
+}
+
+/**
+ * igt_psr_active:
+ *
+ * Returns true if PSR is active on the panel.
+ */
+bool igt_psr_active(void)
+{
+	char buf[512];
+	bool actret = false;
+	bool hwactret = false;
+
+	igt_debugfs_read("i915_edp_psr_status", buf);
+	hwactret = (strstr(buf, "HW Enabled & Active bit: yes\n") != NULL);
+	actret = (strstr(buf, "Active: yes\n") != NULL);
+	igt_debug("hwactret: %s actret: %s\n", hwactret ? "true" : "false",
+		 actret ? "true" : "false");
+	return hwactret && actret;
+}
+
+/**
+ * igt_psr_await_status:
+ * @active: A boolean that causes the function to wait for PSR to activate
+ *          if set to true, or to wait for PSR to deactivate if false.
+ *
+ * Returns true if the requested condition is met.
+ */
+bool igt_psr_await_status(bool active)
+{
+	const int timeout = 5;
+	int count = 0;
+	while (count < timeout) {
+		if (igt_psr_active() == active) {
+			igt_debug("PSR %s after %d seconds.\n",
+				  active ? "Active" : "Inactive", count);
+			return true;
+		}
+		count++;
+		sleep(1);
+	}
+	return false;
+}
+
+/**
+ * igt_psr_enabled:
+ *
+ * Returns true if the PSR feature is enabled.
+ */
+bool igt_psr_enabled(void)
+{
+	char buf[256];
+
+	igt_debugfs_read("i915_edp_psr_status", buf);
+	return strstr(buf, "Enabled: yes\n");
+}
+
+/**
+ * igt_psr_print_status:
+ *
+ * Dumps the contents of i915_edp_psr_status from debugfs.
+ */
+void igt_psr_print_status(void)
+{
+        char buf[256];
+
+        igt_debugfs_read("i915_edp_psr_status", buf);
+        igt_info("PSR status:\n%s\n", buf);
+}
+
+/**
+ * igt_psr_valid_connector:
+ * @connector: a drmModeConnector pointer to check
+ *
+ * Returns true if connector is an eDP connector.
+ */
+bool igt_psr_valid_connector(drmModeConnectorPtr connector)
+{
+	return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
+}
+
+/**
+ * igt_psr_sink_support:
+ *
+ * Returns true if the current eDP panel supports PSR.
+ */
+bool igt_psr_sink_support(void)
+{
+	char buf[256];
+
+	igt_debugfs_read("i915_edp_psr_status", buf);
+	return strstr(buf, "Sink_Support: yes\n");
+}
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
new file mode 100644
index 0000000..9625e91
--- /dev/null
+++ b/lib/igt_psr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2017 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
+
+#define igt_psr_enable() igt_set_module_param_int("enable_psr", 1)
+#define igt_psr_disable() igt_set_module_param_int("enable_psr", 0)
+
+bool igt_psr_possible(void);
+bool igt_psr_active(void);
+bool igt_psr_await_status(bool active);
+bool igt_psr_enabled(void);
+void igt_psr_print_status(void);
+bool igt_psr_valid_connector(drmModeConnectorPtr connector);
+bool igt_psr_sink_support(void);
+
+#endif /* IGT_PSR_H */
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives
  2017-02-13 23:43 [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Jim Bride
@ 2017-02-13 23:43 ` Jim Bride
  2017-03-23 22:22   ` Vivi, Rodrigo
  2017-02-13 23:43 ` [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions Jim Bride
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jim Bride @ 2017-02-13 23:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 tests/kms_psr_sink_crc.c | 53 ++++++++++--------------------------------------
 1 file changed, 11 insertions(+), 42 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 8f6bdc0..1d9eb11 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -191,37 +191,6 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)
 	gem_bo_busy(data->drm_fd, handle);
 }
 
-static bool psr_possible(data_t *data)
-{
-	char buf[512];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-
-	return running_with_psr_disabled ||
-		strstr(buf, "Sink_Support: yes\n");
-}
-
-static bool psr_active(data_t *data)
-{
-	char buf[512];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-
-	return running_with_psr_disabled ||
-		strstr(buf, "HW Enabled & Active bit: yes\n");
-}
-
-static bool wait_psr_entry(data_t *data)
-{
-	int timeout = 5;
-	while (timeout--) {
-		if (psr_active(data))
-			return true;
-		sleep(1);
-	}
-	return false;
-}
-
 static void get_sink_crc(data_t *data, char *crc) {
 	int ret;
 	FILE *file;
@@ -301,7 +270,7 @@ static void run_test(data_t *data)
 	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
 	/* Confirm screen stays Green after PSR got active */
-	igt_assert(wait_psr_entry(data));
+	igt_assert(igt_psr_await_status(true));
 	get_sink_crc(data, ref_crc);
 	assert_or_manual(is_green(ref_crc), "screen GREEN");
 
@@ -315,7 +284,7 @@ static void run_test(data_t *data)
 	igt_display_commit(&data->display);
 
 	/* Confirm it is not Green anymore */
-	igt_assert(wait_psr_entry(data));
+	igt_assert(igt_psr_await_status(true));
 	get_sink_crc(data, ref_crc);
 	if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
 		assert_or_manual(!is_green(ref_crc), "screen WHITE");
@@ -513,7 +482,7 @@ int main(int argc, char *argv[])
 		igt_set_module_param_int("enable_psr", running_with_psr_disabled ?
 					 0 : 1);
 
-		igt_skip_on(!psr_possible(&data));
+		igt_skip_on(!igt_psr_possible());
 
 		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
 		igt_assert(data.bufmgr);
@@ -524,7 +493,7 @@ int main(int argc, char *argv[])
 
 	igt_subtest("psr_basic") {
 		setup_test_plane(&data);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(igt_psr_await_status(true));
 	}
 
 	for (op = PAGE_FLIP; op <= RENDER; op++) {
@@ -532,7 +501,7 @@ int main(int argc, char *argv[])
 			data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 			data.op = op;
 			setup_test_plane(&data);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(igt_psr_await_status(true));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -543,7 +512,7 @@ int main(int argc, char *argv[])
 			data.test_plane = DRM_PLANE_TYPE_OVERLAY;
 			data.op = op;
 			setup_test_plane(&data);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(igt_psr_await_status(true));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -554,7 +523,7 @@ int main(int argc, char *argv[])
 			data.test_plane = DRM_PLANE_TYPE_CURSOR;
 			data.op = op;
 			setup_test_plane(&data);
-			igt_assert(wait_psr_entry(&data));
+			igt_assert(igt_psr_await_status(true));
 			run_test(&data);
 			test_cleanup(&data);
 		}
@@ -564,7 +533,7 @@ int main(int argc, char *argv[])
 		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 		data.op = RENDER;
 		setup_test_plane(&data);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(igt_psr_await_status(true));
 
 		dpms_off_on(data);
 
@@ -579,7 +548,7 @@ int main(int argc, char *argv[])
 
 		dpms_off_on(data);
 
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(igt_psr_await_status(true));
 		run_test(&data);
 		test_cleanup(&data);
 	}
@@ -588,7 +557,7 @@ int main(int argc, char *argv[])
 		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
 		data.op = PAGE_FLIP;
 		setup_test_plane(&data);
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(igt_psr_await_status(true));
 
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
@@ -605,7 +574,7 @@ int main(int argc, char *argv[])
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 
-		igt_assert(wait_psr_entry(&data));
+		igt_assert(igt_psr_await_status(true));
 		run_test(&data);
 		test_cleanup(&data);
 	}
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions
  2017-02-13 23:43 [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Jim Bride
  2017-02-13 23:43 ` [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives Jim Bride
@ 2017-02-13 23:43 ` Jim Bride
  2017-03-23 22:22   ` Vivi, Rodrigo
  2017-02-13 23:43 ` [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: " Jim Bride
  2017-03-23 22:20 ` [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Vivi, Rodrigo
  3 siblings, 1 reply; 8+ messages in thread
From: Jim Bride @ 2017-02-13 23:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni, Rodrigo Vivi

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 tests/kms_frontbuffer_tracking.c | 47 ++++++++--------------------------------
 1 file changed, 9 insertions(+), 38 deletions(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 4f4848b..91376e4 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -793,23 +793,6 @@ static void fbc_print_status(void)
 	igt_info("FBC status:\n%s\n", buf);
 }
 
-static bool psr_is_enabled(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-	return strstr(buf, "\nActive: yes\n") &&
-	       strstr(buf, "\nHW Enabled & Active bit: yes\n");
-}
-
-static void psr_print_status(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-	igt_info("PSR status:\n%s\n", buf);
-}
-
 static struct timespec fbc_get_last_action(void)
 {
 	struct timespec ret = { 0, 0 };
@@ -915,15 +898,8 @@ static bool fbc_wait_until_enabled(void)
 	return igt_wait(fbc_is_enabled(), 2000, 1);
 }
 
-static bool psr_wait_until_enabled(void)
-{
-	return igt_wait(psr_is_enabled(), 5000, 1);
-}
-
 #define fbc_enable() igt_set_module_param_int("enable_fbc", 1)
 #define fbc_disable() igt_set_module_param_int("enable_fbc", 0)
-#define psr_enable() igt_set_module_param_int("enable_psr", 1)
-#define psr_disable() igt_set_module_param_int("enable_psr", 0)
 
 static void get_sink_crc(sink_crc_t *crc, bool mandatory)
 {
@@ -1169,7 +1145,7 @@ static void disable_features(const struct test_mode *t)
 		return;
 
 	fbc_disable();
-	psr_disable();
+	igt_psr_disable();
 }
 
 static void *busy_thread_func(void *data)
@@ -1529,14 +1505,6 @@ static void teardown_fbc(void)
 {
 }
 
-static bool psr_sink_has_support(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-	return strstr(buf, "Sink_Support: yes\n");
-}
-
 static void setup_psr(void)
 {
 	if (get_connector(prim_mode_params.connector_id)->connector_type !=
@@ -1545,7 +1513,7 @@ static void setup_psr(void)
 		return;
 	}
 
-	if (!psr_sink_has_support()) {
+	if (!igt_psr_sink_support()) {
 		igt_info("Can't test PSR: not supported by sink.\n");
 		return;
 	}
@@ -1699,12 +1667,15 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags)
 	}								\
 									\
 	if (flags_ & ASSERT_PSR_ENABLED) {				\
-		if (!psr_wait_until_enabled()) {			\
-			psr_print_status();				\
+		if (!igt_psr_await_status(true)) {		        \
+			igt_psr_print_status();				\
 			igt_assert_f(false, "PSR disabled\n");		\
 		}							\
 	} else if (flags_ & ASSERT_PSR_DISABLED) {			\
-		igt_assert(!psr_wait_until_enabled());			\
+		if (!igt_psr_await_status(false)) {                     \
+			igt_psr_print_status();                         \
+			igt_assert_f(false, "PSR enabled\n");		\
+		}							\
 	}								\
 } while (0)
 
@@ -1804,7 +1775,7 @@ static void enable_features_for_test(const struct test_mode *t)
 	if (t->feature & FEATURE_FBC)
 		fbc_enable();
 	if (t->feature & FEATURE_PSR)
-		psr_enable();
+		igt_psr_enable();
 }
 
 static void check_test_requirements(const struct test_mode *t)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: Refactor to use IGT PSR library functions
  2017-02-13 23:43 [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Jim Bride
  2017-02-13 23:43 ` [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives Jim Bride
  2017-02-13 23:43 ` [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions Jim Bride
@ 2017-02-13 23:43 ` Jim Bride
  2017-03-23 22:24   ` Vivi, Rodrigo
  2017-03-23 22:20 ` [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Vivi, Rodrigo
  3 siblings, 1 reply; 8+ messages in thread
From: Jim Bride @ 2017-02-13 23:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni, Rodrigo Vivi

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 tests/kms_fbcon_fbt.c | 47 +++++++++++------------------------------------
 1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index 6342289..a59257b 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -103,8 +103,9 @@ static bool fbc_is_enabled(void)
 	return strstr(buf, "FBC enabled\n");
 }
 
-static bool fbc_wait_until_enabled(void)
+static bool fbc_wait_until_enabled(bool enabled)
 {
+	enabled = enabled;
 	return igt_wait(fbc_is_enabled(), 5000, 1);
 }
 
@@ -147,35 +148,9 @@ static void set_mode_for_one_screen(struct drm_info *drm, struct igt_fb *fb,
 	igt_assert_eq(rc, 0);
 }
 
-static bool psr_supported_on_chipset(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-	return strstr(buf, "Sink_Support: yes\n");
-}
-
-static bool connector_can_psr(drmModeConnectorPtr connector)
-{
-	return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
-}
-
-static bool psr_is_enabled(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-	return strstr(buf, "\nActive: yes\n");
-}
-
-static bool psr_wait_until_enabled(void)
-{
-	return igt_wait(psr_is_enabled(), 5000, 1);
-}
-
 struct feature {
 	bool (*supported_on_chipset)(void);
-	bool (*wait_until_enabled)(void);
+	bool (*wait_until_enabled)(bool status);
 	bool (*connector_possible_fn)(drmModeConnectorPtr connector);
 	const char *param_name;
 } fbc = {
@@ -184,9 +159,9 @@ struct feature {
 	.connector_possible_fn = connector_can_fbc,
 	.param_name = "enable_fbc",
 }, psr = {
-	.supported_on_chipset = psr_supported_on_chipset,
-	.wait_until_enabled = psr_wait_until_enabled,
-	.connector_possible_fn = connector_can_psr,
+	.supported_on_chipset = igt_psr_sink_support,
+	.wait_until_enabled = igt_psr_await_status,
+	.connector_possible_fn = igt_psr_valid_connector,
 	.param_name = "enable_psr",
 };
 
@@ -210,17 +185,17 @@ static void subtest(struct feature *feature, bool suspend)
 
 	kmstest_unset_all_crtcs(drm.fd, drm.res);
 	wait_user("Modes unset.");
-	igt_assert(!feature->wait_until_enabled());
+	igt_assert(!feature->wait_until_enabled(true));
 
 	set_mode_for_one_screen(&drm, &fb, feature->connector_possible_fn);
 	wait_user("Screen set.");
-	igt_assert(feature->wait_until_enabled());
+	igt_assert(feature->wait_until_enabled(true));
 
 	if (suspend) {
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		sleep(5);
-		igt_assert(feature->wait_until_enabled());
+		igt_assert(feature->wait_until_enabled(true));
 	}
 
 	igt_remove_fb(drm.fd, &fb);
@@ -230,13 +205,13 @@ static void subtest(struct feature *feature, bool suspend)
 	sleep(3);
 
 	wait_user("Back to fbcon.");
-	igt_assert(!feature->wait_until_enabled());
+	igt_assert(!feature->wait_until_enabled(true));
 
 	if (suspend) {
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		sleep(5);
-		igt_assert(!feature->wait_until_enabled());
+		igt_assert(!feature->wait_until_enabled(true));
 	}
 }
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library.
  2017-02-13 23:43 [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Jim Bride
                   ` (2 preceding siblings ...)
  2017-02-13 23:43 ` [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: " Jim Bride
@ 2017-03-23 22:20 ` Vivi, Rodrigo
  3 siblings, 0 replies; 8+ messages in thread
From: Vivi, Rodrigo @ 2017-03-23 22:20 UTC (permalink / raw)
  To: jim.bride@linux.intel.com
  Cc: intel-gfx@lists.freedesktop.org, Zanoni, Paulo R

On Mon, 2017-02-13 at 15:43 -0800, Jim Bride wrote:
> Factor out some code that was replicated in three test utilities into
> some new IGT library functions so that we are checking PSR status in
> a consistent fashion across all of our PSR tests.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  lib/Makefile.sources |   2 +
>  lib/igt.h            |   1 +
>  lib/igt_psr.c        | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_psr.h        |  38 +++++++++++++
>  4 files changed, 188 insertions(+)
>  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 6348487..0a8835b 100644
> --- a/lib/Makefile.sources
> +++ b/lib/Makefile.sources
> @@ -83,6 +83,8 @@ lib_source_list =	 	\
>  	uwildmat/uwildmat.c	\
>  	igt_kmod.c		\
>  	igt_kmod.h		\
> +	igt_psr.c		\
> +	igt_psr.h		\
>  	$(NULL)
>  
>  if HAVE_CHAMELIUM
> diff --git a/lib/igt.h b/lib/igt.h
> index a97923e..7f52d6c 100644
> --- a/lib/igt.h
> +++ b/lib/igt.h
> @@ -37,6 +37,7 @@
>  #include "igt_gt.h"
>  #include "igt_kms.h"
>  #include "igt_pm.h"
> +#include "igt_psr.h"
>  #include "igt_stats.h"
>  #include "igt_chamelium.h"
>  #include "instdone.h"
> diff --git a/lib/igt_psr.c b/lib/igt_psr.c
> new file mode 100644
> index 0000000..833a9d6
> --- /dev/null
> +++ b/lib/igt_psr.c
> @@ -0,0 +1,147 @@
> +/*
> + * Copyright © 2017 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.h"
> +#include <stdio.h>
> +#include <stdbool.h>
> +#include <sys/types.h>
> +#include <string.h>
> +
> +/**
> + * SECTION:igt_psr
> + * @short_description: Panel Self Refresh helpers
> + * @title: Panel Self Refresh
> + * @include: igt.h
> + *
> + * This library provides various helpers to enable Panel Self Refresh,
> + * as well as to check the state of PSR on the system (enabled vs.
> + * disabled, active vs. inactive) or to wait for PSR to be active
> + * or inactive.
> + */
> +
> +/**
> + * igt_psr_possible:
> + *
> + * Returns true if both the source and sink support PSR.
> + */
> +bool igt_psr_possible(void)
> +{
> +	char buf[512];
> +
> +	igt_debugfs_read("i915_edp_psr_status", buf);
> +
> +	return strstr(buf, "Source_OK: yes\n") &&

Remember that with i915.enable_psr=0 Source_OK is "no". But PSR might
still be "possible".

Maybe we could find a better name for the function?
Anyways

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

> +		strstr(buf, "Sink_Support: yes\n");
> +}
> +
> +/**
> + * igt_psr_active:
> + *
> + * Returns true if PSR is active on the panel.
> + */
> +bool igt_psr_active(void)
> +{
> +	char buf[512];
> +	bool actret = false;
> +	bool hwactret = false;
> +
> +	igt_debugfs_read("i915_edp_psr_status", buf);
> +	hwactret = (strstr(buf, "HW Enabled & Active bit: yes\n") != NULL);
> +	actret = (strstr(buf, "Active: yes\n") != NULL);
> +	igt_debug("hwactret: %s actret: %s\n", hwactret ? "true" : "false",
> +		 actret ? "true" : "false");
> +	return hwactret && actret;
> +}
> +
> +/**
> + * igt_psr_await_status:
> + * @active: A boolean that causes the function to wait for PSR to activate
> + *          if set to true, or to wait for PSR to deactivate if false.
> + *
> + * Returns true if the requested condition is met.
> + */
> +bool igt_psr_await_status(bool active)
> +{
> +	const int timeout = 5;
> +	int count = 0;
> +	while (count < timeout) {
> +		if (igt_psr_active() == active) {
> +			igt_debug("PSR %s after %d seconds.\n",
> +				  active ? "Active" : "Inactive", count);
> +			return true;
> +		}
> +		count++;
> +		sleep(1);
> +	}
> +	return false;
> +}
> +
> +/**
> + * igt_psr_enabled:
> + *
> + * Returns true if the PSR feature is enabled.
> + */
> +bool igt_psr_enabled(void)
> +{
> +	char buf[256];
> +
> +	igt_debugfs_read("i915_edp_psr_status", buf);
> +	return strstr(buf, "Enabled: yes\n");
> +}
> +
> +/**
> + * igt_psr_print_status:
> + *
> + * Dumps the contents of i915_edp_psr_status from debugfs.
> + */
> +void igt_psr_print_status(void)
> +{
> +        char buf[256];
> +
> +        igt_debugfs_read("i915_edp_psr_status", buf);
> +        igt_info("PSR status:\n%s\n", buf);
> +}
> +
> +/**
> + * igt_psr_valid_connector:
> + * @connector: a drmModeConnector pointer to check
> + *
> + * Returns true if connector is an eDP connector.
> + */
> +bool igt_psr_valid_connector(drmModeConnectorPtr connector)
> +{
> +	return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
> +}
> +
> +/**
> + * igt_psr_sink_support:
> + *
> + * Returns true if the current eDP panel supports PSR.
> + */
> +bool igt_psr_sink_support(void)
> +{
> +	char buf[256];
> +
> +	igt_debugfs_read("i915_edp_psr_status", buf);
> +	return strstr(buf, "Sink_Support: yes\n");
> +}
> diff --git a/lib/igt_psr.h b/lib/igt_psr.h
> new file mode 100644
> index 0000000..9625e91
> --- /dev/null
> +++ b/lib/igt_psr.h
> @@ -0,0 +1,38 @@
> +/*
> + * Copyright © 2017 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
> +
> +#define igt_psr_enable() igt_set_module_param_int("enable_psr", 1)
> +#define igt_psr_disable() igt_set_module_param_int("enable_psr", 0)
> +
> +bool igt_psr_possible(void);
> +bool igt_psr_active(void);
> +bool igt_psr_await_status(bool active);
> +bool igt_psr_enabled(void);
> +void igt_psr_print_status(void);
> +bool igt_psr_valid_connector(drmModeConnectorPtr connector);
> +bool igt_psr_sink_support(void);
> +
> +#endif /* IGT_PSR_H */



_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives
  2017-02-13 23:43 ` [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives Jim Bride
@ 2017-03-23 22:22   ` Vivi, Rodrigo
  0 siblings, 0 replies; 8+ messages in thread
From: Vivi, Rodrigo @ 2017-03-23 22:22 UTC (permalink / raw)
  To: jim.bride@linux.intel.com; +Cc: intel-gfx@lists.freedesktop.org

On Mon, 2017-02-13 at 15:43 -0800, Jim Bride wrote:
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  tests/kms_psr_sink_crc.c | 53 ++++++++++--------------------------------------
>  1 file changed, 11 insertions(+), 42 deletions(-)
> 
> diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
> index 8f6bdc0..1d9eb11 100644
> --- a/tests/kms_psr_sink_crc.c
> +++ b/tests/kms_psr_sink_crc.c
> @@ -191,37 +191,6 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)
>  	gem_bo_busy(data->drm_fd, handle);
>  }
>  
> -static bool psr_possible(data_t *data)
> -{
> -	char buf[512];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -
> -	return running_with_psr_disabled ||

Oh! this patch removes the hability to run with psr disabled!

I really likes this functionality so we can know what to expect when PSR
is in place.

> -		strstr(buf, "Sink_Support: yes\n");
> -}
> -
> -static bool psr_active(data_t *data)
> -{
> -	char buf[512];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -
> -	return running_with_psr_disabled ||
> -		strstr(buf, "HW Enabled & Active bit: yes\n");
> -}
> -
> -static bool wait_psr_entry(data_t *data)
> -{
> -	int timeout = 5;
> -	while (timeout--) {
> -		if (psr_active(data))
> -			return true;
> -		sleep(1);
> -	}
> -	return false;
> -}
> -
>  static void get_sink_crc(data_t *data, char *crc) {
>  	int ret;
>  	FILE *file;
> @@ -301,7 +270,7 @@ static void run_test(data_t *data)
>  	assert_or_manual(is_green(ref_crc), "screen GREEN");
>  
>  	/* Confirm screen stays Green after PSR got active */
> -	igt_assert(wait_psr_entry(data));
> +	igt_assert(igt_psr_await_status(true));
>  	get_sink_crc(data, ref_crc);
>  	assert_or_manual(is_green(ref_crc), "screen GREEN");
>  
> @@ -315,7 +284,7 @@ static void run_test(data_t *data)
>  	igt_display_commit(&data->display);
>  
>  	/* Confirm it is not Green anymore */
> -	igt_assert(wait_psr_entry(data));
> +	igt_assert(igt_psr_await_status(true));
>  	get_sink_crc(data, ref_crc);
>  	if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
>  		assert_or_manual(!is_green(ref_crc), "screen WHITE");
> @@ -513,7 +482,7 @@ int main(int argc, char *argv[])
>  		igt_set_module_param_int("enable_psr", running_with_psr_disabled ?
>  					 0 : 1);
>  
> -		igt_skip_on(!psr_possible(&data));
> +		igt_skip_on(!igt_psr_possible());
>  
>  		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
>  		igt_assert(data.bufmgr);
> @@ -524,7 +493,7 @@ int main(int argc, char *argv[])
>  
>  	igt_subtest("psr_basic") {
>  		setup_test_plane(&data);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(igt_psr_await_status(true));
>  	}
>  
>  	for (op = PAGE_FLIP; op <= RENDER; op++) {
> @@ -532,7 +501,7 @@ int main(int argc, char *argv[])
>  			data.test_plane = DRM_PLANE_TYPE_PRIMARY;
>  			data.op = op;
>  			setup_test_plane(&data);
> -			igt_assert(wait_psr_entry(&data));
> +			igt_assert(igt_psr_await_status(true));
>  			run_test(&data);
>  			test_cleanup(&data);
>  		}
> @@ -543,7 +512,7 @@ int main(int argc, char *argv[])
>  			data.test_plane = DRM_PLANE_TYPE_OVERLAY;
>  			data.op = op;
>  			setup_test_plane(&data);
> -			igt_assert(wait_psr_entry(&data));
> +			igt_assert(igt_psr_await_status(true));
>  			run_test(&data);
>  			test_cleanup(&data);
>  		}
> @@ -554,7 +523,7 @@ int main(int argc, char *argv[])
>  			data.test_plane = DRM_PLANE_TYPE_CURSOR;
>  			data.op = op;
>  			setup_test_plane(&data);
> -			igt_assert(wait_psr_entry(&data));
> +			igt_assert(igt_psr_await_status(true));
>  			run_test(&data);
>  			test_cleanup(&data);
>  		}
> @@ -564,7 +533,7 @@ int main(int argc, char *argv[])
>  		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
>  		data.op = RENDER;
>  		setup_test_plane(&data);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(igt_psr_await_status(true));
>  
>  		dpms_off_on(data);
>  
> @@ -579,7 +548,7 @@ int main(int argc, char *argv[])
>  
>  		dpms_off_on(data);
>  
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(igt_psr_await_status(true));
>  		run_test(&data);
>  		test_cleanup(&data);
>  	}
> @@ -588,7 +557,7 @@ int main(int argc, char *argv[])
>  		data.test_plane = DRM_PLANE_TYPE_PRIMARY;
>  		data.op = PAGE_FLIP;
>  		setup_test_plane(&data);
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(igt_psr_await_status(true));
>  
>  		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>  					      SUSPEND_TEST_NONE);
> @@ -605,7 +574,7 @@ int main(int argc, char *argv[])
>  		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>  					      SUSPEND_TEST_NONE);
>  
> -		igt_assert(wait_psr_entry(&data));
> +		igt_assert(igt_psr_await_status(true));
>  		run_test(&data);
>  		test_cleanup(&data);
>  	}

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions
  2017-02-13 23:43 ` [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions Jim Bride
@ 2017-03-23 22:22   ` Vivi, Rodrigo
  0 siblings, 0 replies; 8+ messages in thread
From: Vivi, Rodrigo @ 2017-03-23 22:22 UTC (permalink / raw)
  To: jim.bride@linux.intel.com
  Cc: intel-gfx@lists.freedesktop.org, Zanoni, Paulo R

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

On Mon, 2017-02-13 at 15:43 -0800, Jim Bride wrote:
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  tests/kms_frontbuffer_tracking.c | 47 ++++++++--------------------------------
>  1 file changed, 9 insertions(+), 38 deletions(-)
> 
> diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
> index 4f4848b..91376e4 100644
> --- a/tests/kms_frontbuffer_tracking.c
> +++ b/tests/kms_frontbuffer_tracking.c
> @@ -793,23 +793,6 @@ static void fbc_print_status(void)
>  	igt_info("FBC status:\n%s\n", buf);
>  }
>  
> -static bool psr_is_enabled(void)
> -{
> -	char buf[256];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -	return strstr(buf, "\nActive: yes\n") &&
> -	       strstr(buf, "\nHW Enabled & Active bit: yes\n");
> -}
> -
> -static void psr_print_status(void)
> -{
> -	char buf[256];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -	igt_info("PSR status:\n%s\n", buf);
> -}
> -
>  static struct timespec fbc_get_last_action(void)
>  {
>  	struct timespec ret = { 0, 0 };
> @@ -915,15 +898,8 @@ static bool fbc_wait_until_enabled(void)
>  	return igt_wait(fbc_is_enabled(), 2000, 1);
>  }
>  
> -static bool psr_wait_until_enabled(void)
> -{
> -	return igt_wait(psr_is_enabled(), 5000, 1);
> -}
> -
>  #define fbc_enable() igt_set_module_param_int("enable_fbc", 1)
>  #define fbc_disable() igt_set_module_param_int("enable_fbc", 0)
> -#define psr_enable() igt_set_module_param_int("enable_psr", 1)
> -#define psr_disable() igt_set_module_param_int("enable_psr", 0)
>  
>  static void get_sink_crc(sink_crc_t *crc, bool mandatory)
>  {
> @@ -1169,7 +1145,7 @@ static void disable_features(const struct test_mode *t)
>  		return;
>  
>  	fbc_disable();
> -	psr_disable();
> +	igt_psr_disable();
>  }
>  
>  static void *busy_thread_func(void *data)
> @@ -1529,14 +1505,6 @@ static void teardown_fbc(void)
>  {
>  }
>  
> -static bool psr_sink_has_support(void)
> -{
> -	char buf[256];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -	return strstr(buf, "Sink_Support: yes\n");
> -}
> -
>  static void setup_psr(void)
>  {
>  	if (get_connector(prim_mode_params.connector_id)->connector_type !=
> @@ -1545,7 +1513,7 @@ static void setup_psr(void)
>  		return;
>  	}
>  
> -	if (!psr_sink_has_support()) {
> +	if (!igt_psr_sink_support()) {
>  		igt_info("Can't test PSR: not supported by sink.\n");
>  		return;
>  	}
> @@ -1699,12 +1667,15 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags)
>  	}								\
>  									\
>  	if (flags_ & ASSERT_PSR_ENABLED) {				\
> -		if (!psr_wait_until_enabled()) {			\
> -			psr_print_status();				\
> +		if (!igt_psr_await_status(true)) {		        \
> +			igt_psr_print_status();				\
>  			igt_assert_f(false, "PSR disabled\n");		\
>  		}							\
>  	} else if (flags_ & ASSERT_PSR_DISABLED) {			\
> -		igt_assert(!psr_wait_until_enabled());			\
> +		if (!igt_psr_await_status(false)) {                     \
> +			igt_psr_print_status();                         \
> +			igt_assert_f(false, "PSR enabled\n");		\
> +		}							\
>  	}								\
>  } while (0)
>  
> @@ -1804,7 +1775,7 @@ static void enable_features_for_test(const struct test_mode *t)
>  	if (t->feature & FEATURE_FBC)
>  		fbc_enable();
>  	if (t->feature & FEATURE_PSR)
> -		psr_enable();
> +		igt_psr_enable();
>  }
>  
>  static void check_test_requirements(const struct test_mode *t)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: Refactor to use IGT PSR library functions
  2017-02-13 23:43 ` [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: " Jim Bride
@ 2017-03-23 22:24   ` Vivi, Rodrigo
  0 siblings, 0 replies; 8+ messages in thread
From: Vivi, Rodrigo @ 2017-03-23 22:24 UTC (permalink / raw)
  To: jim.bride@linux.intel.com
  Cc: intel-gfx@lists.freedesktop.org, Zanoni, Paulo R

On Mon, 2017-02-13 at 15:43 -0800, Jim Bride wrote:
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  tests/kms_fbcon_fbt.c | 47 +++++++++++------------------------------------
>  1 file changed, 11 insertions(+), 36 deletions(-)
> 
> diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
> index 6342289..a59257b 100644
> --- a/tests/kms_fbcon_fbt.c
> +++ b/tests/kms_fbcon_fbt.c
> @@ -103,8 +103,9 @@ static bool fbc_is_enabled(void)
>  	return strstr(buf, "FBC enabled\n");
>  }
>  
> -static bool fbc_wait_until_enabled(void)
> +static bool fbc_wait_until_enabled(bool enabled)
>  {
> +	enabled = enabled;

why is this needed?

>  	return igt_wait(fbc_is_enabled(), 5000, 1);
>  }
>  
> @@ -147,35 +148,9 @@ static void set_mode_for_one_screen(struct drm_info *drm, struct igt_fb *fb,
>  	igt_assert_eq(rc, 0);
>  }
>  
> -static bool psr_supported_on_chipset(void)
> -{
> -	char buf[256];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -	return strstr(buf, "Sink_Support: yes\n");
> -}
> -
> -static bool connector_can_psr(drmModeConnectorPtr connector)
> -{
> -	return (connector->connector_type == DRM_MODE_CONNECTOR_eDP);
> -}
> -
> -static bool psr_is_enabled(void)
> -{
> -	char buf[256];
> -
> -	igt_debugfs_read("i915_edp_psr_status", buf);
> -	return strstr(buf, "\nActive: yes\n");
> -}
> -
> -static bool psr_wait_until_enabled(void)
> -{
> -	return igt_wait(psr_is_enabled(), 5000, 1);
> -}
> -
>  struct feature {
>  	bool (*supported_on_chipset)(void);
> -	bool (*wait_until_enabled)(void);
> +	bool (*wait_until_enabled)(bool status);
>  	bool (*connector_possible_fn)(drmModeConnectorPtr connector);
>  	const char *param_name;
>  } fbc = {
> @@ -184,9 +159,9 @@ struct feature {
>  	.connector_possible_fn = connector_can_fbc,
>  	.param_name = "enable_fbc",
>  }, psr = {
> -	.supported_on_chipset = psr_supported_on_chipset,
> -	.wait_until_enabled = psr_wait_until_enabled,
> -	.connector_possible_fn = connector_can_psr,
> +	.supported_on_chipset = igt_psr_sink_support,
> +	.wait_until_enabled = igt_psr_await_status,
> +	.connector_possible_fn = igt_psr_valid_connector,
>  	.param_name = "enable_psr",
>  };
>  
> @@ -210,17 +185,17 @@ static void subtest(struct feature *feature, bool suspend)
>  
>  	kmstest_unset_all_crtcs(drm.fd, drm.res);
>  	wait_user("Modes unset.");
> -	igt_assert(!feature->wait_until_enabled());
> +	igt_assert(!feature->wait_until_enabled(true));
>  
>  	set_mode_for_one_screen(&drm, &fb, feature->connector_possible_fn);
>  	wait_user("Screen set.");
> -	igt_assert(feature->wait_until_enabled());
> +	igt_assert(feature->wait_until_enabled(true));
>  
>  	if (suspend) {
>  		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>  					      SUSPEND_TEST_NONE);
>  		sleep(5);
> -		igt_assert(feature->wait_until_enabled());
> +		igt_assert(feature->wait_until_enabled(true));
>  	}
>  
>  	igt_remove_fb(drm.fd, &fb);
> @@ -230,13 +205,13 @@ static void subtest(struct feature *feature, bool suspend)
>  	sleep(3);
>  
>  	wait_user("Back to fbcon.");
> -	igt_assert(!feature->wait_until_enabled());
> +	igt_assert(!feature->wait_until_enabled(true));
>  
>  	if (suspend) {
>  		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
>  					      SUSPEND_TEST_NONE);
>  		sleep(5);
> -		igt_assert(!feature->wait_until_enabled());
> +		igt_assert(!feature->wait_until_enabled(true));
>  	}
>  }
>  

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-03-23 22:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 23:43 [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Jim Bride
2017-02-13 23:43 ` [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives Jim Bride
2017-03-23 22:22   ` Vivi, Rodrigo
2017-02-13 23:43 ` [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions Jim Bride
2017-03-23 22:22   ` Vivi, Rodrigo
2017-02-13 23:43 ` [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: " Jim Bride
2017-03-23 22:24   ` Vivi, Rodrigo
2017-03-23 22:20 ` [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Vivi, Rodrigo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox