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@igalia.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7042>
This commit is contained in:
Eleni Maria Stea 2020-03-26 17:23:08 +01:00 committed by Marge Bot
parent aa1d298b33
commit 06b41ca589
2 changed files with 25 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;