summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2017-02-20 10:18:57 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2017-03-15 14:39:55 +0000
commit7da210dc3f149ccf2d87cc312c1e74d1c9501ecd (patch)
tree0e57862f897f435d91b8a4a3d1a542e4c7dbbd23 /src
parent64537aa6b481bf853f272c442956bbf93bea4ad9 (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 <lionel.g.landwerlin@intel.com> Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 8582ab2d6eff1d8fc1964ba0f353037af212bdfe)
Diffstat (limited to 'src')
-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 9c871053e3c..dd675081827 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -410,6 +410,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)
{