Revert "pvr: Implement VK_EXT_memory_budget"

This reverts commit 97efa57531.

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Acked-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33998>
This commit is contained in:
Luigi Santivetti 2025-04-14 17:36:35 +01:00 committed by Marge Bot
parent a22ad99bdd
commit 6ad0b59cc8
3 changed files with 19 additions and 71 deletions

View file

@ -631,7 +631,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_legacy_vertex_attributes DONE (anv, lvp, nvk, radv, tu, vn)
VK_EXT_line_rasterization DONE (anv, hasvk, hk, nvk, panvk, lvp, radv, tu, v3dv, vn)
VK_EXT_load_store_op_none DONE (anv, hk, lvp, nvk, panvk, radv, tu, v3dv, vn)
VK_EXT_memory_budget DONE (anv, hasvk, lvp, nvk, pvr, radv, tu, v3dv, vn)
VK_EXT_memory_budget DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn)
VK_EXT_memory_priority DONE (lvp, radv)
VK_EXT_mesh_shader DONE (anv/gfx12.5+, lvp, radv)
VK_EXT_multi_draw DONE (anv, hasvk, hk, lvp, nvk, radv, tu, vn, v3dv)

View file

@ -190,7 +190,6 @@ static void pvr_physical_device_get_supported_extensions(
.EXT_external_memory_dma_buf = true,
.EXT_host_query_reset = true,
.EXT_index_type_uint8 = false,
.EXT_memory_budget = true,
.EXT_private_data = true,
.EXT_scalar_block_layout = true,
.EXT_texel_buffer_alignment = false,
@ -966,10 +965,10 @@ pvr_physical_device_enumerate(struct vk_instance *const vk_instance)
mesa_logd("Found compatible display device '%s'.",
drm_display_device->nodes[DRM_NODE_PRIMARY]);
pdevice = vk_zalloc(&vk_instance->alloc,
sizeof(*pdevice),
8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
pdevice = vk_alloc(&vk_instance->alloc,
sizeof(*pdevice),
8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!pdevice) {
result = vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
goto out_free_drm_devices;
@ -1153,22 +1152,6 @@ const static VkQueueFamilyProperties pvr_queue_family_properties = {
.minImageTransferGranularity = { 1, 1, 1 },
};
static uint64_t pvr_compute_heap_budget(struct pvr_physical_device *pdevice)
{
const uint64_t heap_size = pdevice->memory.memoryHeaps[0].size;
const uint64_t heap_used = pdevice->heap_used;
uint64_t sys_available = 0, heap_available;
ASSERTED bool has_available_memory =
os_get_available_system_memory(&sys_available);
assert(has_available_memory);
/* Let's not incite the app to starve the system: report at most 90% of
* available system memory.
*/
heap_available = sys_available * 9 / 10;
return MIN2(heap_size, heap_used + heap_available);
}
void pvr_GetPhysicalDeviceQueueFamilyProperties2(
VkPhysicalDevice physicalDevice,
uint32_t *pQueueFamilyPropertyCount,
@ -1197,24 +1180,7 @@ void pvr_GetPhysicalDeviceMemoryProperties2(
pMemoryProperties->memoryProperties = pdevice->memory;
vk_foreach_struct (ext, pMemoryProperties->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT: {
VkPhysicalDeviceMemoryBudgetPropertiesEXT *pMemoryBudget =
(VkPhysicalDeviceMemoryBudgetPropertiesEXT *)ext;
pMemoryBudget->heapBudget[0] = pvr_compute_heap_budget(pdevice);
pMemoryBudget->heapUsage[0] = pdevice->heap_used;
for (uint32_t i = 1; i < VK_MAX_MEMORY_HEAPS; i++) {
pMemoryBudget->heapBudget[i] = 0u;
pMemoryBudget->heapUsage[i] = 0u;
}
break;
}
default:
vk_debug_ignored_stype(ext->sType);
break;
}
vk_debug_ignored_stype(ext->sType);
}
}
@ -2058,27 +2024,6 @@ VkResult pvr_EnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
}
static void free_memory(struct pvr_device *device,
struct pvr_device_memory *mem,
const VkAllocationCallbacks *pAllocator)
{
if (!mem)
return;
/* From the Vulkan spec (§11.2.13. Freeing Device Memory):
* If a memory object is mapped at the time it is freed, it is implicitly
* unmapped.
*/
if (mem->bo->map)
device->ws->ops->buffer_unmap(mem->bo);
p_atomic_add(&device->pdevice->heap_used, -mem->bo->size);
device->ws->ops->buffer_destroy(mem->bo);
vk_object_free(&device->vk, pAllocator, mem);
}
VkResult pvr_AllocateMemory(VkDevice _device,
const VkMemoryAllocateInfo *pAllocateInfo,
const VkAllocationCallbacks *pAllocator,
@ -2088,7 +2033,6 @@ VkResult pvr_AllocateMemory(VkDevice _device,
PVR_FROM_HANDLE(pvr_device, device, _device);
enum pvr_winsys_bo_type type = PVR_WINSYS_BO_TYPE_GPU;
struct pvr_device_memory *mem;
uint64_t heap_used;
VkResult result;
assert(pAllocateInfo->sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO);
@ -2185,12 +2129,6 @@ VkResult pvr_AllocateMemory(VkDevice _device,
goto err_vk_object_free_mem;
}
heap_used = p_atomic_add_return(&device->pdevice->heap_used, mem->bo->size);
if (heap_used > device->pdevice->memory.memoryHeaps[0].size) {
free_memory(device, mem, pAllocator);
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
}
*pMem = pvr_device_memory_to_handle(mem);
return VK_SUCCESS;
@ -2249,7 +2187,19 @@ void pvr_FreeMemory(VkDevice _device,
PVR_FROM_HANDLE(pvr_device, device, _device);
PVR_FROM_HANDLE(pvr_device_memory, mem, _mem);
free_memory(device, mem, pAllocator);
if (!mem)
return;
/* From the Vulkan spec (§11.2.13. Freeing Device Memory):
* If a memory object is mapped at the time it is freed, it is implicitly
* unmapped.
*/
if (mem->bo->map)
device->ws->ops->buffer_unmap(mem->bo);
device->ws->ops->buffer_destroy(mem->bo);
vk_object_free(&device->vk, pAllocator, mem);
}
VkResult pvr_MapMemory(VkDevice _device,

View file

@ -109,8 +109,6 @@ struct pvr_physical_device {
VkPhysicalDeviceMemoryProperties memory;
uint64_t heap_used;
struct wsi_device wsi_device;
struct rogue_compiler *compiler;