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>
This commit is contained in:
Eric Anholt 2020-05-12 09:39:20 -07:00 committed by Marge Bot
parent 356f99161d
commit a663c595bc
1 changed files with 5 additions and 0 deletions

View File

@ -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);