freedreno: avoid unneccessary batch flush
authorRob Clark <robdclark@gmail.com>
Sun, 19 Nov 2017 21:45:04 +0000 (16:45 -0500)
committerRob Clark <robdclark@gmail.com>
Sun, 3 Dec 2017 19:17:41 +0000 (14:17 -0500)
In some cases we can end up trying to add a write dependency on ourself,
which shouldn't trigger a flush.

Avoids an extra couple flushes per from in stk.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_batch.c

index eff5e8dc359530ad045f1a17f3398a910255a027..9c66dc98bc763f314685c6be36ed392b941f88b5 100644 (file)
@@ -393,6 +393,8 @@ fd_batch_resource_used(struct fd_batch *batch, struct fd_resource *rsc, bool wri
                        struct fd_batch *dep;
                        foreach_batch(dep, cache, rsc->batch_mask) {
                                struct fd_batch *b = NULL;
+                               if (dep == batch)
+                                       continue;
                                /* note that batch_add_dep could flush and unref dep, so
                                 * we need to hold a reference to keep it live for the
                                 * fd_bc_invalidate_batch()