[Mesa-dev] [PATCH 26/27] i965: Disable gather push constants for null constants

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Tue Apr 28 13:08:23 PDT 2015


Programming null constants with gather constant tables seems to
be unsupported and results in a GPU lockup even with the prescribed
GPU workarounds in the bspec. Found out by trial and error that
disabling HW gather constant when the constant state for a stage
needs to be nullified is the only way to go around the issue.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/gen7_disable.c  |  4 ++++
 src/mesa/drivers/dri/i965/gen7_vs_state.c | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/gen7_disable.c b/src/mesa/drivers/dri/i965/gen7_disable.c
index 2c43cd7..ba7fbf8 100644
--- a/src/mesa/drivers/dri/i965/gen7_disable.c
+++ b/src/mesa/drivers/dri/i965/gen7_disable.c
@@ -29,6 +29,8 @@
 static void
 disable_stages(struct brw_context *brw)
 {
+   gen7_toggle_gather_constants(brw, false);
+
    /* Disable the HS Unit */
    BEGIN_BATCH(7);
    OUT_BATCH(_3DSTATE_CONSTANT_HS << 16 | (7 - 2));
@@ -87,6 +89,8 @@ disable_stages(struct brw_context *brw)
    OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_DS << 16 | (2 - 2));
    OUT_BATCH(0);
    ADVANCE_BATCH();
+
+   gen7_toggle_gather_constants(brw, true);
 }
 
 const struct brw_tracked_state gen7_disable_stages = {
diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c
index adfaa59..f5e77ed 100644
--- a/src/mesa/drivers/dri/i965/gen7_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c
@@ -85,6 +85,13 @@ gen7_upload_constant_state(struct brw_context *brw,
    int const_loc = use_gather ? 16 : 0;
    int dwords = brw->gen >= 8 ? 11 : 7;
 
+   /* Disable gather constants when zeroing constant states */
+   bool gather_switched_off = false;
+   if (use_gather && !active) {
+      gen7_toggle_gather_constants(brw, false);
+      gather_switched_off = true;
+   }
+
    struct brw_stage_prog_data *prog_data = stage_state->prog_data;
    if (prog_data && use_gather && active) {
       gen7_submit_gather_table(brw, stage_state, prog_data, gather_opcode);
@@ -115,6 +122,10 @@ gen7_upload_constant_state(struct brw_context *brw,
 
    ADVANCE_BATCH();
 
+   /* Re-enable gather again if required */
+   if (gather_switched_off)
+      gen7_toggle_gather_constants(brw, true);
+
   /* On SKL+ the new constants don't take effect until the next corresponding
    * 3DSTATE_BINDING_TABLE_POINTER_* command is parsed so we need to ensure
    * that is sent
-- 
1.9.1



More information about the mesa-dev mailing list