anv/query: add query status report

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20782>
This commit is contained in:
Dave Airlie
2023-01-20 14:19:33 +10:00
committed by Marge Bot
parent 98c58a16ef
commit 76e8d015d8
2 changed files with 41 additions and 4 deletions
+6 -1
View File
@@ -2800,7 +2800,12 @@ void anv_GetPhysicalDeviceQueueFamilyProperties2(
properties->priorityCount = count;
break;
}
case VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_KHR: {
VkQueueFamilyQueryResultStatusPropertiesKHR *prop =
(VkQueueFamilyQueryResultStatusPropertiesKHR *)ext;
prop->queryResultStatusSupport = VK_TRUE;
break;
}
default:
anv_debug_ignored_stype(ext->sType);
}
+35 -3
View File
@@ -59,6 +59,18 @@ anv_query_address(struct anv_query_pool *pool, uint32_t query)
};
}
static void
emit_query_mi_flush_availability(struct anv_cmd_buffer *cmd_buffer,
struct anv_address addr,
bool available)
{
anv_batch_emit(&cmd_buffer->batch, GENX(MI_FLUSH_DW), flush) {
flush.PostSyncOperation = WriteImmediateData;
flush.Address = addr;
flush.ImmediateData = available;
}
}
VkResult genX(CreateQueryPool)(
VkDevice _device,
const VkQueryPoolCreateInfo* pCreateInfo,
@@ -172,6 +184,9 @@ VkResult genX(CreateQueryPool)(
break;
#endif
case VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR:
uint64s_per_slot = 1;
break;
default:
assert(!"Invalid query type");
}
@@ -473,7 +488,8 @@ VkResult genX(GetQueryPoolResults)(
pool->type == VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT ||
pool->type == VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR ||
pool->type == VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL ||
pool->type == VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT);
pool->type == VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT ||
pool->type == VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR);
if (vk_device_is_lost(&device->vk))
return VK_ERROR_DEVICE_LOST;
@@ -623,6 +639,14 @@ VkResult genX(GetQueryPoolResults)(
break;
}
case VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR:
if (!write_results)
break;
const uint32_t *query_data = query_slot(pool, firstQuery + i);
uint32_t result = available ? *query_data : 0;
cpu_write_query_result(pData, flags, idx, result);
break;
default:
unreachable("invalid pool type");
}
@@ -826,7 +850,10 @@ void genX(CmdResetQueryPool)(
emit_query_mi_availability(&b, anv_query_address(pool, firstQuery + i), false);
break;
}
case VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR:
for (uint32_t i = 0; i < queryCount; i++)
emit_query_mi_flush_availability(cmd_buffer, anv_query_address(pool, firstQuery + i), false);
break;
default:
unreachable("Unsupported query type");
}
@@ -1119,7 +1146,9 @@ void genX(CmdBeginQueryIndexedEXT)(
emit_perf_intel_query(cmd_buffer, pool, &b, query_addr, false);
break;
}
case VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR:
emit_query_mi_flush_availability(cmd_buffer, query_addr, false);
break;
default:
unreachable("");
}
@@ -1285,6 +1314,9 @@ void genX(CmdEndQueryIndexedEXT)(
emit_query_mi_availability(&b, query_addr, true);
break;
}
case VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR:
emit_query_mi_flush_availability(cmd_buffer, query_addr, true);
break;
default:
unreachable("");