From eec8afec25084e309bc59ecf28e9349c5488c490 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Fri, 10 Dec 2021 23:55:35 +0100 Subject: [PATCH] etnaviv: drm: properly handle reviving BOs via a lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Guido Günther Reviewed-by: Christian Gmeiner Part-of: (cherry picked from commit 1b1f8592c03c7e98b7baf89cb4d012bb7af546ac) --- .pick_status.json | 2 +- src/etnaviv/drm/etnaviv_bo.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index dddbf7baa7e..98798ce59a4 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -940,7 +940,7 @@ "description": "etnaviv: drm: properly handle reviving BOs via a lookup", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c index 86c0e9afb4f..9372808b8f2 100644 --- a/src/etnaviv/drm/etnaviv_bo.c +++ b/src/etnaviv/drm/etnaviv_bo.c @@ -86,7 +86,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;