Quoting Lionel Landwerlin (2018-09-04 11:30:42)
> Both brw_bo_map_cpu() & brw_bo_map_wc() assert if mapping the
> underlying BO fails. Failing back to brw_bo_map_gtt() doesn't seem to
> make any sense for that reason.
> 
> We also only call brw_bo_map_gtt() for tiled buffers which as far as
> we know are never mapped coherent (coherent is a parameter reserved
> for buffer objects which are always allocated linear). So explicitly
> assert if we ever run into this case.
> 
> This makes checking the kernel about whether GTT maps are actually
> coherent unnecessary.
> 
> v2: Add some explanation (Chris/Lionel)
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_bufmgr.c | 34 ++++++++++++--------------
>  1 file changed, 15 insertions(+), 19 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c 
> b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> index f1675b191c1..95c5439a521 100644
> --- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
> +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
> @@ -1095,6 +1095,21 @@ brw_bo_map_gtt(struct brw_context *brw, struct brw_bo 
> *bo, unsigned flags)
>  {
>     struct brw_bufmgr *bufmgr = bo->bufmgr;
>  
> +   /* It was recently discovered that some platforms cannot do coherent GTT
> +    * mappings. The kernel API previously assumed that they were. To deal 
> with
> +    * what is effectively a change in ABI, the kernel introduced a
> +    * I915_PARAM_MMAP_GTT_COHERENT getparam to let userspace know whether the
> +    * underlying platform is capable of coherent GTT mappings.
> +    *
> +    * Some digging in the i965 codebase revealed that we don't actually do
> +    * coherent GTT mappings. Coherent mappings are only used for buffer
> +    * objects which are allocated linear and we only call this function for
> +    * non linear buffers. The couple of asserts below are a reminder of the
> +    * cases where we should use GTT maps.
> +    */
> +   assert(bo->tiling_mode != I915_TILING_NONE);
> +   assert((flags & MAP_COHERENT) == 0);

Lucky you only have to support platforms with working WC :)

The explanation matches with my understanding,
Reviewed-by: Chris Wilson <ch...@chris-wilson.co.uk>
-Chris
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to