freedreno: add resource seqno

Intended to be something more compact than a 64b pointer, which could be
used as a key into hashtables.  Prep work for texture state objects.

Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Rob Clark
2018-10-12 09:24:21 -04:00
parent abcdf5627a
commit e8606b11dd
4 changed files with 11 additions and 3 deletions
@@ -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
@@ -95,6 +95,9 @@ struct fd_resource {
*/
uint32_t bc_batch_mask;
/* Sequence # incremented each time bo changes: */
uint16_t seqno;
unsigned tile_mode : 2;
unsigned preferred_tile_mode : 2;
@@ -95,6 +95,8 @@ struct fd_screen {
struct fd_batch_cache batch_cache;
bool reorder;
uint16_t rsc_seqno;
};
static inline struct fd_screen *
@@ -117,9 +117,10 @@ fd_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
void
fd_texture_init(struct pipe_context *pctx)
{
pctx->delete_sampler_state = fd_sampler_state_delete;
pctx->sampler_view_destroy = fd_sampler_view_destroy;
if (!pctx->delete_sampler_state)
pctx->delete_sampler_state = fd_sampler_state_delete;
if (!pctx->sampler_view_destroy)
pctx->sampler_view_destroy = fd_sampler_view_destroy;
}
/* helper for setting up border-color buffer for a3xx/a4xx: */