anv: Move code adding protected memory type to common code

Xe KMD now has support for protected memory, so lets move it
to common code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30723>
This commit is contained in:
José Roberto de Souza 2024-07-15 12:10:19 -07:00 committed by Marge Bot
parent 187e65002f
commit a99d90d015
2 changed files with 12 additions and 12 deletions

View file

@ -2034,6 +2034,18 @@ anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
break;
}
if (device->has_protected_contexts) {
/* Add a memory type for protected buffers, local and not host
* visible.
*/
device->memory.types[device->memory.type_count++] =
(struct anv_memory_type) {
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
VK_MEMORY_PROPERTY_PROTECTED_BIT,
.heapIndex = 0,
};
}
assert(device->memory.type_count < ARRAY_SIZE(device->memory.types));
if (result != VK_SUCCESS)

View file

@ -207,18 +207,6 @@ anv_i915_physical_device_init_memory_types(struct anv_physical_device *device)
};
}
if (device->has_protected_contexts) {
/* Add a memory type for protected buffers, local and not host
* visible.
*/
device->memory.types[device->memory.type_count++] =
(struct anv_memory_type) {
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
VK_MEMORY_PROPERTY_PROTECTED_BIT,
.heapIndex = 0,
};
}
return VK_SUCCESS;
}