Mesa (master): zink: return true from program ref functions upon free
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Mar 15 16:25:37 UTC 2021
Module: Mesa
Branch: master
Commit: ddb807e5c94faed8122a371aba0052136ed7bdf7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddb807e5c94faed8122a371aba0052136ed7bdf7
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Dec 14 13:41:23 2020 -0500
zink: return true from program ref functions upon free
this lets us unset the context pointer accurately
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9470>
---
src/gallium/drivers/zink/zink_program.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h
index 6b4c5e749bb..5d7a31688c1 100644
--- a/src/gallium/drivers/zink/zink_program.h
+++ b/src/gallium/drivers/zink/zink_program.h
@@ -163,17 +163,21 @@ zink_program_get_descriptor_usage(struct zink_context *ctx, enum pipe_shader_typ
void
debug_describe_zink_gfx_program(char* buf, const struct zink_gfx_program *ptr);
-static inline void
+static inline bool
zink_gfx_program_reference(struct zink_screen *screen,
struct zink_gfx_program **dst,
struct zink_gfx_program *src)
{
struct zink_gfx_program *old_dst = dst ? *dst : NULL;
+ bool ret = false;
if (pipe_reference_described(old_dst ? &old_dst->base.reference : NULL, &src->base.reference,
- (debug_reference_descriptor)debug_describe_zink_gfx_program))
+ (debug_reference_descriptor)debug_describe_zink_gfx_program)) {
zink_destroy_gfx_program(screen, old_dst);
+ ret = true;
+ }
if (dst) *dst = src;
+ return ret;
}
struct zink_compute_program *
@@ -185,17 +189,21 @@ zink_destroy_compute_program(struct zink_screen *screen,
void
debug_describe_zink_compute_program(char* buf, const struct zink_compute_program *ptr);
-static inline void
+static inline bool
zink_compute_program_reference(struct zink_screen *screen,
struct zink_compute_program **dst,
struct zink_compute_program *src)
{
struct zink_compute_program *old_dst = dst ? *dst : NULL;
+ bool ret = false;
if (pipe_reference_described(old_dst ? &old_dst->base.reference : NULL, &src->base.reference,
- (debug_reference_descriptor)debug_describe_zink_compute_program))
+ (debug_reference_descriptor)debug_describe_zink_compute_program)) {
zink_destroy_compute_program(screen, old_dst);
+ ret = true;
+ }
if (dst) *dst = src;
+ return ret;
}
void
More information about the mesa-commit
mailing list