nvk: Drop the device-level mutex

This existed to let us lock the memory_objects list and for handling
BO-based vk_sync waits.  We don't have either of these things anymore so
there's no need for a device-level lock.  We already have fine-grained
locks around the data structures that need them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25357>
This commit is contained in:
Faith Ekstrand 2023-09-25 17:20:31 -05:00 committed by Marge Bot
parent b4364f5762
commit 39bb73b21f
3 changed files with 1 additions and 38 deletions

View file

@ -215,35 +215,13 @@ nvk_CreateDevice(VkPhysicalDevice physicalDevice,
nvk_slm_area_init(&dev->slm);
if (pthread_mutex_init(&dev->mutex, NULL) != 0) {
result = vk_error(dev, VK_ERROR_INITIALIZATION_FAILED);
goto fail_slm;
}
pthread_condattr_t condattr;
if (pthread_condattr_init(&condattr) != 0) {
result = vk_error(dev, VK_ERROR_INITIALIZATION_FAILED);
goto fail_mutex;
}
if (pthread_condattr_setclock(&condattr, CLOCK_MONOTONIC) != 0) {
pthread_condattr_destroy(&condattr);
result = vk_error(dev, VK_ERROR_INITIALIZATION_FAILED);
goto fail_mutex;
}
if (pthread_cond_init(&dev->queue_submit, &condattr) != 0) {
pthread_condattr_destroy(&condattr);
result = vk_error(dev, VK_ERROR_INITIALIZATION_FAILED);
goto fail_mutex;
}
pthread_condattr_destroy(&condattr);
void *zero_map;
dev->zero_page = nouveau_ws_bo_new_mapped(dev->ws_dev, 0x1000, 0,
NOUVEAU_WS_BO_LOCAL |
NOUVEAU_WS_BO_NO_SHARE,
NOUVEAU_WS_BO_WR, &zero_map);
if (dev->zero_page == NULL)
goto fail_queue_submit;
goto fail_slm;
memset(zero_map, 0, 0x1000);
nouveau_ws_bo_unmap(dev->zero_page, zero_map);
@ -278,10 +256,6 @@ fail_vab_memory:
nouveau_ws_bo_destroy(dev->vab_memory);
fail_zero_page:
nouveau_ws_bo_destroy(dev->zero_page);
fail_queue_submit:
pthread_cond_destroy(&dev->queue_submit);
fail_mutex:
pthread_mutex_destroy(&dev->mutex);
fail_slm:
nvk_slm_area_finish(&dev->slm);
nvk_heap_finish(dev, &dev->event_heap);
@ -312,8 +286,6 @@ nvk_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
nvk_device_finish_meta(dev);
pthread_cond_destroy(&dev->queue_submit);
pthread_mutex_destroy(&dev->mutex);
nvk_queue_finish(dev, &dev->queue);
if (dev->vab_memory)
nouveau_ws_bo_destroy(dev->vab_memory);

View file

@ -46,9 +46,6 @@ struct nvk_device {
struct nvk_queue queue;
pthread_mutex_t mutex;
pthread_cond_t queue_submit;
struct vk_meta_device meta;
};

View file

@ -315,8 +315,6 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
push_add_sync_wait(&pb, &submit->waits[i]);
}
pthread_mutex_lock(&dev->mutex);
for (uint32_t i = 0; i < submit->signal_count; i++) {
push_add_sync_signal(&pb, &submit->signals[i]);
}
@ -351,9 +349,5 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
result = push_submit(&pb, queue, sync);
}
pthread_cond_broadcast(&dev->queue_submit);
pthread_mutex_unlock(&dev->mutex);
return result;
}