From: Kristian Høgsberg Kristensen Date: Fri, 29 Jan 2016 20:07:34 +0000 (-0800) Subject: anv: Limit flushing to the range of mapped memory X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31d3486bd2dda4b9dd65c8b24544b8f8cb54054b;p=mesa.git anv: Limit flushing to the range of mapped memory --- 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);