Module: Mesa
Branch: staging/23.3
Commit: 92f39d1cc3a58e755794ac381c668e2689d14d82
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=92f39d1cc3a58e755794ac381c668e2689d14d82

Author: Mike Blumenkrantz <michael.blumenkra...@gmail.com>
Date:   Wed Jan 10 10:27:45 2024 -0500

zink: fix buffer rebind early-out check

this was accidentally inverted; the rebind attempt is over if the
number of enacted rebinds >= the expected rebinds

Fixes: c32bcb9a8c2 ("zink: improve handling of buffer rebinds using tc info")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26959>
(cherry picked from commit 6e4d901a2eeb3ede16fc423c6347fca2442ea811)

---

 .pick_status.json                       |  2 +-
 src/gallium/drivers/zink/zink_context.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 590e516c0a9..63d32d99729 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1394,7 +1394,7 @@
         "description": "zink: fix buffer rebind early-out check",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "c32bcb9a8c2354b0c117d3f209c3d790b81f26be",
         "notes": null
diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index 1a11042c388..04b03b5e9b9 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -4360,7 +4360,7 @@ rebind_buffer(struct zink_context *ctx, struct 
zink_resource *res, uint32_t rebi
       }
       rebind_mask &= ~BITFIELD_BIT(TC_BINDING_STREAMOUT_BUFFER);
    }
-   if (num_rebinds && expected_num_rebinds >= num_rebinds && !rebind_mask)
+   if (expected_num_rebinds && num_rebinds >= expected_num_rebinds && 
!rebind_mask)
       goto end;
 
    if ((rebind_mask & BITFIELD_BIT(TC_BINDING_VERTEX_BUFFER)) || (!rebind_mask 
&& res->vbo_bind_mask)) {
@@ -4375,7 +4375,7 @@ rebind_buffer(struct zink_context *ctx, struct 
zink_resource *res, uint32_t rebi
       rebind_mask &= ~BITFIELD_BIT(TC_BINDING_VERTEX_BUFFER);
       ctx->vertex_buffers_dirty = true;
    }
-   if (num_rebinds && expected_num_rebinds >= num_rebinds && !rebind_mask)
+   if (expected_num_rebinds && num_rebinds >= expected_num_rebinds && 
!rebind_mask)
       goto end;
 
    const uint32_t ubo_mask = rebind_mask ?
@@ -4391,7 +4391,7 @@ rebind_buffer(struct zink_context *ctx, struct 
zink_resource *res, uint32_t rebi
       }
    }
    rebind_mask &= ~BITFIELD_RANGE(TC_BINDING_UBO_VS, MESA_SHADER_STAGES);
-   if (num_rebinds && expected_num_rebinds >= num_rebinds && !rebind_mask)
+   if (expected_num_rebinds && num_rebinds >= expected_num_rebinds && 
!rebind_mask)
       goto end;
 
    const unsigned ssbo_mask = rebind_mask ?
@@ -4408,7 +4408,7 @@ rebind_buffer(struct zink_context *ctx, struct 
zink_resource *res, uint32_t rebi
       }
    }
    rebind_mask &= ~BITFIELD_RANGE(TC_BINDING_SSBO_VS, MESA_SHADER_STAGES);
-   if (num_rebinds && expected_num_rebinds >= num_rebinds && !rebind_mask)
+   if (expected_num_rebinds && num_rebinds >= expected_num_rebinds && 
!rebind_mask)
       goto end;
    const unsigned sampler_mask = rebind_mask ?
                                  rebind_mask & 
BITFIELD_RANGE(TC_BINDING_SAMPLERVIEW_VS, MESA_SHADER_STAGES) :
@@ -4423,7 +4423,7 @@ rebind_buffer(struct zink_context *ctx, struct 
zink_resource *res, uint32_t rebi
       }
    }
    rebind_mask &= ~BITFIELD_RANGE(TC_BINDING_SAMPLERVIEW_VS, 
MESA_SHADER_STAGES);
-   if (num_rebinds && expected_num_rebinds >= num_rebinds && !rebind_mask)
+   if (expected_num_rebinds && num_rebinds >= expected_num_rebinds && 
!rebind_mask)
       goto end;
 
    const unsigned image_mask = rebind_mask ?

Reply via email to