radeon: only suspend queries on flush if they haven't been suspended yet
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 27 Nov 2015 23:02:26 +0000 (00:02 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Sat, 28 Nov 2015 10:08:49 +0000 (11:08 +0100)
Non-timer queries are suspended during blits. When the blits end, the queries
are resumed, but this resume operation itself might run out of CS space and
trigger a flush. When this happens, we must prevent a duplicate suspend during
preflush suspend, and we must also prevent a duplicate resume when the CS flush
returns back to the original resume operation.

This fixes a regression that was introduced by:

commit 8a125afa6e88a3eeddba8c7fdc1a75c9b99d5489
Author: Nicolai Hähnle <nhaehnle@gmail.com>
Date:   Wed Nov 18 18:40:22 2015 +0100

    radeon: ensure that timing/profiling queries are suspended on flush

    The queries_suspended_for_flush flag is redundant because suspended queries
    are not removed from their respective linked list.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reported-by: Axel Davy <axel.davy@ens.fr>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h

index f03dcd96e85815741a392cbac862c9bd9c7a9e41..aaea8fe27f4b34765b401d26c6c310447e9aa237 100644 (file)
@@ -136,8 +136,12 @@ static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
 void r600_preflush_suspend_features(struct r600_common_context *ctx)
 {
        /* suspend queries */
-       if (!LIST_IS_EMPTY(&ctx->active_nontimer_queries))
+       if (ctx->num_cs_dw_nontimer_queries_suspend) {
+               /* Since non-timer queries are suspended during blits,
+                * we have to guard against double-suspends. */
                r600_suspend_nontimer_queries(ctx);
+               ctx->nontimer_queries_suspended_by_flush = true;
+       }
        if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
                r600_suspend_timer_queries(ctx);
 
@@ -158,8 +162,10 @@ void r600_postflush_resume_features(struct r600_common_context *ctx)
        /* resume queries */
        if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
                r600_resume_timer_queries(ctx);
-       if (!LIST_IS_EMPTY(&ctx->active_nontimer_queries))
+       if (ctx->nontimer_queries_suspended_by_flush) {
+               ctx->nontimer_queries_suspended_by_flush = false;
                r600_resume_nontimer_queries(ctx);
+       }
 }
 
 static void r600_flush_from_st(struct pipe_context *ctx,
index 253d6577680705cfc95c49614c54b44f182b214c..a4f3fcef7fdea886e3f77269f94f983bd1651ccd 100644 (file)
@@ -396,6 +396,7 @@ struct r600_common_context {
        struct list_head                active_nontimer_queries;
        struct list_head                active_timer_queries;
        unsigned                        num_cs_dw_nontimer_queries_suspend;
+       bool                            nontimer_queries_suspended_by_flush;
        unsigned                        num_cs_dw_timer_queries_suspend;
        /* Additional hardware info. */
        unsigned                        backend_mask;