From 17d7282ccadba91a0a781a7e6cd0182c242e4151 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Guido=20G=C3=BCnther?= Date: Fri, 31 May 2019 14:35:08 +0200 Subject: [PATCH] etnaviv: drm: s/table_lock/etna_table_lock/ MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This avoids a conflict with freedreno's table_lock Signed-off-by: Guido Günther Reviewed-by: Christian Gmeiner --- src/etnaviv/drm/etnaviv_bo.c | 32 +++++++++++++++--------------- src/etnaviv/drm/etnaviv_bo_cache.c | 8 ++++---- src/etnaviv/drm/etnaviv_device.c | 6 +++--- src/etnaviv/drm/etnaviv_priv.h | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c index 096415afae3..6d6339aff49 100644 --- a/src/etnaviv/drm/etnaviv_bo.c +++ b/src/etnaviv/drm/etnaviv_bo.c @@ -30,10 +30,10 @@ #include "etnaviv_priv.h" #include "etnaviv_drmif.h" -pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t etna_drm_table_lock = PTHREAD_MUTEX_INITIALIZER; void bo_del(struct etna_bo *bo); -/* set buffer name, and add to table, call w/ table_lock held: */ +/* set buffer name, and add to table, call w/ etna_drm_table_lock held: */ static void set_name(struct etna_bo *bo, uint32_t name) { bo->name = name; @@ -41,7 +41,7 @@ static void set_name(struct etna_bo *bo, uint32_t name) _mesa_hash_table_insert(bo->dev->name_table, &bo->name, bo); } -/* Called under table_lock */ +/* Called under etna_drm_table_lock */ void bo_del(struct etna_bo *bo) { if (bo->map) @@ -62,7 +62,7 @@ void bo_del(struct etna_bo *bo) free(bo); } -/* lookup a buffer from it's handle, call w/ table_lock held: */ +/* lookup a buffer from it's handle, call w/ etna_drm_table_lock held: */ static struct etna_bo *lookup_bo(void *tbl, uint32_t handle) { struct etna_bo *bo = NULL; @@ -79,7 +79,7 @@ static struct etna_bo *lookup_bo(void *tbl, uint32_t handle) return bo; } -/* allocate a new buffer object, call w/ table_lock held */ +/* allocate a new buffer object, call w/ etna_drm_table_lock held */ static struct etna_bo *bo_from_handle(struct etna_device *dev, uint32_t size, uint32_t handle, uint32_t flags) { @@ -127,10 +127,10 @@ struct etna_bo *etna_bo_new(struct etna_device *dev, uint32_t size, if (ret) return NULL; - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); bo = bo_from_handle(dev, size, req.handle, flags); bo->reuse = 1; - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); return bo; } @@ -171,7 +171,7 @@ struct etna_bo *etna_bo_from_name(struct etna_device *dev, .name = name, }; - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); /* check name table first, to see if bo is already open: */ bo = lookup_bo(dev->name_table, name); @@ -192,7 +192,7 @@ struct etna_bo *etna_bo_from_name(struct etna_device *dev, set_name(bo, name); out_unlock: - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); return bo; } @@ -211,11 +211,11 @@ struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd) * racing against etna_bo_del, which might invalidate the * returned handle. */ - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); ret = drmPrimeFDToHandle(dev->fd, fd, &handle); if (ret) { - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); return NULL; } @@ -230,7 +230,7 @@ struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd) bo = bo_from_handle(dev, size, handle, 0); out_unlock: - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); return bo; } @@ -246,7 +246,7 @@ void etna_bo_del(struct etna_bo *bo) if (!p_atomic_dec_zero(&bo->refcnt)) return; - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); if (bo->reuse && (etna_bo_cache_free(&dev->bo_cache, bo) == 0)) goto out; @@ -254,7 +254,7 @@ void etna_bo_del(struct etna_bo *bo) bo_del(bo); etna_device_del_locked(dev); out: - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); } /* get the global flink/DRI2 buffer name */ @@ -271,9 +271,9 @@ int etna_bo_get_name(struct etna_bo *bo, uint32_t *name) return ret; } - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); set_name(bo, req.name); - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); bo->reuse = 0; } diff --git a/src/etnaviv/drm/etnaviv_bo_cache.c b/src/etnaviv/drm/etnaviv_bo_cache.c index fa0d2a28451..116013cb2f1 100644 --- a/src/etnaviv/drm/etnaviv_bo_cache.c +++ b/src/etnaviv/drm/etnaviv_bo_cache.c @@ -28,7 +28,7 @@ #include "etnaviv_drmif.h" void bo_del(struct etna_bo *bo); -extern pthread_mutex_t table_lock; +extern pthread_mutex_t etna_drm_table_lock; static void add_bucket(struct etna_bo_cache *cache, int size) { @@ -66,7 +66,7 @@ void etna_bo_cache_init(struct etna_bo_cache *cache) } } -/* Frees older cached buffers. Called under table_lock */ +/* Frees older cached buffers. Called under etna_drm_table_lock */ void etna_bo_cache_cleanup(struct etna_bo_cache *cache, time_t time) { unsigned i; @@ -122,7 +122,7 @@ static struct etna_bo *find_in_bucket(struct etna_bo_bucket *bucket, uint32_t fl { struct etna_bo *bo = NULL, *tmp; - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); if (LIST_IS_EMPTY(&bucket->list)) goto out_unlock; @@ -146,7 +146,7 @@ static struct etna_bo *find_in_bucket(struct etna_bo_bucket *bucket, uint32_t fl bo = NULL; out_unlock: - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); return bo; } diff --git a/src/etnaviv/drm/etnaviv_device.c b/src/etnaviv/drm/etnaviv_device.c index 7dffb1cb3ab..b8d465ac8a4 100644 --- a/src/etnaviv/drm/etnaviv_device.c +++ b/src/etnaviv/drm/etnaviv_device.c @@ -29,7 +29,7 @@ #include "etnaviv_priv.h" #include "etnaviv_drmif.h" -static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t etna_drm_table_lock = PTHREAD_MUTEX_INITIALIZER; static uint32_t u32_hash(const void *key) @@ -106,9 +106,9 @@ void etna_device_del(struct etna_device *dev) if (!p_atomic_dec_zero(&dev->refcnt)) return; - pthread_mutex_lock(&table_lock); + pthread_mutex_lock(&etna_drm_table_lock); etna_device_del_impl(dev); - pthread_mutex_unlock(&table_lock); + pthread_mutex_unlock(&etna_drm_table_lock); } int etna_device_fd(struct etna_device *dev) diff --git a/src/etnaviv/drm/etnaviv_priv.h b/src/etnaviv/drm/etnaviv_priv.h index 4117be13771..527cee30dc3 100644 --- a/src/etnaviv/drm/etnaviv_priv.h +++ b/src/etnaviv/drm/etnaviv_priv.h @@ -85,7 +85,7 @@ struct etna_bo *etna_bo_cache_alloc(struct etna_bo_cache *cache, uint32_t *size, uint32_t flags); int etna_bo_cache_free(struct etna_bo_cache *cache, struct etna_bo *bo); -/* for where @table_lock is already held: */ +/* for where @etna_drm_table_lock is already held: */ void etna_device_del_locked(struct etna_device *dev); /* a GEM buffer object allocated from the DRM device */ -- 2.30.2