summaryrefslogtreecommitdiff
path: root/lib/igt_debugfs.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-03-08 13:09:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-03-10 12:51:16 +0000
commite8eb9afd4c53e67d834f520a42a641adb874a463 (patch)
treefd8b98d66685e4f0dfd097d39b51bdf92e116311 /lib/igt_debugfs.c
parentdf75b388f915c813e69b3139e16c45ffe956c58b (diff)
igt: Exercise the shrinker
Introduce a new fork helper that spawns a process that just repeatedly calls i915_gem_shrink_all() and watch what happens as we try to use objects that have been shrunk. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r--lib/igt_debugfs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index e64d001b..0a991a1f 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -873,6 +873,28 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc)
*/
/**
+ * igt_drop_caches_has:
+ * @val: bitmask for DROP_* values
+ *
+ * This queries the debugfs to see if it supports the full set of desired
+ * operations.
+ */
+bool igt_drop_caches_has(uint64_t val)
+{
+ FILE *file;
+ uint64_t mask;
+
+ mask = 0;
+ file = igt_debugfs_fopen("i915_gem_drop_caches", "r");
+ if (file) {
+ fscanf(file, "0x%" PRIx64, &mask);
+ fclose(file);
+ }
+
+ return (val & mask) == val;
+}
+
+/**
* igt_drop_caches_set:
* @val: bitmask for DROP_* values
*