r600g: don't suspend queries if they have already been suspended by blitter
authorMarek Olšák <maraeo@gmail.com>
Thu, 10 Nov 2011 14:22:34 +0000 (15:22 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 10 Nov 2011 17:09:10 +0000 (18:09 +0100)
And add some assertions.

src/gallium/drivers/r600/r600_hw_context.c

index 87435147e3878770d85b25dc4cf81f4a78cb4aaa..838af30efd5d94898ec8a02e16f9f78b2ccddbc6 100644 (file)
@@ -1503,12 +1503,16 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
 void r600_context_flush(struct r600_context *ctx, unsigned flags)
 {
        struct r600_block *enable_block = NULL;
+       bool queries_suspended = false;
 
        if (ctx->pm4_cdwords == ctx->init_dwords)
                return;
 
        /* suspend queries */
-       r600_context_queries_suspend(ctx);
+       if (ctx->num_cs_dw_queries_suspend) {
+               r600_context_queries_suspend(ctx);
+               queries_suspended = true;
+       }
 
        if (ctx->screen->chip_class >= EVERGREEN)
                evergreen_context_flush_dest_caches(ctx);
@@ -1540,7 +1544,9 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
        r600_init_cs(ctx);
 
        /* resume queries */
-       r600_context_queries_resume(ctx);
+       if (queries_suspended) {
+               r600_context_queries_resume(ctx);
+       }
 
        /* set all valid group as dirty so they get reemited on
         * next draw command
@@ -1837,12 +1843,15 @@ void r600_context_queries_suspend(struct r600_context *ctx)
        LIST_FOR_EACH_ENTRY(query, &ctx->active_query_list, list) {
                r600_query_end(ctx, query);
        }
+       assert(ctx->num_cs_dw_queries_suspend == 0);
 }
 
 void r600_context_queries_resume(struct r600_context *ctx)
 {
        struct r600_query *query;
 
+       assert(ctx->num_cs_dw_queries_suspend == 0);
+
        LIST_FOR_EACH_ENTRY(query, &ctx->active_query_list, list) {
                r600_query_begin(ctx, query);
        }