mesa: don't wraparound st_context::work_counter

st->release_counter is initialized to 0, so if we happen to call
st_add_releasebuf with a non-NULL releasebuf when st->work_counter
is 0 due to wraparound in st_context_add_work, we might end up never
calling st_prune_releasebufs.

Since st_context_add_work and st_add_releasebuf both use work_counter
as a "some work was done" and don't care about the actual value, we
can remove the wraparound which will fix the buffer not being released
issue.

Fixes: b3133e250e ("gallium: add pipe_context::resource_release to eliminate buffer refcounting")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14955
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14499
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40168>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2026-03-02 11:30:43 +01:00
parent 8a4d8d490b
commit 10d32feae8

View file

@ -545,7 +545,6 @@ st_context_add_work(struct st_context *st)
* performance.
*/
if (unlikely(++st->work_counter % 512 == 0)) {
st->work_counter = 0;
if (!st->thread_scheduler_disabled)
st_context_apply_scheduler_policy(st);
}