panfrost: Cleanup leak todos
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 17 May 2019 00:14:49 +0000 (00:14 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 17 May 2019 00:14:49 +0000 (00:14 +0000)
Many of these are now patched; one of them we patch here. Regardless,
this is one less thing to worry about in the code, I suppose.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_resource.c

index 635d0cfa44aa9f9e2cfc03c3c93e9cb6742d7fef..18cd6fe2c04e3dd3cbc45e37d3fd4d981a7f92d0 100644 (file)
@@ -1669,15 +1669,6 @@ panfrost_bind_vertex_elements_state(
         ctx->dirty |= PAN_DIRTY_VERTEX;
 }
 
-static void
-panfrost_delete_vertex_elements_state(struct pipe_context *pctx, void *hwcso)
-{
-        struct panfrost_vertex_state *so = (struct panfrost_vertex_state *) hwcso;
-        unsigned bytes = sizeof(struct mali_attr_meta) * so->num_elements;
-        DBG("Vertex elements delete leaks descriptor (%d bytes)\n", bytes);
-        free(hwcso);
-}
-
 static void *
 panfrost_create_shader_state(
         struct pipe_context *pctx,
@@ -1705,9 +1696,6 @@ panfrost_delete_shader_state(
                 DBG("Deleting TGSI shader leaks duplicated tokens\n");
         }
 
-        unsigned leak = cso->variant_count * sizeof(struct mali_shader_meta);
-        DBG("Deleting shader state leaks descriptors (%d bytes), and shader bytecode\n", leak);
-
         free(so);
 }
 
@@ -2567,7 +2555,7 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
 
         gallium->create_vertex_elements_state = panfrost_create_vertex_elements_state;
         gallium->bind_vertex_elements_state = panfrost_bind_vertex_elements_state;
-        gallium->delete_vertex_elements_state = panfrost_delete_vertex_elements_state;
+        gallium->delete_vertex_elements_state = panfrost_generic_cso_delete;
 
         gallium->create_fs_state = panfrost_create_shader_state;
         gallium->delete_fs_state = panfrost_delete_shader_state;
index 3b03cd650c8ecea1e2eca19a2bb0a526a3784855..6e913ac3374daa0300277c8181141816b758fac2 100644 (file)
@@ -30,7 +30,6 @@
 struct panfrost_job *
 panfrost_create_job(struct panfrost_context *ctx)
 {
-        /* TODO: Don't leak */
         struct panfrost_job *job = rzalloc(NULL, struct panfrost_job);
 
         job->ctx = ctx;
index 6638f36285563d3fb734c8c2f44b795e6912f52a..23a05ee43ccd1ee7e8bce626fbc00c3add0d3d6e 100644 (file)
@@ -353,8 +353,14 @@ panfrost_destroy_bo(struct panfrost_screen *screen, struct panfrost_bo *pbo)
         }
 
         if (bo->has_checksum) {
-                /* TODO */
-                DBG("--leaking checksum (%zd bytes)--\n", bo->checksum_slab.size);
+                struct panfrost_memory mem = {
+                        .cpu = bo->checksum_slab.cpu,
+                        .gpu = bo->checksum_slab.gpu,
+                        .size = bo->checksum_slab.size,
+                        .gem_handle = bo->checksum_slab.gem_handle,
+                };
+
+                screen->driver->free_slab(screen, &mem);
         }
 
         if (bo->imported) {