mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
radv: add protected type bits for memory requirements
Add protected type bits for memory requirements of protected resources Signed-off-by: Trigger Huang <Trigger.Huang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40619>
This commit is contained in:
parent
540864685d
commit
68db27f0b4
4 changed files with 11 additions and 0 deletions
|
|
@ -188,6 +188,9 @@ radv_get_buffer_memory_requirements(struct radv_device *device, VkDeviceSize siz
|
|||
VK_BUFFER_USAGE_2_PREPROCESS_BUFFER_BIT_EXT | VK_BUFFER_USAGE_2_DESCRIPTOR_HEAP_BIT_EXT))
|
||||
pMemoryRequirements->memoryRequirements.memoryTypeBits = pdev->memory_types_32bit;
|
||||
|
||||
if (flags & VK_BUFFER_CREATE_PROTECTED_BIT)
|
||||
pMemoryRequirements->memoryRequirements.memoryTypeBits &= pdev->memory_types_protected;
|
||||
|
||||
if (flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) {
|
||||
pMemoryRequirements->memoryRequirements.alignment = 4096;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1607,6 +1607,9 @@ radv_GetImageMemoryRequirements2(VkDevice _device, const VkImageMemoryRequiremen
|
|||
pMemoryRequirements->memoryRequirements.memoryTypeBits =
|
||||
((1u << pdev->memory_properties.memoryTypeCount) - 1u) & ~pdev->memory_types_32bit;
|
||||
|
||||
if (image->vk.create_flags & VK_IMAGE_CREATE_PROTECTED_BIT)
|
||||
pMemoryRequirements->memoryRequirements.memoryTypeBits &= pdev->memory_types_protected;
|
||||
|
||||
if (image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT) {
|
||||
/* Only expose host visible memory types for images that need to be mapped on the CPU. */
|
||||
pMemoryRequirements->memoryRequirements.memoryTypeBits &= pdev->memory_types_host_visible;
|
||||
|
|
|
|||
|
|
@ -650,6 +650,8 @@ radv_physical_device_init_mem_types(struct radv_physical_device *pdev)
|
|||
pdev->memory_types_32bit |= BITFIELD_BIT(i);
|
||||
if (pdev->memory_flags[i] & RADEON_FLAG_CPU_ACCESS)
|
||||
pdev->memory_types_host_visible |= BITFIELD_BIT(i);
|
||||
if (pdev->memory_flags[i] & RADEON_FLAG_ENCRYPTED)
|
||||
pdev->memory_types_protected |= BITFIELD_BIT(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@ struct radv_physical_device {
|
|||
/* Bitmask of memory types that are host-visible. */
|
||||
uint32_t memory_types_host_visible;
|
||||
|
||||
/* Bitmask of memory types that are protected. */
|
||||
uint32_t memory_types_protected;
|
||||
|
||||
#ifndef _WIN32
|
||||
int available_nodes;
|
||||
drmPciBusInfo bus_info;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue