[igt-dev] [PATCH i-g-t] lib/igt_pm: dump runtime pm status on timeout
don.hiatt at intel.com
don.hiatt at intel.com
Thu Oct 10 17:07:59 UTC 2019
From: Don Hiatt <don.hiatt at 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 at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Reviewed-by: Vanshidhar Konda <vanshidhar.r.konda at 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
More information about the igt-dev
mailing list