mesa: use _mesa_delete_query in drivers
authorYevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Thu, 1 Aug 2019 11:11:44 +0000 (14:11 +0300)
committerEric Anholt <eric@anholt.net>
Wed, 7 Aug 2019 17:25:22 +0000 (17:25 +0000)
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 <eric@anholt.net>
CC: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/mesa/drivers/dri/i965/brw_queryobj.c
src/mesa/drivers/dri/radeon/radeon_queryobj.c
src/mesa/main/queryobj.c
src/mesa/main/queryobj.h
src/mesa/state_tracker/st_cb_queryobj.c

index c6bd57130deebeed9e57500e2bbb5315fef99dc7..c48f85392759dec332b31a3499659e287df11b18 100644 (file)
@@ -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);
 }
 
 /**
index baf7081994c78f2d8f0ecf8beb877fe9e806fe29..c75c1e03a4aacd5749be940972d8efc6beb65b8c 100644 (file)
@@ -29,6 +29,7 @@
 #include "radeon_debug.h"
 
 #include "main/imports.h"
+#include "main/queryobj.h"
 
 #include <inttypes.h>
 
@@ -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)
index 67d1f76a21a28d550dda3bad911ccc4b08182da0..b2740c5ea754e0970193566fb8073259341377b4 100644 (file)
@@ -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);
index 24a82571db04ef3ba4d3bb4598b43acc45bca3ad..ba8336b525a49473a5cfc93532df0eab1fc68a31 100644 (file)
@@ -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
index 9694876cd646aa85a692e92f2694fc4a09a76768..14de2431d64fc2eaf72a8f4d2e5a8198ed81adce 100644 (file)
@@ -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