Quoting Jason Ekstrand (2018-01-12 01:40:52)
> This helper should be used carefully as setting tiling is a racy
> operation since it potentially interacts with other processes.  Still,
> it is a useful thing to be able to do.
> 
> Cc: mesa-sta...@lists.freedesktop.org
> ---
>  src/mesa/drivers/dri/i965/brw_bufmgr.c | 27 +++++++++++++++++++++++++++
>  src/mesa/drivers/dri/i965/brw_bufmgr.h | 10 ++++++++++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c 
> b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> index 469895e..dbd13dd 100644
> --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> @@ -1133,6 +1133,33 @@ brw_bo_get_tiling(struct brw_bo *bo, uint32_t 
> *tiling_mode,
>     return 0;
>  }
>  
> +int
> +brw_bo_set_tiling(struct brw_bo *bo, uint32_t tiling_mode,
> +                  uint32_t stride)
> +{
> +   struct brw_bufmgr *bufmgr = bo->bufmgr;
> +
> +   mtx_lock(&bufmgr->lock);

This mutex protects the buffer cache, which should not be containing
this bo. Changing the tiling of a shared active bo also should not
happen because the other parties will have already derived state from
the older tiling. So I don't see the purpose of this mutex here.

If we will need exclusive access to a bo, let's have a bo->lock.
-Chris
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to