panfrost: Free imported BOs
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 15 Feb 2019 00:15:14 +0000 (00:15 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 18 Feb 2019 05:10:06 +0000 (05:10 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_resource.c
src/gallium/drivers/panfrost/pan_resource.h
src/gallium/drivers/panfrost/pan_screen.h

index 1287193c0e90d7e6f3e8f7cdd81232a21b45136b..26f4782a4ad413493fd36e98cc3c96f6b0b8fb76 100644 (file)
@@ -312,6 +312,10 @@ panfrost_destroy_bo(struct panfrost_screen *screen, struct panfrost_bo *pbo)
                 /* TODO */
                 printf("--leaking checksum (%zd bytes)--\n", bo->checksum_slab.size);
         }
+
+        if (bo->imported) {
+                screen->driver->free_imported_bo(screen, bo);
+        }
 }
 
 static void
index af92fa48ec94f161e9e9f8cbdfeaa564871bafa9..dea2332dbfaf6c1d3b114daf4ab700f8c9cfde6f 100644 (file)
@@ -45,6 +45,12 @@ struct panfrost_bo {
         /* Memory entry corresponding to gpu above */
         struct panfrost_memory_entry *entry[MAX_MIP_LEVELS];
 
+        /* Set if this bo was imported rather than allocated */
+        bool imported;
+
+        /* Number of bytes of the imported allocation */
+        size_t imported_size;
+
         /* Set for tiled, clear for linear. */
         bool tiled;
 
index afb3d34b5b13c1b9521ca140d2ba3101597b9839..646923c9864584d56fa901b8df84e70c4fddf6fe 100644 (file)
@@ -60,6 +60,8 @@ struct panfrost_driver {
                               int extent);
         void (*free_slab) (struct panfrost_screen *screen,
                            struct panfrost_memory *mem);
+        void (*free_imported_bo) (struct panfrost_screen *screen,
+                             struct panfrost_bo *bo);
         void (*enable_counters) (struct panfrost_screen *screen);
 };