r600: fix refcnt imbalance related to atomic_buffer_state

Indeed, these references are not freed.

For instance, this issue is triggered on an evergreen card with
"piglit/bin/shader_runner tests/spec/arb_shader_atomic_counter_ops/execution/all_touch_test.shader_test -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Fixes: 06993e4ee3 ("r600: add support for hw atomic counters. (v3)")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22798>
This commit is contained in:
Patrick Lerda 2023-04-22 13:18:58 +02:00 committed by Marge Bot
parent 0937a02d96
commit 4ca8be82d5

View file

@ -130,6 +130,16 @@ static void r600_destroy_context(struct pipe_context *context)
r600_resource_reference(&rctx->last_trace_buf, NULL);
radeon_clear_saved_cs(&rctx->last_gfx);
switch (rctx->b.gfx_level) {
case EVERGREEN:
case CAYMAN:
for (i = 0; i < EG_MAX_ATOMIC_BUFFERS; ++i)
pipe_resource_reference(&rctx->atomic_buffer_state.buffer[i].buffer, NULL);
break;
default:
break;
}
FREE(rctx);
}