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:
parent
9eb2ae5d21
commit
8de279f8db
|
@ -61,6 +61,8 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
|
||||||
{
|
{
|
||||||
struct fd_bo *bo;
|
struct fd_bo *bo;
|
||||||
|
|
||||||
|
simple_mtx_assert_locked(&table_lock);
|
||||||
|
|
||||||
bo = dev->funcs->bo_from_handle(dev, size, handle);
|
bo = dev->funcs->bo_from_handle(dev, size, handle);
|
||||||
if (!bo) {
|
if (!bo) {
|
||||||
struct drm_gem_close req = {
|
struct drm_gem_close req = {
|
||||||
|
@ -272,6 +274,8 @@ void bo_del(struct fd_bo *bo)
|
||||||
{
|
{
|
||||||
VG_BO_FREE(bo);
|
VG_BO_FREE(bo);
|
||||||
|
|
||||||
|
simple_mtx_assert_locked(&table_lock);
|
||||||
|
|
||||||
if (bo->map)
|
if (bo->map)
|
||||||
os_munmap(bo->map, bo->size);
|
os_munmap(bo->map, bo->size);
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#include "freedreno_drmif.h"
|
#include "freedreno_drmif.h"
|
||||||
#include "freedreno_priv.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 * kgsl_device_new(int fd);
|
||||||
struct fd_device * msm_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)
|
static void fd_device_del_impl(struct fd_device *dev)
|
||||||
{
|
{
|
||||||
int close_fd = dev->closefd ? dev->fd : -1;
|
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->bo_cache, 0);
|
||||||
fd_bo_cache_cleanup(&dev->ring_cache, 0);
|
fd_bo_cache_cleanup(&dev->ring_cache, 0);
|
||||||
_mesa_hash_table_destroy(dev->handle_table, NULL);
|
_mesa_hash_table_destroy(dev->handle_table, NULL);
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
#include "freedreno_drmif.h"
|
#include "freedreno_drmif.h"
|
||||||
#include "freedreno_ringbuffer.h"
|
#include "freedreno_ringbuffer.h"
|
||||||
|
|
||||||
|
extern simple_mtx_t table_lock;
|
||||||
|
|
||||||
struct fd_device_funcs {
|
struct fd_device_funcs {
|
||||||
int (*bo_new_handle)(struct fd_device *dev, uint32_t size,
|
int (*bo_new_handle)(struct fd_device *dev, uint32_t size,
|
||||||
uint32_t flags, uint32_t *handle);
|
uint32_t flags, uint32_t *handle);
|
||||||
|
|
Loading…
Reference in New Issue