blorp: Add a binding_table_offset_to_pointer helper

On Gen11+, we have a feature that requires us to shift binding table
offsets by 3.  This adds a helper which gives the driver a hook to do
this if it so chooses.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14507>
This commit is contained in:
Jason Ekstrand
2020-05-11 13:49:55 -05:00
committed by Marge Bot
parent 3c3a8f853d
commit a83c91a261
4 changed files with 31 additions and 3 deletions

View File

@@ -190,6 +190,13 @@ blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
} }
} }
static uint32_t
blorp_binding_table_offset_to_pointer(struct blorp_batch *batch,
uint32_t offset)
{
return offset;
}
static void * static void *
blorp_alloc_vertex_buffer(struct blorp_batch *blorp_batch, blorp_alloc_vertex_buffer(struct blorp_batch *blorp_batch,
uint32_t size, uint32_t size,

View File

@@ -177,6 +177,13 @@ blorp_alloc_binding_table(struct blorp_batch *blorp_batch,
batch->screen->vtbl.update_surface_base_address(batch, binder); batch->screen->vtbl.update_surface_base_address(batch, binder);
} }
static uint32_t
blorp_binding_table_offset_to_pointer(struct blorp_batch *batch,
uint32_t offset)
{
return offset;
}
static void * static void *
blorp_alloc_vertex_buffer(struct blorp_batch *blorp_batch, blorp_alloc_vertex_buffer(struct blorp_batch *blorp_batch,
uint32_t size, uint32_t size,

View File

@@ -90,6 +90,10 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
uint32_t *bt_offset, uint32_t *surface_offsets, uint32_t *bt_offset, uint32_t *surface_offsets,
void **surface_maps); void **surface_maps);
static uint32_t
blorp_binding_table_offset_to_pointer(struct blorp_batch *batch,
uint32_t offset);
static void static void
blorp_flush_range(struct blorp_batch *batch, void *start, size_t size); blorp_flush_range(struct blorp_batch *batch, void *start, size_t size);
@@ -1662,16 +1666,19 @@ blorp_emit_btp(struct blorp_batch *batch, uint32_t bind_offset)
blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_GS), bt); blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_GS), bt);
blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_PS), bt) { blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_PS), bt) {
bt.PointertoPSBindingTable = bind_offset; bt.PointertoPSBindingTable =
blorp_binding_table_offset_to_pointer(batch, bind_offset);
} }
#elif GFX_VER >= 6 #elif GFX_VER >= 6
blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS), bt) { blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS), bt) {
bt.PSBindingTableChange = true; bt.PSBindingTableChange = true;
bt.PointertoPSBindingTable = bind_offset; bt.PointertoPSBindingTable =
blorp_binding_table_offset_to_pointer(batch, bind_offset);
} }
#else #else
blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS), bt) { blorp_emit(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS), bt) {
bt.PointertoPSBindingTable = bind_offset; bt.PointertoPSBindingTable =
blorp_binding_table_offset_to_pointer(batch, bind_offset);
} }
#endif #endif
} }

View File

@@ -195,6 +195,13 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
} }
} }
static uint32_t
blorp_binding_table_offset_to_pointer(struct blorp_batch *batch,
uint32_t offset)
{
return offset;
}
static void * static void *
blorp_alloc_vertex_buffer(struct blorp_batch *batch, uint32_t size, blorp_alloc_vertex_buffer(struct blorp_batch *batch, uint32_t size,
struct blorp_address *addr) struct blorp_address *addr)