[igt-dev] [PATCH igt 1/2] lib/igt_debugfs: Drop-caches support for msm

Rob Clark robdclark at gmail.com
Thu May 26 16:14:44 UTC 2022


From: Rob Clark <robdclark at chromium.org>

Signed-off-by: Rob Clark <robdclark at chromium.org>
---
 lib/igt_debugfs.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 7211c410..7e7ccf22 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -1139,8 +1139,20 @@ void igt_drop_caches_set(int drm_fd, uint64_t val)
 	int dir;
 
 	dir = igt_debugfs_dir(drm_fd);
-	igt_assert(igt_sysfs_printf(dir, "i915_gem_drop_caches",
-				    "0x%" PRIx64, val) > 0);
+	if (is_i915_device(drm_fd)) {
+		igt_assert(igt_sysfs_printf(dir, "i915_gem_drop_caches",
+					    "0x%" PRIx64, val) > 0);
+	} else if (is_msm_device(drm_fd)) {
+		/*
+		 * msm doesn't currently have debugs that supports fine grained
+		 * control of *what* to drop, just # of objects to scan (equiv
+		 * to shrink_control::nr_to_scan).  To meet that limit it will
+		 * first try shrinking, and then dropping idle.  So just tell
+		 * it to try and drop as many objects as possible:
+		 */
+		igt_assert(igt_sysfs_printf(dir, "shrink", "0x%" PRIx64,
+					    ~(uint64_t)0) > 0);
+	}
 	close(dir);
 }
 
-- 
2.35.3



More information about the igt-dev mailing list