Mesa (master): iris: add support for fence signal capability

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 26 12:20:17 UTC 2020


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

Author: Eleni Maria Stea <estea at igalia.com>
Date:   Thu Mar 26 17:23:08 2020 +0100

iris: add support for fence signal capability

This enables GL_EXT_semaphore feature.

v2:
* reversed previous commit that was conditionally setting the signal
  fence capability if the syncobj was present
* reversed previous commit that was introducing a bool has_syncobj that
  is not necessary anymore

v3:
* changed the signal function to use fence->seqno due to recent changes
  to master

v4:
* changed the signal callback to use the new structs of the fences
  backend (iris_fine_fence)

v5:
* removed check for ctx == NULL in iris_fence_signal and await functions
  as at the time they are called we always have a context
* splitted a line to not exceed width

v6:
* put back the if(ctx) check in iris_fence_await, if this is an error
  the fix should be in a different MR

Signed-off-by: Eleni Maria Stea <estea at igalia.com>
Reviewed-by: Rohan Garg <rohan.garg at collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7042>

---

 src/gallium/drivers/iris/iris_fence.c  | 24 ++++++++++++++++++++++++
 src/gallium/drivers/iris/iris_screen.c |  1 +
 2 files changed, 25 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_fence.c b/src/gallium/drivers/iris/iris_fence.c
index aeed3fd8d7b..958ae789191 100644
--- a/src/gallium/drivers/iris/iris_fence.c
+++ b/src/gallium/drivers/iris/iris_fence.c
@@ -556,6 +556,29 @@ iris_fence_create_fd(struct pipe_context *ctx,
    *out = fence;
 }
 
+static void
+iris_fence_signal(struct pipe_context *ctx,
+                  struct pipe_fence_handle *fence)
+{
+   struct iris_context *ice = (struct iris_context *)ctx;
+
+   if (ctx == fence->unflushed_ctx)
+      return;
+
+   for (unsigned b = 0; b < IRIS_BATCH_COUNT; b++) {
+      for (unsigned i = 0; i < ARRAY_SIZE(fence->fine); i++) {
+         struct iris_fine_fence *fine = fence->fine[i];
+
+         /* already signaled fence skipped */
+         if (iris_fine_fence_signaled(fine))
+            continue;
+
+         iris_batch_add_syncobj(&ice->batches[b], fine->syncobj,
+                                I915_EXEC_FENCE_SIGNAL);
+      }
+   }
+}
+
 void
 iris_init_screen_fence_functions(struct pipe_screen *screen)
 {
@@ -570,4 +593,5 @@ iris_init_context_fence_functions(struct pipe_context *ctx)
    ctx->flush = iris_fence_flush;
    ctx->create_fence_fd = iris_fence_create_fd;
    ctx->fence_server_sync = iris_fence_await;
+   ctx->fence_server_signal = iris_fence_signal;
 }
diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c
index 4d615f631d1..1d57d0fa71d 100644
--- a/src/gallium/drivers/iris/iris_screen.c
+++ b/src/gallium/drivers/iris/iris_screen.c
@@ -236,6 +236,7 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION:
    case PIPE_CAP_NATIVE_FENCE_FD:
    case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
+   case PIPE_CAP_FENCE_SIGNAL:
       return true;
    case PIPE_CAP_FBFETCH:
       return BRW_MAX_DRAW_BUFFERS;



More information about the mesa-commit mailing list