From: Yevhenii Kolesnikov Date: Thu, 1 Aug 2019 11:11:44 +0000 (+0300) Subject: mesa: use _mesa_delete_query in drivers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f767ded6effc60f7542089f368614f3d51bbba5;p=mesa.git mesa: use _mesa_delete_query in drivers Now drivers can call _mesa_delete_query once driver-specific clean-up has been done. Brings into conformity with how other GL objects are handled. CC: Eric Anholt CC: Kenneth Graunke Suggested-by: Eric Anholt Signed-off-by: Yevhenii Kolesnikov Reviewed-by: Eric Anholt Reviewed-by: Lionel Landwerlin --- diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index c6bd57130de..c48f8539275 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -36,6 +36,7 @@ * needs. */ #include "main/imports.h" +#include "main/queryobj.h" #include "brw_context.h" #include "brw_defines.h" @@ -239,8 +240,7 @@ brw_delete_query(struct gl_context *ctx, struct gl_query_object *q) struct brw_query_object *query = (struct brw_query_object *)q; brw_bo_unreference(query->bo); - free(query->Base.Label); - free(query); + _mesa_delete_query(ctx, q); } /** diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index baf7081994c..c75c1e03a4a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -29,6 +29,7 @@ #include "radeon_debug.h" #include "main/imports.h" +#include "main/queryobj.h" #include @@ -80,7 +81,7 @@ static void radeonDeleteQuery(struct gl_context *ctx, struct gl_query_object *q) radeon_bo_unref(query->bo); } - free(query); + _mesa_delete_query(ctx, q); } static void radeonWaitQuery(struct gl_context *ctx, struct gl_query_object *q) diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 67d1f76a21a..b2740c5ea75 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -120,10 +120,15 @@ _mesa_check_query(struct gl_context *ctx, struct gl_query_object *q) /** - * Delete a query object. Called via ctx->Driver.DeleteQuery(). + * Delete a query object. Called via ctx->Driver.DeleteQuery(), if not + * overwritten by driver. In the latter case, called from the driver + * after all driver-specific clean-up has been done. * Not removed from hash table here. + * + * \param ctx GL context to wich query object belongs. + * \param q query object due to be deleted. */ -static void +void _mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q) { free(q->Label); diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index 24a82571db0..ba8336b525a 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -48,6 +48,9 @@ _mesa_init_queryobj(struct gl_context *ctx); extern void _mesa_free_queryobj_data(struct gl_context *ctx); +extern void +_mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q); + void GLAPIENTRY _mesa_GenQueries(GLsizei n, GLuint *ids); void GLAPIENTRY diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 9694876cd64..14de2431d64 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -36,6 +36,7 @@ #include "main/imports.h" #include "main/compiler.h" #include "main/context.h" +#include "main/queryobj.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -86,8 +87,7 @@ st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q) free_queries(pipe, stq); - free(q->Label); - free(stq); + _mesa_delete_query(ctx, q); } static int