From 1cd001aa63ed55e26775fdb1a16a595265c10d43 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 7 Feb 2019 08:48:38 -0800 Subject: iris: Make a iris_batch_reference_signal_syncpt helper function. Suggested by Chris Wilson. More obvious what's going on. --- src/gallium/drivers/iris/iris_batch.h | 18 ++++++++++++++++++ src/gallium/drivers/iris/iris_fence.h | 2 ++ src/gallium/drivers/iris/iris_query.c | 9 ++------- 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/iris/iris_batch.h b/src/gallium/drivers/iris/iris_batch.h index d398c3c473e..3dd33663f11 100644 --- a/src/gallium/drivers/iris/iris_batch.h +++ b/src/gallium/drivers/iris/iris_batch.h @@ -33,6 +33,8 @@ #include "i915_drm.h" #include "common/gen_decoder.h" +#include "iris_fence.h" + /* The kernel assumes batchbuffers are smaller than 256kB. */ #define MAX_BATCH_SIZE (256 * 1024) @@ -193,4 +195,20 @@ iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size) memcpy(map, data, size); } +/** + * Take a reference to the batch's signalling syncpt. + * + * Callers can use this to wait for the the current batch under construction + * to complete (after flushing it). + */ +static inline void +iris_batch_reference_signal_syncpt(struct iris_batch *batch, + struct iris_syncpt **out_syncpt) +{ + /* The signalling syncpt is the first one in the list. */ + struct iris_syncpt *syncpt = + ((struct iris_syncpt **) util_dynarray_begin(&batch->syncpts))[0]; + iris_syncpt_reference(batch->screen, out_syncpt, syncpt); +} + #endif diff --git a/src/gallium/drivers/iris/iris_fence.h b/src/gallium/drivers/iris/iris_fence.h index f14940fdc53..caf2ceeb315 100644 --- a/src/gallium/drivers/iris/iris_fence.h +++ b/src/gallium/drivers/iris/iris_fence.h @@ -27,6 +27,8 @@ #include "util/u_inlines.h" struct pipe_screen; +struct iris_screen; +struct iris_batch; struct iris_syncpt { struct pipe_reference ref; diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c index e04ff702721..ec9050b6390 100644 --- a/src/gallium/drivers/iris/iris_query.c +++ b/src/gallium/drivers/iris/iris_query.c @@ -811,13 +811,10 @@ iris_end_query(struct pipe_context *ctx, struct pipe_query *query) struct iris_context *ice = (void *) ctx; struct iris_query *q = (void *) query; struct iris_batch *batch = &ice->batches[q->batch_idx]; - struct iris_screen *screen = (void *) ctx->screen; if (q->type == PIPE_QUERY_TIMESTAMP) { iris_begin_query(ctx, query); - struct iris_syncpt *syncpt = - ((struct iris_syncpt **) util_dynarray_begin(&batch->syncpts))[0]; - iris_syncpt_reference(screen, &q->syncpt, syncpt); + iris_batch_reference_signal_syncpt(batch, &q->syncpt); mark_available(ice, q); return true; } @@ -835,9 +832,7 @@ iris_end_query(struct pipe_context *ctx, struct pipe_query *query) q->query_state_ref.offset + offsetof(struct iris_query_snapshots, end)); - struct iris_syncpt *syncpt = - ((struct iris_syncpt **) util_dynarray_begin(&batch->syncpts))[0]; - iris_syncpt_reference(screen, &q->syncpt, syncpt); + iris_batch_reference_signal_syncpt(batch, &q->syncpt); mark_available(ice, q); return true; -- cgit v1.2.3