summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Arceri <tarceri@itsqueeze.com>2017-02-13 09:59:55 +1100
committerEdward O'Callaghan <funfunctor@folklore1984.net>2017-02-17 12:07:33 +1100
commitde12160a6415b002f938ec08966af7351e584b84 (patch)
tree56ab4937665cba4940bde36e2e26b6e20beb20fc
parent70545f9a7df4d648516a9ebedd9092114d722922 (diff)
r600/radeonsi: enable glsl/tgsi on-disk cache
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c10
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c2
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c11
-rw-r--r--src/gallium/include/pipe/p_screen.h3
-rw-r--r--src/mesa/state_tracker/st_context.c2
6 files changed, 28 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 5290f40d6c..bdd8c0a21f 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -600,6 +600,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen)
compute_memory_pool_delete(rscreen->global_pool);
}
+ disk_cache_destroy(rscreen->b.b.disk_shader_cache);
r600_destroy_common_screen(&rscreen->b);
}
@@ -633,6 +634,15 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
return NULL;
}
+ uint32_t mesa_timestamp;
+ if (disk_cache_get_function_timestamp(r600_screen_create, &mesa_timestamp)) {
+ char *timestamp_str;
+ if (asprintf(&timestamp_str, "%u", mesa_timestamp) != -1) {
+ rscreen->b.b.disk_shader_cache = disk_cache_create(r600_get_chip_name(&rscreen->b), timestamp_str);
+ free(timestamp_str);
+ }
+ }
+
if (rscreen->b.info.chip_class >= EVERGREEN) {
rscreen->b.b.is_format_supported = evergreen_is_format_supported;
} else {
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 53d3dc6935..caaa0c517b 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -723,7 +723,7 @@ static const char* r600_get_device_vendor(struct pipe_screen* pscreen)
return "AMD";
}
-static const char* r600_get_chip_name(struct r600_common_screen *rscreen)
+const char* r600_get_chip_name(struct r600_common_screen *rscreen)
{
switch (rscreen->info.family) {
case CHIP_R600: return "AMD R600";
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 1fe44d9dd8..76ee9f0aa2 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -767,6 +767,7 @@ void radeon_save_cs(struct radeon_winsys *ws, struct radeon_winsys_cs *cs,
struct radeon_saved_cs *saved);
void radeon_clear_saved_cs(struct radeon_saved_cs *saved);
bool r600_check_device_reset(struct r600_common_context *rctx);
+const char* r600_get_chip_name(struct r600_common_screen *rscreen);
/* r600_gpu_load.c */
void r600_gpu_load_kill_thread(struct r600_common_screen *rscreen);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 880602745c..37e10f01fa 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -704,6 +704,7 @@ static void si_destroy_screen(struct pipe_screen* pscreen)
}
}
pipe_mutex_destroy(sscreen->shader_parts_mutex);
+ disk_cache_destroy(sscreen->b.b.disk_shader_cache);
si_destroy_shader_cache(sscreen);
r600_destroy_common_screen(&sscreen->b);
}
@@ -793,6 +794,16 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
return NULL;
}
+ uint32_t mesa_timestamp, llvm_timestamp;
+ if (disk_cache_get_function_timestamp(radeonsi_screen_create, &mesa_timestamp) &&
+ disk_cache_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, &llvm_timestamp)) {
+ char *timestamp_str;
+ if (asprintf(&timestamp_str, "%u_%u", mesa_timestamp, llvm_timestamp) != -1) {
+ sscreen->b.b.disk_shader_cache = disk_cache_create(r600_get_chip_name(&sscreen->b), timestamp_str);
+ free(timestamp_str);
+ }
+ }
+
si_handle_env_var_force_family(sscreen);
if (!debug_get_bool_option("RADEON_DISABLE_PERFCOUNTERS", false))
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index b6203f1da0..6fd527fa04 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -42,6 +42,7 @@
#include "pipe/p_format.h"
#include "pipe/p_defines.h"
#include "pipe/p_video_enums.h"
+#include "util/disk_cache.h"
@@ -318,6 +319,8 @@ struct pipe_screen {
const void *(*get_compiler_options)(struct pipe_screen *screen,
enum pipe_shader_ir ir,
unsigned shader);
+
+ struct disk_cache *disk_shader_cache;
};
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index f4ad6d8ad1..55522b1e0d 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -538,6 +538,8 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
return NULL;
}
+ ctx->Cache = pipe->screen->disk_shader_cache;
+
st_init_driver_flags(&ctx->DriverFlags);
/* XXX: need a capability bit in gallium to query if the pipe