}
static unsigned
-decode_get_state_size(void *v_batch, uint32_t offset_from_base)
+decode_get_state_size(void *v_batch,
+ uint64_t address,
+ UNUSED uint64_t base_address)
{
struct iris_batch *batch = v_batch;
-
- /* The decoder gives us offsets from a base address, which is not great.
- * Binding tables are relative to surface state base address, and other
- * state is relative to dynamic state base address. These could alias,
- * but in practice it's unlikely because surface offsets are always in
- * the [0, 64K) range, and we assign dynamic state addresses starting at
- * the top of the 4GB range. We should fix this but it's likely good
- * enough for now.
- */
unsigned size = (uintptr_t)
- _mesa_hash_table_u64_search(batch->state_sizes, offset_from_base);
+ _mesa_hash_table_u64_search(batch->state_sizes, address);
return size;
}
struct iris_bo *bo = iris_resource_bo(*out_res);
iris_use_pinned_bo(batch, bo, false);
- *out_offset += iris_bo_offset_from_base_address(bo);
+ iris_record_state_size(batch->state_sizes,
+ bo->gtt_offset + *out_offset, size);
- iris_record_state_size(batch->state_sizes, *out_offset, size);
+ *out_offset += iris_bo_offset_from_base_address(bo);
return ptr;
}
return;
struct pipe_resource *res = shs->sampler_table.res;
- shs->sampler_table.offset +=
- iris_bo_offset_from_base_address(iris_resource_bo(res));
+ struct iris_bo *bo = iris_resource_bo(res);
+
+ iris_record_state_size(ice->state.sizes,
+ bo->gtt_offset + shs->sampler_table.offset, size);
- iris_record_state_size(ice->state.sizes, shs->sampler_table.offset, size);
+ shs->sampler_table.offset += iris_bo_offset_from_base_address(bo);
/* Make sure all land in the same BO */
iris_border_color_pool_reserve(ice, IRIS_MAX_TEXTURE_SAMPLERS);
struct gen_batch_decode_bo (*get_bo)(void *,
bool,
uint64_t),
- unsigned (*get_state_size)(void *, uint32_t),
+ unsigned (*get_state_size)(void *, uint64_t,
+ uint64_t),
void *user_data)
{
memset(ctx, 0, sizeof(*ctx));
static int
update_count(struct gen_batch_decode_ctx *ctx,
- uint32_t offset_from_dsba,
+ uint64_t address,
+ uint64_t base_address,
unsigned element_dwords,
unsigned guess)
{
unsigned size = 0;
if (ctx->get_state_size)
- size = ctx->get_state_size(ctx->user_data, offset_from_dsba);
+ size = ctx->get_state_size(ctx->user_data, address, base_address);
if (size > 0)
return size / (sizeof(uint32_t) * element_dwords);
return;
}
- if (count < 0)
- count = update_count(ctx, offset, 1, 8);
+ if (count < 0) {
+ count = update_count(ctx, ctx->surface_base + offset,
+ ctx->surface_base, 1, 8);
+ }
if (offset % 32 != 0 || offset >= UINT16_MAX) {
fprintf(ctx->fp, " invalid binding table pointer\n");
dump_samplers(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
{
struct gen_group *strct = gen_spec_find_struct(ctx->spec, "SAMPLER_STATE");
+ uint64_t state_addr = ctx->dynamic_base + offset;
- if (count < 0)
- count = update_count(ctx, offset, strct->dw_length, 4);
+ if (count < 0) {
+ count = update_count(ctx, state_addr, ctx->dynamic_base,
+ strct->dw_length, 4);
+ }
- uint64_t state_addr = ctx->dynamic_base + offset;
struct gen_batch_decode_bo bo = ctx_get_bo(ctx, true, state_addr);
const void *state_map = bo.map;
state = gen_spec_find_struct(ctx->spec, struct_type);
}
- count = update_count(ctx, state_offset, state->dw_length, count);
+ count = update_count(ctx, ctx->dynamic_base + state_offset,
+ ctx->dynamic_base, state->dw_length, count);
for (int i = 0; i < count; i++) {
fprintf(ctx->fp, "%s %d\n", struct_type, i);
*/
struct gen_batch_decode_bo (*get_bo)(void *user_data, bool ppgtt, uint64_t address);
unsigned (*get_state_size)(void *user_data,
- uint32_t offset_from_dynamic_state_base_addr);
+ uint64_t address,
+ uint64_t base_address);
void *user_data;
FILE *fp;
bool,
uint64_t),
- unsigned (*get_state_size)(void *, uint32_t),
+ unsigned (*get_state_size)(void *, uint64_t,
+ uint64_t),
void *user_data);
void gen_batch_decode_ctx_finish(struct gen_batch_decode_ctx *ctx);
}
static unsigned
-decode_get_state_size(void *v_brw, uint32_t offset_from_dsba)
+decode_get_state_size(void *v_brw, uint64_t address, uint64_t base_address)
{
struct brw_context *brw = v_brw;
struct intel_batchbuffer *batch = &brw->batch;
- unsigned size = (uintptr_t) _mesa_hash_table_u64_search(
- batch->state_batch_sizes, offset_from_dsba);
+ unsigned size = (uintptr_t)
+ _mesa_hash_table_u64_search(batch->state_batch_sizes,
+ address - base_address);
return size;
}