mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 17:20:21 +01:00
tc: fix usage wrapping in busy test
un-wrapping requires adding INT8_MAX (not INT8_MAX-1) because e.g.,
the cases of batch_generation=126 and batch_generation=0 are not the same
also fix a stale comment
Fixes: b89e0fa226 ("tc: rework resource usage tracking to be lighter")
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36069>
This commit is contained in:
parent
e386680ab0
commit
94f42bb201
1 changed files with 3 additions and 3 deletions
|
|
@ -377,12 +377,12 @@ tc_resource_batch_usage_test_busy(const struct threaded_context *tc, const struc
|
|||
|
||||
int diff;
|
||||
if (tbuf->last_batch_usage < tc->last_completed)
|
||||
/* account for wrapping */
|
||||
diff = (tbuf->last_batch_usage + (INT8_MAX - 1)) - tc->last_completed;
|
||||
/* account for wrapping: un-wrap the resource's usage */
|
||||
diff = (tbuf->last_batch_usage + INT8_MAX) - tc->last_completed;
|
||||
else
|
||||
diff = tbuf->last_batch_usage - tc->last_completed;
|
||||
|
||||
/* if diff is positive, then batch usage has completed: resource is not busy */
|
||||
/* if diff is positive, then batch usage has not completed: resource is busy */
|
||||
return diff > 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue