Mesa (master): turnip: clean up tu_device_memory
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Sep 29 23:37:59 UTC 2020
Module: Mesa
Branch: master
Commit: dcc278c72277fad5ee2f0b86e8215fd78ffc57e0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dcc278c72277fad5ee2f0b86e8215fd78ffc57e0
Author: Jonathan Marek <jonathan at marek.ca>
Date: Tue Sep 29 11:07:39 2020 -0400
turnip: clean up tu_device_memory
Delete unused code.
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6913>
---
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 1f58026ce0e..8b4f15766e4 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 388f5b3835e..6f98ee2fdbb 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
More information about the mesa-commit
mailing list