zink: only update usage on buffer rebind if rebinds occurred
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 17 Mar 2022 15:29:30 +0000 (11:29 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 18 Mar 2022 12:42:31 +0000 (12:42 +0000)
this is a harmless case, but it's still wrong

cc: mesa-stable

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

src/gallium/drivers/zink/zink_context.c

index c969016..a79ab9d 100644 (file)
@@ -3926,7 +3926,8 @@ rebind_buffer(struct zink_context *ctx, struct zink_resource *res, uint32_t rebi
       }
    }
 end:
-   zink_batch_resource_usage_set(&ctx->batch, res, has_write);
+   if (num_rebinds)
+      zink_batch_resource_usage_set(&ctx->batch, res, has_write);
    return num_rebinds;
 }