mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
zink: split out query suspending into util function
no functional changes Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15227>
This commit is contained in:
parent
5aecec48ee
commit
0cb3ae949c
1 changed files with 20 additions and 14 deletions
|
|
@ -818,29 +818,35 @@ zink_get_query_result(struct pipe_context *pctx,
|
|||
return get_query_result(pctx, q, wait, result);
|
||||
}
|
||||
|
||||
static void
|
||||
suspend_query(struct zink_context *ctx, struct zink_query *query)
|
||||
{
|
||||
/* if a query isn't active here then we don't need to reactivate it on the next batch */
|
||||
if (query->active && !is_time_query(query))
|
||||
end_query(ctx, &ctx->batch, query);
|
||||
if (query->needs_update)
|
||||
update_qbo(ctx, query);
|
||||
/* do an implicit copy+reset if:
|
||||
* - query is being read from and >50% of pool is used
|
||||
* - >90% of pool is used
|
||||
*
|
||||
* this avoids overflow
|
||||
*/
|
||||
if ((query->last_start && query->curr_query > NUM_QUERIES / 2) || (query->curr_query > NUM_QUERIES * 0.9))
|
||||
reset_pool(ctx, &ctx->batch, query);
|
||||
}
|
||||
|
||||
void
|
||||
zink_suspend_queries(struct zink_context *ctx, struct zink_batch *batch)
|
||||
{
|
||||
set_foreach(batch->state->active_queries, entry) {
|
||||
struct zink_query *query = (void*)entry->key;
|
||||
/* if a query isn't active here then we don't need to reactivate it on the next batch */
|
||||
if (query->active && !is_time_query(query)) {
|
||||
end_query(ctx, batch, query);
|
||||
if (query->active && !is_time_query(query))
|
||||
/* the fence is going to steal the set off the batch, so we have to copy
|
||||
* the active queries onto a list
|
||||
*/
|
||||
list_addtail(&query->active_list, &ctx->suspended_queries);
|
||||
}
|
||||
if (query->needs_update)
|
||||
update_qbo(ctx, query);
|
||||
/* do an implicit copy+reset if:
|
||||
* - query is being read from and >50% of pool is used
|
||||
* - >90% of pool is used
|
||||
*
|
||||
* this avoids overflow
|
||||
*/
|
||||
if ((query->last_start && query->curr_query > NUM_QUERIES / 2) || (query->curr_query > NUM_QUERIES * 0.9))
|
||||
reset_pool(ctx, batch, query);
|
||||
suspend_query(ctx, query);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue