zink: move zink_batch_resource_usage_set to be static inline
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 9 Aug 2022 11:44:10 +0000 (07:44 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sat, 20 Aug 2022 01:27:13 +0000 (01:27 +0000)
this has to go in zink_resource.h to avoid infinite include dependency
conflicts

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>

src/gallium/drivers/zink/zink_batch.c
src/gallium/drivers/zink/zink_batch.h
src/gallium/drivers/zink/zink_resource.h

index ede5c23..db3f280 100644 (file)
@@ -521,27 +521,6 @@ 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 (res->obj->dt) {
-      VkSemaphore acquire = zink_kopper_acquire_submit(zink_screen(batch->state->ctx->base.screen), res);
-      if (acquire)
-         util_dynarray_append(&batch->state->acquires, VkSemaphore, acquire);
-   }
-   if (write && !res->obj->is_buffer) {
-      if (!res->valid && res->fb_binds)
-         batch->state->ctx->rp_loadop_changed = true;
-      res->valid = true;
-   }
-   zink_resource_usage_set(res, batch->state, write);
-   /* 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);
-
-   batch->has_work = true;
-}
-
-void
 zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource *res, bool write)
 {
    /* if the resource already has usage of any sort set for this batch, */
index 337cc73..5e515ae 100644 (file)
@@ -69,9 +69,6 @@ void
 zink_batch_add_wait_semaphore(struct zink_batch *batch, VkSemaphore sem);
 
 void
-zink_batch_resource_usage_set(struct zink_batch *batch, struct zink_resource *res, bool write);
-
-void
 zink_batch_reference_resource_rw(struct zink_batch *batch,
                                  struct zink_resource *res,
                                  bool write);
index f368a5d..cae8209 100644 (file)
@@ -86,6 +86,7 @@ zink_is_swapchain(const struct zink_resource *res)
 
 #include "zink_batch.h"
 #include "zink_bo.h"
+#include "zink_kopper.h"
 
 static inline bool
 zink_resource_usage_is_unflushed(const struct zink_resource *res)
@@ -142,6 +143,27 @@ zink_resource_object_usage_unset(struct zink_resource_object *obj, struct zink_b
    return zink_bo_usage_unset(obj->bo, bs);
 }
 
+static inline void
+zink_batch_resource_usage_set(struct zink_batch *batch, struct zink_resource *res, bool write)
+{
+   if (res->obj->dt) {
+      VkSemaphore acquire = zink_kopper_acquire_submit(zink_screen(batch->state->ctx->base.screen), res);
+      if (acquire)
+         util_dynarray_append(&batch->state->acquires, VkSemaphore, acquire);
+   }
+   if (write && !res->obj->is_buffer) {
+      if (!res->valid && res->fb_binds)
+         batch->state->ctx->rp_loadop_changed = true;
+      res->valid = true;
+   }
+   zink_resource_usage_set(res, batch->state, write);
+   /* 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);
+
+   batch->has_work = true;
+}
+
 #ifdef __cplusplus
 }
 #endif