[Mesa-dev] [PATCH 5/5] i965: Upload binding tables in hw-generated binding table format.

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Tue May 19 23:32:10 PDT 2015


When hardware-generated binding tables are enabled, use the hw-generated
binding table format when uploading binding table state.

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.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/brw_binding_tables.c | 27 ++++++++++++++++++++++++--
 1 file changed, 25 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 e0ee700..7c6780f 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -86,7 +86,12 @@ brw_upload_binding_table(struct brw_context *brw,
          return;
 
       stage_state->bind_bo_offset = 0;
-   } else {
+   }
+
+   /* If resource streamer is enabled, skip manual binding table upload */
+   if (!brw->hw_bt_pool.bo) {
+      /* CACHE_NEW_*_PROG */
+
       /* Upload a new binding table. */
       if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
          brw->vtbl.emit_buffer_surface_state(
@@ -103,15 +108,33 @@ brw_upload_binding_table(struct brw_context *brw,
       /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
       memcpy(bind, stage_state->surf_offset,
              prog_data->binding_table.size_bytes);
+   } else {
+      gen7_update_binding_table_from_array(brw, stage_state->stage,
+                                           stage_state->surf_offset,
+                                           prog_data->binding_table.size_bytes /
+                                           4);
    }
 
    brw->ctx.NewDriverState |= brw_new_binding_table;
 
    if (brw->gen >= 7) {
+
+      if (brw->has_resource_streamer)
+         stage_state->bind_bo_offset = brw->hw_bt_pool.next_offset;
+
       BEGIN_BATCH(2);
       OUT_BATCH(packet_name << 16 | (2 - 2));
-      OUT_BATCH(stage_state->bind_bo_offset);
+      /* Align SurfaceStateOffset[16:6] format to [15:5] PS Binding Table field
+       * when hw-generated binding table is enabled.
+       */
+      OUT_BATCH(brw->has_resource_streamer ?
+                (stage_state->bind_bo_offset >> 1) :
+                stage_state->bind_bo_offset);
       ADVANCE_BATCH();
+
+      if (brw->has_resource_streamer)
+         brw->hw_bt_pool.next_offset += ALIGN(prog_data->binding_table.size_bytes,
+                                              64);
    }
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list