diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc index d3343799634..b638f9c5890 100644 --- a/src/freedreno/vulkan/tu_device.cc +++ b/src/freedreno/vulkan/tu_device.cc @@ -629,7 +629,12 @@ tu_physical_device_init(struct tu_physical_device *device, device->ccu_offset_bypass = depth_cache_size; device->ccu_offset_gmem = device->gmem_size - color_cache_size; - device->usable_sets = device->reserved_set_idx = device->info->a6xx.max_sets - 1; + if (instance->reserve_descriptor_set) { + device->usable_sets = device->reserved_set_idx = device->info->a6xx.max_sets - 1; + } else { + device->usable_sets = device->info->a6xx.max_sets; + device->reserved_set_idx = -1; + } break; } default: @@ -757,6 +762,7 @@ static const driOptionDescription tu_dri_options[] = { DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_DISABLE_CONSERVATIVE_LRZ(false) + DRI_CONF_TU_DONT_RESERVE_DESCRIPTOR_SET(false) DRI_CONF_SECTION_END }; @@ -773,6 +779,8 @@ tu_init_dri_options(struct tu_instance *instance) driQueryOptionb(&instance->dri_options, "vk_dont_care_as_load"); instance->conservative_lrz = !driQueryOptionb(&instance->dri_options, "disable_conservative_lrz"); + instance->reserve_descriptor_set = + !driQueryOptionb(&instance->dri_options, "tu_dont_reserve_descriptor_set"); } VKAPI_ATTR VkResult VKAPI_CALL diff --git a/src/freedreno/vulkan/tu_device.h b/src/freedreno/vulkan/tu_device.h index ad5ff44e13f..6c5de23f62c 100644 --- a/src/freedreno/vulkan/tu_device.h +++ b/src/freedreno/vulkan/tu_device.h @@ -147,6 +147,13 @@ struct tu_instance * suffer a performance loss with conservative LRZ. */ bool conservative_lrz; + + /* If to internally reserve a descriptor set for descriptor set + * dynamic offsets, a descriptor set can be freed at the cost of + * being unable to use the feature. As it is a part of the Vulkan + * core, this is enabled by default. + */ + bool reserve_descriptor_set; }; VK_DEFINE_HANDLE_CASTS(tu_instance, vk.base, VkInstance, VK_OBJECT_TYPE_INSTANCE) diff --git a/src/util/driconf.h b/src/util/driconf.h index 8d7f2eb57a5..dca737c977e 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -574,6 +574,14 @@ DRI_CONF_OPT_B(disable_conservative_lrz, def, \ "Disable conservative LRZ") +/** + * \brief Turnip specific configuration options + */ + +#define DRI_CONF_TU_DONT_RESERVE_DESCRIPTOR_SET(def) \ + DRI_CONF_OPT_B(tu_dont_reserve_descriptor_set, def, \ + "Don't internally reserve one of the HW descriptor sets for descriptor set dynamic offset support, this frees up an extra descriptor set at the cost of that feature") + /** * \brief venus specific configuration options */