Mesa (master): iris: Defer stream output target space allocation until set time

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 4 22:48:15 UTC 2021


Module: Mesa
Branch: master
Commit: e40fafa991755c22ab82db472acb76d0a9b48c41
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e40fafa991755c22ab82db472acb76d0a9b48c41

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Feb  1 05:12:30 2021 -0800

iris: Defer stream output target space allocation until set time

In the future, Marek is planning to make u_threaded_context call
create_stream_output_target() from a different thread than the main
driver thread, which means that we can't safely use uploaders there.

To prepare for this eventual future, just defer the allocation of
the offset BO 'til later.  It's a very small amount of overhead.

Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8964>

---

 src/gallium/drivers/iris/iris_state.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index fd621d95227..83d06e97b89 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -3709,8 +3709,6 @@ iris_create_stream_output_target(struct pipe_context *ctx,
    util_range_add(&res->base, &res->valid_buffer_range, buffer_offset,
                   buffer_offset + buffer_size);
 
-   upload_state(ctx->stream_uploader, &cso->offset, sizeof(uint32_t), 4);
-
    return &cso->base;
 }
 
@@ -3800,6 +3798,9 @@ iris_set_stream_output_targets(struct pipe_context *ctx,
          continue;
       }
 
+      if (!tgt->offset.res)
+         upload_state(ctx->stream_uploader, &tgt->offset, sizeof(uint32_t), 4);
+
       struct iris_resource *res = (void *) tgt->base.buffer;
 
       /* Note that offsets[i] will either be 0, causing us to zero



More information about the mesa-commit mailing list