ilo: improve WA handling in rectlist path
authorChia-I Wu <olvaffe@gmail.com>
Wed, 4 Mar 2015 21:38:50 +0000 (14:38 -0700)
committerChia-I Wu <olvaffe@gmail.com>
Wed, 4 Mar 2015 22:28:05 +0000 (15:28 -0700)
Add wrappers for 3DPRIMITIVE to make sure we clear current_pipe_control_dw1
and deferred_pipe_control_dw1 after it.  Add missing
gen7_wa_post_ps_and_later().

src/gallium/drivers/ilo/ilo_render_gen.h
src/gallium/drivers/ilo/ilo_render_gen6.c
src/gallium/drivers/ilo/ilo_render_gen7.c
src/gallium/drivers/ilo/ilo_render_gen8.c

index 012c3d7daeb341ae25b167d4d3d60821e8adee87..583265f4f6011fe8a821e49699a4b471c5516342 100644 (file)
@@ -439,9 +439,4 @@ gen7_draw_sol(struct ilo_render *r,
               const struct ilo_state_vector *vec,
               struct ilo_render_draw_session *session);
 
-void
-gen7_draw_vf_draw(struct ilo_render *r,
-                  const struct ilo_state_vector *vec,
-                  struct ilo_render_draw_session *session);
-
 #endif /* ILO_RENDER_GEN_H */
index 0221acdc7e6a1d7c836c2056e2389bda1bdcf08f..723288266be8b060d0ad157fe217c8060d393f54 100644 (file)
@@ -41,7 +41,7 @@
 /**
  * A wrapper for gen6_PIPE_CONTROL().
  */
-static inline void
+static void
 gen6_pipe_control(struct ilo_render *r, uint32_t dw1)
 {
    struct intel_bo *bo = (dw1 & GEN6_PIPE_CONTROL_WRITE__MASK) ?
@@ -56,6 +56,20 @@ gen6_pipe_control(struct ilo_render *r, uint32_t dw1)
    assert(!r->state.deferred_pipe_control_dw1);
 }
 
+static void
+gen6_3dprimitive(struct ilo_render *r,
+                 const struct pipe_draw_info *info,
+                 const struct ilo_ib_state *ib)
+{
+   ILO_DEV_ASSERT(r->dev, 6, 6);
+
+   /* 3DPRIMITIVE */
+   gen6_3DPRIMITIVE(r->builder, info, ib);
+
+   r->state.current_pipe_control_dw1 = 0;
+   assert(!r->state.deferred_pipe_control_dw1);
+}
+
 /**
  * This should be called before PIPE_CONTROL.
  */
@@ -482,18 +496,6 @@ gen6_draw_vf_statistics(struct ilo_render *r,
       gen6_3DSTATE_VF_STATISTICS(r->builder, false);
 }
 
-static void
-gen6_draw_vf_draw(struct ilo_render *r,
-                  const struct ilo_state_vector *vec,
-                  struct ilo_render_draw_session *session)
-{
-   /* 3DPRIMITIVE */
-   gen6_3DPRIMITIVE(r->builder, vec->draw, &vec->ib);
-
-   r->state.current_pipe_control_dw1 = 0;
-   assert(!r->state.deferred_pipe_control_dw1);
-}
-
 void
 gen6_draw_vs(struct ilo_render *r,
              const struct ilo_state_vector *vec,
@@ -850,7 +852,8 @@ ilo_render_emit_draw_commands_gen6(struct ilo_render *render,
    gen6_draw_wm_raster(render, vec, session);
    gen6_draw_sf_rect(render, vec, session);
    gen6_draw_vf(render, vec, session);
-   gen6_draw_vf_draw(render, vec, session);
+
+   gen6_3dprimitive(render, vec->draw, &vec->ib);
 }
 
 static void
@@ -995,7 +998,7 @@ ilo_render_emit_rectlist_commands_gen6(struct ilo_render *r,
    gen6_3DSTATE_DRAWING_RECTANGLE(r->builder, 0, 0,
          blitter->fb.width, blitter->fb.height);
 
-   gen6_3DPRIMITIVE(r->builder, &blitter->draw, NULL);
+   gen6_3dprimitive(r, &blitter->draw, NULL);
 }
 
 int
index cfb9e2e1a8bf382708b72ba926210f5381f1d627..2d3f6cfee56e7bc932ab5936fb5ae114b385762b 100644 (file)
@@ -63,6 +63,23 @@ gen7_pipe_control(struct ilo_render *r, uint32_t dw1)
    r->state.deferred_pipe_control_dw1 &= ~dw1;
 }
 
+static void
+gen7_3dprimitive(struct ilo_render *r,
+                 const struct pipe_draw_info *info,
+                 const struct ilo_ib_state *ib)
+{
+   ILO_DEV_ASSERT(r->dev, 7, 7.5);
+
+   if (r->state.deferred_pipe_control_dw1)
+      gen7_pipe_control(r, r->state.deferred_pipe_control_dw1);
+
+   /* 3DPRIMITIVE */
+   gen7_3DPRIMITIVE(r->builder, info, ib);
+
+   r->state.current_pipe_control_dw1 = 0;
+   r->state.deferred_pipe_control_dw1 = 0;
+}
+
 static void
 gen7_wa_post_3dstate_push_constant_alloc_ps(struct ilo_render *r)
 {
@@ -648,21 +665,6 @@ gen7_draw_wm_multisample(struct ilo_render *r,
    }
 }
 
-void
-gen7_draw_vf_draw(struct ilo_render *r,
-                  const struct ilo_state_vector *vec,
-                  struct ilo_render_draw_session *session)
-{
-   if (r->state.deferred_pipe_control_dw1)
-      gen7_pipe_control(r, r->state.deferred_pipe_control_dw1);
-
-   /* 3DPRIMITIVE */
-   gen7_3DPRIMITIVE(r->builder, vec->draw, &vec->ib);
-
-   r->state.current_pipe_control_dw1 = 0;
-   r->state.deferred_pipe_control_dw1 = 0;
-}
-
 void
 ilo_render_emit_draw_commands_gen7(struct ilo_render *render,
                                    const struct ilo_state_vector *vec,
@@ -696,7 +698,8 @@ ilo_render_emit_draw_commands_gen7(struct ilo_render *render,
    gen6_draw_wm_raster(render, vec, session);
    gen6_draw_sf_rect(render, vec, session);
    gen6_draw_vf(render, vec, session);
-   gen7_draw_vf_draw(render, vec, session);
+
+   gen7_3dprimitive(render, vec->draw, &vec->ib);
 }
 
 static void
@@ -893,7 +896,10 @@ ilo_render_emit_rectlist_commands_gen7(struct ilo_render *r,
    gen6_3DSTATE_DRAWING_RECTANGLE(r->builder, 0, 0,
          blitter->fb.width, blitter->fb.height);
 
-   gen7_3DPRIMITIVE(r->builder, &blitter->draw, NULL);
+   if (ilo_dev_gen(r->dev) == ILO_GEN(7))
+      gen7_wa_post_ps_and_later(r);
+
+   gen7_3dprimitive(r, &blitter->draw, NULL);
 }
 
 int
index b858041ee38968ccc2ce2aef2a3cd19102f0eb03..36fc129475305443ab58a6c1f17e966384c35149 100644 (file)
@@ -64,6 +64,23 @@ gen8_pipe_control(struct ilo_render *r, uint32_t dw1)
    r->state.deferred_pipe_control_dw1 &= ~dw1;
 }
 
+static void
+gen8_3dprimitive(struct ilo_render *r,
+                 const struct pipe_draw_info *info,
+                 const struct ilo_ib_state *ib)
+{
+   ILO_DEV_ASSERT(r->dev, 8, 8);
+
+   if (r->state.deferred_pipe_control_dw1)
+      gen8_pipe_control(r, r->state.deferred_pipe_control_dw1);
+
+   /* 3DPRIMITIVE */
+   gen7_3DPRIMITIVE(r->builder, info, ib);
+
+   r->state.current_pipe_control_dw1 = 0;
+   r->state.deferred_pipe_control_dw1 = 0;
+}
+
 static void
 gen8_wa_pre_depth(struct ilo_render *r)
 {
@@ -309,7 +326,8 @@ ilo_render_emit_draw_commands_gen8(struct ilo_render *render,
    gen6_draw_wm_raster(render, vec, session);
    gen6_draw_sf_rect(render, vec, session);
    gen8_draw_vf(render, vec, session);
-   gen7_draw_vf_draw(render, vec, session);
+
+   gen8_3dprimitive(render, vec->draw, &vec->ib);
 }
 
 int