public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_pm: dump runtime pm status on timeout
@ 2019-10-10 17:07 don.hiatt
  2019-10-10 17:53 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_pm: dump runtime pm status on timeout (rev2) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: don.hiatt @ 2019-10-10 17:07 UTC (permalink / raw)
  To: igt-dev

From: Don Hiatt <don.hiatt@intel.com>

Display the runtime pm status if we timeout waiting for status.

v2: Add helper to map runtime pm status enum to string.

Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
---
 lib/igt_pm.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index 64ce240e093f..d96fee7a2eb4 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -684,6 +684,28 @@ enum igt_runtime_pm_status igt_get_runtime_pm_status(void)
 	return IGT_RUNTIME_PM_STATUS_UNKNOWN;
 }
 
+/**
+ * _pm_status_name
+ * @status: runtime PM status to stringify
+ *
+ * Returns: The current runtime PM status as a string
+ */
+static const char *_pm_status_name(enum igt_runtime_pm_status status)
+{
+	switch (status) {
+	case IGT_RUNTIME_PM_STATUS_ACTIVE:
+		return "active";
+	case IGT_RUNTIME_PM_STATUS_RESUMING:
+		return "resuming";
+	case IGT_RUNTIME_PM_STATUS_SUSPENDED:
+		return "suspended";
+	case IGT_RUNTIME_PM_STATUS_SUSPENDING:
+		return "suspending";
+	default:
+		return "unknown";
+	}
+}
+
 /**
  * igt_wait_for_pm_status:
  * @status: desired runtime PM status
@@ -697,7 +719,16 @@ enum igt_runtime_pm_status igt_get_runtime_pm_status(void)
  */
 bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
 {
-	return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
+	bool ret;
+	enum igt_runtime_pm_status expected = status;
+
+	ret = igt_wait((status = igt_get_runtime_pm_status()) == expected, 10000, 100);
+	if (!ret)
+		igt_warn("timeout: pm_status expected:%s, got:%s\n",
+			_pm_status_name(expected),
+			_pm_status_name(status));
+
+	return ret;
 }
 
 /**
-- 
2.20.1

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

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

end of thread, other threads:[~2019-10-11 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-10 17:07 [igt-dev] [PATCH i-g-t] lib/igt_pm: dump runtime pm status on timeout don.hiatt
2019-10-10 17:53 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_pm: dump runtime pm status on timeout (rev2) Patchwork
2019-10-11  7:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-10-11 13:23 ` [igt-dev] [PATCH i-g-t] lib/igt_pm: dump runtime pm status on timeout Arkadiusz Hiler

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