radv: ignore radv_zero_vram=true if zeroInitialDeviceMemory is enabled

To let applications like vkd3d-proton to take full control.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34896>
This commit is contained in:
Samuel Pitoiset 2025-05-09 14:54:44 +02:00 committed by Marge Bot
parent 21badbf336
commit 219a2b1e32
4 changed files with 15 additions and 5 deletions

View file

@ -898,13 +898,10 @@ radv_create_descriptor_pool(struct radv_device *device, const VkDescriptorPoolCr
}
if (bo_size) {
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT)) {
enum radeon_bo_flag flags = RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_READ_ONLY | RADEON_FLAG_32BIT;
if (instance->drirc.zero_vram)
if (radv_device_should_clear_vram(device))
flags |= RADEON_FLAG_ZERO_VRAM;
VkResult result = radv_bo_create(device, &pool->base, bo_size, 32, RADEON_DOMAIN_VRAM, flags,

View file

@ -84,6 +84,16 @@ radv_trap_handler_enabled()
return !!getenv("RADV_TRAP_HANDLER");
}
bool
radv_device_should_clear_vram(const struct radv_device *device)
{
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
/* Ignore drirc radv_zero_vram=true if the feature is enabled to let applications take control. */
return instance->drirc.zero_vram && !device->vk.enabled_features.zeroInitializeDeviceMemory;
}
VKAPI_ATTR VkResult VKAPI_CALL
radv_GetMemoryHostPointerPropertiesEXT(VkDevice _device, VkExternalMemoryHandleTypeFlagBits handleType,
const void *pHostPointer,

View file

@ -379,4 +379,6 @@ bool radv_device_acquire_performance_counters(struct radv_device *device);
void radv_device_release_performance_counters(struct radv_device *device);
bool radv_device_should_clear_vram(const struct radv_device *device);
#endif /* RADV_DEVICE_H */

View file

@ -231,7 +231,8 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
if (flags_info && flags_info->flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT)
flags |= RADEON_FLAG_REPLAYABLE;
if ((flags_info && flags_info->flags & VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT) || instance->drirc.zero_vram)
if ((flags_info && flags_info->flags & VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT) ||
radv_device_should_clear_vram(device))
flags |= RADEON_FLAG_ZERO_VRAM;
/* On GFX12, DCC is transparent to the userspace driver and PTE.DCC is