[Mesa-dev] [PATCH 3/3] st/mesa: don't mark the program as in cache_fallback when there is cache miss

Timothy Arceri tarceri at itsqueeze.com
Thu May 18 05:32:22 UTC 2017


On 18/05/17 15:22, Timothy Arceri wrote:
> When we fallback currently the gl_program objects are re-allocated.
> 
> This is likely to change when the i965 cache lands, but for now
> this fixes a crash when using MESA_GLSL=cache_fb. This env var
> simulates the fallback path taken when a tgsi cache item doesn't
> exist due to being evicted previously or some kind of error.
> 
> Unlike i965 we are always falling back at link time so it's safe to
> just re-allocate everything. We will be unnecessarily freeing and
> re-allocate a bunch of things here but it's probably not a huge deal,
> and can be changed when the i965 code lands.

This should have:

Fixes: 0e9991f957e2 ("glsl: don't reference shader prog data during 
cache fallback")

I've added this locally.

> 
> Cc: Nicolai Hähnle <nhaehnle at gmail.com>
> ---
>   src/mesa/state_tracker/st_shader_cache.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
> index 394adbe..bb162cd 100644
> --- a/src/mesa/state_tracker/st_shader_cache.c
> +++ b/src/mesa/state_tracker/st_shader_cache.c
> @@ -388,19 +388,18 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
>   fallback_recompile:
>      free(buffer);
>   
>      if (ctx->_Shader->Flags & GLSL_CACHE_INFO)
>         fprintf(stderr, "TGSI cache falling back to recompile.\n");
>   
>      for (unsigned i = 0; i < prog->NumShaders; i++) {
>         _mesa_glsl_compile_shader(ctx, prog->Shaders[i], false, false, true);
>      }
>   
> -   prog->data->cache_fallback = true;
>      _mesa_glsl_link_shader(ctx, prog);
>   
>      /* Turn the fallback flag back on if we disabled it previously */
>      if (cache_fb)
>         ctx->_Shader->Flags |= GLSL_CACHE_FALLBACK;
>   
>      return true;
>   }
> 


More information about the mesa-dev mailing list