[Mesa-dev] [PATCH 2/8] i965/miptree: Directly gtt map the mcs buffer

Pohjolainen, Topi topi.pohjolainen at gmail.com
Mon Nov 7 09:33:13 UTC 2016


On Thu, Nov 03, 2016 at 10:39:37AM +0000, Lionel Landwerlin wrote:
> From: Ben Widawsky <benjamin.widawsky at intel.com>
> 
> The next patch will change the map type, and this will make sure there are no
> regressions as a result of the other stuff. Since the miptree is newly created,
> I believe it is always safe to just map.
> 
> It is possible to CPU map this buffer on LLC platforms (it additionally requires
> rounding up to tile size). I did experiment with that patch, and found no
> performance gains to be had.
> 
> I've added in error handling while here. Generally GTT mapping is an operation
> which is highly unlikely to fail, but we may as well handle it when it does.
> 
> v2: rebase on master (Lionel)
> 
> Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com> (v1)
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com> (v2)
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index fa82d6e..0001511 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -1496,10 +1496,16 @@ intel_miptree_init_mcs(struct brw_context *brw,
>      *
>      * Note: the clear value for MCS buffers is all 1's, so we memset to 0xff.
>      */
> -   void *data = intel_miptree_map_raw(brw, mt->mcs_buf->mt);
> +   const int ret = brw_bo_map_gtt(brw, mt->mcs_buf->bo, "miptree");
> +   if (unlikely(ret)) {

Should we print something to stderr as well while we handle this? Either way:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> +      intel_miptree_release(&mt->mcs_buf->mt);
> +      free(mt->mcs_buf);
> +      return;
> +   }
> +   void *data = mt->mcs_buf->bo->virtual;
>     memset(data, init_value,
>            mt->mcs_buf->mt->total_height * mt->mcs_buf->mt->pitch);
> -   intel_miptree_unmap_raw(mt->mcs_buf->mt);
> +   drm_intel_bo_unmap(mt->mcs_buf->bo);
>     mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;
>  }
>  
> -- 
> 2.10.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list