r600g: disable render condition for some blitter operations
authorMarek Olšák <maraeo@gmail.com>
Wed, 15 Jun 2011 12:26:41 +0000 (14:26 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 15 Jun 2011 13:24:37 +0000 (15:24 +0200)
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_query.c

index e9f35c10ac16188a15016bfb7c0cdf479806614d..043c8759f569397d8345c52c1e11e4bf55b0e3a9 100644 (file)
 
 enum r600_blitter_op /* bitmask */
 {
-       R600_CLEAR         = 1,
-       R600_CLEAR_SURFACE = 2,
-       R600_COPY          = 4
+       R600_SAVE_TEXTURES      = 1,
+       R600_SAVE_FRAMEBUFFER   = 2,
+       R600_DISABLE_RENDER_COND = 4,
+
+       R600_CLEAR         = 0,
+
+       R600_CLEAR_SURFACE = R600_SAVE_FRAMEBUFFER,
+
+       R600_COPY          = R600_SAVE_FRAMEBUFFER | R600_SAVE_TEXTURES |
+                            R600_DISABLE_RENDER_COND,
+
+       R600_DECOMPRESS    = R600_SAVE_FRAMEBUFFER | R600_DISABLE_RENDER_COND,
 };
 
 static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op)
@@ -58,10 +67,10 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
                                         rctx->vbuf_mgr->nr_vertex_buffers,
                                         rctx->vbuf_mgr->vertex_buffer);
 
-       if (op & (R600_CLEAR_SURFACE | R600_COPY))
+       if (op & R600_SAVE_FRAMEBUFFER)
                util_blitter_save_framebuffer(rctx->blitter, &rctx->framebuffer);
 
-       if (op & R600_COPY) {
+       if (op & R600_SAVE_TEXTURES) {
                util_blitter_save_fragment_sampler_states(
                        rctx->blitter, rctx->ps_samplers.n_samplers,
                        (void**)rctx->ps_samplers.samplers);
@@ -71,11 +80,23 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op
                        (struct pipe_sampler_view**)rctx->ps_samplers.views);
        }
 
+       if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) {
+               rctx->saved_render_cond = rctx->current_render_cond;
+               rctx->saved_render_cond_mode = rctx->current_render_cond_mode;
+               rctx->context.render_condition(&rctx->context, NULL, 0);
+       }
+
 }
 
 static void r600_blitter_end(struct pipe_context *ctx)
 {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+       if (rctx->saved_render_cond) {
+               rctx->context.render_condition(&rctx->context,
+                                              rctx->saved_render_cond,
+                                              rctx->saved_render_cond_mode);
+               rctx->saved_render_cond = NULL;
+       }
        r600_context_queries_resume(&rctx->ctx);
        rctx->blit = false;
 }
@@ -107,7 +128,7 @@ void r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_t
            rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
                depth = 0.0f;
 
-       r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
+       r600_blitter_begin(ctx, R600_DECOMPRESS);
        util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth);
        r600_blitter_end(ctx);
 
index 5e534ca905cf15ad91fef668da425dc805b8fab1..84a45bec05dedf16929a8c7f85b68cfedaf3056d 100644 (file)
@@ -191,6 +191,10 @@ struct r600_pipe_context {
        struct r600_pipe_rasterizer     *rasterizer;
        struct r600_pipe_state          vgt;
        struct r600_pipe_state          spi;
+       struct pipe_query               *current_render_cond;
+       unsigned                        current_render_cond_mode;
+       struct pipe_query               *saved_render_cond;
+       unsigned                        saved_render_cond_mode;
        /* shader information */
        unsigned                        sprite_coord_enable;
        boolean                         flatshade;
index 181ea3f9e49b1cad0a8bda620c7d5305d0c308d7..bedb48b6031a1a1b64454af6d14030e372ba4e3e 100644 (file)
@@ -75,6 +75,9 @@ static void r600_render_condition(struct pipe_context *ctx,
        struct r600_query *rquery = (struct r600_query *)query;
        int wait_flag = 0;
 
+       rctx->current_render_cond = query;
+       rctx->current_render_cond_mode = mode;
+
        if (!query) {
                rctx->ctx.predicate_drawing = false;
                r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1);