[igt-dev] [PATCH i-g-t 3/5] lib/igt_psr: added function to check output supports pr

Kunal Joshi kunal1.joshi at intel.com
Fri Oct 20 06:05:01 UTC 2023


added function to check output supports PR

Note :- New debugfs interfaces which are used
        will be added by below patch in the driver
        https://patchwork.freedesktop.org/series/94470/

Cc: Jouni Högander <jouni.hogander at intel.com>
Cc: Animesh Manna <animesh.manna at intel.com>
Cc: Arun R Murthy <arun.r.murthy at intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 lib/igt_psr.c | 17 +++++++++++++++++
 lib/igt_psr.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index acacfa31f..4c912a064 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -22,6 +22,7 @@
  */
 
 #include "drmtest.h"
+#include "igt_kms.h"
 #include "igt_params.h"
 #include "igt_psr.h"
 #include "igt_sysfs.h"
@@ -373,3 +374,19 @@ enum psr_mode psr_get_mode(int debugfs_fd)
 
 	return PSR_DISABLED;
 }
+
+bool output_supports_pr(int debugfs_fd, igt_output_t *output)
+{
+	char debugfs_file[128] = {0};
+	char buf[PSR_STATUS_MAX_LEN];
+
+	if (!strstr(output->name,"DP"))
+		return false;
+
+        sprintf(debugfs_file, "%s/i915_psr_status", output->name);
+
+        igt_debugfs_simple_read(debugfs_fd, debugfs_file,
+				buf, sizeof(buf));
+
+        return strstr(buf, "Panel Replay = yes");
+}
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index 243154897..8e36fcf2f 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -55,5 +55,6 @@ bool i915_psr2_selective_fetch_check(int drm_fd);
 
 bool i915_psr2_sel_fetch_to_psr1(int drm_fd);
 void i915_psr2_sel_fetch_restore(int drm_fd);
+bool output_supports_pr(int debugfs_fd, igt_output_t *output);
 
 #endif
-- 
2.25.1



More information about the igt-dev mailing list