mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 12:00:12 +01:00
etnaviv: drm: s/table_lock/etna_table_lock/
This avoids a conflict with freedreno's table_lock Signed-off-by: Guido Günther <guido.gunther@puri.sm> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
This commit is contained in:
parent
7a5b19346a
commit
17d7282cca
4 changed files with 24 additions and 24 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue