summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2022-05-21 11:25:17 -0700
committerRob Clark <robdclark@chromium.org>2022-05-31 14:05:10 -0700
commit9ce1c981ab12b2036cce6eeaa725e724c8e51668 (patch)
tree5ab439dad5effd9469d85c4690c118d4b021a08a /lib
parentde4c6076a0f38ad3522b08931748f59d59a925ce (diff)
lib/igt_debugfs: Drop-caches support for msm
Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_debugfs.c16
1 files 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);
}