aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2020-05-11 15:08:35 -0700
committerMarge Bot <[email protected]>2020-05-12 21:19:50 +0000
commit356f99161df36223091cf9721dd49e52cb9e5e3e (patch)
tree002116af825194e038c10c3d3ec50a5fa28861dd /src
parentd393837332a07f53b9622ca55149e63947e0f937 (diff)
freedreno: Move the resource_read early out to an inline.
Looking at perf, the drawoverhead test case was now spending 13% CPU (89% in that function) on stack management. nohw drawoverhead throughput 1.03902% +/- 0.380257% (n=13). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4996>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_batch.c15
-rw-r--r--src/gallium/drivers/freedreno/freedreno_batch.h2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.h18
3 files changed, 20 insertions, 15 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c
index 3ee150fce75..288f3307ad3 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch.c
@@ -392,12 +392,6 @@ flush_write_batch(struct fd_resource *rsc)
fd_batch_reference_locked(&b, NULL);
}
-static bool
-fd_batch_references_resource(struct fd_batch *batch, struct fd_resource *rsc)
-{
- return rsc->batch_mask & (1 << batch->idx);
-}
-
static void
fd_batch_add_resource(struct fd_batch *batch, struct fd_resource *rsc)
{
@@ -456,17 +450,10 @@ fd_batch_resource_write(struct fd_batch *batch, struct fd_resource *rsc)
}
void
-fd_batch_resource_read(struct fd_batch *batch, struct fd_resource *rsc)
+fd_batch_resource_read_slowpath(struct fd_batch *batch, struct fd_resource *rsc)
{
fd_screen_assert_locked(batch->ctx->screen);
- /* Early out, if we hit this then we know we don't have anyone else
- * writing to it (since both _write and _read flush other writers), and
- * that we've already recursed for stencil.
- */
- if (likely(fd_batch_references_resource(batch, rsc)))
- return;
-
if (rsc->stencil)
fd_batch_resource_read(batch, rsc->stencil);
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h
index 8ec3700b7ad..6a48c3435ac 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.h
+++ b/src/gallium/drivers/freedreno/freedreno_batch.h
@@ -257,7 +257,7 @@ void fd_batch_reset(struct fd_batch *batch);
void fd_batch_flush(struct fd_batch *batch);
void fd_batch_add_dep(struct fd_batch *batch, struct fd_batch *dep);
void fd_batch_resource_write(struct fd_batch *batch, struct fd_resource *rsc);
-void fd_batch_resource_read(struct fd_batch *batch, struct fd_resource *rsc);
+void fd_batch_resource_read_slowpath(struct fd_batch *batch, struct fd_resource *rsc);
void fd_batch_check_size(struct fd_batch *batch);
/* not called directly: */
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h
index d1c673996cc..b60b6ee6a30 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.h
+++ b/src/gallium/drivers/freedreno/freedreno_resource.h
@@ -240,4 +240,22 @@ void fd_resource_uncompress(struct fd_context *ctx, struct fd_resource *rsc);
bool fd_render_condition_check(struct pipe_context *pctx);
+static inline bool
+fd_batch_references_resource(struct fd_batch *batch, struct fd_resource *rsc)
+{
+ return rsc->batch_mask & (1 << batch->idx);
+}
+
+static inline void
+fd_batch_resource_read(struct fd_batch *batch,
+ struct fd_resource *rsc)
+{
+ /* Fast path: if we hit this then we know we don't have anyone else
+ * writing to it (since both _write and _read flush other writers), and
+ * that we've already recursed for stencil.
+ */
+ if (unlikely(!fd_batch_references_resource(batch, rsc)))
+ fd_batch_resource_read_slowpath(batch, rsc);
+}
+
#endif /* FREEDRENO_RESOURCE_H_ */