From: Marek Olšák <marek.ol...@amd.com> +1.2% performance with: piglit/drawoverhead - DrawElements (no state changes) on radeonsi
Tested-by: Dieter Nützel <die...@nuetzel-hh.de> --- src/gallium/auxiliary/util/u_inlines.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 6e149a31926..83013df53f1 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -102,50 +102,52 @@ pipe_reference(struct pipe_reference *dst, struct pipe_reference *src) return pipe_reference_described(dst, src, (debug_reference_descriptor) debug_describe_reference); } static inline void pipe_surface_reference(struct pipe_surface **dst, struct pipe_surface *src) { struct pipe_surface *old_dst = *dst; - if (pipe_reference_described(&(*dst)->reference, &src->reference, + if (pipe_reference_described(&old_dst->reference, &src->reference, (debug_reference_descriptor) debug_describe_surface)) old_dst->context->surface_destroy(old_dst->context, old_dst); *dst = src; } /** * Similar to pipe_surface_reference() but always set the pointer to NULL * and pass in an explicit context. The explicit context avoids the problem * of using a deleted context's surface_destroy() method when freeing a surface * that's shared by multiple contexts. */ static inline void pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **ptr) { - if (pipe_reference_described(&(*ptr)->reference, NULL, + struct pipe_surface *old = *ptr; + + if (pipe_reference_described(&old->reference, NULL, (debug_reference_descriptor) debug_describe_surface)) - pipe->surface_destroy(pipe, *ptr); + pipe->surface_destroy(pipe, old); *ptr = NULL; } static inline void pipe_resource_reference(struct pipe_resource **dst, struct pipe_resource *src) { struct pipe_resource *old_dst = *dst; - if (pipe_reference_described(&(*dst)->reference, &src->reference, + if (pipe_reference_described(&old_dst->reference, &src->reference, (debug_reference_descriptor) debug_describe_resource)) { /* Avoid recursion, which would prevent inlining this function */ do { struct pipe_resource *next = old_dst->next; old_dst->screen->resource_destroy(old_dst->screen, old_dst); old_dst = next; } while (pipe_reference_described(&old_dst->reference, NULL, (debug_reference_descriptor) @@ -159,53 +161,54 @@ pipe_resource_reference(struct pipe_resource **dst, struct pipe_resource *src) * * The caller must guarantee that \p src and *dst were created in * the same context (if they exist), and that this must be the current context. */ static inline void pipe_sampler_view_reference(struct pipe_sampler_view **dst, struct pipe_sampler_view *src) { struct pipe_sampler_view *old_dst = *dst; - if (pipe_reference_described(&(*dst)->reference, &src->reference, + if (pipe_reference_described(&old_dst->reference, &src->reference, (debug_reference_descriptor) debug_describe_sampler_view)) old_dst->context->sampler_view_destroy(old_dst->context, old_dst); *dst = src; } /** * Similar to pipe_sampler_view_reference() but always set the pointer to * NULL and pass in the current context explicitly. * * If *ptr is non-NULL, it may refer to a view that was created in a different * context (however, that context must still be alive). */ static inline void pipe_sampler_view_release(struct pipe_context *ctx, struct pipe_sampler_view **ptr) { struct pipe_sampler_view *old_view = *ptr; - if (pipe_reference_described(&(*ptr)->reference, NULL, + + if (pipe_reference_described(&old_view->reference, NULL, (debug_reference_descriptor)debug_describe_sampler_view)) { ctx->sampler_view_destroy(ctx, old_view); } *ptr = NULL; } static inline void pipe_so_target_reference(struct pipe_stream_output_target **dst, struct pipe_stream_output_target *src) { struct pipe_stream_output_target *old_dst = *dst; - if (pipe_reference_described(&(*dst)->reference, &src->reference, + if (pipe_reference_described(&old_dst->reference, &src->reference, (debug_reference_descriptor)debug_describe_so_target)) old_dst->context->stream_output_target_destroy(old_dst->context, old_dst); *dst = src; } static inline void pipe_vertex_buffer_unreference(struct pipe_vertex_buffer *dst) { if (dst->is_user_buffer) dst->buffer.user = NULL; -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev