nvk: Move report offset to reports_start for nvk_CmdCopyQueryPoolResults

That remove the need of a special case for timestamp and will allow some
simplification for MME copies.

Signed-off-by: Mary Guillemard <mary@mary.zone>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
This commit is contained in:
Mary Guillemard 2026-05-04 19:06:30 +02:00
parent 5ae92173b1
commit c6e9dd8af6
3 changed files with 8 additions and 17 deletions

View file

@ -21,22 +21,12 @@ nvk_copy_queries(uint64_t pool_addr, uint available_stride,
bool write_results = available || (flags & VK_QUERY_RESULT_PARTIAL_BIT);
uint64_t report_offs = reports_start + (uint64_t)query * (uint64_t)query_stride;
global struct nvk_query_report *report =
(global void *)(pool_addr + report_offs);
global uint64_t *report = (global uint64_t *)(pool_addr + report_offs);
uint64_t dst_offset = dst_stride * (uint64_t)i;
if (flags & NVK_QUERY_IS_TIMESTAMP) {
/* Timestamp queries are the only ones use a single report */
if (write_results) {
vk_write_query(dst_addr + dst_offset, 0, flags, report->timestamp);
}
} else {
if (write_results) {
for (uint r = 0; r < report_count; ++r) {
vk_write_query(dst_addr + dst_offset, r, flags, report[r].value);
}
}
for (uint r = 0; r < report_count; ++r) {
vk_write_query(dst_addr + dst_offset, r, flags, report[r * 2]);
}
if (flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) {

View file

@ -6,8 +6,6 @@
#include "compiler/libcl/libcl.h"
#define NVK_QUERY_IS_TIMESTAMP 0x80000000u
struct nvk_query_report {
uint64_t value;
uint64_t timestamp;

View file

@ -1015,13 +1015,16 @@ nvk_meta_copy_query_pool_results(struct nvk_cmd_buffer *cmd,
return;
}
uint64_t reports_start = pool->reports_start;
if (pool->vk.query_type == VK_QUERY_TYPE_TIMESTAMP)
flags |= NVK_QUERY_IS_TIMESTAMP;
reports_start += offsetof(struct nvk_query_report, timestamp);
else
reports_start += offsetof(struct nvk_query_report, value);
const struct nvk_copy_query_push push = {
.pool_addr = pool->mem->va->addr,
.available_stride = nvk_query_available_stride_B(pool),
.reports_start = pool->reports_start,
.reports_start = reports_start,
.report_count = vk_query_pool_report_count(&pool->vk),
.query_stride = pool->query_stride,
.first_query = first_query,