Normally, the CS will will just consume the binding table pointer commands
as pipelined state. When the RS is enabled however, the RS flushes whatever
edited surface state entries of our on-chip binding table to the binding
table pool before passing the command on to the CS.

Note that the the binding table pointer offset is relative to the binding table
pool base address when resource streamer instead of the surface state base 
address.

In addition, 3DSTATE_BINDING_TABLE_POINTERS_* expects btp offsets of up to 64k 
when
resource streamer hardware binding tables are enabled. However the bt entry 
within
the command only allows until 32k. Therefore, ensure that offset fits within the
highest bit of the command.

Signed-off-by: Abdiel Janulgue <[email protected]>
---
 src/mesa/drivers/dri/i965/brw_binding_tables.c | 3 ++-
 src/mesa/drivers/dri/i965/gen7_blorp.cpp       | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index d97b3d9..03e7a4a 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -106,7 +106,8 @@ brw_upload_binding_table(struct brw_context *brw,
 
       BEGIN_BATCH(2);
       OUT_BATCH(packet_name << 16 | (2 - 2));
-      OUT_BATCH(stage_state->bind_bo_offset);
+      OUT_BATCH(brw->hw_bt_pool.bo ? stage_state->bind_bo_offset >> 1
+                : stage_state->bind_bo_offset);
       ADVANCE_BATCH();
 
       if (brw->has_resource_streamer)
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 3d5c7df..f6fb904 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -560,7 +560,9 @@ gen7_blorp_emit_binding_table_pointers_ps(struct 
brw_context *brw,
 {
    BEGIN_BATCH(2);
    OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS_PS << 16 | (2 - 2));
-   OUT_BATCH(wm_bind_bo_offset);
+   /* For RS: fit maximum 64k binding table offset within high bits */
+   OUT_BATCH(brw->hw_bt_pool.bo ? wm_bind_bo_offset >> 1
+             : wm_bind_bo_offset);
    ADVANCE_BATCH();
 }
 
-- 
1.9.1

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to