summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-09-22 23:32:18 +0800
committerChia-I Wu <[email protected]>2014-09-23 10:08:05 +0800
commit34e807817fb06b800f588b7e966e579110afeb2d (patch)
tree00a15643a28cfefd390dcc6e0730991c5f6ea5ae
parent2c1f978d6c70dcf1cb854560572a5bca4da1da88 (diff)
ilo: remove handle_invalid_batch_bo()
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 <[email protected]>
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline.c52
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline.h38
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c9
3 files changed, 32 insertions, 67 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline.c b/src/gallium/drivers/ilo/ilo_3d_pipeline.c
index 9cceb84e781..74553dcd392 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline.c
@@ -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,
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline.h b/src/gallium/drivers/ilo/ilo_3d_pipeline.h
index c2ebb2fe224..5556edb4c69 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline.h
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline.h
@@ -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,
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
index 686cf5fb589..7ae6cc124e8 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
@@ -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);