Mesa (master): iris: Make a resource_is_busy() helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 23 07:24:51 UTC 2019


Module: Mesa
Branch: master
Commit: 768b17a7ad12fa59de5e4be89029b579a5832baf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=768b17a7ad12fa59de5e4be89029b579a5832baf

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Apr 16 13:23:06 2019 -0700

iris: Make a resource_is_busy() helper

This checks both "is it busy" and "do we have work queued up for it"?

---

 src/gallium/drivers/iris/iris_resource.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 293f71aa1f9..ddff9296c60 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -878,6 +878,18 @@ iris_resource_get_handle(struct pipe_screen *pscreen,
    return false;
 }
 
+static bool
+resource_is_busy(struct iris_context *ice,
+                 struct iris_resource *res)
+{
+   bool busy = iris_bo_busy(res->bo);
+
+   for (int i = 0; i < IRIS_BATCH_COUNT; i++)
+      busy |= iris_batch_references(&ice->batches[i], res->bo);
+
+   return busy;
+}
+
 static void
 iris_invalidate_resource(struct pipe_context *ctx,
                          struct pipe_resource *resource)
@@ -1331,10 +1343,7 @@ iris_transfer_map(struct pipe_context *ctx,
    }
 
    if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
-      map_would_stall = iris_bo_busy(res->bo);
-
-      for (int i = 0; i < IRIS_BATCH_COUNT; i++)
-         map_would_stall |= iris_batch_references(&ice->batches[i], res->bo);
+      map_would_stall = resource_is_busy(ice, res);
 
       if (map_would_stall && (usage & PIPE_TRANSFER_DONTBLOCK) &&
                              (usage & PIPE_TRANSFER_MAP_DIRECTLY))




More information about the mesa-commit mailing list