vkd3d: Add debug config to log resizable BAR allocations.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
710fa98918
commit
12066a2b67
|
@ -71,6 +71,7 @@ enum vkd3d_config_flags
|
||||||
VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE = 0x00000100,
|
VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE = 0x00000100,
|
||||||
VKD3D_CONFIG_FLAG_FORCE_MINIMUM_SUBGROUP_SIZE = 0x00000200,
|
VKD3D_CONFIG_FLAG_FORCE_MINIMUM_SUBGROUP_SIZE = 0x00000200,
|
||||||
VKD3D_CONFIG_FLAG_UPLOAD_HVV = 0x00000400,
|
VKD3D_CONFIG_FLAG_UPLOAD_HVV = 0x00000400,
|
||||||
|
VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET = 0x00000800,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);
|
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);
|
||||||
|
|
|
@ -501,6 +501,7 @@ static const struct vkd3d_debug_option vkd3d_config_options[] =
|
||||||
{"force_dsv_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE},
|
{"force_dsv_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE},
|
||||||
{"force_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_RTV_EXCLUSIVE_QUEUE | VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE},
|
{"force_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_RTV_EXCLUSIVE_QUEUE | VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE},
|
||||||
{"upload_hvv", VKD3D_CONFIG_FLAG_UPLOAD_HVV},
|
{"upload_hvv", VKD3D_CONFIG_FLAG_UPLOAD_HVV},
|
||||||
|
{"log_memory_budget", VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void vkd3d_config_flags_init_once(void)
|
static void vkd3d_config_flags_init_once(void)
|
||||||
|
|
|
@ -154,6 +154,11 @@ void vkd3d_free_device_memory(struct d3d12_device *device, const struct vkd3d_de
|
||||||
pthread_mutex_lock(&device->memory_info.budget_lock);
|
pthread_mutex_lock(&device->memory_info.budget_lock);
|
||||||
assert(*type_current >= allocation->size);
|
assert(*type_current >= allocation->size);
|
||||||
*type_current -= allocation->size;
|
*type_current -= allocation->size;
|
||||||
|
if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET)
|
||||||
|
{
|
||||||
|
INFO("Freeing memory of type %u, new total allocated size %"PRIu64" MiB.\n",
|
||||||
|
allocation->vk_memory_type, *type_current / (1024 * 1024));
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&device->memory_info.budget_lock);
|
pthread_mutex_unlock(&device->memory_info.budget_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,8 +203,11 @@ static HRESULT vkd3d_try_allocate_device_memory(struct d3d12_device *device,
|
||||||
pthread_mutex_lock(&memory_info->budget_lock);
|
pthread_mutex_lock(&memory_info->budget_lock);
|
||||||
if (*type_current + size > *type_budget)
|
if (*type_current + size > *type_budget)
|
||||||
{
|
{
|
||||||
WARN("Attempting to allocate from memory type %u, but exceeding fixed budget: %"PRIu64" + %"PRIu64" > %"PRIu64".\n",
|
if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET)
|
||||||
type_index, *type_current, size, *type_budget);
|
{
|
||||||
|
INFO("Attempting to allocate from memory type %u, but exceeding fixed budget: %"PRIu64" + %"PRIu64" > %"PRIu64".\n",
|
||||||
|
type_index, *type_current, size, *type_budget);
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&memory_info->budget_lock);
|
pthread_mutex_unlock(&memory_info->budget_lock);
|
||||||
|
|
||||||
/* If we're out of DEVICE budget, don't try other types. */
|
/* If we're out of DEVICE budget, don't try other types. */
|
||||||
|
@ -215,7 +223,14 @@ static HRESULT vkd3d_try_allocate_device_memory(struct d3d12_device *device,
|
||||||
if (budget_sensitive)
|
if (budget_sensitive)
|
||||||
{
|
{
|
||||||
if (vr == VK_SUCCESS)
|
if (vr == VK_SUCCESS)
|
||||||
|
{
|
||||||
*type_current += size;
|
*type_current += size;
|
||||||
|
if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET)
|
||||||
|
{
|
||||||
|
INFO("Allocated memory of type %u, new total allocated size %"PRIu64" MiB.\n",
|
||||||
|
type_index, *type_current / (1024 * 1024));
|
||||||
|
}
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&memory_info->budget_lock);
|
pthread_mutex_unlock(&memory_info->budget_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue