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>
This commit is contained in:
Jonathan Marek 2020-09-29 11:07:39 -04:00 committed by Marge Bot
parent d12cdc9374
commit dcc278c722
2 changed files with 10 additions and 42 deletions

View File

@ -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

View File

@ -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