mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 09:00:10 +01:00
radeonsi: align pipe_resource & sampler_view allocations to a cache line
It eliminates "False Sharing" for atomic operations. (see wikipedia) Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11618>
This commit is contained in:
parent
8c6e18bc51
commit
c85ce2531e
3 changed files with 11 additions and 13 deletions
|
|
@ -218,12 +218,12 @@ static void si_resource_destroy(struct pipe_screen *screen, struct pipe_resource
|
|||
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);
|
||||
FREE_CL(buffer);
|
||||
} else if (buf->flags & SI_RESOURCE_AUX_PLANE) {
|
||||
struct si_auxiliary_texture *tex = (struct si_auxiliary_texture *)buf;
|
||||
|
||||
radeon_bo_reference(((struct si_screen*)screen)->ws, &tex->buffer, NULL);
|
||||
FREE(tex);
|
||||
FREE_CL(tex);
|
||||
} else {
|
||||
struct si_texture *tex = (struct si_texture *)buf;
|
||||
struct si_resource *resource = &tex->buffer;
|
||||
|
|
@ -234,7 +234,7 @@ static void si_resource_destroy(struct pipe_screen *screen, struct pipe_resource
|
|||
si_resource_reference(&tex->cmask_buffer, NULL);
|
||||
}
|
||||
radeon_bo_reference(((struct si_screen*)screen)->ws, &resource->buf, NULL);
|
||||
FREE(tex);
|
||||
FREE_CL(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -560,9 +560,7 @@ static void si_buffer_subdata(struct pipe_context *ctx, struct pipe_resource *bu
|
|||
static struct si_resource *si_alloc_buffer_struct(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ)
|
||||
{
|
||||
struct si_resource *buf;
|
||||
|
||||
buf = MALLOC_STRUCT(si_resource);
|
||||
struct si_resource *buf = MALLOC_STRUCT_CL(si_resource);
|
||||
|
||||
buf->b.b = *templ;
|
||||
buf->b.b.next = NULL;
|
||||
|
|
@ -594,7 +592,7 @@ static struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
|
|||
|
||||
if (!si_alloc_resource(sscreen, buf)) {
|
||||
threaded_resource_deinit(&buf->b.b);
|
||||
FREE(buf);
|
||||
FREE_CL(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -644,7 +642,7 @@ static struct pipe_resource *si_buffer_from_user_memory(struct pipe_screen *scre
|
|||
buf->buf = ws->buffer_from_ptr(ws, user_memory, templ->width0);
|
||||
if (!buf->buf) {
|
||||
threaded_resource_deinit(&buf->b.b);
|
||||
FREE(buf);
|
||||
FREE_CL(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4321,7 +4321,7 @@ struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx
|
|||
unsigned force_level)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
struct si_sampler_view *view = CALLOC_STRUCT(si_sampler_view);
|
||||
struct si_sampler_view *view = CALLOC_STRUCT_CL(si_sampler_view);
|
||||
struct si_texture *tex = (struct si_texture *)texture;
|
||||
unsigned base_level, first_level, last_level;
|
||||
unsigned char state_swizzle[4];
|
||||
|
|
@ -4455,7 +4455,7 @@ static void si_sampler_view_destroy(struct pipe_context *ctx, struct pipe_sample
|
|||
struct si_sampler_view *view = (struct si_sampler_view *)state;
|
||||
|
||||
pipe_resource_reference(&state->texture, NULL);
|
||||
FREE(view);
|
||||
FREE_CL(view);
|
||||
}
|
||||
|
||||
static bool wrap_mode_uses_border_color(unsigned wrap, bool linear_filter)
|
||||
|
|
|
|||
|
|
@ -896,7 +896,7 @@ static struct si_texture *si_texture_create_object(struct pipe_screen *screen,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tex = CALLOC_STRUCT(si_texture);
|
||||
tex = CALLOC_STRUCT_CL(si_texture);
|
||||
if (!tex)
|
||||
goto error;
|
||||
|
||||
|
|
@ -1129,7 +1129,7 @@ static struct si_texture *si_texture_create_object(struct pipe_screen *screen,
|
|||
return tex;
|
||||
|
||||
error:
|
||||
FREE(tex);
|
||||
FREE_CL(tex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1584,7 +1584,7 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
|
|||
return NULL;
|
||||
|
||||
if (whandle->plane >= util_format_get_num_planes(whandle->format)) {
|
||||
struct si_auxiliary_texture *tex = CALLOC_STRUCT(si_auxiliary_texture);
|
||||
struct si_auxiliary_texture *tex = CALLOC_STRUCT_CL(si_auxiliary_texture);
|
||||
if (!tex)
|
||||
return NULL;
|
||||
tex->b.b = *templ;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue