nvc0: ensure the query's fence has been emitted in nvc0_hw_query_fifo_wait
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 5 Apr 2018 21:31:25 +0000 (22:31 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 7 Apr 2018 20:45:00 +0000 (16:45 -0400)
If the fence has not been emitted, hq->fence->sequence would be zero. This
would result in the semaphore never being triggered, blocking all later
commands in the pushbuf.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
[imirkin: use nouveau_fence_emit instead]
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c

index 83a57fa01184010bbd389abaa8073e6a88dce107..8ff3572c5cb97287638fd17cf9bf2c23e68f1cb0 100644 (file)
@@ -611,6 +611,10 @@ nvc0_hw_query_fifo_wait(struct nvc0_context *nvc0, struct nvc0_query *q)
    struct nvc0_hw_query *hq = nvc0_hw_query(q);
    unsigned offset = hq->offset;
 
+   /* ensure the query's fence has been emitted */
+   if (hq->is64bit && hq->fence->state < NOUVEAU_FENCE_STATE_EMITTED)
+      nouveau_fence_emit(hq->fence);
+
    if (q->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE) offset += 0x20;
 
    PUSH_SPACE(push, 5);