[Mesa-dev] [PATCH 5/5] i965: Port 3DSTATE_VF_TOPOLOGY on gen8+ to genxml.

Rafael Antognolli rafael.antognolli at intel.com
Wed May 10 00:12:12 UTC 2017


With this last state ported, we can get rid of gen8_draw_upload.c.

Signed-off-by: Rafael Antognolli <rafael.antognolli at intel.com>
---
 src/mesa/drivers/dri/i965/Makefile.sources    |  1 -
 src/mesa/drivers/dri/i965/brw_state.h         |  1 -
 src/mesa/drivers/dri/i965/gen8_draw_upload.c  | 53 ---------------------------
 src/mesa/drivers/dri/i965/genX_state_upload.c | 22 ++++++++++-
 4 files changed, 21 insertions(+), 56 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index 9e567cb..0221a97 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -92,7 +92,6 @@ i965_FILES = \
 	gen7_urb.c \
 	gen7_wm_surface_state.c \
 	gen8_depth_state.c \
-	gen8_draw_upload.c \
 	gen8_multisample_state.c \
 	gen8_surface_state.c \
 	hsw_queryobj.c \
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index a9c3bf2..2682286 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -113,7 +113,6 @@ extern const struct brw_tracked_state gen7_l3_state;
 extern const struct brw_tracked_state gen7_push_constant_space;
 extern const struct brw_tracked_state gen7_urb;
 extern const struct brw_tracked_state gen8_pma_fix;
-extern const struct brw_tracked_state gen8_vf_topology;
 extern const struct brw_tracked_state brw_cs_work_groups_surface;
 
 static inline bool
diff --git a/src/mesa/drivers/dri/i965/gen8_draw_upload.c b/src/mesa/drivers/dri/i965/gen8_draw_upload.c
index 01c3ac3..e69de29 100644
--- a/src/mesa/drivers/dri/i965/gen8_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/gen8_draw_upload.c
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2012 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include "main/bufferobj.h"
-#include "main/context.h"
-#include "main/enums.h"
-#include "main/macros.h"
-
-#include "brw_draw.h"
-#include "brw_defines.h"
-#include "brw_context.h"
-#include "brw_state.h"
-
-#include "intel_batchbuffer.h"
-#include "intel_buffer_objects.h"
-
-static void
-gen8_emit_vf_topology(struct brw_context *brw)
-{
-   BEGIN_BATCH(2);
-   OUT_BATCH(_3DSTATE_VF_TOPOLOGY << 16 | (2 - 2));
-   OUT_BATCH(brw->primitive);
-   ADVANCE_BATCH();
-}
-
-const struct brw_tracked_state gen8_vf_topology = {
-   .dirty = {
-      .mesa = 0,
-      .brw = BRW_NEW_BLORP |
-             BRW_NEW_PRIMITIVE,
-   },
-   .emit = gen8_emit_vf_topology,
-};
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 96cad92..eef8fa7 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -3991,7 +3991,27 @@ static const struct brw_tracked_state genX(ps_blend) = {
    },
    .emit = genX(upload_ps_blend)
 };
+#endif
+
+/* ---------------------------------------------------------------------- */
+
+#if GEN_GEN >= 8
+static void
+genX(emit_vf_topology)(struct brw_context *brw)
+{
+   brw_batch_emit(brw, GENX(3DSTATE_VF_TOPOLOGY), vftopo) {
+      vftopo.PrimitiveTopologyType = brw->primitive;
+   }
+}
 
+static const struct brw_tracked_state genX(vf_topology) = {
+   .dirty = {
+      .mesa = 0,
+      .brw = BRW_NEW_BLORP |
+             BRW_NEW_PRIMITIVE,
+   },
+   .emit = genX(emit_vf_topology),
+};
 #endif
 
 /* ---------------------------------------------------------------------- */
@@ -4329,7 +4349,7 @@ genX(init_atoms)(struct brw_context *brw)
 
       &genX(drawing_rect),
 
-      &gen8_vf_topology,
+      &genX(vf_topology),
 
       &brw_indices,
       &genX(index_buffer),
-- 
2.9.3



More information about the mesa-dev mailing list