etnaviv/drm: add some locking asserts
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7832>
This commit is contained in:
parent
034dd948df
commit
37226269d3
|
@ -36,6 +36,8 @@ void _etna_bo_del(struct etna_bo *bo);
|
|||
/* 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)
|
||||
{
|
||||
simple_mtx_assert_locked(&etna_drm_table_lock);
|
||||
|
||||
bo->name = name;
|
||||
/* add ourself into the name table: */
|
||||
_mesa_hash_table_insert(bo->dev->name_table, &bo->name, bo);
|
||||
|
@ -46,6 +48,8 @@ void _etna_bo_del(struct etna_bo *bo)
|
|||
{
|
||||
VG_BO_FREE(bo);
|
||||
|
||||
simple_mtx_assert_locked(&etna_drm_table_lock);
|
||||
|
||||
if (bo->va)
|
||||
util_vma_heap_free(&bo->dev->address_space, bo->va, bo->size);
|
||||
|
||||
|
@ -71,7 +75,11 @@ void _etna_bo_del(struct etna_bo *bo)
|
|||
static struct etna_bo *lookup_bo(void *tbl, uint32_t handle)
|
||||
{
|
||||
struct etna_bo *bo = NULL;
|
||||
struct hash_entry *entry = _mesa_hash_table_search(tbl, &handle);
|
||||
struct hash_entry *entry;
|
||||
|
||||
simple_mtx_assert_locked(&etna_drm_table_lock);
|
||||
|
||||
entry = _mesa_hash_table_search(tbl, &handle);
|
||||
|
||||
if (entry) {
|
||||
/* found, incr refcnt and return: */
|
||||
|
@ -90,6 +98,8 @@ static struct etna_bo *bo_from_handle(struct etna_device *dev,
|
|||
{
|
||||
struct etna_bo *bo = calloc(sizeof(*bo), 1);
|
||||
|
||||
simple_mtx_assert_locked(&etna_drm_table_lock);
|
||||
|
||||
if (!bo) {
|
||||
struct drm_gem_close req = {
|
||||
.handle = handle,
|
||||
|
|
|
@ -181,7 +181,11 @@ struct etna_bo *etna_bo_cache_alloc(struct etna_bo_cache *cache, uint32_t *size,
|
|||
|
||||
int etna_bo_cache_free(struct etna_bo_cache *cache, struct etna_bo *bo)
|
||||
{
|
||||
struct etna_bo_bucket *bucket = get_bucket(cache, bo->size);
|
||||
struct etna_bo_bucket *bucket;
|
||||
|
||||
simple_mtx_assert_locked(&etna_drm_table_lock);
|
||||
|
||||
bucket = get_bucket(cache, bo->size);
|
||||
|
||||
/* see if we can be green and recycle: */
|
||||
if (bucket) {
|
||||
|
|
|
@ -154,6 +154,8 @@ static uint32_t append_bo(struct etna_cmd_stream *stream, struct etna_bo *bo)
|
|||
struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
|
||||
uint32_t idx;
|
||||
|
||||
simple_mtx_assert_locked(&idx_lock);
|
||||
|
||||
idx = APPEND(&priv->submit, bos);
|
||||
idx = APPEND(priv, bos);
|
||||
|
||||
|
|
|
@ -98,6 +98,8 @@ static void etna_device_del_impl(struct etna_device *dev)
|
|||
|
||||
void etna_device_del_locked(struct etna_device *dev)
|
||||
{
|
||||
simple_mtx_assert_locked(&etna_drm_table_lock);
|
||||
|
||||
if (!p_atomic_dec_zero(&dev->refcnt))
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue