From 6c2e7797f55ea9e31ccbd2c5a45e5c8983d619ab Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 1 Aug 2022 17:49:39 +0300 Subject: [PATCH] anv: tweak performance query timeout based on number of passes This avoids device lost events when we replay a command buffer 1k times on DG2. Signed-off-by: Lionel Landwerlin Reviewed-by: Ivan Briano Part-of: --- src/intel/vulkan/genX_query.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c index f851d61d21f..f70b6d5ec27 100644 --- a/src/intel/vulkan/genX_query.c +++ b/src/intel/vulkan/genX_query.c @@ -415,7 +415,19 @@ static VkResult wait_for_available(struct anv_device *device, struct anv_query_pool *pool, uint32_t query) { - uint64_t abs_timeout_ns = os_time_get_absolute_timeout(2 * NSEC_PER_SEC); + /* By default we leave a 2s timeout before declaring the device lost. */ + uint64_t rel_timeout = 2 * NSEC_PER_SEC; + if (pool->type == VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR) { + /* With performance queries, there is an additional 500us reconfiguration + * time in i915. + */ + rel_timeout += 500 * 1000; + /* Additionally a command buffer can be replayed N times to gather data + * for each of the metric sets to capture all the counters requested. + */ + rel_timeout *= pool->n_passes; + } + uint64_t abs_timeout_ns = os_time_get_absolute_timeout(rel_timeout); while (os_time_get_nano() < abs_timeout_ns) { if (query_is_available(pool, query))