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

2017-05-18 Thread Timothy Arceri
Actually no this will just cause us to load from the cache again. I'm 
not sure why this was working on the test I was using. We might need to 
try something else.


We could maybe introduce another flag just for now that overrides the 
cache_fallback check in shader_cache_read_program_metadata() I think 
that should do the trick.


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.

Cc: Nicolai Hähnle 
---
  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;

  }


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-05-17 Thread Timothy Arceri

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 
---
  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;

  }


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-05-17 Thread Timothy Arceri
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.

Cc: Nicolai Hähnle 
---
 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;
 }
-- 
2.9.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev