Mesa (master): freedreno: Skip some batch dependency tracking if !ctx->dirty.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 25 23:18:24 UTC 2021
Module: Mesa
Branch: master
Commit: aa1ddb6fe3c364c4f10df29bb42a0cf09d4cdabe
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa1ddb6fe3c364c4f10df29bb42a0cf09d4cdabe
Author: Eric Anholt <eric at anholt.net>
Date: Wed Jan 20 14:20:46 2021 -0800
freedreno: Skip some batch dependency tracking if !ctx->dirty.
drawoverhead test 1 perf 4.37618% +/- 0.933261% (n=57)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8602>
---
src/gallium/drivers/freedreno/freedreno_draw.c | 61 +++++++++++++++-----------
1 file changed, 35 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 01e07d899d2..25f62334c3b 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -59,24 +59,12 @@ resource_written(struct fd_batch *batch, struct pipe_resource *prsc)
}
static void
-batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
- const struct pipe_draw_indirect_info *indirect)
+batch_draw_tracking_for_dirty_bits(struct fd_batch *batch)
{
struct fd_context *ctx = batch->ctx;
struct pipe_framebuffer_state *pfb = &batch->framebuffer;
unsigned buffers = 0, restore_buffers = 0;
- /* NOTE: needs to be before resource_written(batch->query_buf), otherwise
- * query_buf may not be created yet.
- */
- fd_batch_set_stage(batch, FD_STAGE_DRAW);
-
- /*
- * Figure out the buffers/features we need:
- */
-
- fd_screen_lock(ctx->screen);
-
if (ctx->dirty & (FD_DIRTY_FRAMEBUFFER | FD_DIRTY_ZSA)) {
if (fd_depth_enabled(ctx)) {
if (fd_resource(pfb->zsbuf->texture)->valid) {
@@ -176,14 +164,6 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
}
}
- /* Mark index buffer as being read */
- if (info->index_size)
- resource_read(batch, info->index.resource);
-
- /* Mark indirect draw buffer as being read */
- if (indirect && indirect->buffer)
- resource_read(batch, indirect->buffer);
-
/* Mark textures as being read */
if (ctx->dirty_shader[PIPE_SHADER_VERTEX] & FD_DIRTY_SHADER_TEX) {
foreach_bit (i, ctx->tex[PIPE_SHADER_VERTEX].valid_textures)
@@ -202,17 +182,46 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
resource_written(batch, ctx->streamout.targets[i]->buffer);
}
+ /* any buffers that haven't been cleared yet, we need to restore: */
+ batch->restore |= restore_buffers & (FD_BUFFER_ALL & ~batch->invalidated);
+ /* and any buffers used, need to be resolved: */
+ batch->resolve |= buffers;
+}
+
+static void
+batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
+ const struct pipe_draw_indirect_info *indirect)
+{
+ struct fd_context *ctx = batch->ctx;
+
+ /* NOTE: needs to be before resource_written(batch->query_buf), otherwise
+ * query_buf may not be created yet.
+ */
+ fd_batch_set_stage(batch, FD_STAGE_DRAW);
+
+ /*
+ * Figure out the buffers/features we need:
+ */
+
+ fd_screen_lock(ctx->screen);
+
+ if (ctx->dirty)
+ batch_draw_tracking_for_dirty_bits(batch);
+
+ /* Mark index buffer as being read */
+ if (info->index_size)
+ resource_read(batch, info->index.resource);
+
+ /* Mark indirect draw buffer as being read */
+ if (indirect && indirect->buffer)
+ resource_read(batch, indirect->buffer);
+
resource_written(batch, batch->query_buf);
list_for_each_entry(struct fd_acc_query, aq, &ctx->acc_active_queries, node)
resource_written(batch, aq->prsc);
fd_screen_unlock(ctx->screen);
-
- /* any buffers that haven't been cleared yet, we need to restore: */
- batch->restore |= restore_buffers & (FD_BUFFER_ALL & ~batch->invalidated);
- /* and any buffers used, need to be resolved: */
- batch->resolve |= buffers;
}
static void
More information about the mesa-commit
mailing list