[Mesa-dev] [PATCH 07/14] i965/blorp: Move clipper disabling to meta util

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Feb 25 09:46:12 UTC 2016


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp.h     |  3 ---
 src/mesa/drivers/dri/i965/brw_meta_util.c | 23 +++++++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_meta_util.h |  2 ++
 src/mesa/drivers/dri/i965/gen6_blorp.cpp  | 28 +---------------------------
 src/mesa/drivers/dri/i965/gen7_blorp.cpp  |  3 ++-
 5 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index a04a1df..e3e07ce 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -414,9 +414,6 @@ gen6_blorp_emit_gs_disable(struct brw_context *brw,
                            const brw_blorp_params *params);
 
 void
-gen6_blorp_emit_clip_disable(struct brw_context *brw);
-
-void
 gen6_blorp_emit_drawing_rectangle(struct brw_context *brw,
                                   const brw_blorp_params *params);
 
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c
index 8c0b642..8b9d5df 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.c
@@ -256,3 +256,26 @@ brw_meta_emit_vertex_buffer_state(struct brw_context *brw,
    OUT_BATCH(0);
    ADVANCE_BATCH();
 }
+
+/* Disable the clipper.
+ *
+ * Meta op emits a rectangle primitive, which requires clipping to
+ * be disabled. From page 10 of the Sandy Bridge PRM Volume 2 Part 1
+ * Section 1.3 "3D Primitives Overview":
+ *    RECTLIST:
+ *    Either the CLIP unit should be DISABLED, or the CLIP unit's Clip
+ *    Mode should be set to a value other than CLIPMODE_NORMAL.
+ *
+ * Also disable perspective divide. This doesn't change the clipper's
+ * output, but does spare a few electrons.
+ */
+void
+brw_meta_emit_clip_disable(struct brw_context *brw)
+{
+   BEGIN_BATCH(4);
+   OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
+   OUT_BATCH(0);
+   OUT_BATCH(GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE);
+   OUT_BATCH(0);
+   ADVANCE_BATCH();
+}
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.h b/src/mesa/drivers/dri/i965/brw_meta_util.h
index 2cc63ee..99c9186 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.h
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.h
@@ -56,6 +56,8 @@ void brw_meta_emit_vertex_buffer_state(struct brw_context *brw,
                                        unsigned vbo_size,
                                        uint32_t vertex_offset);
 
+void brw_meta_emit_clip_disable(struct brw_context *brw);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 0f5a952..e295b5d 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -549,32 +549,6 @@ gen6_blorp_emit_gs_disable(struct brw_context *brw,
 }
 
 
-/* 3DSTATE_CLIP
- *
- * Disable the clipper.
- *
- * The BLORP op emits a rectangle primitive, which requires clipping to
- * be disabled. From page 10 of the Sandy Bridge PRM Volume 2 Part 1
- * Section 1.3 "3D Primitives Overview":
- *    RECTLIST:
- *    Either the CLIP unit should be DISABLED, or the CLIP unit's Clip
- *    Mode should be set to a value other than CLIPMODE_NORMAL.
- *
- * Also disable perspective divide. This doesn't change the clipper's
- * output, but does spare a few electrons.
- */
-void
-gen6_blorp_emit_clip_disable(struct brw_context *brw)
-{
-   BEGIN_BATCH(4);
-   OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
-   OUT_BATCH(0);
-   OUT_BATCH(GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE);
-   OUT_BATCH(0);
-   ADVANCE_BATCH();
-}
-
-
 /* 3DSTATE_SF
  *
  * Disable ViewportTransformEnable (dw2.1)
@@ -1010,7 +984,7 @@ gen6_blorp_exec(struct brw_context *brw,
    }
    gen6_blorp_emit_vs_disable(brw, params);
    gen6_blorp_emit_gs_disable(brw, params);
-   gen6_blorp_emit_clip_disable(brw);
+   brw_meta_emit_clip_disable(brw);
    gen6_blorp_emit_sf_config(brw, params);
    if (params->use_wm_prog)
       gen6_blorp_emit_constant_ps(brw, params, wm_push_const_offset);
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index d4204d5..dbe3581 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -30,6 +30,7 @@
 #include "brw_state.h"
 
 #include "brw_blorp.h"
+#include "brw_meta_util.h"
 
 
 /* 3DSTATE_URB_VS
@@ -812,7 +813,7 @@ gen7_blorp_exec(struct brw_context *brw,
    gen7_blorp_emit_ds_disable(brw);
    gen7_blorp_emit_gs_disable(brw);
    gen7_blorp_emit_streamout_disable(brw);
-   gen6_blorp_emit_clip_disable(brw);
+   brw_meta_emit_clip_disable(brw);
    gen7_blorp_emit_sf_config(brw, params);
    gen7_blorp_emit_wm_config(brw, params, prog_data);
    if (params->use_wm_prog) {
-- 
2.5.0



More information about the mesa-dev mailing list