zink: collapse a conditional in zink_batch_resource_usage_set()
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 7 Jul 2021 13:33:16 +0000 (09:33 -0400)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 26 Jul 2021 23:48:07 +0000 (19:48 -0400)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12008>

src/gallium/drivers/zink/zink_batch.c

index 026f00f..9e13264 100644 (file)
@@ -584,13 +584,9 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
 void
 zink_batch_resource_usage_set(struct zink_batch *batch, struct zink_resource *res, bool write)
 {
-   if (write) {
-      zink_batch_usage_set(&res->obj->writes, batch->state);
-      if (res->scanout_obj)
-         batch->state->scanout_flush = true;
-   } else {
-      zink_batch_usage_set(&res->obj->reads, batch->state);
-   }
+   zink_resource_usage_set(res, batch->state, write);
+   if (write && res->scanout_obj)
+      batch->state->scanout_flush = true;
    /* multiple array entries are fine */
    if (!res->obj->coherent && res->obj->persistent_maps)
       util_dynarray_append(&batch->state->persistent_resources, struct zink_resource_object*, res->obj);