panfrost: Fix reference counting with batch->resources
authorAlyssa Rosenzweig <alyssa@collabora.com>
Tue, 15 Nov 2022 16:16:15 +0000 (11:16 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 16 Nov 2022 15:20:33 +0000 (15:20 +0000)
commit42212a9bfdab8381beb9206b5d2551344c71d584
tree8883dedc1f4dc6dcec250ee5e85e204624d7d1c3
parentba9bdd5642aa933272708de380618dea74c98c60
panfrost: Fix reference counting with batch->resources

Refactor accesses to batch->resources to happen through safe helpers
that update the appropriate bookkeeping. This makes it obvious that (in
particular) reference counts are updated when they should be.

The functional change is that we are now correctly unreferencing
resources during shadowing, fixing a leak of shadowed resources.

Closes: #7362
Fixes: 2d8f28df731 ("panfrost: Replace resource shadowing flush")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reported-by: Mastodon, apparently
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19753>
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h