mesa: avoid triggering assert in implementation
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 16 Dec 2019 15:58:41 +0000 (17:58 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Dec 2019 12:52:04 +0000 (12:52 +0000)
When tearing down a GL context with an active performance query, the
implementation can be confused by a query marked active when it's
being deleted.

This shouldn't happen in the implementation because the context will
already be idle.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2235
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3115>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3115>

src/mesa/main/performance_query.c

index b9e7cf9961b5b362f934dbd728886ecd0798b800..1eaf0bb1a769f21e53577ac4ffaccf30cd3bd82b 100644 (file)
@@ -48,6 +48,12 @@ free_performance_query(GLuint key, void *data, void *user)
    struct gl_perf_query_object *m = data;
    struct gl_context *ctx = user;
 
+   /* Don't confuse the implementation by deleting an active query. We can
+    * toggle Active/Used to false because we're tearing down the GL context
+    * and it's already idle (see _mesa_free_context_data).
+    */
+   m->Active = false;
+   m->Used = false;
    ctx->Driver.DeletePerfQuery(ctx, m);
 }