diff options
author | Eric Anholt <[email protected]> | 2020-05-12 09:39:20 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-12 21:42:00 +0000 |
commit | a663c595bc19d627d2fd28081412306b91554d96 (patch) | |
tree | f1b2fb9cd5fecbb7b91fb77edaa0420eba75c155 /src | |
parent | 356f99161df36223091cf9721dd49e52cb9e5e3e (diff) |
freedreno: Skip taking the lock for resource usage if it's already flagged.
Improves nohw drawoverhead 8-ubos update throughput by 13.493% +/-
0.391444% (n=15).
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5011>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h index b60b6ee6a30..f71cd6a8617 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.h +++ b/src/gallium/drivers/freedreno/freedreno_resource.h @@ -145,6 +145,11 @@ fd_resource_set_usage(struct pipe_resource *prsc, enum fd_dirty_3d_state usage) if (!prsc) return; struct fd_resource *rsc = fd_resource(prsc); + /* Bits are only ever ORed in, and we expect many set_usage() per + * resource, so do the quick check outside of the lock. + */ + if (likely(rsc->dirty & usage)) + return; fd_resource_lock(rsc); rsc->dirty |= usage; fd_resource_unlock(rsc); |