[Mesa-dev] [PATCH 19/20] i965: Disable gather push constants for null constants

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Fri Sep 11 01:33:33 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 | 7 +++++++
 src/mesa/drivers/dri/i965/gen8_disable.c  | 4 ++++
 3 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 bb50969..259accc 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(brw->hw_bt_pool.next_offset);
    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 cf07658..4daf2bc 100644
--- a/src/mesa/drivers/dri/i965/gen7_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c
@@ -87,6 +87,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);
diff --git a/src/mesa/drivers/dri/i965/gen8_disable.c b/src/mesa/drivers/dri/i965/gen8_disable.c
index 32508e3..617ed76 100644
--- a/src/mesa/drivers/dri/i965/gen8_disable.c
+++ b/src/mesa/drivers/dri/i965/gen8_disable.c
@@ -29,6 +29,8 @@
 static void
 disable_stages(struct brw_context *brw)
 {
+   gen7_toggle_gather_constants(brw, false);
+
    BEGIN_BATCH(5);
    OUT_BATCH(_3DSTATE_WM_HZ_OP << 16 | (5 - 2));
    OUT_BATCH(0);
@@ -104,6 +106,8 @@ disable_stages(struct brw_context *brw)
    OUT_BATCH(brw->hw_bt_pool.next_offset);
    ADVANCE_BATCH();
 
+   gen7_toggle_gather_constants(brw, true);
+
    BEGIN_BATCH(2);
    OUT_BATCH(_3DSTATE_WM_CHROMAKEY << 16 | (2 - 2));
    OUT_BATCH(0);
-- 
1.9.1



More information about the mesa-dev mailing list