From: Alyssa Rosenzweig Date: Tue, 7 Jul 2020 20:19:39 +0000 (-0400) Subject: panfrost: Drop Gallium-local pan_bo_create wrapper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d88f078201a9f48322c4447c597f311aa980057;p=mesa.git panfrost: Drop Gallium-local pan_bo_create wrapper We can handle pandecode in shared code now, which will matter for tracing non-Gallium drivers. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c index 7c87836959a..ed8d26f127e 100644 --- a/src/gallium/drivers/panfrost/pan_allocate.c +++ b/src/gallium/drivers/panfrost/pan_allocate.c @@ -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 | diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index e7ac80a7f5c..37c9c690996 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -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); } diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 5614ee4535a..52f0b8f3c7e 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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); } diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 113812fbb70..04d54cedbad 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -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). */ diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index e73f3a0f787..d9c481fd482 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -50,23 +50,6 @@ #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 */ diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h index 392e988a182..209a6c185cc 100644 --- a/src/gallium/drivers/panfrost/pan_resource.h +++ b/src/gallium/drivers/panfrost/pan_resource.h @@ -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 */ diff --git a/src/panfrost/encoder/pan_bo.c b/src/panfrost/encoder/pan_bo.c index 32fc84e1363..53249e87301 100644 --- a/src/panfrost/encoder/pan_bo.c +++ b/src/panfrost/encoder/pan_bo.c @@ -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; }