Module: Mesa
Branch: staging/22.3
Commit: 3e4424944f65624702b0c0d9cc457f76ff0cad0f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e4424944f65624702b0c0d9cc457f76ff0cad0f

Author: Lucas Stach <[email protected]>
Date:   Thu Jan 26 19:08:14 2023 +0100

etnaviv: drm: fix check if BO is on a deferred destroy list

list_is_linked() isn't the right function to use in order to check if
the BO is on a cache bucket or the zombie list, as this checks if the
next pointer of the list isn't NULL. This is always the case with the
BO list item as it's always initialized, so the next pointer points to
the list head itself when the BO isn't on any list.

Use list_is_empty() to check if the BO is actually linked into one
of the deferred destroy lists.

Fixes: 1b1f8592c03c ("etnaviv: drm: properly handle reviving BOs via a lookup")
Signed-off-by: Lucas Stach <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20940>
(cherry picked from commit 196882a1477a69ba1593db8bdaaf6726fe914fca)

---

 .pick_status.json            | 2 +-
 src/etnaviv/drm/etnaviv_bo.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 7289d4b8f1e..203cbc7af28 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
         "description": "etnaviv: drm: fix check if BO is on a deferred destroy 
list",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "1b1f8592c03c7e98b7baf89cb4d012bb7af546ac"
     },
diff --git a/src/etnaviv/drm/etnaviv_bo.c b/src/etnaviv/drm/etnaviv_bo.c
index d790823bcb7..aae81a015b1 100644
--- a/src/etnaviv/drm/etnaviv_bo.c
+++ b/src/etnaviv/drm/etnaviv_bo.c
@@ -138,8 +138,8 @@ static struct etna_bo *lookup_bo(void *tbl, uint32_t handle)
                /* found, incr refcnt and return: */
                bo = etna_bo_ref(entry->data);
 
-               /* don't break the bucket if this bo was found in one */
-               if (list_is_linked(&bo->list)) {
+               /* don't break the bucket/zombie list if this bo was found in 
one */
+               if (!list_is_empty(&bo->list)) {
                        VG_BO_OBTAIN(bo);
                        etna_device_ref(bo->dev);
                        list_delinit(&bo->list);

Reply via email to