Mesa (master): zink: remove framebuffer cache
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 22:07:27 UTC 2020
Module: Mesa
Branch: master
Commit: d3f0022a43a726af60bcd541162f8005610ba3ff
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3f0022a43a726af60bcd541162f8005610ba3ff
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Apr 27 12:48:08 2020 -0400
zink: remove framebuffer cache
this can only match when re-rendering identical frames, which is not a
typical case. the lack of cache eviction also leads to memory ballooning.
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4768>
---
src/gallium/drivers/zink/zink_context.c | 36 ++++-----------------------------
src/gallium/drivers/zink/zink_context.h | 1 -
2 files changed, 4 insertions(+), 33 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index e4343244894..32a0a1f82e6 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -515,7 +515,7 @@ get_render_pass(struct zink_context *ctx)
}
static struct zink_framebuffer *
-get_framebuffer(struct zink_context *ctx)
+create_framebuffer(struct zink_context *ctx)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
@@ -536,16 +536,7 @@ get_framebuffer(struct zink_context *ctx)
state.height = ctx->fb_state.height;
state.layers = MAX2(ctx->fb_state.layers, 1);
- struct hash_entry *entry = _mesa_hash_table_search(ctx->framebuffer_cache,
- &state);
- if (!entry) {
- struct zink_framebuffer *fb = zink_create_framebuffer(screen, &state);
- entry = _mesa_hash_table_insert(ctx->framebuffer_cache, &state, fb);
- if (!entry)
- return NULL;
- }
-
- return entry->data;
+ return zink_create_framebuffer(screen, &state);
}
void
@@ -647,7 +638,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
util_copy_framebuffer_state(&ctx->fb_state, state);
- struct zink_framebuffer *fb = get_framebuffer(ctx);
+ struct zink_framebuffer *fb = create_framebuffer(ctx);
zink_framebuffer_reference(screen, &ctx->framebuffer, fb);
zink_render_pass_reference(screen, &ctx->gfx_pipeline_state.render_pass, fb->rp);
@@ -912,20 +903,6 @@ equals_render_pass_state(const void *a, const void *b)
return memcmp(a, b, sizeof(struct zink_render_pass_state)) == 0;
}
-static uint32_t
-hash_framebuffer_state(const void *key)
-{
- struct zink_framebuffer_state *s = (struct zink_framebuffer_state*)key;
- return _mesa_hash_data(key, sizeof(struct zink_framebuffer_state) + sizeof(s->attachments) * s->num_attachments);
-}
-
-static bool
-equals_framebuffer_state(const void *a, const void *b)
-{
- struct zink_framebuffer_state *s = (struct zink_framebuffer_state*)a;
- return memcmp(a, b, sizeof(struct zink_framebuffer_state) + sizeof(s->attachments) * s->num_attachments) == 0;
-}
-
static void
zink_flush(struct pipe_context *pctx,
struct pipe_fence_handle **pfence,
@@ -1165,12 +1142,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->render_pass_cache = _mesa_hash_table_create(NULL,
hash_render_pass_state,
equals_render_pass_state);
- ctx->framebuffer_cache = _mesa_hash_table_create(NULL,
- hash_framebuffer_state,
- equals_framebuffer_state);
-
- if (!ctx->program_cache || !ctx->render_pass_cache ||
- !ctx->framebuffer_cache)
+ if (!ctx->program_cache || !ctx->render_pass_cache)
goto fail;
const uint8_t data[] = { 0 };
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 3aeef31e3d3..76fa780b9f7 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -82,7 +82,6 @@ struct zink_context {
unsigned dirty_program : 1;
struct hash_table *render_pass_cache;
- struct hash_table *framebuffer_cache;
struct primconvert_context *primconvert;
More information about the mesa-commit
mailing list