vkr: add vkr_device_memory_release

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
macos/master
Yiwei Zhang 3 years ago
parent c2e77fce08
commit 0b2e4b2cd8
  1. 4
      src/venus/vkr_device.c
  2. 9
      src/venus/vkr_device_memory.c
  3. 3
      src/venus/vkr_device_memory.h

@ -238,9 +238,7 @@ vkr_device_object_destroy(struct vkr_context *ctx,
break; break;
case VK_OBJECT_TYPE_DEVICE_MEMORY: case VK_OBJECT_TYPE_DEVICE_MEMORY:
vkFreeMemory(device, obj->handle.device_memory, NULL); vkFreeMemory(device, obj->handle.device_memory, NULL);
vkr_device_memory_release((struct vkr_device_memory *)obj);
/* remove device memory from exported or attachment list */
list_del(&((struct vkr_device_memory *)obj)->exported_head);
break; break;
case VK_OBJECT_TYPE_BUFFER: case VK_OBJECT_TYPE_BUFFER:
vkDestroyBuffer(device, obj->handle.buffer, NULL); vkDestroyBuffer(device, obj->handle.buffer, NULL);

@ -151,8 +151,7 @@ vkr_dispatch_vkFreeMemory(struct vn_dispatch_context *dispatch,
if (!mem) if (!mem)
return; return;
list_del(&mem->exported_head); vkr_device_memory_release(mem);
vkr_device_memory_destroy_and_remove(dispatch->data, args); vkr_device_memory_destroy_and_remove(dispatch->data, args);
} }
@ -244,3 +243,9 @@ vkr_context_init_device_memory_dispatch(struct vkr_context *ctx)
dispatch->dispatch_vkGetMemoryResourcePropertiesMESA = dispatch->dispatch_vkGetMemoryResourcePropertiesMESA =
vkr_dispatch_vkGetMemoryResourcePropertiesMESA; vkr_dispatch_vkGetMemoryResourcePropertiesMESA;
} }
void
vkr_device_memory_release(struct vkr_device_memory *mem)
{
list_del(&mem->exported_head);
}

@ -24,4 +24,7 @@ VKR_DEFINE_OBJECT_CAST(device_memory, VK_OBJECT_TYPE_DEVICE_MEMORY, VkDeviceMemo
void void
vkr_context_init_device_memory_dispatch(struct vkr_context *ctx); vkr_context_init_device_memory_dispatch(struct vkr_context *ctx);
void
vkr_device_memory_release(struct vkr_device_memory *mem);
#endif /* VKR_DEVICE_MEMORY_H */ #endif /* VKR_DEVICE_MEMORY_H */

Loading…
Cancel
Save