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@chris-wilson.co.uk>
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;
}
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)
* 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,