Mesa (main): zink: count streamout rebinds when doing buffer rebinds

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 14:36:55 UTC 2021


Module: Mesa
Branch: main
Commit: 1e362da3dff140a56c060f32c79bf065508334d3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e362da3dff140a56c060f32c79bf065508334d3

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Jun  3 15:31:48 2021 -0400

zink: count streamout rebinds when doing buffer rebinds

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12425>

---

 src/gallium/drivers/zink/zink_context.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 9033f31db4d..754757f18b3 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3229,6 +3229,18 @@ rebind_buffer(struct zink_context *ctx, struct zink_resource *res)
    unsigned num_rebinds = 0, num_image_rebinds_remaining[2] = {res->image_bind_count[0], res->image_bind_count[1]};
    bool has_write = false;
 
+   if (res->so_bind_count && ctx->num_so_targets) {
+      for (unsigned i = 0; i < ctx->num_so_targets; i++) {
+         if (ctx->so_targets[i]) {
+            struct zink_resource *so = zink_resource(ctx->so_targets[i]->buffer);
+            if (so && so == res) {
+               ctx->dirty_so_targets = true;
+               num_rebinds++;
+            }
+         }
+      }
+   }
+
    if (res->vbo_bind_mask) {
       u_foreach_bit(slot, res->vbo_bind_mask) {
          if (ctx->vertex_buffers[slot].buffer.resource != &res->base.b) //wrong context
@@ -3337,11 +3349,8 @@ rebind_image(struct zink_context *ctx, struct zink_resource *res)
 void
 zink_resource_rebind(struct zink_context *ctx, struct zink_resource *res)
 {
-   if (res->bind_history & ZINK_RESOURCE_USAGE_STREAMOUT)
-      ctx->dirty_so_targets = true;
    /* force counter buffer reset */
    res->bind_history &= ~ZINK_RESOURCE_USAGE_STREAMOUT;
-
    if (!res->bind_count[0] && !res->bind_count[1])
       return;
    if (res->base.b.target == PIPE_BUFFER)



More information about the mesa-commit mailing list