summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@collabora.com>2022-04-04 08:40:30 -0500
committerMarge Bot <emma+marge@anholt.net>2022-04-13 17:22:14 +0000
commit30191fd9df1c6804e2041854f2bb79e7df157539 (patch)
tree064c39132f15282ffb4acf3d3e792ee0fe39d26a
parent25441b5e5c3a30b3df0c6bb231e47df0e15a9dec (diff)
v3dv: Don't use pthread functions on c11 mutexes
This only works because c11/threads.h is typedeffing the c11 stuff to ptrheads. Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15704>
-rw-r--r--src/broadcom/vulkan/v3dv_device.c14
-rw-r--r--src/broadcom/vulkan/v3dv_pipeline_cache.c8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index 38913a058d7..2c46c9ebea7 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -852,7 +852,7 @@ physical_device_init(struct v3dv_physical_device *device,
get_device_extensions(device, &device->vk.supported_extensions);
- pthread_mutex_init(&device->mutex, NULL);
+ mtx_init(&device->mutex, mtx_plain);
return VK_SUCCESS;
@@ -1857,8 +1857,8 @@ queue_init(struct v3dv_device *device, struct v3dv_queue *queue,
queue->device = device;
queue->noop_job = NULL;
list_inithead(&queue->submit_wait_list);
- pthread_mutex_init(&queue->mutex, NULL);
- pthread_mutex_init(&queue->noop_mutex, NULL);
+ mtx_init(&queue->mutex, mtx_plain);
+ mtx_init(&queue->noop_mutex, mtx_plain);
return VK_SUCCESS;
}
@@ -1869,8 +1869,8 @@ queue_finish(struct v3dv_queue *queue)
assert(list_is_empty(&queue->submit_wait_list));
if (queue->noop_job)
v3dv_job_destroy(queue->noop_job);
- pthread_mutex_destroy(&queue->mutex);
- pthread_mutex_destroy(&queue->noop_mutex);
+ mtx_destroy(&queue->mutex);
+ mtx_destroy(&queue->noop_mutex);
}
static void
@@ -1944,7 +1944,7 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
device->instance = instance;
device->pdevice = physical_device;
- pthread_mutex_init(&device->mutex, NULL);
+ mtx_init(&device->mutex, mtx_plain);
result = queue_init(device, &device->queue,
pCreateInfo->pQueueCreateInfos, 0);
@@ -2012,7 +2012,7 @@ v3dv_DestroyDevice(VkDevice _device,
v3dv_DeviceWaitIdle(_device);
queue_finish(&device->queue);
- pthread_mutex_destroy(&device->mutex);
+ mtx_destroy(&device->mutex);
destroy_device_syncs(device, device->pdevice->render_fd);
destroy_device_meta(device);
v3dv_pipeline_cache_finish(&device->default_pipeline_cache);
diff --git a/src/broadcom/vulkan/v3dv_pipeline_cache.c b/src/broadcom/vulkan/v3dv_pipeline_cache.c
index 2e86a63f55f..9d2b816a79e 100644
--- a/src/broadcom/vulkan/v3dv_pipeline_cache.c
+++ b/src/broadcom/vulkan/v3dv_pipeline_cache.c
@@ -67,14 +67,14 @@ static void
pipeline_cache_lock(struct v3dv_pipeline_cache *cache)
{
if (!cache->externally_synchronized)
- pthread_mutex_lock(&cache->mutex);
+ mtx_lock(&cache->mutex);
}
static void
pipeline_cache_unlock(struct v3dv_pipeline_cache *cache)
{
if (!cache->externally_synchronized)
- pthread_mutex_unlock(&cache->mutex);
+ mtx_unlock(&cache->mutex);
}
void
@@ -203,7 +203,7 @@ v3dv_pipeline_cache_init(struct v3dv_pipeline_cache *cache,
bool cache_enabled)
{
cache->device = device;
- pthread_mutex_init(&cache->mutex, NULL);
+ mtx_init(&cache->mutex, mtx_plain);
if (cache_enabled) {
cache->nir_cache = _mesa_hash_table_create(NULL, sha1_hash_func,
@@ -714,7 +714,7 @@ v3dv_CreatePipelineCache(VkDevice _device,
void
v3dv_pipeline_cache_finish(struct v3dv_pipeline_cache *cache)
{
- pthread_mutex_destroy(&cache->mutex);
+ mtx_destroy(&cache->mutex);
if (dump_stats_on_destroy)
cache_dump_stats(cache);