mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 11:20:20 +01:00
radv: fix vk_object_base_init/finish for internal device memory objects
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13172>
This commit is contained in:
parent
87505442de
commit
ae4be2d7ae
3 changed files with 28 additions and 5 deletions
|
|
@ -5045,6 +5045,22 @@ radv_get_memory_fd(struct radv_device *device, struct radv_device_memory *memory
|
|||
return device->ws->buffer_get_fd(device->ws, memory->bo, pFD);
|
||||
}
|
||||
|
||||
void
|
||||
radv_device_memory_init(struct radv_device_memory *mem, struct radv_device *device,
|
||||
struct radeon_winsys_bo *bo)
|
||||
{
|
||||
memset(mem, 0, sizeof(*mem));
|
||||
vk_object_base_init(&device->vk, &mem->base, VK_OBJECT_TYPE_DEVICE_MEMORY);
|
||||
|
||||
mem->bo = bo;
|
||||
}
|
||||
|
||||
void
|
||||
radv_device_memory_finish(struct radv_device_memory *mem)
|
||||
{
|
||||
vk_object_base_finish(&mem->base);
|
||||
}
|
||||
|
||||
void
|
||||
radv_free_memory(struct radv_device *device, const VkAllocationCallbacks *pAllocator,
|
||||
struct radv_device_memory *mem)
|
||||
|
|
@ -5070,7 +5086,7 @@ radv_free_memory(struct radv_device *device, const VkAllocationCallbacks *pAlloc
|
|||
mem->bo = NULL;
|
||||
}
|
||||
|
||||
vk_object_base_finish(&mem->base);
|
||||
radv_device_memory_finish(mem);
|
||||
vk_free2(&device->vk.alloc, pAllocator, mem);
|
||||
}
|
||||
|
||||
|
|
@ -5108,11 +5124,11 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
|||
}
|
||||
|
||||
mem =
|
||||
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*mem), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*mem), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (mem == NULL)
|
||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
vk_object_base_init(&device->vk, &mem->base, VK_OBJECT_TYPE_DEVICE_MEMORY);
|
||||
radv_device_memory_init(mem, device, NULL);
|
||||
|
||||
if (wsi_info) {
|
||||
if(wsi_info->implicit_sync)
|
||||
|
|
@ -5153,7 +5169,6 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
|||
(int)(priority_float * RADV_BO_PRIORITY_APPLICATION_MAX));
|
||||
|
||||
mem->user_ptr = NULL;
|
||||
mem->bo = NULL;
|
||||
|
||||
#if RADV_SUPPORT_ANDROID_HARDWARE_BUFFER
|
||||
mem->android_hardware_buffer = NULL;
|
||||
|
|
|
|||
|
|
@ -1334,7 +1334,9 @@ create_buffer_from_image(struct radv_cmd_buffer *cmd_buffer, struct radv_meta_bl
|
|||
VkBufferUsageFlagBits usage, VkBuffer *buffer)
|
||||
{
|
||||
struct radv_device *device = cmd_buffer->device;
|
||||
struct radv_device_memory mem = {.bo = surf->image->bo};
|
||||
struct radv_device_memory mem;
|
||||
|
||||
radv_device_memory_init(&mem, device, surf->image->bo);
|
||||
|
||||
radv_CreateBuffer(radv_device_to_handle(device),
|
||||
&(VkBufferCreateInfo){
|
||||
|
|
@ -1353,6 +1355,8 @@ create_buffer_from_image(struct radv_cmd_buffer *cmd_buffer, struct radv_meta_bl
|
|||
.memory = radv_device_memory_to_handle(&mem),
|
||||
.memoryOffset = surf->image->offset,
|
||||
}});
|
||||
|
||||
radv_device_memory_finish(&mem);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -867,6 +867,10 @@ struct radv_device_memory {
|
|||
#endif
|
||||
};
|
||||
|
||||
void radv_device_memory_init(struct radv_device_memory *mem, struct radv_device *device,
|
||||
struct radeon_winsys_bo *bo);
|
||||
void radv_device_memory_finish(struct radv_device_memory *mem);
|
||||
|
||||
struct radv_descriptor_range {
|
||||
uint64_t va;
|
||||
uint32_t size;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue