freedreno/drm: Add some locking asserts

Also fix evil-twin table_lock which they turned up.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7580>
This commit is contained in:
Rob Clark 2020-11-11 11:21:05 -08:00 committed by Marge Bot
parent 9eb2ae5d21
commit 8de279f8db
3 changed files with 9 additions and 2 deletions

View File

@ -61,6 +61,8 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
{
struct fd_bo *bo;
simple_mtx_assert_locked(&table_lock);
bo = dev->funcs->bo_from_handle(dev, size, handle);
if (!bo) {
struct drm_gem_close req = {
@ -272,6 +274,8 @@ void bo_del(struct fd_bo *bo)
{
VG_BO_FREE(bo);
simple_mtx_assert_locked(&table_lock);
if (bo->map)
os_munmap(bo->map, bo->size);

View File

@ -33,8 +33,6 @@
#include "freedreno_drmif.h"
#include "freedreno_priv.h"
static simple_mtx_t table_lock = _SIMPLE_MTX_INITIALIZER_NP;
struct fd_device * kgsl_device_new(int fd);
struct fd_device * msm_device_new(int fd);
@ -110,6 +108,9 @@ struct fd_device * fd_device_ref(struct fd_device *dev)
static void fd_device_del_impl(struct fd_device *dev)
{
int close_fd = dev->closefd ? dev->fd : -1;
simple_mtx_assert_locked(&table_lock);
fd_bo_cache_cleanup(&dev->bo_cache, 0);
fd_bo_cache_cleanup(&dev->ring_cache, 0);
_mesa_hash_table_destroy(dev->handle_table, NULL);

View File

@ -51,6 +51,8 @@
#include "freedreno_drmif.h"
#include "freedreno_ringbuffer.h"
extern simple_mtx_t table_lock;
struct fd_device_funcs {
int (*bo_new_handle)(struct fd_device *dev, uint32_t size,
uint32_t flags, uint32_t *handle);