diff options
author | Bo Hu <bohu@google.com> | 2024-02-21 21:49:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-02-21 21:49:42 +0000 |
commit | a70f9dbc3e32d5285c34273faebedadc5ccce257 (patch) | |
tree | 7e7e47053a3b6e8a59e0eafe8026a139529456cc | |
parent | 95e90c743b21c55e805903ac3d851fa32ec8b021 (diff) | |
parent | dcb2b4af0c7b3ade19cfd3a57368c6a8faf82bb7 (diff) | |
download | gfxstream-a70f9dbc3e32d5285c34273faebedadc5ccce257.tar.gz |
Merge "amdgpu: only allow device local memory" into main
-rw-r--r-- | host/vulkan/VkDecoderGlobalState.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp index ce9251fe..ebfac077 100644 --- a/host/vulkan/VkDecoderGlobalState.cpp +++ b/host/vulkan/VkDecoderGlobalState.cpp @@ -1223,6 +1223,14 @@ class VkDecoderGlobalState::Impl { pMemoryProperties->memoryTypes[i].propertyFlags & ~(VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } + + // for AMD, zap the type that is is not on device + if (feature_is_enabled(kFeature_VulkanAllocateDeviceMemoryOnly)) { + auto memFlags = pMemoryProperties->memoryTypes[i].propertyFlags; + if (!(memFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) { + pMemoryProperties->memoryTypes[i].propertyFlags = 0; + } + } } } @@ -1281,6 +1289,14 @@ class VkDecoderGlobalState::Impl { pMemoryProperties->memoryProperties.memoryTypes[i].propertyFlags & ~(VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); } + + // for AMD, zap the type that is is not on device + if (feature_is_enabled(kFeature_VulkanAllocateDeviceMemoryOnly)) { + auto memFlags = pMemoryProperties->memoryProperties.memoryTypes[i].propertyFlags; + if (!(memFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) { + pMemoryProperties->memoryProperties.memoryTypes[i].propertyFlags = 0; + } + } } } |