zink: add "nofallback" descriptor mode
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 8 Sep 2021 16:37:08 +0000 (12:37 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sun, 12 Sep 2021 23:58:48 +0000 (23:58 +0000)
this disables lazy fallback and forces caching always

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12783>

src/gallium/drivers/zink/zink_descriptors.c
src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_screen.h

index d45ec8e..6da7487 100644 (file)
@@ -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",
index 02ac9cb..163977e 100644 (file)
@@ -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();
    }
index f2514ad..07b3dc8 100644 (file)
@@ -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,
 };