[Mesa-dev] [PATCH 04/14] i965/blorp: Use meta utility for primitive emission

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


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp   |  3 +++
 src/mesa/drivers/dri/i965/brw_meta_util.c | 17 +++++++++++++++++
 src/mesa/drivers/dri/i965/brw_meta_util.h |  4 ++++
 src/mesa/drivers/dri/i965/gen6_blorp.cpp  | 18 ------------------
 src/mesa/drivers/dri/i965/gen7_blorp.cpp  | 19 -------------------
 5 files changed, 24 insertions(+), 37 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 4497eab..0379258 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -27,6 +27,7 @@
 
 #include "brw_blorp.h"
 #include "brw_state.h"
+#include "brw_meta_util.h"
 
 #define FILE_DEBUG_FLAG DEBUG_BLORP
 
@@ -240,6 +241,8 @@ retry:
       unreachable("not reached");
    }
 
+   brw_meta_draw_rect(brw, params->num_layers);
+
    /* Make sure we didn't wrap the batch unintentionally, and make sure we
     * reserved enough space that a wrap will never happen.
     */
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c
index a3b0604..1bda31f 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.c
@@ -23,6 +23,9 @@
 
 #include "brw_meta_util.h"
 #include "main/fbobject.h"
+#include "vbo/vbo.h"
+#include "brw_defines.h"
+#include "brw_draw.h"
 
 /**
  * Helper function for handling mirror image blits.
@@ -157,3 +160,17 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
 
    return false;
 }
+
+void
+brw_meta_draw_rect(struct brw_context *brw, int num_instances)
+{
+   const struct _mesa_prim prim = { .num_instances = num_instances };
+
+   brw_emit_prim(brw,
+                 &prim,
+                 _3DPRIM_RECTLIST,
+                 0 /* start_vertex_location */,
+                 0 /* base_vertex_location */,
+                 3 /* vertex count per instance */,
+                 false /* predicate_enable */);
+}
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.h b/src/mesa/drivers/dri/i965/brw_meta_util.h
index dc9dff2..0a399cd 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.h
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.h
@@ -41,6 +41,10 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
                                  GLfloat *dstX1, GLfloat *dstY1,
                                  bool *mirror_x, bool *mirror_y);
 
+struct brw_context;
+
+void brw_meta_draw_rect(struct brw_context *brw, int num_instances);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 079e1ba..e28e6db 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -977,23 +977,6 @@ gen6_blorp_emit_viewport_state(struct brw_context *brw,
 }
 
 
-/* 3DPRIMITIVE */
-static void
-gen6_blorp_emit_primitive(struct brw_context *brw,
-                          const brw_blorp_params *params)
-{
-   BEGIN_BATCH(6);
-   OUT_BATCH(CMD_3D_PRIM << 16 | (6 - 2) |
-             _3DPRIM_RECTLIST << GEN4_3DPRIM_TOPOLOGY_TYPE_SHIFT |
-             GEN4_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL);
-   OUT_BATCH(3); /* vertex count per instance */
-   OUT_BATCH(0);
-   OUT_BATCH(params->num_layers); /* instance count */
-   OUT_BATCH(0);
-   OUT_BATCH(0);
-   ADVANCE_BATCH();
-}
-
 /**
  * \brief Execute a blit or render pass operation.
  *
@@ -1075,6 +1058,5 @@ gen6_blorp_exec(struct brw_context *brw,
       gen6_blorp_emit_depth_disable(brw, params);
    gen6_blorp_emit_clear_params(brw, params);
    gen6_blorp_emit_drawing_rectangle(brw, params);
-   gen6_blorp_emit_primitive(brw, params);
 }
 
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 89b73ca..d4204d5 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -747,24 +747,6 @@ gen7_blorp_emit_clear_params(struct brw_context *brw,
 }
 
 
-/* 3DPRIMITIVE */
-static void
-gen7_blorp_emit_primitive(struct brw_context *brw,
-                          const brw_blorp_params *params)
-{
-   BEGIN_BATCH(7);
-   OUT_BATCH(CMD_3D_PRIM << 16 | (7 - 2));
-   OUT_BATCH(GEN7_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL |
-             _3DPRIM_RECTLIST);
-   OUT_BATCH(3); /* vertex count per instance */
-   OUT_BATCH(0);
-   OUT_BATCH(params->num_layers); /* instance count */
-   OUT_BATCH(0);
-   OUT_BATCH(0);
-   ADVANCE_BATCH();
-}
-
-
 /**
  * \copydoc gen6_blorp_exec()
  */
@@ -849,5 +831,4 @@ gen7_blorp_exec(struct brw_context *brw,
       gen7_blorp_emit_depth_disable(brw);
    gen7_blorp_emit_clear_params(brw, params);
    gen6_blorp_emit_drawing_rectangle(brw, params);
-   gen7_blorp_emit_primitive(brw, params);
 }
-- 
2.5.0



More information about the mesa-dev mailing list