From f59da830852ef8a3955fe0d1a0626af92ca4db66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 30 Jul 2019 13:10:11 +0300 Subject: [PATCH] st/mesa/radeonsi: move glsl_type dtor back to atexit WIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes some changes of commit a6b7068ff5f and 624789e3708 in hope to avoid problems spotted within vk-gl-cts. WIP is there because I'm not 100% convinced this makes sense. Signed-off-by: Tapani Pälli --- src/mesa/drivers/dri/i915/intel_context.c | 2 +- src/mesa/drivers/dri/i965/brw_context.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_common_context.c | 2 +- src/mesa/drivers/osmesa/osmesa.c | 2 +- src/mesa/drivers/x11/xm_api.c | 2 +- src/mesa/main/context.c | 12 +++++------- src/mesa/main/context.h | 2 +- src/mesa/state_tracker/st_context.c | 7 +------ 9 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index aa3175816cf..c23e5ffb26e 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -599,7 +599,7 @@ intelDestroyContext(__DRIcontext * driContextPriv) driDestroyOptionCache(&intel->optionCache); /* free the Mesa context */ - _mesa_free_context_data(&intel->ctx, true); + _mesa_free_context_data(&intel->ctx); _math_matrix_dtr(&intel->ViewportMatrix); diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 3783d1532e9..5cf5aa3aea1 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1228,7 +1228,7 @@ intelDestroyContext(__DRIcontext * driContextPriv) driDestroyOptionCache(&brw->optionCache); /* free the Mesa context */ - _mesa_free_context_data(&brw->ctx, true); + _mesa_free_context_data(&brw->ctx); ralloc_free(brw); driContextPriv->driverPrivate = NULL; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 8fec35237c0..93f6ce473a1 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -217,7 +217,7 @@ nouveau_context_deinit(struct gl_context *ctx) nouveau_object_del(&nctx->hw.chan); nouveau_scratch_destroy(ctx); - _mesa_free_context_data(ctx, true); + _mesa_free_context_data(ctx); } void diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 689304aa4fc..47719baa575 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -270,7 +270,7 @@ void radeonDestroyContext(__DRIcontext *driContextPriv ) /* free atom list */ /* free the Mesa context data */ - _mesa_free_context_data(&radeon->glCtx, true); + _mesa_free_context_data(&radeon->glCtx); /* free the option cache */ driDestroyOptionCache(&radeon->optionCache); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index a065161b89e..0011f57177d 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -854,7 +854,7 @@ OSMesaCreateContextAttribs(const int *attribList, OSMesaContext sharelist) osmesa->gl_buffer = _mesa_create_framebuffer(osmesa->gl_visual); if (!osmesa->gl_buffer) { _mesa_destroy_visual( osmesa->gl_visual ); - _mesa_free_context_data(&osmesa->mesa, true); + _mesa_free_context_data(&osmesa->mesa); free(osmesa); return NULL; } diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 90f89a36221..b2a6096b0c7 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -945,7 +945,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) !_vbo_CreateContext( mesaCtx ) || !_tnl_CreateContext( mesaCtx ) || !_swsetup_CreateContext( mesaCtx )) { - _mesa_free_context_data(&c->mesa, true); + _mesa_free_context_data(&c->mesa); free(c); return NULL; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 6e11f88cf1b..1ec114a0e84 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -361,6 +361,7 @@ static void one_time_fini(void) { _mesa_destroy_shader_compiler(); + _mesa_destroy_shader_compiler_types(); _mesa_locale_fini(); } @@ -408,6 +409,8 @@ one_time_init( struct gl_context *ctx ) _mesa_debug(ctx, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n"); } #endif + + _mesa_init_shader_compiler_types(); } /* per-API one-time init */ @@ -1205,8 +1208,6 @@ _mesa_initialize_context(struct gl_context *ctx, /* misc one-time initializations */ one_time_init(ctx); - _mesa_init_shader_compiler_types(); - /* Plug in driver functions and context pointer here. * This is important because when we call alloc_shared_state() below * we'll call ctx->Driver.NewTextureObject() to create the default @@ -1319,7 +1320,7 @@ fail: * \sa _mesa_initialize_context() and init_attrib_groups(). */ void -_mesa_free_context_data(struct gl_context *ctx, bool destroy_compiler_types) +_mesa_free_context_data(struct gl_context *ctx) { if (!_mesa_get_current_context()){ /* No current context, but we may need one in order to delete @@ -1394,9 +1395,6 @@ _mesa_free_context_data(struct gl_context *ctx, bool destroy_compiler_types) free(ctx->VersionString); - if (destroy_compiler_types) - _mesa_destroy_shader_compiler_types(); - ralloc_free(ctx->SoftFP64); /* unbind the context if it's currently bound */ @@ -1419,7 +1417,7 @@ void _mesa_destroy_context( struct gl_context *ctx ) { if (ctx) { - _mesa_free_context_data(ctx, true); + _mesa_free_context_data(ctx); free( (void *) ctx ); } } diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index e9b270df14c..58123155002 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -115,7 +115,7 @@ _mesa_initialize_context( struct gl_context *ctx, const struct dd_function_table *driverFunctions); extern void -_mesa_free_context_data(struct gl_context *ctx, bool destroy_compiler_types); +_mesa_free_context_data(struct gl_context *ctx); extern void _mesa_destroy_context( struct gl_context *ctx ); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index fada76437b2..3ed0dfe043d 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -1002,18 +1002,13 @@ st_destroy_context(struct st_context *st) st_destroy_program_variants(st); - _mesa_free_context_data(ctx, false); + _mesa_free_context_data(ctx); /* This will free the st_context too, so 'st' must not be accessed * afterwards. */ st_destroy_context_priv(st, true); st = NULL; - /* This must be called after st_destroy_context_priv() to avoid a race - * condition between any shader compiler threads and context destruction. - */ - _mesa_destroy_shader_compiler_types(); - free(ctx); if (save_ctx == ctx) { -- 2.20.1