gallium/u_threaded: mark queries flushed only for non-deferred flushes
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 22 Oct 2017 15:38:50 +0000 (17:38 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 9 Nov 2017 13:00:42 +0000 (14:00 +0100)
The driver uses (and must use) the flushed flag of queries as a hint that
it does not have to check for synchronization with currently queued up
commands. Deferred flushes do not actually flush queued up commands, so
we must not set the flushed flag for them.

Found by inspection.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/util/u_threaded_context.c
src/gallium/auxiliary/util/u_threaded_context.h

index ccce12b00ce2557e73a8ee5939ad09e7a76b7e8e..510201df617e1a76a333b381b57ed8867d8af194 100644 (file)
@@ -1809,9 +1809,11 @@ tc_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence,
    struct pipe_context *pipe = tc->pipe;
    struct threaded_query *tq, *tmp;
 
-   LIST_FOR_EACH_ENTRY_SAFE(tq, tmp, &tc->unflushed_queries, head_unflushed) {
-      tq->flushed = true;
-      LIST_DEL(&tq->head_unflushed);
+   if (!(flags & PIPE_FLUSH_DEFERRED)) {
+      LIST_FOR_EACH_ENTRY_SAFE(tq, tmp, &tc->unflushed_queries, head_unflushed) {
+         tq->flushed = true;
+         LIST_DEL(&tq->head_unflushed);
+      }
    }
 
    /* TODO: deferred flushes? */
index ac7bc3dec73756920ac4ab1afe4bba1b983c7bd2..a9f79a66d42d20ac2d101df2605cea3ea5ed748f 100644 (file)
@@ -264,7 +264,7 @@ struct threaded_query {
    /* The query is added to the list in end_query and removed in flush. */
    struct list_head head_unflushed;
 
-   /* Whether pipe->flush has been called after end_query. */
+   /* Whether pipe->flush has been called in non-deferred mode after end_query. */
    bool flushed;
 };