From c8240c9dea7f0061a6a24cb5d234f0a639170515 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 25 Jun 2013 15:36:15 +0800 Subject: [PATCH] ilo: honor render condition in blitter Make pass_render_condition() available for blitter, and check for render condition in (and only in) clear(), clear_render_target(), and clear_depth_stencil(). --- src/gallium/drivers/ilo/ilo_3d.c | 15 +++++++-------- src/gallium/drivers/ilo/ilo_3d.h | 3 +++ src/gallium/drivers/ilo/ilo_blitter_blt.c | 7 +++++++ src/gallium/drivers/ilo/ilo_blitter_pipe.c | 6 ++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index 6223de98c0f..9ce6b75f978 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -426,9 +426,10 @@ update_prim_count(struct ilo_3d *hw3d, int generated, int emitted) q->data.u64 += emitted; } -static bool -pass_render_condition(struct ilo_3d *hw3d, struct pipe_context *pipe) +bool +ilo_3d_pass_render_condition(struct ilo_context *ilo) { + struct ilo_3d *hw3d = ilo->hw3d; uint64_t result; bool wait; @@ -447,13 +448,11 @@ pass_render_condition(struct ilo_3d *hw3d, struct pipe_context *pipe) break; } - if (pipe->get_query_result(pipe, hw3d->render_condition.query, - wait, (union pipe_query_result *) &result)) { + if (ilo->base.get_query_result(&ilo->base, hw3d->render_condition.query, + wait, (union pipe_query_result *) &result)) return (!result == hw3d->render_condition.cond); - } - else { + else return true; - } } #define UPDATE_MIN2(a, b) (a) = MIN2((a), (b)) @@ -698,7 +697,7 @@ ilo_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) struct ilo_3d *hw3d = ilo->hw3d; int prim_generated, prim_emitted; - if (!pass_render_condition(hw3d, pipe)) + if (!ilo_3d_pass_render_condition(ilo)) return; if (info->primitive_restart && info->indexed) { diff --git a/src/gallium/drivers/ilo/ilo_3d.h b/src/gallium/drivers/ilo/ilo_3d.h index 2c86153c2cd..f73b8177a4c 100644 --- a/src/gallium/drivers/ilo/ilo_3d.h +++ b/src/gallium/drivers/ilo/ilo_3d.h @@ -82,6 +82,9 @@ ilo_3d_end_query(struct ilo_context *ilo, struct ilo_query *q); void ilo_3d_process_query(struct ilo_context *ilo, struct ilo_query *q); +bool +ilo_3d_pass_render_condition(struct ilo_context *ilo); + void ilo_init_3d_functions(struct ilo_context *ilo); diff --git a/src/gallium/drivers/ilo/ilo_blitter_blt.c b/src/gallium/drivers/ilo/ilo_blitter_blt.c index 55fc68b08c0..80c0dcc46d6 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_blt.c +++ b/src/gallium/drivers/ilo/ilo_blitter_blt.c @@ -28,6 +28,7 @@ #include "util/u_pack_color.h" #include "intel_reg.h" +#include "ilo_3d.h" #include "ilo_context.h" #include "ilo_cp.h" #include "ilo_resource.h" @@ -692,6 +693,9 @@ ilo_blitter_blt_clear_rt(struct ilo_blitter *blitter, union util_color packed; bool success; + if (!ilo_3d_pass_render_condition(blitter->ilo)) + return true; + switch (cpp) { case 1: mask = GEN6_BLT_MASK_8; @@ -753,6 +757,9 @@ ilo_blitter_blt_clear_zs(struct ilo_blitter *blitter, struct pipe_box box; uint32_t val; + if (!ilo_3d_pass_render_condition(blitter->ilo)) + return true; + switch (zs->format) { case PIPE_FORMAT_Z16_UNORM: if (!(clear_flags & PIPE_CLEAR_DEPTH)) diff --git a/src/gallium/drivers/ilo/ilo_blitter_pipe.c b/src/gallium/drivers/ilo/ilo_blitter_pipe.c index e37231ac00b..8ca8f08e466 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_pipe.c +++ b/src/gallium/drivers/ilo/ilo_blitter_pipe.c @@ -28,6 +28,7 @@ #include "util/u_blitter.h" #include "util/u_surface.h" +#include "ilo_3d.h" #include "ilo_context.h" #include "ilo_blitter.h" @@ -67,6 +68,11 @@ ilo_blitter_pipe_begin(struct ilo_blitter *blitter, util_blitter_save_rasterizer(b, (void *) ilo->rasterizer); util_blitter_save_framebuffer(b, &ilo->fb.state); + util_blitter_save_render_condition(b, + ilo->hw3d->render_condition.query, + ilo->hw3d->render_condition.cond, + ilo->hw3d->render_condition.mode); + util_blitter_save_fragment_sampler_states(b, ilo->sampler[PIPE_SHADER_FRAGMENT].count, (void **) ilo->sampler[PIPE_SHADER_FRAGMENT].cso); -- 2.30.2