summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-02-20 10:18:57 -0800
committerJason Ekstrand <[email protected]>2017-02-21 12:26:35 -0800
commit8582ab2d6eff1d8fc1964ba0f353037af212bdfe (patch)
tree16682b817545d07666f55dead69886922b007c61
parente8d600710cf7c1a646a36947ee7752c89860bf11 (diff)
anv: Add an invalidate_range helper
This is similar to clflush_range except that it puts the mfence on the other side to ensure caches are flushed prior to reading. Reviewed-by: Lionel Landwerlin <[email protected]> Cc: "13.0 17.0" <[email protected]>
-rw-r--r--src/intel/vulkan/anv_private.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index cd35eba2668..c36fdcf75b4 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -448,6 +448,19 @@ anv_clflush_range(void *start, size_t size)
}
}
+static inline void
+anv_invalidate_range(void *start, size_t size)
+{
+ void *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK);
+ void *end = start + size;
+
+ while (p < end) {
+ __builtin_ia32_clflush(p);
+ p += CACHELINE_SIZE;
+ }
+ __builtin_ia32_mfence();
+}
+
static void inline
anv_state_clflush(struct anv_state state)
{