panfrost: Track the device through the pool
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 7 Jul 2020 19:15:04 +0000 (15:15 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 9 Jul 2020 14:54:38 +0000 (14:54 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5794>

src/gallium/drivers/panfrost/pan_allocate.c
src/gallium/drivers/panfrost/pan_allocate.h
src/gallium/drivers/panfrost/pan_job.c

index 4785f9a35295a9101e98598fde3c60bc623f861b..d9cbd0c3fb1b501fef1a402b9b4cbe5ed543702b 100644 (file)
  * into the pool and copy there */
 
 struct pan_pool
-panfrost_create_pool(void *memctx)
+panfrost_create_pool(void *memctx, struct panfrost_device *dev)
 {
         struct pan_pool pool = {
+                .dev = dev,
                 .transient_offset = 0,
                 .transient_bo = NULL
         };
@@ -85,7 +86,7 @@ panfrost_allocate_transient(struct panfrost_batch *batch, size_t sz)
                  * flags to this function and keep the read/write,
                  * fragment/vertex+tiler pools separate.
                  */
-                bo = pan_bo_create(pan_device(batch->ctx->base.screen), bo_sz, 0);
+                bo = pan_bo_create(batch->pool.dev, bo_sz, 0);
 
                 uintptr_t flags = PAN_BO_ACCESS_PRIVATE |
                                   PAN_BO_ACCESS_RW |
index 2eff640045cc72cbb1b2757626664adc13300a43..1f30ee143b6ce01660f78c245c9b9fb0c110f4ce 100644 (file)
@@ -41,6 +41,9 @@ struct panfrost_batch;
  * command pool */
 
 struct pan_pool {
+        /* Parent device for allocation */
+        struct panfrost_device *dev;
+
         /* panfrost_bo -> access_flags owned by the pool */
         struct hash_table *bos;
 
@@ -52,7 +55,7 @@ struct pan_pool {
 };
 
 struct pan_pool
-panfrost_create_pool(void *memctx);
+panfrost_create_pool(void *memctx, struct panfrost_device *dev);
 
 /* Represents a fat pointer for GPU-mapped memory, returned from the transient
  * allocator and not used for much else */
index f5cfc6a1ec800533abf7ec9e49e2be1e191819ce..0945a9cef6709df398cb5dfa6018edf154c05db8 100644 (file)
@@ -117,7 +117,7 @@ panfrost_create_batch(struct panfrost_context *ctx,
         batch->out_sync = panfrost_create_batch_fence(batch);
         util_copy_framebuffer_state(&batch->key, key);
 
-        batch->pool = panfrost_create_pool(batch);
+        batch->pool = panfrost_create_pool(batch, pan_device(ctx->base.screen));
 
         return batch;
 }