zink: align pipe_resource and sampler_view allocations to cachelines

this eliminates false sharing for atomics

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13431>
This commit is contained in:
Mike Blumenkrantz 2021-10-18 10:54:58 -04:00 committed by Marge Bot
parent 89ed9ed400
commit 86b24fba05
2 changed files with 7 additions and 7 deletions

View File

@ -711,7 +711,7 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres,
{
struct zink_screen *screen = zink_screen(pctx->screen);
struct zink_resource *res = zink_resource(pres);
struct zink_sampler_view *sampler_view = CALLOC_STRUCT(zink_sampler_view);
struct zink_sampler_view *sampler_view = CALLOC_STRUCT_CL(zink_sampler_view);
bool err;
sampler_view->base = *state;
@ -766,7 +766,7 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres,
err = !sampler_view->buffer_view;
}
if (err) {
FREE(sampler_view);
FREE_CL(sampler_view);
return NULL;
}
return &sampler_view->base;
@ -798,7 +798,7 @@ zink_sampler_view_destroy(struct pipe_context *pctx,
zink_surface_reference(zink_screen(pctx->screen), &view->image_view, NULL);
}
pipe_resource_reference(&pview->texture, NULL);
FREE(view);
FREE_CL(view);
}
static void

View File

@ -121,7 +121,7 @@ zink_resource_destroy(struct pipe_screen *pscreen,
zink_resource_object_reference(screen, &res->obj, NULL);
zink_resource_object_reference(screen, &res->scanout_obj, NULL);
threaded_resource_deinit(pres);
FREE(res);
FREE_CL(res);
}
static VkImageAspectFlags
@ -735,14 +735,14 @@ resource_create(struct pipe_screen *pscreen,
const uint64_t *modifiers, int modifiers_count)
{
struct zink_screen *screen = zink_screen(pscreen);
struct zink_resource *res = CALLOC_STRUCT(zink_resource);
struct zink_resource *res = CALLOC_STRUCT_CL(zink_resource);
if (modifiers_count > 0) {
/* for rebinds */
res->modifiers_count = modifiers_count;
res->modifiers = mem_dup(modifiers, modifiers_count * sizeof(uint64_t));
if (!res->modifiers) {
FREE(res);
FREE_CL(res);
return NULL;
}
/* TODO: remove this when multi-plane modifiers are supported */
@ -772,7 +772,7 @@ resource_create(struct pipe_screen *pscreen,
res->obj = resource_object_create(screen, &templ2, whandle, &optimal_tiling, NULL, 0);
if (!res->obj) {
free(res->modifiers);
FREE(res);
FREE_CL(res);
return NULL;
}