From 7c1b7ded7a38df5eead29efc0bc0c76dc0fc83ee Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 8 Sep 2021 12:37:08 -0400 Subject: [PATCH] zink: add "nofallback" descriptor mode this disables lazy fallback and forces caching always Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_descriptors.c | 2 +- src/gallium/drivers/zink/zink_screen.c | 3 ++- src/gallium/drivers/zink/zink_screen.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index d45ec8e..6da7487 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -1434,7 +1434,7 @@ zink_descriptors_update(struct zink_context *ctx, bool is_compute) zds = zink_descriptor_set_get(ctx, h, is_compute, &cache_hit); if (cache_hit) { pdd_cached(pg)->cache_misses[h] = 0; - } else { + } else if (likely(zink_screen(ctx->base.screen)->descriptor_mode != ZINK_DESCRIPTOR_MODE_NOFALLBACK)) { if (++pdd_cached(pg)->cache_misses[h] == MAX_CACHE_MISSES) { const char *set_names[] = { "UBO", diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 02ac9cb..163977e 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -75,6 +75,7 @@ static const struct debug_named_value zink_descriptor_options[] = { { "auto", ZINK_DESCRIPTOR_MODE_AUTO, "Automatically detect best mode" }, { "lazy", ZINK_DESCRIPTOR_MODE_LAZY, "Don't cache, do least amount of updates" }, + { "nofallback", ZINK_DESCRIPTOR_MODE_NOFALLBACK, "Cache, never use lazy fallback" }, { "notemplates", ZINK_DESCRIPTOR_MODE_NOTEMPLATES, "Cache, but disable templated updates" }, DEBUG_NAMED_VALUE_END }; @@ -1769,7 +1770,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config) zink_debug = debug_get_option_zink_debug(); screen->descriptor_mode = debug_get_option_zink_descriptor_mode(); - if (util_bitcount(screen->descriptor_mode) > 1) { + if (screen->descriptor_mode > ZINK_DESCRIPTOR_MODE_NOTEMPLATES) { printf("Specify exactly one descriptor mode.\n"); abort(); } diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index f2514ad..07b3dc8 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -64,6 +64,7 @@ enum zink_descriptor_type; enum zink_descriptor_mode { ZINK_DESCRIPTOR_MODE_AUTO, ZINK_DESCRIPTOR_MODE_LAZY, + ZINK_DESCRIPTOR_MODE_NOFALLBACK, ZINK_DESCRIPTOR_MODE_NOTEMPLATES, }; -- 2.7.4