[Mesa-dev] [PATCH 6/8] i965: Disable unused pipeline stages once at startup on Gen7+.

Kenneth Graunke kenneth at whitecape.org
Sat Jun 8 12:01:21 PDT 2013


This removes a tiny bit of code from our drawing loop.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_state.h        |  4 +++-
 src/mesa/drivers/dri/i965/brw_state_upload.c |  5 ++++-
 src/mesa/drivers/dri/i965/gen7_disable.c     | 13 ++-----------
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 7215128..62d5efc 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -111,7 +111,6 @@ extern const struct brw_tracked_state gen7_cc_state_pointer;
 extern const struct brw_tracked_state gen7_cc_viewport_state_pointer;
 extern const struct brw_tracked_state gen7_clip_state;
 extern const struct brw_tracked_state gen7_depth_stencil_state_pointer;
-extern const struct brw_tracked_state gen7_disable_stages;
 extern const struct brw_tracked_state gen7_ps_state;
 extern const struct brw_tracked_state gen7_push_constant_alloc;
 extern const struct brw_tracked_state gen7_samplers;
@@ -215,6 +214,9 @@ uint32_t
 get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,
                   int fs_attr, bool two_side_color, uint32_t *max_source_attr);
 
+/* gen7_disable.c */
+void gen7_disable_unused_stages(struct brw_context *brw);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 6a69a67..fa9b5af 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -211,7 +211,6 @@ static const struct brw_tracked_state *gen7_atoms[] =
    &gen7_samplers,
    &gen6_multisample_state,
 
-   &gen7_disable_stages,
    &gen7_vs_state,
    &gen7_sol_state,
    &gen7_clip_state,
@@ -252,6 +251,10 @@ brw_upload_initial_gpu_state(struct brw_context *brw)
       return;
 
    brw_upload_invariant_state(brw);
+
+   if (intel->gen >= 7) {
+      gen7_disable_unused_stages(brw);
+   }
 }
 
 void brw_init_state( struct brw_context *brw )
diff --git a/src/mesa/drivers/dri/i965/gen7_disable.c b/src/mesa/drivers/dri/i965/gen7_disable.c
index aaf88a8..c152d0a 100644
--- a/src/mesa/drivers/dri/i965/gen7_disable.c
+++ b/src/mesa/drivers/dri/i965/gen7_disable.c
@@ -26,8 +26,8 @@
 #include "brw_defines.h"
 #include "intel_batchbuffer.h"
 
-static void
-disable_stages(struct brw_context *brw)
+void
+gen7_disable_unused_stages(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
 
@@ -123,12 +123,3 @@ disable_stages(struct brw_context *brw)
    OUT_BATCH(0);
    ADVANCE_BATCH();
 }
-
-const struct brw_tracked_state gen7_disable_stages = {
-   .dirty = {
-      .mesa  = 0,
-      .brw   = BRW_NEW_CONTEXT,
-      .cache = 0,
-   },
-   .emit = disable_stages,
-};
-- 
1.8.3



More information about the mesa-dev mailing list