[igt-dev] [PATCH i-g-t 3/4] lib/igt_vc4: Add helpers for underrun count and load tracker state

Paul Kocialkowski paul.kocialkowski at bootlin.com
Tue Jan 8 15:02:23 UTC 2019


Introduce new helpers that allow getting the current underrun count
from debugfs and getting/setting the enabled state of the load tracker.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
---
 lib/igt_vc4.c | 32 ++++++++++++++++++++++++++++++++
 lib/igt_vc4.h |  6 ++++++
 2 files changed, 38 insertions(+)

diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c
index 16dfe67a44b1..1e2c2e636509 100644
--- a/lib/igt_vc4.c
+++ b/lib/igt_vc4.c
@@ -34,6 +34,7 @@
 #include "drmtest.h"
 #include "igt_aux.h"
 #include "igt_core.h"
+#include "igt_sysfs.h"
 #include "igt_vc4.h"
 #include "ioctl_wrappers.h"
 #include "intel_reg.h"
@@ -176,3 +177,34 @@ bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable)
 
 	return arg.retained;
 }
+
+int igt_vc4_get_underrun_count(int debugfs)
+{
+	int underrun_count;
+	char *underrun = igt_sysfs_get(debugfs, VC4_UNDERRUN_DEBUGFS);
+
+	igt_assert(underrun);
+
+	underrun_count = atoi(underrun);
+	free(underrun);
+
+	return underrun_count;
+}
+
+void igt_vc4_set_load_tracker(int debugfs, bool enable)
+{
+	igt_sysfs_set(debugfs, VC4_LOAD_TRACKER_DEBUGFS, enable ? "Y" : "N");
+}
+
+bool igt_vc4_get_load_tracker(int debugfs)
+{
+	bool enabled;
+	char *load_tracker = igt_sysfs_get(debugfs, VC4_LOAD_TRACKER_DEBUGFS);
+
+	igt_assert(load_tracker);
+
+	enabled = (load_tracker[0] == 'Y');
+	free(load_tracker);
+
+	return enabled;
+}
diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h
index ebc8a3881b5e..0f7dba6b25e6 100644
--- a/lib/igt_vc4.h
+++ b/lib/igt_vc4.h
@@ -24,6 +24,9 @@
 #ifndef IGT_VC4_H
 #define IGT_VC4_H
 
+#define VC4_LOAD_TRACKER_DEBUGFS	"hvs_load_tracker"
+#define VC4_UNDERRUN_DEBUGFS		"hvs_underrun"
+
 uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval);
 int igt_vc4_create_bo(int fd, size_t size);
 void *igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
@@ -32,5 +35,8 @@ bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable);
 
 void igt_vc4_set_tiling(int fd, uint32_t handle, uint64_t modifier);
 uint64_t igt_vc4_get_tiling(int fd, uint32_t handle);
+int igt_vc4_get_underrun_count(int debugfs);
+void igt_vc4_set_load_tracker(int debugfs, bool enable);
+bool igt_vc4_get_load_tracker(int debugfs);
 
 #endif /* IGT_VC4_H */
-- 
2.20.1



More information about the igt-dev mailing list