From: Chia-I Wu Date: Wed, 22 May 2013 07:33:15 +0000 (+0800) Subject: ilo: avoid unnecessary emission of SO states X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bbb30398e58440bf542427a408810cf0e31297b5;p=mesa.git ilo: avoid unnecessary emission of SO states No need to emit 3DSTATE_SO_BUFFER and 3DSTATE_SO_DECL_LIST when SO is disabled. As the implicit flush done by the commands is also gone, emit an explicit flush. --- diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index 817cf89adfe..980bdb4451e 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -376,13 +376,18 @@ draw_vbo(struct ilo_3d *hw3d, const struct ilo_context *ilo, ilo_3d_own_render_ring(hw3d); - /* - * Without a better tracking mechanism, when the framebuffer changes, we - * have to assume that the old framebuffer may be sampled from. If that - * happens in the middle of a batch buffer, we need to insert manual - * flushes. - */ - need_flush = (!hw3d->new_batch && (ilo->dirty & ILO_DIRTY_FRAMEBUFFER)); + if (!hw3d->new_batch) { + /* + * Without a better tracking mechanism, when the framebuffer changes, we + * have to assume that the old framebuffer may be sampled from. If that + * happens in the middle of a batch buffer, we need to insert manual + * flushes. + */ + need_flush = (ilo->dirty & ILO_DIRTY_FRAMEBUFFER); + + /* same to SO target changes */ + need_flush |= (ilo->dirty & ILO_DIRTY_STREAM_OUTPUT_TARGETS); + } /* make sure there is enough room first */ max_len = ilo_3d_pipeline_estimate_size(hw3d->pipeline, diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c index 2cf78e53406..a2e7ea2304c 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c @@ -394,7 +394,8 @@ gen7_pipeline_sol(struct ilo_3d_pipeline *p, gen6_pipeline_update_max_svbi(p, ilo, session); /* 3DSTATE_SO_BUFFER */ - if (DIRTY(STREAM_OUTPUT_TARGETS) || dirty_sh) { + if ((DIRTY(STREAM_OUTPUT_TARGETS) || dirty_sh) && + ilo->stream_output_targets.num_targets) { int i; for (i = 0; i < ilo->stream_output_targets.num_targets; i++) { @@ -416,7 +417,7 @@ gen7_pipeline_sol(struct ilo_3d_pipeline *p, } /* 3DSTATE_SO_DECL_LIST */ - if (dirty_sh) + if (dirty_sh && ilo->stream_output_targets.num_targets) p->gen7_3DSTATE_SO_DECL_LIST(p->dev, so_info, sh, p->cp); /* 3DSTATE_STREAMOUT */