summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r--src/intel/vulkan/anv_device.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 991ca50f7dd..2af09d4f122 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2005,6 +2005,8 @@ VkResult anv_CreateDevice(
high_heap->size;
}
+ list_inithead(&device->memory_objects);
+
/* As per spec, the driver implementation may deny requests to acquire
* a priority above the default priority (MEDIUM) if the caller does not
* have sufficient privileges. In this scenario VK_ERROR_NOT_PERMITTED_EXT
@@ -2118,9 +2120,6 @@ VkResult anv_CreateDevice(
if (device->info.gen >= 10)
anv_device_init_hiz_clear_value_bo(device);
- if (physical_device->use_softpin)
- device->pinned_buffers = _mesa_pointer_set_create(NULL);
-
anv_scratch_pool_init(device, &device->scratch_pool);
anv_queue_init(device, &device->queue);
@@ -2211,9 +2210,6 @@ void anv_DestroyDevice(
anv_queue_finish(&device->queue);
- if (physical_device->use_softpin)
- _mesa_set_destroy(device->pinned_buffers, NULL);
-
#ifdef HAVE_VALGRIND
/* We only need to free these to prevent valgrind errors. The backing
* BO will go away in a couple of lines so we don't actually leak.
@@ -2698,6 +2694,10 @@ VkResult anv_AllocateMemory(
}
success:
+ pthread_mutex_lock(&device->mutex);
+ list_addtail(&mem->link, &device->memory_objects);
+ pthread_mutex_unlock(&device->mutex);
+
*pMem = anv_device_memory_to_handle(mem);
return VK_SUCCESS;
@@ -2789,6 +2789,10 @@ void anv_FreeMemory(
if (mem == NULL)
return;
+ pthread_mutex_lock(&device->mutex);
+ list_del(&mem->link);
+ pthread_mutex_unlock(&device->mutex);
+
if (mem->map)
anv_UnmapMemory(_device, _mem);
@@ -3324,12 +3328,6 @@ VkResult anv_CreateBuffer(
buffer->usage = pCreateInfo->usage;
buffer->address = ANV_NULL_ADDRESS;
- if (buffer->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT) {
- pthread_mutex_lock(&device->mutex);
- _mesa_set_add(device->pinned_buffers, buffer);
- pthread_mutex_unlock(&device->mutex);
- }
-
*pBuffer = anv_buffer_to_handle(buffer);
return VK_SUCCESS;
@@ -3346,12 +3344,6 @@ void anv_DestroyBuffer(
if (!buffer)
return;
- if (buffer->usage & VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT) {
- pthread_mutex_lock(&device->mutex);
- _mesa_set_remove_key(device->pinned_buffers, buffer);
- pthread_mutex_unlock(&device->mutex);
- }
-
vk_free2(&device->alloc, pAllocator, buffer);
}