[Mesa-dev] [PATCH 1/2] i965/bufmgr: Add a helper to mark a BO as external

Andres Gomez agomez at igalia.com
Tue Nov 21 00:13:28 UTC 2017


Jason, this nominated series landed without mentioning any specific
stable queue.

>From what I'm seeing, both depend on 2c4097aff1b which didn't make it
for 17.2 so I'm dropping them for that queue.

Let me know what you think.

On Fri, 2017-11-17 at 17:02 -0800, Jason Ekstrand wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_bufmgr.c | 17 +++++++++++------
>  1 file 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 17036b5..60b0dad 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);
-- 
Br,

Andres


More information about the mesa-dev mailing list