asahi: Assert that freed BOs have no pending writers
authorAsahi Lina <lina@asahilina.net>
Wed, 3 May 2023 06:40:33 +0000 (15:40 +0900)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 7 May 2023 13:10:37 +0000 (09:10 -0400)
This is just a sanity check, I haven't actually hit this case but if we
ever do something is very broken (e.g. BO refcounting bug).

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>

src/asahi/lib/agx_bo.c

index a58c2a2..3e9e608 100644 (file)
@@ -193,6 +193,8 @@ agx_bo_unreference(struct agx_bo *bo)
     * lock, let's make sure it's still not referenced before freeing it.
     */
    if (p_atomic_read(&bo->refcnt) == 0) {
+      assert(!bo->writer_syncobj);
+
       if (dev->debug & AGX_DBG_TRACE)
          agxdecode_track_free(bo);