panfrost: Drop Gallium-local pan_bo_create wrapper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 7 Jul 2020 20:19:39 +0000 (16:19 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 9 Jul 2020 14:54:38 +0000 (14:54 +0000)
We can handle pandecode in shared code now, which will matter for
tracing non-Gallium drivers.

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_assemble.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_resource.c
src/gallium/drivers/panfrost/pan_resource.h
src/panfrost/encoder/pan_bo.c

index 7c87836959a9b0495ef194815debb984cecb773c..ed8d26f127e60095e279d34b16ea1d2241d78249 100644 (file)
@@ -86,7 +86,7 @@ panfrost_pool_alloc(struct pan_pool *pool, size_t sz)
                  * flags to this function and keep the read/write,
                  * fragment/vertex+tiler pools separate.
                  */
-                bo = pan_bo_create(pool->dev, bo_sz, 0);
+                bo = panfrost_bo_create(pool->dev, bo_sz, 0);
 
                 uintptr_t flags = PAN_BO_ACCESS_PRIVATE |
                                   PAN_BO_ACCESS_RW |
index e7ac80a7f5c3f212e485c0a18ce4a67e3d4e7811..37c9c690996b0b347f6076522a958a17d34b1dd1 100644 (file)
@@ -181,7 +181,7 @@ panfrost_shader_compile(struct panfrost_context *ctx,
          * that's how I'd do it. */
 
         if (size) {
-                state->bo = pan_bo_create(dev, size, PAN_BO_EXECUTE);
+                state->bo = panfrost_bo_create(dev, size, PAN_BO_EXECUTE);
                 memcpy(state->bo->cpu, dst, size);
         }
 
index 5614ee4535ae20d7a923c2736f902f732bda42fd..52f0b8f3c7ee4896d964faef7de73c30e785f55c 100644 (file)
@@ -969,7 +969,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
                                 so->base.u.tex.last_layer,
                                 type, prsrc->layout);
 
-                so->bo = pan_bo_create(device, size, 0);
+                so->bo = panfrost_bo_create(device, size, 0);
 
                 so->bifrost_descriptor = rzalloc(pctx, struct bifrost_texture_descriptor);
                 panfrost_new_texture_bifrost(
@@ -997,7 +997,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
                                 type, prsrc->layout);
                 size += sizeof(struct mali_texture_descriptor);
 
-                so->bo = pan_bo_create(device, size, 0);
+                so->bo = panfrost_bo_create(device, size, 0);
 
                 panfrost_new_texture(
                                 so->bo->cpu,
@@ -1279,7 +1279,7 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q)
         case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
                 /* Allocate a bo for the query results to be stored */
                 if (!query->bo) {
-                        query->bo = pan_bo_create(
+                        query->bo = panfrost_bo_create(
                                         pan_device(ctx->base.screen),
                                         sizeof(unsigned), 0);
                 }
index 113812fbb70f3391d823b7be397ab89d23acd27f..04d54cedbad076e96df17cbc75410c594f99f7c5 100644 (file)
@@ -629,12 +629,12 @@ panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size,
 {
         struct panfrost_bo *bo;
 
-        bo = pan_bo_create(pan_device(batch->ctx->base.screen), size,
+        bo = panfrost_bo_create(pan_device(batch->ctx->base.screen), size,
                                 create_flags);
         panfrost_batch_add_bo(batch, bo, access_flags);
 
         /* panfrost_batch_add_bo() has retained a reference and
-         * pan_bo_create() initialize the refcnt to 1, so let's
+         * panfrost_bo_create() initialize the refcnt to 1, so let's
          * unreference the BO here so it gets released when the batch is
          * destroyed (unless it's retained by someone else in the meantime).
          */
index e73f3a0f787b6e7f7e7f30455b8ec104d3a164ff..d9c481fd482787b2865a408bb0a78c62b6e46140 100644 (file)
 #include "pandecode/decode.h"
 #include "panfrost-quirks.h"
 
-/* Wrapper around panfrost_bo_create that handles pandecode */
-
-struct panfrost_bo *
-pan_bo_create(struct panfrost_device *dev, size_t size, uint32_t flags)
-{
-        struct panfrost_bo *bo = panfrost_bo_create(dev, size, flags);
-
-        if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC)) {
-                if (flags & PAN_BO_INVISIBLE)
-                        pandecode_inject_mmap(bo->gpu, NULL, bo->size, NULL);
-                else if (!(flags & PAN_BO_DELAY_MMAP))
-                        pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
-        }
-
-        return bo;
-}
-
 void
 panfrost_resource_reset_damage(struct panfrost_resource *pres)
 {
@@ -113,7 +96,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
             templat->bind & PIPE_BIND_RENDER_TARGET) {
                 unsigned size = panfrost_compute_checksum_size(
                                         &rsc->slices[0], templat->width0, templat->height0);
-                rsc->slices[0].checksum_bo = pan_bo_create(dev, size, 0);
+                rsc->slices[0].checksum_bo = panfrost_bo_create(dev, size, 0);
                 rsc->checksummed = true;
         }
 
@@ -448,7 +431,7 @@ panfrost_resource_create_bo(struct panfrost_device *dev, struct panfrost_resourc
 
         /* We create a BO immediately but don't bother mapping, since we don't
          * care to map e.g. FBOs which the CPU probably won't touch */
-        pres->bo = pan_bo_create(dev, bo_size, PAN_BO_DELAY_MMAP);
+        pres->bo = panfrost_bo_create(dev, bo_size, PAN_BO_DELAY_MMAP);
 }
 
 void
@@ -650,7 +633,7 @@ panfrost_transfer_map(struct pipe_context *pctx,
                          * doing to it.
                          */
                         if (!(bo->flags & (PAN_BO_IMPORTED | PAN_BO_EXPORTED)))
-                                newbo = pan_bo_create(dev, bo->size,
+                                newbo = panfrost_bo_create(dev, bo->size,
                                                            flags);
 
                         if (newbo) {
@@ -952,7 +935,7 @@ panfrost_resource_hint_layout(
         /* If we grew in size, reallocate the BO */
         if (new_size > rsrc->bo->size) {
                 panfrost_bo_unreference(rsrc->bo);
-                rsrc->bo = pan_bo_create(dev, new_size, PAN_BO_DELAY_MMAP);
+                rsrc->bo = panfrost_bo_create(dev, new_size, PAN_BO_DELAY_MMAP);
         }
 
         /* TODO: If there are textures bound, regenerate their descriptors */
index 392e988a182025791974346603f04018c79bc78d..209a6c185cc8d6c72c53bb24c1a051ccd7341283 100644 (file)
@@ -126,8 +126,4 @@ panfrost_resource_set_damage_region(struct pipe_screen *screen,
                                     unsigned int nrects,
                                     const struct pipe_box *rects);
 
-
-struct panfrost_bo *
-pan_bo_create(struct panfrost_device *dev, size_t size, uint32_t flags);
-
 #endif /* PAN_RESOURCE_H */
index 32fc84e13637b81cd82143d2548c4ef0a24b346f..53249e8730192b3ee0127b742dde0faace0917d4 100644 (file)
@@ -31,6 +31,8 @@
 #include "drm-uapi/panfrost_drm.h"
 
 #include "pan_bo.h"
+#include "pan_util.h"
+#include "../pandecode/public.h"
 
 #include "os/os_mman.h"
 
@@ -405,6 +407,13 @@ panfrost_bo_create(struct panfrost_device *dev, size_t size,
         _mesa_set_add(bo->dev->active_bos, bo);
         pthread_mutex_unlock(&dev->active_bos_lock);
 
+        if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC)) {
+                if (flags & PAN_BO_INVISIBLE)
+                        pandecode_inject_mmap(bo->gpu, NULL, bo->size, NULL);
+                else if (!(flags & PAN_BO_DELAY_MMAP))
+                        pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
+        }
+
         return bo;
 }