diff --git a/.pick_status.json b/.pick_status.json index 544d5ddcc45..2884266d255 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -400,7 +400,7 @@ "description": "anv: use the right helper to invalidate memory", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 3d542b6a1e9..9ab7dd4a1d8 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -4167,25 +4167,6 @@ void anv_UnmapMemory( mem->map_delta = 0; } -static void -clflush_mapped_ranges(struct anv_device *device, - uint32_t count, - const VkMappedMemoryRange *ranges) -{ - for (uint32_t i = 0; i < count; i++) { - ANV_FROM_HANDLE(anv_device_memory, mem, ranges[i].memory); - uint64_t map_offset = ranges[i].offset + mem->map_delta; - if (map_offset >= mem->map_size) - continue; - - if (mem->type->propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) - continue; - - intel_clflush_range(mem->map + map_offset, - MIN2(ranges[i].size, mem->map_size - map_offset)); - } -} - VkResult anv_FlushMappedMemoryRanges( VkDevice _device, uint32_t memoryRangeCount, @@ -4199,7 +4180,19 @@ VkResult anv_FlushMappedMemoryRanges( /* Make sure the writes we're flushing have landed. */ __builtin_ia32_mfence(); - clflush_mapped_ranges(device, memoryRangeCount, pMemoryRanges); + for (uint32_t i = 0; i < memoryRangeCount; i++) { + ANV_FROM_HANDLE(anv_device_memory, mem, pMemoryRanges[i].memory); + uint64_t map_offset = pMemoryRanges[i].offset + mem->map_delta; + if (map_offset >= mem->map_size) + continue; + + if (mem->type->propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) + continue; + + intel_clflush_range(mem->map + map_offset, + MIN2(pMemoryRanges[i].size, + mem->map_size - map_offset)); + } return VK_SUCCESS; } @@ -4214,7 +4207,19 @@ VkResult anv_InvalidateMappedMemoryRanges( if (!device->physical->memory.need_clflush) return VK_SUCCESS; - clflush_mapped_ranges(device, memoryRangeCount, pMemoryRanges); + for (uint32_t i = 0; i < memoryRangeCount; i++) { + ANV_FROM_HANDLE(anv_device_memory, mem, pMemoryRanges[i].memory); + uint64_t map_offset = pMemoryRanges[i].offset + mem->map_delta; + if (map_offset >= mem->map_size) + continue; + + if (mem->type->propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) + continue; + + intel_invalidate_range(mem->map + map_offset, + MIN2(pMemoryRanges[i].size, + mem->map_size - map_offset)); + } /* Make sure no reads get moved up above the invalidate. */ __builtin_ia32_mfence();