ilo: remove handle_invalid_batch_bo()
authorChia-I Wu <olvaffe@gmail.com>
Mon, 22 Sep 2014 15:32:18 +0000 (23:32 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 23 Sep 2014 02:08:05 +0000 (10:08 +0800)
It was used to set has_gen6_wa_pipe_control to false when the batch buffer
changed.  When called from emit_flush() and others, it also unset
ILO_3D_PIPELINE_INVALIDATE_BATCH_BO so that the following emit_draw() will not
set has_gen6_wa_pipe_control to false again.  It sounded error-prone and was
just ugly.

We should be able to achieve the same goal by reset has_gen6_wa_pipe_control
in ilo_3d_pipeline_invalidate().  With handle_invalid_batch_bo() gone, the
emit functions can also be inlined.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/ilo/ilo_3d_pipeline.c
src/gallium/drivers/ilo/ilo_3d_pipeline.h
src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c

index 9cceb84..74553dc 100644 (file)
@@ -129,58 +129,6 @@ ilo_3d_pipeline_destroy(struct ilo_3d_pipeline *p)
    FREE(p);
 }
 
-static void
-handle_invalid_batch_bo(struct ilo_3d_pipeline *p, bool unset)
-{
-   if (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_BATCH_BO) {
-      if (ilo_dev_gen(p->dev) == ILO_GEN(6))
-         p->state.has_gen6_wa_pipe_control = false;
-
-      if (unset)
-         p->invalidate_flags &= ~ILO_3D_PIPELINE_INVALIDATE_BATCH_BO;
-   }
-}
-
-/**
- * Emit context states and 3DPRIMITIVE.
- */
-void
-ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p,
-                          const struct ilo_state_vector *vec)
-{
-   handle_invalid_batch_bo(p, false);
-   p->emit_draw(p, vec);
-}
-
-/**
- * Emit PIPE_CONTROL to flush all caches.
- */
-void
-ilo_3d_pipeline_emit_flush(struct ilo_3d_pipeline *p)
-{
-   handle_invalid_batch_bo(p, true);
-   p->emit_flush(p);
-}
-
-/**
- * Emit PIPE_CONTROL or MI_STORE_REGISTER_MEM to save register values.
- */
-void
-ilo_3d_pipeline_emit_query(struct ilo_3d_pipeline *p,
-                           struct ilo_query *q, uint32_t offset)
-{
-   handle_invalid_batch_bo(p, true);
-   p->emit_query(p, q, offset);
-}
-
-void
-ilo_3d_pipeline_emit_rectlist(struct ilo_3d_pipeline *p,
-                              const struct ilo_blitter *blitter)
-{
-   handle_invalid_batch_bo(p, false);
-   p->emit_rectlist(p, blitter);
-}
-
 void
 ilo_3d_pipeline_get_sample_position(struct ilo_3d_pipeline *p,
                                     unsigned sample_count,
index c2ebb2f..5556edb 100644 (file)
@@ -144,6 +144,7 @@ static inline void
 ilo_3d_pipeline_invalidate(struct ilo_3d_pipeline *p, uint32_t flags)
 {
    p->invalidate_flags |= flags;
+   p->state.has_gen6_wa_pipe_control = false;
 }
 
 /**
@@ -157,20 +158,41 @@ ilo_3d_pipeline_estimate_size(struct ilo_3d_pipeline *pipeline,
    return pipeline->estimate_size(pipeline, action, arg);
 }
 
-void
+/**
+ * Emit context states and 3DPRIMITIVE.
+ */
+static inline void
 ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p,
-                          const struct ilo_state_vector *vec);
+                          const struct ilo_state_vector *vec)
+{
+   p->emit_draw(p, vec);
+}
 
-void
-ilo_3d_pipeline_emit_flush(struct ilo_3d_pipeline *p);
+/**
+ * Emit PIPE_CONTROL to flush all caches.
+ */
+static inline void
+ilo_3d_pipeline_emit_flush(struct ilo_3d_pipeline *p)
+{
+   p->emit_flush(p);
+}
 
-void
+/**
+ * Emit PIPE_CONTROL or MI_STORE_REGISTER_MEM to save register values.
+ */
+static inline void
 ilo_3d_pipeline_emit_query(struct ilo_3d_pipeline *p,
-                           struct ilo_query *q, uint32_t offset);
+                           struct ilo_query *q, uint32_t offset)
+{
+   p->emit_query(p, q, offset);
+}
 
-void
+static inline void
 ilo_3d_pipeline_emit_rectlist(struct ilo_3d_pipeline *p,
-                              const struct ilo_blitter *blitter);
+                              const struct ilo_blitter *blitter)
+{
+   p->emit_rectlist(p, blitter);
+}
 
 void
 ilo_3d_pipeline_get_sample_position(struct ilo_3d_pipeline *p,
index 686cf5f..7ae6cc1 100644 (file)
@@ -1369,19 +1369,14 @@ gen6_pipeline_prepare(const struct ilo_3d_pipeline *p,
       session->kernel_bo_changed = true;
       session->prim_changed = true;
       session->primitive_restart_changed = true;
-   }
-   else {
+   } else {
       /*
        * Any state that involves resources needs to be re-emitted when the
        * batch bo changed.  This is because we do not pin the resources and
        * their offsets (or existence) may change between batch buffers.
-       *
-       * Since we messed around with ILO_3D_PIPELINE_INVALIDATE_BATCH_BO in
-       * handle_invalid_batch_bo(), use ILO_3D_PIPELINE_INVALIDATE_STATE_BO as
-       * a temporary workaround.
        */
       session->batch_bo_changed =
-         (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_STATE_BO);
+         (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_BATCH_BO);
 
       session->state_bo_changed =
          (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_STATE_BO);