Mesa (main): zink: align pipe_resource and sampler_view allocations to cachelines
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 19 02:56:40 UTC 2021
Module: Mesa
Branch: main
Commit: 86b24fba05b940ccae9b15aa89a7361a9ea92a30
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=86b24fba05b940ccae9b15aa89a7361a9ea92a30
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Oct 18 10:54:58 2021 -0400
zink: align pipe_resource and sampler_view allocations to cachelines
this eliminates false sharing for atomics
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13431>
---
src/gallium/drivers/zink/zink_context.c | 6 +++---
src/gallium/drivers/zink/zink_resource.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 8ba86e6f851..7083d2835aa 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -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
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index d98ecc2924c..b403bb88864 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -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;
}
More information about the mesa-commit
mailing list