Mesa (main): zink: make batch_usage_unset take a batch state param

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 16 02:58:41 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri May  7 08:21:02 2021 -0400

zink: make batch_usage_unset take a batch state param

no functional changes

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

---

 src/gallium/drivers/zink/zink_batch.c       | 4 ++--
 src/gallium/drivers/zink/zink_batch.h       | 4 ++--
 src/gallium/drivers/zink/zink_descriptors.c | 2 +-
 src/gallium/drivers/zink/zink_fence.c       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index 9bc85fbb123..16ab2444aee 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -42,12 +42,12 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs)
 
    set_foreach_remove(bs->surfaces, entry) {
       struct zink_surface *surf = (struct zink_surface *)entry->key;
-      zink_batch_usage_unset(&surf->batch_uses, bs->fence.batch_id);
+      zink_batch_usage_unset(&surf->batch_uses, bs);
       zink_surface_reference(screen, &surf, NULL);
    }
    set_foreach_remove(bs->bufferviews, entry) {
       struct zink_buffer_view *buffer_view = (struct zink_buffer_view *)entry->key;
-      zink_batch_usage_unset(&buffer_view->batch_uses, bs->fence.batch_id);
+      zink_batch_usage_unset(&buffer_view->batch_uses, bs);
       zink_buffer_view_reference(screen, &buffer_view, NULL);
    }
 
diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h
index b1e913c67eb..559931835c2 100644
--- a/src/gallium/drivers/zink/zink_batch.h
+++ b/src/gallium/drivers/zink/zink_batch.h
@@ -175,9 +175,9 @@ zink_batch_state_reference(struct zink_screen *screen,
 }
 
 static inline void
-zink_batch_usage_unset(struct zink_batch_usage *u, uint32_t batch_id)
+zink_batch_usage_unset(struct zink_batch_usage *u, struct zink_batch_state *bs)
 {
-   p_atomic_cmpxchg(&u->usage, batch_id, 0);
+   p_atomic_cmpxchg(&u->usage, bs->fence.batch_id, 0);
 }
 
 static inline void
diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c
index 7f8e5ce054c..4009cf2636b 100644
--- a/src/gallium/drivers/zink/zink_descriptors.c
+++ b/src/gallium/drivers/zink/zink_descriptors.c
@@ -1387,7 +1387,7 @@ zink_batch_descriptor_reset(struct zink_screen *screen, struct zink_batch_state
 {
    set_foreach(bs->dd->desc_sets, entry) {
       struct zink_descriptor_set *zds = (void*)entry->key;
-      zink_batch_usage_unset(&zds->batch_uses, bs->fence.batch_id);
+      zink_batch_usage_unset(&zds->batch_uses, bs);
       /* reset descriptor pools when no bs is using this program to avoid
        * having some inactive program hogging a billion descriptors
        */
diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c
index 7f96068beec..aeddfae8e31 100644
--- a/src/gallium/drivers/zink/zink_fence.c
+++ b/src/gallium/drivers/zink/zink_fence.c
@@ -39,8 +39,8 @@ zink_fence_clear_resources(struct zink_screen *screen, struct zink_fence *fence)
    /* unref all used resources */
    set_foreach_remove(fence->resources, entry) {
       struct zink_resource_object *obj = (struct zink_resource_object *)entry->key;
-      zink_batch_usage_unset(&obj->reads, fence->batch_id);
-      zink_batch_usage_unset(&obj->writes, fence->batch_id);
+      zink_batch_usage_unset(&obj->reads, zink_batch_state(fence));
+      zink_batch_usage_unset(&obj->writes, zink_batch_state(fence));
       zink_resource_object_reference(screen, &obj, NULL);
    }
    simple_mtx_unlock(&fence->resource_mtx);



More information about the mesa-commit mailing list