Mesa (master): ilo: avoid unnecessary emission of SO states

Chia-I Wu olv at kemper.freedesktop.org
Wed May 22 12:27:49 UTC 2013


Module: Mesa
Branch: master
Commit: bbb30398e58440bf542427a408810cf0e31297b5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bbb30398e58440bf542427a408810cf0e31297b5

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Wed May 22 15:33:15 2013 +0800

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.

---

 src/gallium/drivers/ilo/ilo_3d.c               |   19 ++++++++++++-------
 src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c |    5 +++--
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c
index 817cf89..980bdb4 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 2cf78e5..a2e7ea2 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 */




More information about the mesa-commit mailing list