diff options
author | Jason Ekstrand <[email protected]> | 2017-11-17 16:49:03 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-11-17 17:16:44 -0800 |
commit | 344252a27f8d875572bbe65641a825af8e73845d (patch) | |
tree | 22b743d116ac9b8ed747ef557f9f97df0b31b01e /src/mesa/drivers/dri/i965/brw_bufmgr.c | |
parent | 1866f7aee596d203c34439c7b603db22788b0190 (diff) |
i965/bufmgr: Add a helper to mark a BO as external
Reviewed-by: Kenneth Graunke <[email protected]>
Cc: [email protected]
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_bufmgr.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_bufmgr.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c index 17036b53bcd..60b0dad2be7 100644 --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c @@ -1177,8 +1177,8 @@ err: return NULL; } -int -brw_bo_gem_export_to_prime(struct brw_bo *bo, int *prime_fd) +static void +brw_bo_make_external(struct brw_bo *bo) { struct brw_bufmgr *bufmgr = bo->bufmgr; @@ -1190,6 +1190,14 @@ brw_bo_gem_export_to_prime(struct brw_bo *bo, int *prime_fd) } mtx_unlock(&bufmgr->lock); } +} + +int +brw_bo_gem_export_to_prime(struct brw_bo *bo, int *prime_fd) +{ + struct brw_bufmgr *bufmgr = bo->bufmgr; + + brw_bo_make_external(bo); if (drmPrimeHandleToFD(bufmgr->fd, bo->gem_handle, DRM_CLOEXEC, prime_fd) != 0) @@ -1213,11 +1221,8 @@ brw_bo_flink(struct brw_bo *bo, uint32_t *name) if (drmIoctl(bufmgr->fd, DRM_IOCTL_GEM_FLINK, &flink)) return -errno; + brw_bo_make_external(bo); mtx_lock(&bufmgr->lock); - if (!bo->external) { - _mesa_hash_table_insert(bufmgr->handle_table, &bo->gem_handle, bo); - bo->external = true; - } if (!bo->global_name) { bo->global_name = flink.name; _mesa_hash_table_insert(bufmgr->name_table, &bo->global_name, bo); |