radeonsi: avoid redundant SET_PREDICATION packet with QBO workaround
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 27 Jul 2017 17:41:26 +0000 (19:41 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 2 Aug 2017 07:49:06 +0000 (09:49 +0200)
The QBO workaround compute grid launch emits the render condition atom
when dirty, so install the render condition in the context only after
launching the compute grid. This avoids a redundant SET_PREDICATION.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_query.c

index 5879a07586ceae456bfe3062b7caf7dc8c139f53..4069d2eb90a3a7a54b243da06864bc35e20b3d65 100644 (file)
@@ -1790,10 +1790,6 @@ static void r600_render_condition(struct pipe_context *ctx,
        struct r600_query_buffer *qbuf;
        struct r600_atom *atom = &rctx->render_cond_atom;
 
-       rctx->render_cond = query;
-       rctx->render_cond_invert = condition;
-       rctx->render_cond_mode = mode;
-
        /* Compute the size of SET_PREDICATION packets. */
        atom->num_dw = 0;
        if (query) {
@@ -1820,6 +1816,11 @@ static void r600_render_condition(struct pipe_context *ctx,
                                &rquery->workaround_offset,
                                (struct pipe_resource **)&rquery->workaround_buf);
 
+                       /* Reset to NULL to avoid a redundant SET_PREDICATION
+                        * from launching the compute grid.
+                        */
+                       rctx->render_cond = NULL;
+
                        ctx->get_query_result_resource(
                                ctx, query, true, PIPE_QUERY_TYPE_U64, 0,
                                &rquery->workaround_buf->b.b, rquery->workaround_offset);
@@ -1836,6 +1837,10 @@ static void r600_render_condition(struct pipe_context *ctx,
                }
        }
 
+       rctx->render_cond = query;
+       rctx->render_cond_invert = condition;
+       rctx->render_cond_mode = mode;
+
        rctx->set_atom_dirty(rctx, atom, query != NULL);
 }