Mesa (master): ilo: add a helper for RECTLIST blitter

Chia-I Wu olv at kemper.freedesktop.org
Sat Sep 20 03:31:10 UTC 2014


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Sep 20 11:21:20 2014 +0800

ilo: add a helper for RECTLIST blitter

Add ilo_3d_draw_rectlist() for use by RECTLIST blitter.

---

 src/gallium/drivers/ilo/ilo_3d.c               |   41 +++++++++++++++++++++++-
 src/gallium/drivers/ilo/ilo_3d.h               |    3 +-
 src/gallium/drivers/ilo/ilo_blitter_rectlist.c |   32 +-----------------
 3 files changed, 43 insertions(+), 33 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c
index cf2c483..f0aee2f 100644
--- a/src/gallium/drivers/ilo/ilo_3d.c
+++ b/src/gallium/drivers/ilo/ilo_3d.c
@@ -200,7 +200,7 @@ ilo_3d_pause_queries(struct ilo_3d *hw3d)
    }
 }
 
-void
+static void
 ilo_3d_own_render_ring(struct ilo_3d *hw3d)
 {
    ilo_cp_set_owner(hw3d->cp, INTEL_RING_RENDER, &hw3d->owner);
@@ -539,6 +539,45 @@ ilo_3d_pass_render_condition(struct ilo_context *ilo)
       return true;
 }
 
+void
+ilo_3d_draw_rectlist(struct ilo_3d *hw3d, const struct ilo_blitter *blitter)
+{
+   ilo_3d_own_render_ring(hw3d);
+
+   /*
+    * From the Sandy Bridge PRM, volume 2 part 1, page 313:
+    *
+    *     "If other rendering operations have preceded this clear, a
+    *      PIPE_CONTROL with write cache flush enabled and Z-inhibit
+    *      disabled must be issued before the rectangle primitive used for
+    *      the depth buffer clear operation."
+    *
+    * From the Sandy Bridge PRM, volume 2 part 1, page 314:
+    *
+    *     "Depth buffer clear pass must be followed by a PIPE_CONTROL
+    *      command with DEPTH_STALL bit set and Then followed by Depth
+    *      FLUSH"
+    *
+    * But the pipeline has to be flushed both before and after not only
+    * because of these workarounds.  We need them for reasons such as
+    *
+    *  - we may sample from a texture that was rendered to
+    *  - we may sample from the fb shortly after
+    *
+    * Skip checking blitter->op and do the flushes.
+    *
+    * XXX need space check
+    */
+   if (!hw3d->new_batch)
+      ilo_3d_pipeline_emit_flush(hw3d->pipeline);
+
+   ilo_3d_pipeline_emit_rectlist(hw3d->pipeline, blitter);
+
+   ilo_3d_pipeline_emit_flush(hw3d->pipeline);
+
+   hw3d->new_batch = false;
+}
+
 #define UPDATE_MIN2(a, b) (a) = MIN2((a), (b))
 #define UPDATE_MAX2(a, b) (a) = MAX2((a), (b))
 
diff --git a/src/gallium/drivers/ilo/ilo_3d.h b/src/gallium/drivers/ilo/ilo_3d.h
index ccc57cd..ff3a59e 100644
--- a/src/gallium/drivers/ilo/ilo_3d.h
+++ b/src/gallium/drivers/ilo/ilo_3d.h
@@ -32,6 +32,7 @@
 #include "ilo_cp.h"
 
 struct ilo_3d_pipeline;
+struct ilo_blitter;
 struct ilo_context;
 struct ilo_query;
 
@@ -69,7 +70,7 @@ void
 ilo_3d_cp_submitted(struct ilo_3d *hw3d);
 
 void
-ilo_3d_own_render_ring(struct ilo_3d *hw3d);
+ilo_3d_draw_rectlist(struct ilo_3d *hw3d, const struct ilo_blitter *blitter);
 
 void
 ilo_3d_begin_query(struct ilo_context *ilo, struct ilo_query *q);
diff --git a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
index ced2851..eabb483 100644
--- a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
+++ b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
@@ -304,42 +304,12 @@ hiz_align_fb(struct ilo_blitter *blitter)
 static void
 hiz_emit_rectlist(struct ilo_blitter *blitter)
 {
-   struct ilo_3d *hw3d = blitter->ilo->hw3d;
-   struct ilo_3d_pipeline *p = hw3d->pipeline;
-
    hiz_align_fb(blitter);
 
    ilo_blitter_set_rectlist(blitter, 0, 0,
          blitter->fb.width, blitter->fb.height);
 
-   ilo_3d_own_render_ring(hw3d);
-
-   /*
-    * From the Sandy Bridge PRM, volume 2 part 1, page 313:
-    *
-    *     "If other rendering operations have preceded this clear, a
-    *      PIPE_CONTROL with write cache flush enabled and Z-inhibit
-    *      disabled must be issued before the rectangle primitive used for
-    *      the depth buffer clear operation."
-    *
-    * From the Sandy Bridge PRM, volume 2 part 1, page 314:
-    *
-    *     "Depth buffer clear pass must be followed by a PIPE_CONTROL
-    *      command with DEPTH_STALL bit set and Then followed by Depth
-    *      FLUSH"
-    *
-    * But the pipeline has to be flushed both before and after not only
-    * because of these workarounds.  We need them for reasons such as
-    *
-    *  - we may sample from a texture that was rendered to
-    *  - we may sample from the fb shortly after
-    */
-   if (ilo_builder_batch_used(&p->cp->builder))
-      ilo_3d_pipeline_emit_flush(p);
-
-   ilo_3d_pipeline_emit_rectlist(p, blitter);
-
-   ilo_3d_pipeline_emit_flush(p);
+   ilo_3d_draw_rectlist(blitter->ilo->hw3d, blitter);
 }
 
 static bool




More information about the mesa-commit mailing list