zink: stop using atomics to check fence submit/complete

this isn't actually achieving anything since reading a "wrong" value
here isn't harmful

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37068>
This commit is contained in:
Mike Blumenkrantz 2025-08-26 13:50:46 -04:00 committed by Marge Bot
parent d1f8cd54f4
commit ffa5518c45
2 changed files with 4 additions and 5 deletions

View file

@ -450,10 +450,9 @@ find_completed_batch_state(struct zink_context *ctx)
/* states are stored sequentially, so if the first one doesn't work, none of them will */
for (struct zink_batch_state *i = ctx->batch_states, *j = i ? i->next : NULL; i; i = j, j = j ? j->next : NULL) {
/* only a submitted state can be reused */
if (p_atomic_read(&i->fence.submitted) &&
if (i->fence.submitted &&
/* a submitted state must have completed before it can be reused */
(zink_screen_check_last_finished(screen, i->fence.batch_id) ||
p_atomic_read(&i->fence.completed))) {
(zink_screen_check_last_finished(screen, i->fence.batch_id) || i->fence.completed)) {
pop_batch_state(ctx);
reset_batch_state_ctx(ctx, i);
simple_mtx_lock(&screen->active_batch_states_lock);

View file

@ -132,7 +132,7 @@ fence_wait(struct zink_screen *screen, struct zink_fence *fence, uint64_t timeou
struct zink_batch_state *bs = zink_batch_state(fence);
if (screen->device_lost)
return true;
if (p_atomic_read(&fence->completed))
if (fence->completed)
return true;
if (screen->threaded_submit) {
@ -147,7 +147,7 @@ fence_wait(struct zink_screen *screen, struct zink_fence *fence, uint64_t timeou
bool success = zink_screen_timeline_wait(screen, fence->batch_id, timeout_ns);
if (success) {
p_atomic_set(&fence->completed, true);
fence->completed = true;
bs->usage.usage = 0;
zink_screen_update_last_finished(screen, fence->batch_id);
}