diff options
author | Chris Wilson <[email protected]> | 2018-11-13 17:55:21 +0000 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:10 -0800 |
commit | 01e729f883af47a6a38fca255f37c7d327c2edee (patch) | |
tree | 5397ca772e2ac5fe93106de945a131cb26a096c6 /src/gallium/drivers/iris/iris_bufmgr.c | |
parent | 1b69b14c2a20932fe59d2d48ff398be28a313a33 (diff) |
iris: Tidy exporting the flink handle
Diffstat (limited to 'src/gallium/drivers/iris/iris_bufmgr.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_bufmgr.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index 6ac5e88fa55..b4851711b4a 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -1405,18 +1405,25 @@ err: } static void +iris_bo_make_external_locked(struct iris_bo *bo) +{ + if (!bo->external) { + _mesa_hash_table_insert(bo->bufmgr->handle_table, &bo->gem_handle, bo); + bo->external = true; + } +} + +static void iris_bo_make_external(struct iris_bo *bo) { struct iris_bufmgr *bufmgr = bo->bufmgr; - if (!bo->external) { - mtx_lock(&bufmgr->lock); - if (!bo->external) { - _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo); - bo->external = true; - } - mtx_unlock(&bufmgr->lock); - } + if (bo->external) + return; + + mtx_lock(&bufmgr->lock); + iris_bo_make_external_locked(bo); + mtx_unlock(&bufmgr->lock); } int @@ -1454,9 +1461,9 @@ iris_bo_flink(struct iris_bo *bo, uint32_t *name) if (drm_ioctl(bufmgr->fd, DRM_IOCTL_GEM_FLINK, &flink)) return -errno; - iris_bo_make_external(bo); mtx_lock(&bufmgr->lock); if (!bo->global_name) { + iris_bo_make_external_locked(bo); bo->global_name = flink.name; _mesa_hash_table_insert(bufmgr->name_table, &bo->global_name, bo); } |