Revert "zink: remove descriptor-mode selection infrastructure"

this would've been in-use, but khronos changes while I was on vacation
blocked a merge

This reverts commit 3f371d4e94.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20489>
This commit is contained in:
Mike Blumenkrantz
2023-01-02 09:31:20 -05:00
parent 97f2b60833
commit 885e5a3571
3 changed files with 33 additions and 0 deletions

View File

@@ -249,6 +249,19 @@ are required to be supported
* :ext:`VK_KHR_draw_indirect_count`
Performance
-----------
If you notice poor performance and high CPU usage while running an application,
changing the descriptor manager may improve performance:
.. envvar:: ZINK_DESCRIPTORS <mode> ("auto")
``auto``
Automatically detect best mode. This is the default.
``lazy``
Attempt to use the least amount of CPU by binding descriptors opportunistically.
Debugging
---------

View File

@@ -89,6 +89,17 @@ uint32_t
zink_debug;
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" },
DEBUG_NAMED_VALUE_END
};
DEBUG_GET_ONCE_FLAGS_OPTION(zink_descriptor_mode, "ZINK_DESCRIPTORS", zink_descriptor_options, ZINK_DESCRIPTOR_MODE_AUTO)
enum zink_descriptor_mode zink_descriptor_mode;
static const char *
zink_get_vendor(struct pipe_screen *pscreen)
{
@@ -2465,6 +2476,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
screen->abort_on_hang = debug_get_bool_option("ZINK_HANG_ABORT", false);
zink_debug = debug_get_option_zink_debug();
zink_descriptor_mode = debug_get_option_zink_descriptor_mode();
screen->loader_lib = util_dl_open(VK_LIBNAME);
if (!screen->loader_lib)
@@ -2571,6 +2583,9 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_IMAGE] = 4;
screen->desc_set_id[ZINK_DESCRIPTOR_BINDLESS] = 5;
}
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_AUTO) {
zink_descriptor_mode = ZINK_DESCRIPTOR_MODE_LAZY;
}
if (screen->info.have_EXT_calibrated_timestamps && !check_have_device_time(screen))
goto fail;

View File

@@ -146,6 +146,11 @@ enum zink_descriptor_type {
ZINK_DESCRIPTOR_NON_BINDLESS_TYPES = ZINK_DESCRIPTOR_BASE_TYPES + 1, /**< for struct sizing */
};
enum zink_descriptor_mode {
ZINK_DESCRIPTOR_MODE_AUTO,
ZINK_DESCRIPTOR_MODE_LAZY,
};
/* indexing for descriptor template management */
enum zink_descriptor_size_index {
ZDS_INDEX_UBO,