summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_device.c
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-01-29 12:07:34 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-01-29 14:56:41 -0800
commit31d3486bd2dda4b9dd65c8b24544b8f8cb54054b (patch)
tree4e59a73f2439487c66ae7304eaac462bda50e3d0 /src/vulkan/anv_device.c
parent89ec36f221099cf47ade0b90d09c7731460ab381 (diff)
anv: Limit flushing to the range of mapped memory
Diffstat (limited to 'src/vulkan/anv_device.c')
-rw-r--r--src/vulkan/anv_device.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index 27968bdf371..c7a9fd15c1d 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -1148,7 +1148,12 @@ clflush_mapped_ranges(struct anv_device *device,
for (uint32_t i = 0; i < count; i++) {
ANV_FROM_HANDLE(anv_device_memory, mem, ranges[i].memory);
void *p = mem->map + (ranges[i].offset & ~CACHELINE_MASK);
- void *end = mem->map + ranges[i].offset + ranges[i].size;
+ void *end;
+
+ if (ranges[i].offset + ranges[i].size > mem->map_size)
+ end = mem->map + mem->map_size;
+ else
+ end = mem->map + ranges[i].offset + ranges[i].size;
while (p < end) {
__builtin_ia32_clflush(p);