zink: remove unnecessary conditionals in resource batch tracking
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 7 May 2021 12:23:04 +0000 (08:23 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 16 Jun 2021 02:45:45 +0000 (02:45 +0000)
this is no longer an atomic op

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

src/gallium/drivers/zink/zink_batch.c

index 7362a26..8b39e4c 100644 (file)
@@ -566,18 +566,14 @@ zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource
       }
        }
    if (write) {
-      if (res->obj->writes.usage != batch->state->fence.batch_id) {
-         if (stencil)
-            zink_batch_usage_set(&stencil->obj->writes, batch->state->fence.batch_id);
-         zink_batch_usage_set(&res->obj->writes, batch->state->fence.batch_id);
-      }
+      if (stencil)
+         zink_batch_usage_set(&stencil->obj->writes, batch->state->fence.batch_id);
+      zink_batch_usage_set(&res->obj->writes, batch->state->fence.batch_id);
       res->scanout_dirty = !!res->scanout_obj;
    } else {
-      if (res->obj->reads.usage != batch->state->fence.batch_id) {
-         if (stencil)
-            zink_batch_usage_set(&stencil->obj->reads, batch->state->fence.batch_id);
-         zink_batch_usage_set(&res->obj->reads, batch->state->fence.batch_id);
-      }
+      if (stencil)
+         zink_batch_usage_set(&stencil->obj->reads, batch->state->fence.batch_id);
+      zink_batch_usage_set(&res->obj->reads, batch->state->fence.batch_id);
    }
    /* multiple array entries are fine */
    if (res->obj->persistent_maps)