mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
radeonsi: generate buffer_id_unique for u_threaded_context
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10813>
This commit is contained in:
parent
9dc7fff448
commit
9ba17ec21a
3 changed files with 13 additions and 1 deletions
|
|
@ -221,11 +221,13 @@ bool si_alloc_resource(struct si_screen *sscreen, struct si_resource *res)
|
|||
static void si_resource_destroy(struct pipe_screen *screen, struct pipe_resource *buf)
|
||||
{
|
||||
if (buf->target == PIPE_BUFFER) {
|
||||
struct si_screen *sscreen = (struct si_screen *)screen;
|
||||
struct si_resource *buffer = si_resource(buf);
|
||||
|
||||
threaded_resource_deinit(buf);
|
||||
util_range_destroy(&buffer->valid_buffer_range);
|
||||
radeon_bo_reference(((struct si_screen*)screen)->ws, &buffer->buf, NULL);
|
||||
util_idalloc_mt_free(&sscreen->buffer_ids, buffer->b.buffer_id_unique);
|
||||
FREE(buffer);
|
||||
} else if (buf->flags & SI_RESOURCE_AUX_PLANE) {
|
||||
struct si_auxiliary_texture *tex = (struct si_auxiliary_texture *)buf;
|
||||
|
|
@ -303,6 +305,8 @@ void si_replace_buffer_storage(struct pipe_context *ctx, struct pipe_resource *d
|
|||
assert(sdst->domains == ssrc->domains);
|
||||
|
||||
si_rebind_buffer(sctx, dst);
|
||||
|
||||
util_idalloc_mt_free(&sctx->screen->buffer_ids, delete_buffer_id);
|
||||
}
|
||||
|
||||
static void si_invalidate_resource(struct pipe_context *ctx, struct pipe_resource *resource)
|
||||
|
|
@ -608,6 +612,8 @@ static struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
|
|||
FREE(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf->b.buffer_id_unique = util_idalloc_mt_alloc(&sscreen->buffer_ids);
|
||||
return &buf->b.b;
|
||||
}
|
||||
|
||||
|
|
@ -660,7 +666,7 @@ static struct pipe_resource *si_buffer_from_user_memory(struct pipe_screen *scre
|
|||
buf->gpu_address = ws->buffer_get_virtual_address(buf->buf);
|
||||
buf->vram_usage_kb = 0;
|
||||
buf->gart_usage_kb = templ->width0 / 1024;
|
||||
|
||||
buf->b.buffer_id_unique = util_idalloc_mt_alloc(&sscreen->buffer_ids);
|
||||
return &buf->b.b;
|
||||
}
|
||||
|
||||
|
|
@ -694,6 +700,7 @@ struct pipe_resource *si_buffer_from_winsys_buffer(struct pipe_screen *screen,
|
|||
res->flags |= RADEON_FLAG_SPARSE;
|
||||
}
|
||||
|
||||
res->b.buffer_id_unique = util_idalloc_mt_alloc(&sscreen->buffer_ids);
|
||||
return &res->b.b;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -876,6 +876,8 @@ static void si_destroy_screen(struct pipe_screen *pscreen)
|
|||
|
||||
disk_cache_destroy(sscreen->disk_shader_cache);
|
||||
util_live_shader_cache_deinit(&sscreen->live_shader_cache);
|
||||
util_idalloc_mt_fini(&sscreen->buffer_ids);
|
||||
|
||||
sscreen->ws->destroy(sscreen->ws);
|
||||
FREE(sscreen);
|
||||
}
|
||||
|
|
@ -1027,6 +1029,7 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
util_idalloc_mt_init_tc(&sscreen->buffer_ids);
|
||||
|
||||
/* Set functions first. */
|
||||
sscreen->b.context_create = si_pipe_create_context;
|
||||
|
|
|
|||
|
|
@ -666,6 +666,8 @@ struct si_screen {
|
|||
unsigned ps_wave_size;
|
||||
unsigned ge_wave_size;
|
||||
unsigned ngg_subgroup_size;
|
||||
|
||||
struct util_idalloc_mt buffer_ids;
|
||||
};
|
||||
|
||||
struct si_sampler_view {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue