turnip: clean up tu_device_memory
Delete unused code.
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6913>
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 1f58026..8b4f157 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -1448,12 +1448,13 @@
&device->enabled_extensions);
}
-static VkResult
-tu_alloc_memory(struct tu_device *device,
- const VkMemoryAllocateInfo *pAllocateInfo,
- const VkAllocationCallbacks *pAllocator,
- VkDeviceMemory *pMem)
+VkResult
+tu_AllocateMemory(VkDevice _device,
+ const VkMemoryAllocateInfo *pAllocateInfo,
+ const VkAllocationCallbacks *pAllocator,
+ VkDeviceMemory *pMem)
{
+ TU_FROM_HANDLE(tu_device, device, _device);
struct tu_device_memory *mem;
VkResult result;
@@ -1502,27 +1503,11 @@
return result;
}
- mem->size = pAllocateInfo->allocationSize;
- mem->type_index = pAllocateInfo->memoryTypeIndex;
-
- mem->map = NULL;
- mem->user_ptr = NULL;
-
*pMem = tu_device_memory_to_handle(mem);
return VK_SUCCESS;
}
-VkResult
-tu_AllocateMemory(VkDevice _device,
- const VkMemoryAllocateInfo *pAllocateInfo,
- const VkAllocationCallbacks *pAllocator,
- VkDeviceMemory *pMem)
-{
- TU_FROM_HANDLE(tu_device, device, _device);
- return tu_alloc_memory(device, pAllocateInfo, pAllocator, pMem);
-}
-
void
tu_FreeMemory(VkDevice _device,
VkDeviceMemory _mem,
@@ -1555,28 +1540,20 @@
return VK_SUCCESS;
}
- if (mem->user_ptr) {
- *ppData = mem->user_ptr;
- } else if (!mem->map) {
+ if (!mem->bo.map) {
result = tu_bo_map(device, &mem->bo);
if (result != VK_SUCCESS)
return result;
- *ppData = mem->map = mem->bo.map;
- } else
- *ppData = mem->map;
-
- if (*ppData) {
- *ppData += offset;
- return VK_SUCCESS;
}
- return vk_error(device->instance, VK_ERROR_MEMORY_MAP_FAILED);
+ *ppData = mem->bo.map + offset;
+ return VK_SUCCESS;
}
void
tu_UnmapMemory(VkDevice _device, VkDeviceMemory _memory)
{
- /* I do not see any unmapping done by the freedreno Gallium driver. */
+ /* TODO: unmap here instead of waiting for FreeMemory */
}
VkResult
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index 388f5b3..6f98ee2 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -558,15 +558,6 @@
struct vk_object_base base;
struct tu_bo bo;
- VkDeviceSize size;
-
- /* for dedicated allocations */
- struct tu_image *image;
- struct tu_buffer *buffer;
-
- uint32_t type_index;
- void *map;
- void *user_ptr;
};
struct tu_descriptor_range