diff options
author | Jason Ekstrand <[email protected]> | 2016-02-12 11:00:08 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-12 11:00:08 -0800 |
commit | 42155abdd7265efd32ea4678fb9698c2ac4ee18a (patch) | |
tree | 08b05618c1ac03af5db8b06322d239a742b2f9b2 /src | |
parent | 3c8dc1afd1101ff11d942a056a22ae43c0611bb7 (diff) |
anv: Add a clfush_range helper function
Diffstat (limited to 'src')
-rw-r--r-- | src/vulkan/anv_private.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 6da714ad8b2..22df64c5825 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -418,14 +418,11 @@ struct anv_state_stream { #define CACHELINE_SIZE 64 #define CACHELINE_MASK 63 -static void inline -anv_state_clflush(struct anv_state state) +static inline void +anv_clflush_range(void *start, size_t size) { - /* state.map may not be cacheline aligned, so round down the start pointer - * to a cacheline boundary so we flush all pages that contain the state. - */ - void *end = state.map + state.alloc_size; - void *p = (void *) (((uintptr_t) state.map) & ~CACHELINE_MASK); + void *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK); + void *end = start + size; __builtin_ia32_mfence(); while (p < end) { @@ -434,6 +431,12 @@ anv_state_clflush(struct anv_state state) } } +static void inline +anv_state_clflush(struct anv_state state) +{ + anv_clflush_range(state.map, state.alloc_size); +} + void anv_block_pool_init(struct anv_block_pool *pool, struct anv_device *device, uint32_t block_size); void anv_block_pool_finish(struct anv_block_pool *pool); |