summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2021-12-10 23:55:35 +0100
committerMarge Bot <emma+marge@anholt.net>2022-01-10 16:49:00 +0000
commit1b1f8592c03c7e98b7baf89cb4d012bb7af546ac (patch)
tree744cf8876c7ba134f6dc5c29267d0c9c3f26be5f
parentccfd5054a4f729ece655ebb7924ed21a84aef7e5 (diff)
etnaviv: drm: properly handle reviving BOs via a lookup
If a BO is removed from a cache bucket list via a lookup, we must handle it in the same way as if a allocation from the cache happened: tell valgrind that the buffer is active again and take a reference to the etna_device, which the BO had given up while being in the cache. Cc: mesa-stable Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Guido Günther <agx@sigxcpu.org> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14159>
-rw-r--r--src/etnaviv/drm/etnaviv_bo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c
index 38b56953c32..5cbc088b241 100644
--- a/src/etnaviv/drm/etnaviv_bo.c
+++ b/src/etnaviv/drm/etnaviv_bo.c
@@ -87,7 +87,11 @@ static struct etna_bo *lookup_bo(void *tbl, uint32_t handle)
bo = etna_bo_ref(entry->data);
/* don't break the bucket if this bo was found in one */
- list_delinit(&bo->list);
+ if (list_is_linked(&bo->list)) {
+ VG_BO_OBTAIN(bo);
+ etna_device_ref(bo->dev);
+ list_delinit(&bo->list);
+ }
}
return bo;