panfrost: Don't leak oversized transient allocations
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 15 Jul 2019 19:05:48 +0000 (12:05 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 15 Jul 2019 23:12:56 +0000 (16:12 -0700)
When we allocate them, we allocate with two references accidentally,
causing them to leak uncontrollably.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_allocate.c

index 9d78fab85d6c18ff1de900254fd96335b096f637..9e9565d60067ae98ad94838572cb6f4e5a208a88 100644 (file)
@@ -118,6 +118,10 @@ panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz)
                 /* Create a new BO and reference it */
                 bo = panfrost_drm_create_bo(screen, ALIGN_POT(sz, 4096), 0);
                 panfrost_job_add_bo(batch, bo);
+
+                /* Creating a BO adds a reference, and then the job adds a
+                 * second one. So we need to pop back one reference */
+                panfrost_bo_unreference(&screen->base, bo);
         }
 
         struct panfrost_transfer ret = {