[Mesa-dev] [PATCH 3/4] i965: Issue performance warnings for program cache related stalls.

Kristian Høgsberg hoegsberg at gmail.com
Fri Sep 26 08:36:39 PDT 2014


On Fri, Aug 29, 2014 at 11:10:49PM -0700, Kenneth Graunke wrote:
> We don't really want extra buffer copying or stalls when mapping,
> so it'd be nice to know when it's happening.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
>  src/mesa/drivers/dri/i965/brw_state_cache.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
> index b0986ea..b9bb0fc 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_cache.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
> @@ -175,7 +175,7 @@ brw_cache_new_bo(struct brw_cache *cache, uint32_t new_size)
>  
>     /* Copy any existing data that needs to be saved. */
>     if (cache->next_offset != 0) {
> -      drm_intel_bo_map(cache->bo, false);
> +      brw_bo_map(brw, cache->bo, false, "program cache");
>        drm_intel_bo_subdata(new_bo, 0, cache->next_offset, cache->bo->virtual);
>        drm_intel_bo_unmap(cache->bo);
>     }
> @@ -200,6 +200,7 @@ brw_try_upload_using_copy(struct brw_cache *cache,
>  			  const void *data,
>  			  const void *aux)
>  {
> +   struct brw_context *brw = cache->brw;
>     int i;
>     struct brw_cache_item *item;
>  
> @@ -221,7 +222,7 @@ brw_try_upload_using_copy(struct brw_cache *cache,
>  	    continue;
>  	 }
>  
> -	 drm_intel_bo_map(cache->bo, false);
> +	 brw_bo_map(brw, cache->bo, false, "program cache");
>  	 ret = memcmp(cache->bo->virtual + item->offset, data, item->size);
>  	 drm_intel_bo_unmap(cache->bo);
>  	 if (ret)
> @@ -241,6 +242,8 @@ brw_upload_item_data(struct brw_cache *cache,
>  		     struct brw_cache_item *item,
>  		     const void *data)
>  {
> +   struct brw_context *brw = cache->brw;
> +
>     /* Allocate space in the cache BO for our new program. */
>     if (cache->next_offset + item->size > cache->bo->size) {
>        uint32_t new_size = cache->bo->size * 2;
> @@ -255,6 +258,7 @@ brw_upload_item_data(struct brw_cache *cache,
>      * recreate it.
>      */
>     if (cache->bo_used_by_gpu) {
> +      perf_debug("Copying busy program cache buffer.\n");
>        brw_cache_new_bo(cache, cache->bo->size);
>     }
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list