summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-01-08 11:12:05 -0500
committerMarek Olšák <[email protected]>2019-01-09 11:08:44 -0500
commite986c1ca1d61bd7492936f43e45996cd4f8bdb61 (patch)
tree4b18c8901de891ce4b4238dd7f9fe123c52d0226 /src/gallium/auxiliary
parentfd82a1d1d6be1a3636ca5d8d952ae29fa260abc8 (diff)
st/mesa: don't leak pipe_surface if pipe_context is not current
We have found some pipe_surface leaks internally. This is the same code as surface_destroy in radeonsi. Ideally, surface_destroy would be in pipe_screen. Cc: 18.3 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index b06fb111709..fa1e920b509 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -155,6 +155,25 @@ pipe_resource_reference(struct pipe_resource **dst, struct pipe_resource *src)
}
/**
+ * Same as pipe_surface_release, but used when pipe_context doesn't exist
+ * anymore.
+ */
+static inline void
+pipe_surface_release_no_context(struct pipe_surface **ptr)
+{
+ struct pipe_surface *surf = *ptr;
+
+ if (pipe_reference_described(&surf->reference, NULL,
+ (debug_reference_descriptor)
+ debug_describe_surface)) {
+ /* trivially destroy pipe_surface */
+ pipe_resource_reference(&surf->texture, NULL);
+ free(surf);
+ }
+ *ptr = NULL;
+}
+
+/**
* Set *dst to \p src with proper reference counting.
*
* The caller must guarantee that \p src and *dst were created in