From dcc278c72277fad5ee2f0b86e8215fd78ffc57e0 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Tue, 29 Sep 2020 11:07:39 -0400 Subject: [PATCH] turnip: clean up tu_device_memory Delete unused code. Signed-off-by: Jonathan Marek Part-of: --- src/freedreno/vulkan/tu_device.c | 43 +++++++++------------------------------ src/freedreno/vulkan/tu_private.h | 9 -------- 2 files changed, 10 insertions(+), 42 deletions(-) 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 @@ tu_GetDeviceProcAddr(VkDevice _device, const char *pName) &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 @@ tu_alloc_memory(struct tu_device *device, 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 @@ tu_MapMemory(VkDevice _device, 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 tu_device_memory 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 -- 2.7.4