Mesa (main): zink: don't check rebind count outside of buffer/image rebind function

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 26 15:17:50 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Oct 22 14:33:29 2021 -0400

zink: don't check rebind count outside of buffer/image rebind function

zink_resource_has_binds() only checks descriptor binds, and this doesn't
include streamout or fb bindings, so call these functions from the specific
rebind points to ensure those cases are also checked

fixes #5541

cc: mesa-stable

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

---

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

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index b2ecb048f56..7ebd1cc665d 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3768,6 +3768,9 @@ rebind_buffer(struct zink_context *ctx, struct zink_resource *res, uint32_t rebi
    unsigned num_rebinds = 0;
    bool has_write = false;
 
+   if (!zink_resource_has_binds(res))
+      return 0;
+
    assert(!res->bindless[1]); //TODO
    if ((rebind_mask & BITFIELD_BIT(TC_BINDING_STREAMOUT_BUFFER)) || (!rebind_mask && res->so_bind_count && ctx->num_so_targets)) {
       for (unsigned i = 0; i < ctx->num_so_targets; i++) {
@@ -3919,8 +3922,6 @@ rebind_image(struct zink_context *ctx, struct zink_resource *res)
 bool
 zink_resource_rebind(struct zink_context *ctx, struct zink_resource *res)
 {
-   if (!zink_resource_has_binds(res))
-      return 0;
    if (res->base.b.target == PIPE_BUFFER) {
       /* force counter buffer reset */
       res->so_valid = false;



More information about the mesa-commit mailing list