summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-09-01 01:22:08 -0400
committerMarek Olšák <[email protected]>2018-09-10 14:53:01 -0400
commited880fe192d138c6b1115b22c306e7be9646d4a0 (patch)
tree60faeada03ae5c13bd251430d8f03df71298f0b9 /src/gallium
parentc042a34b147f382cc4981345acf7bbaf36e8e620 (diff)
gallium/u_inlines: improve pipe_reference_described perf for debug builds
Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 83013df53f1..820d3080a5c 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -79,14 +79,15 @@ pipe_reference_described(struct pipe_reference *dst,
if (dst != src) {
/* bump the src.count first */
if (src) {
- assert(pipe_is_referenced(src));
- p_atomic_inc(&src->count);
+ MAYBE_UNUSED int count = p_atomic_inc_return(&src->count);
+ assert(count != 1); /* src had to be referenced */
debug_reference(src, get_desc, 1);
}
if (dst) {
- assert(pipe_is_referenced(dst));
- if (p_atomic_dec_zero(&dst->count))
+ int count = p_atomic_dec_return(&dst->count);
+ assert(count != -1); /* dst had to be referenced */
+ if (!count)
destroy = TRUE;
debug_reference(dst, get_desc, -1);