From: Tapani Pälli Date: Fri, 26 Jan 2018 06:20:07 +0000 (+0200) Subject: i965: move disk cache from brw_context to intel_screen X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6316c2ecbda6d9370f1f876981ebcc35393c04e8;p=mesa.git i965: move disk cache from brw_context to intel_screen Now every context refers to same disk_cache instance in screen. Signed-off-by: Tapani Pälli Suggested-by: Emil Velikov Reviewed-by: Emil Velikov Reviewed-by: Jordan Justen --- diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 07a234b367f..addacf2cf80 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1066,7 +1066,7 @@ brwCreateContext(gl_api api, vbo_use_buffer_objects(ctx); vbo_always_unmap_buffers(ctx); - brw_disk_cache_init(brw); + brw->ctx.Cache = brw->screen->disk_cache; return true; } @@ -1130,8 +1130,6 @@ intelDestroyContext(__DRIcontext * driContextPriv) driDestroyOptionCache(&brw->optionCache); - disk_cache_destroy(brw->ctx.Cache); - /* free the Mesa context */ _mesa_free_context_data(&brw->ctx); diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c index 6196386425d..f989456bcde 100644 --- a/src/mesa/drivers/dri/i965/brw_disk_cache.c +++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c @@ -404,7 +404,7 @@ brw_disk_cache_write_compute_program(struct brw_context *brw) } void -brw_disk_cache_init(struct brw_context *brw) +brw_disk_cache_init(struct intel_screen *screen) { #ifdef ENABLE_SHADER_CACHE if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", true)) @@ -412,7 +412,7 @@ brw_disk_cache_init(struct brw_context *brw) char renderer[10]; MAYBE_UNUSED int len = snprintf(renderer, sizeof(renderer), "i965_%04x", - brw->screen->deviceID); + screen->deviceID); assert(len == sizeof(renderer) - 1); const struct build_id_note *note = @@ -425,6 +425,6 @@ brw_disk_cache_init(struct brw_context *brw) char timestamp[41]; _mesa_sha1_format(timestamp, id_sha1); - brw->ctx.Cache = disk_cache_create(renderer, timestamp, 0); + screen->disk_cache = disk_cache_create(renderer, timestamp, 0); #endif } diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index ad508950f78..d29ae6b972f 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -125,7 +125,7 @@ void gen8_write_pma_stall_bits(struct brw_context *brw, uint32_t pma_stall_bits); /* brw_disk_cache.c */ -void brw_disk_cache_init(struct brw_context *brw); +void brw_disk_cache_init(struct intel_screen *screen); bool brw_disk_cache_upload_program(struct brw_context *brw, gl_shader_stage stage); void brw_disk_cache_write_compute_program(struct brw_context *brw); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index a4e34e9f2cf..e1e520bc899 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -41,6 +41,7 @@ #include "compiler/nir/nir.h" #include "utils.h" +#include "util/disk_cache.h" #include "util/xmlpool.h" static const __DRIconfigOptionsExtension brw_config_options = { @@ -1572,6 +1573,8 @@ intelDestroyScreen(__DRIscreen * sPriv) brw_bufmgr_destroy(screen->bufmgr); driDestroyOptionInfo(&screen->optionCache); + disk_cache_destroy(screen->disk_cache); + ralloc_free(screen); sPriv->driverPrivate = NULL; } @@ -2683,6 +2686,8 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen) } } + brw_disk_cache_init(screen); + return (const __DRIconfig**) intel_screen_make_configs(dri_screen); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h index 7948617b7f0..ef2d08974ed 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.h +++ b/src/mesa/drivers/dri/i965/intel_screen.h @@ -117,6 +117,8 @@ struct intel_screen bool mesa_format_supports_texture[MESA_FORMAT_COUNT]; bool mesa_format_supports_render[MESA_FORMAT_COUNT]; enum isl_format mesa_to_isl_render_format[MESA_FORMAT_COUNT]; + + struct disk_cache *disk_cache; }; extern void intelDestroyContext(__DRIcontext * driContextPriv);