iris: Drop 'old_address' parameter from iris_rebind_buffer
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 31 Oct 2019 16:41:49 +0000 (09:41 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 25 Nov 2019 23:54:54 +0000 (15:54 -0800)
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
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_state.c

index b83582658f33495538e5ad9a02e83bcca5860a9a..b81cd30441a33d0fd2a6c181c34b2742b8564f76 100644 (file)
@@ -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);
index df1bf0f745126258d13245a927976e3d269ffe42..296d99ed810b7dc5e2ffcf7a9ac7318aeb0b1810 100644 (file)
@@ -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);
 
index 4f615ee906089ca46a2ebc7d17674b8ba904d040..37f1ae26c1717189e0dd63c59570a5580e98a146 100644 (file)
@@ -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;
          }
       }