v3dv: implement interaction of queries with multiview

When multiview is enabled, queries must begin and end in the
same subpass and N consecutive queries are implicitly used,
where N is the number of views enabled in the subpass.
Implementations decide how results are split across queries.

In our case, only one query is really used, but we still need
to flag all N queries as available by the time we flag the one
we use so that the application doesn't receive unexpected errors
when trying to retrieve values from them.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12034>
This commit is contained in:
Iago Toral Quiroga
2021-07-23 14:49:05 +02:00
committed by Marge Bot
parent 374215de1a
commit c19dcec604
3 changed files with 54 additions and 8 deletions
+13 -7
View File
@@ -198,9 +198,11 @@ static VkResult
handle_end_query_cpu_job(struct v3dv_job *job)
{
struct v3dv_end_query_cpu_job_info *info = &job->cpu.query_end;
assert(info->query < info->pool->query_count);
struct v3dv_query *query = &info->pool->queries[info->query];
query->maybe_available = true;
for (uint32_t i = 0; i < info->count; i++) {
assert(info->query + i < info->pool->query_count);
struct v3dv_query *query = &info->pool->queries[info->query + i];
query->maybe_available = true;
}
return VK_SUCCESS;
}
@@ -452,10 +454,14 @@ handle_timestamp_query_cpu_job(struct v3dv_job *job)
/* Compute timestamp */
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
assert(info->query < info->pool->query_count);
struct v3dv_query *query = &info->pool->queries[info->query];
query->maybe_available = true;
query->value = t.tv_sec * 1000000000ull + t.tv_nsec;
for (uint32_t i = 0; i < info->count; i++) {
assert(info->query + i < info->pool->query_count);
struct v3dv_query *query = &info->pool->queries[info->query + i];
query->maybe_available = true;
if (i == 0)
query->value = t.tv_sec * 1000000000ull + t.tv_nsec;
}
return VK_SUCCESS;
}