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 (closed) Fixes: 2d8f28df ("panfrost: Replace resource shadowing flush") Signed-off-by: Alyssa Rosenzweig alyssa@collabora.com Reported-by: Mastodon, apparently