i965: Set up sandybridge binding table pointers but don't enable it yet.
authorEric Anholt <eric@anholt.net>
Tue, 3 Nov 2009 22:02:24 +0000 (14:02 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 25 Feb 2010 18:53:06 +0000 (10:53 -0800)
It hangs the GPU at the clipper stage, presumably because we're lacking
other setup.

src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/brw_state.h

index ea0d7e05d4184254b66087962c98fed05bb5f18b..afdc5a1d85dbd1a449fad6d9168ce740778a3469 100644 (file)
 
 #define CMD_PIPELINED_STATE_POINTERS  0x7800
 #define CMD_BINDING_TABLE_PTRS        0x7801
+# define GEN6_BINDING_TABLE_MODIFY_VS  (1 << 8)
+# define GEN6_BINDING_TABLE_MODIFY_GS  (1 << 9)
+# define GEN6_BINDING_TABLE_MODIFY_PS  (1 << 10)
 
 #define CMD_VERTEX_BUFFER             0x7808
 # define BRW_VB0_INDEX_SHIFT           27
index d6eb6162df901fe0d3213cf88544ada2dd27b0b4..7d9e793ff2fa12466f801583efbcc52802b2fa23 100644 (file)
@@ -136,6 +136,41 @@ const struct brw_tracked_state brw_binding_table_pointers = {
    .emit = upload_binding_table_pointers,
 };
 
+/**
+ * Upload the binding table pointers, which point each stage's array of surface
+ * state pointers.
+ *
+ * The binding table pointers are relative to the surface state base address,
+ * which is 0.
+ */
+static void upload_gen6_binding_table_pointers(struct brw_context *brw)
+{
+   struct intel_context *intel = &brw->intel;
+
+   BEGIN_BATCH(4);
+   OUT_BATCH(CMD_BINDING_TABLE_PTRS << 16 |
+            GEN6_BINDING_TABLE_MODIFY_VS |
+            GEN6_BINDING_TABLE_MODIFY_GS |
+            GEN6_BINDING_TABLE_MODIFY_PS |
+            (4 - 2));
+   if (brw->vs.bind_bo != NULL)
+      OUT_RELOC(brw->vs.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* vs */
+   else
+      OUT_BATCH(0);
+   OUT_BATCH(0); /* gs */
+   OUT_RELOC(brw->wm.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* wm/ps */
+   ADVANCE_BATCH();
+}
+
+const struct brw_tracked_state gen6_binding_table_pointers = {
+   .dirty = {
+      .mesa = 0,
+      .brw = BRW_NEW_BATCH,
+      .cache = CACHE_NEW_SURF_BIND,
+   },
+   .prepare = prepare_binding_table_pointers,
+   .emit = upload_gen6_binding_table_pointers,
+};
 
 /**
  * Upload pointers to the per-stage state.
index 536fe8b249bc06e268ae5e225e83786c79259816..a24a02100c00fd6cb179935cdffda4371fc06b5a 100644 (file)
@@ -90,6 +90,7 @@ const struct brw_tracked_state brw_drawing_rect;
 const struct brw_tracked_state brw_indices;
 const struct brw_tracked_state brw_vertices;
 const struct brw_tracked_state brw_index_buffer;
+const struct brw_tracked_state gen6_binding_table_pointers;
 
 /**
  * Use same key for WM and VS surfaces.