From 4c1f81ad6220db86f49f33e034764db37523425e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 31 Oct 2019 09:41:49 -0700 Subject: [PATCH] iris: Drop 'old_address' parameter from iris_rebind_buffer We can just compare the VERTEX_BUFFER_STATE address field to the current BO's address. When calling rebind, we've already updated the resource to the new buffer, but the state will have the old address. --- src/gallium/drivers/iris/iris_context.h | 3 +-- src/gallium/drivers/iris/iris_resource.c | 2 +- src/gallium/drivers/iris/iris_state.c | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index b83582658f3..b81cd30441a 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -432,8 +432,7 @@ struct iris_vtable { struct iris_batch *batch, const struct pipe_grid_info *grid); void (*rebind_buffer)(struct iris_context *ice, - struct iris_resource *res, - uint64_t old_address); + struct iris_resource *res); void (*resolve_conditional_render)(struct iris_context *ice); void (*load_register_reg32)(struct iris_batch *batch, uint32_t dst, uint32_t src); diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index df1bf0f7451..296d99ed810 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1265,7 +1265,7 @@ iris_invalidate_resource(struct pipe_context *ctx, /* Rebind the buffer, replacing any state referring to the old BO's * address, and marking state dirty so it's reemitted. */ - ice->vtbl.rebind_buffer(ice, res, old_bo->gtt_offset); + ice->vtbl.rebind_buffer(ice, res); util_range_set_empty(&res->valid_buffer_range); diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 4f615ee9060..37f1ae26c17 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -6368,8 +6368,7 @@ iris_destroy_state(struct iris_context *ice) static void iris_rebind_buffer(struct iris_context *ice, - struct iris_resource *res, - uint64_t old_address) + struct iris_resource *res) { struct pipe_context *ctx = &ice->ctx; struct iris_screen *screen = (void *) ctx->screen; @@ -6398,9 +6397,10 @@ iris_rebind_buffer(struct iris_context *ice, STATIC_ASSERT(GENX(VERTEX_BUFFER_STATE_BufferStartingAddress_start) == 32); STATIC_ASSERT(GENX(VERTEX_BUFFER_STATE_BufferStartingAddress_bits) == 64); uint64_t *addr = (uint64_t *) &state->state[1]; + struct iris_bo *bo = iris_resource_bo(state->resource); - if (*addr == old_address + state->offset) { - *addr = res->bo->gtt_offset + state->offset; + if (*addr != bo->gtt_offset + state->offset) { + *addr = bo->gtt_offset + state->offset; ice->state.dirty |= IRIS_DIRTY_VERTEX_BUFFERS; } } -- 2.30.2