freedreno: add resource seqno
[mesa.git] / src / gallium / drivers / freedreno / freedreno_resource.c
index 4b23b6458576dcc91b6642fd719b85f1e849dcf4..759ae7d28ae6f4f4926178265c8dbf7747bbb154 100644 (file)
@@ -108,6 +108,7 @@ realloc_bo(struct fd_resource *rsc, uint32_t size)
                fd_bo_del(rsc->bo);
 
        rsc->bo = fd_bo_new(screen->dev, size, flags);
+       rsc->seqno = p_atomic_inc_return(&screen->rsc_seqno);
        util_range_set_empty(&rsc->valid_buffer_range);
        fd_bc_invalidate_resource(rsc, true);
 }
@@ -193,6 +194,7 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
        /* TODO valid_buffer_range?? */
        swap(rsc->bo,        shadow->bo);
        swap(rsc->write_batch,   shadow->write_batch);
+       rsc->seqno = p_atomic_inc_return(&ctx->screen->rsc_seqno);
 
        /* at this point, the newly created shadow buffer is not referenced
         * by any batches, but the existing rsc (probably) is.  We need to