Mesa (master): iris: Fix overzealous query object batch flushing.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 26 16:49:11 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Jun 25 21:14:11 2019 -0700

iris: Fix overzealous query object batch flushing.

In the past, each query object had their own BO.  Checking if the batch
referenced that BO was an easy way to check if commands were still
queued to compute the query value.  If so, we needed to flush.

More recently (c24a574e6c), we started using an u_upload_mgr for query
objects, placing multiple queries in the same BO.  One side-effect is
that iris_batch_references is a no longer a reasonable way to check if
commands are still queued for our query.  Ours might be done, but a
later query that happens to be in the same BO might be queued.  We don't
want to flush in that case.

Instead, check if the current batch's signalling syncpt is the one we
referenced when ending the query.  We know the syncpt can't have been
reused because our query is holding a reference, so a simple pointer
comparison should suffice.

Removes all batch flushing caused by query objects in Shadow of Mordor.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/gallium/drivers/iris/iris_query.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c
index 1a230b39532..f10f91567b0 100644
--- a/src/gallium/drivers/iris/iris_query.c
+++ b/src/gallium/drivers/iris/iris_query.c
@@ -864,7 +864,6 @@ iris_get_query_result(struct pipe_context *ctx,
    struct iris_query *q = (void *) query;
    struct iris_screen *screen = (void *) ctx->screen;
    const struct gen_device_info *devinfo = &screen->devinfo;
-   struct iris_bo *bo = iris_resource_bo(q->query_state_ref.res);
 
    if (unlikely(screen->no_hw)) {
       result->u64 = 0;
@@ -872,8 +871,9 @@ iris_get_query_result(struct pipe_context *ctx,
    }
 
    if (!q->ready) {
-      if (iris_batch_references(&ice->batches[q->batch_idx], bo))
-         iris_batch_flush(&ice->batches[q->batch_idx]);
+      struct iris_batch *batch = &ice->batches[q->batch_idx];
+      if (q->syncpt == iris_batch_get_signal_syncpt(batch))
+         iris_batch_flush(batch);
 
       while (!READ_ONCE(q->map->snapshots_landed)) {
          if (wait)
@@ -919,7 +919,7 @@ iris_get_query_result_resource(struct pipe_context *ctx,
        * now so that progress happens.  Either way, copy the snapshots
        * landed field to the destination resource.
        */
-      if (iris_batch_references(batch, bo))
+      if (q->syncpt == iris_batch_get_signal_syncpt(batch))
          iris_batch_flush(batch);
 
       ice->vtbl.copy_mem_mem(batch, iris_resource_bo(p_res), offset,




More information about the mesa-commit mailing list