diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-12 16:45:44 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-15 08:03:34 -0700 |
commit | 1ffca961abe7d4f3dfc7884745ed9a96209c2731 (patch) | |
tree | c15aefe0b07ea11b6286064ab3bcd39462e93412 /src | |
parent | 9981b6ef0fa387675e81a2966637080bb74f7c01 (diff) |
panfrost: Remove all old allocators
With the new refactor, this all becomes dead code.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_allocate.c | 49 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_allocate.h | 46 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_resource.c | 66 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_resource.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.h | 3 | ||||
-rw-r--r-- | src/panfrost/pandecode/decode.h | 1 |
7 files changed, 1 insertions, 166 deletions
diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c index a07eba8b8f6..3f83e3f29c2 100644 --- a/src/gallium/drivers/panfrost/pan_allocate.c +++ b/src/gallium/drivers/panfrost/pan_allocate.c @@ -34,28 +34,6 @@ /* TODO: What does this actually have to be? */ #define ALIGNMENT 128 -/* Allocate a mapped chunk directly from a heap */ - -struct panfrost_transfer -panfrost_allocate_chunk(struct panfrost_context *ctx, size_t size, unsigned heap_id) -{ - size = ALIGN_POT(size, ALIGNMENT); - - struct pipe_context *gallium = (struct pipe_context *) ctx; - struct panfrost_screen *screen = pan_screen(gallium->screen); - - struct pb_slab_entry *entry = pb_slab_alloc(&screen->slabs, size, heap_id); - struct panfrost_memory_entry *p_entry = (struct panfrost_memory_entry *) entry; - struct panfrost_memory *backing = (struct panfrost_memory *) entry->slab; - - struct panfrost_transfer transfer = { - .cpu = backing->bo->cpu + p_entry->offset, - .gpu = backing->bo->gpu + p_entry->offset - }; - - return transfer; -} - /* Allocate a new transient slab */ static struct panfrost_bo * @@ -224,14 +202,6 @@ pandev_upload(int cheating_offset, int *stack_bottom, mali_ptr base, void *base_ return base + offset; } -/* Upload immediately after the last allocation */ - -mali_ptr -pandev_upload_sequential(mali_ptr base, void *base_map, const void *data, size_t sz) -{ - return pandev_upload(last_offset, NULL, base, base_map, data, sz, /* false */ true); -} - /* Simplified APIs for the real driver, rather than replays */ mali_ptr @@ -246,22 +216,3 @@ panfrost_upload(struct panfrost_memory *mem, const void *data, size_t sz, bool n return pandev_upload(-1, &mem->stack_bottom, mem->bo->gpu, mem->bo->cpu, data, sz, no_pad); } - -mali_ptr -panfrost_upload_sequential(struct panfrost_memory *mem, const void *data, size_t sz) -{ - return pandev_upload(last_offset, &mem->stack_bottom, mem->bo->gpu, mem->bo->cpu, data, sz, true); -} - -/* Simplified interface to allocate a chunk without any upload, to allow - * zero-copy uploads. This is particularly useful when the copy would happen - * anyway, for instance with texture swizzling. */ - -void * -panfrost_allocate_transfer(struct panfrost_memory *mem, size_t sz, mali_ptr *gpu) -{ - int offset = pandev_allocate_offset(&mem->stack_bottom, sz); - - *gpu = mem->bo->gpu + offset; - return mem->bo->cpu + offset; -} diff --git a/src/gallium/drivers/panfrost/pan_allocate.h b/src/gallium/drivers/panfrost/pan_allocate.h index 45c86b7cb7b..fcb00bfcfd1 100644 --- a/src/gallium/drivers/panfrost/pan_allocate.h +++ b/src/gallium/drivers/panfrost/pan_allocate.h @@ -28,28 +28,11 @@ #include <unistd.h> #include <sys/mman.h> #include <stdbool.h> -#include "pipebuffer/pb_slab.h" #include <panfrost-misc.h> struct panfrost_context; -/* Texture memory */ - -#define HEAP_TEXTURE 0 - -/* Single-frame (transient) command stream memory, done at the block scale - * rather than the individual cmdstream alllocation scale. We use pb_alloc for - * pooling, but we have to implement our own logic atop the API for performance - * reasons when considering many low-latency tiny heterogenous allocations */ - -#define HEAP_TRANSIENT 1 - -/* Multi-frame descriptor memory (replaces what used to be - * cmdstream_persistent), for long-living small allocations */ - -#define HEAP_DESCRIPTOR 2 - /* Represents a fat pointer for GPU-mapped memory, returned from the transient * allocator and not used for much else */ @@ -74,39 +57,16 @@ struct panfrost_bo { }; struct panfrost_memory { - /* Subclassing slab object */ - struct pb_slab slab; - /* Backing for the slab in memory */ struct panfrost_bo *bo; int stack_bottom; }; -/* Slab entry sizes range from 2^min to 2^max. In this case, we range from 1k - * to 16MB. Numbers are kind of arbitrary but these seem to work alright in - * practice. */ - -#define MIN_SLAB_ENTRY_SIZE (10) -#define MAX_SLAB_ENTRY_SIZE (24) - -struct panfrost_memory_entry { - /* Subclass */ - struct pb_slab_entry base; - - /* Have we been freed? */ - bool freed; - - /* Offset into the slab of the entry */ - off_t offset; -}; - /* Functions for replay */ mali_ptr pandev_upload(int cheating_offset, int *stack_bottom, mali_ptr base, void *base_map, const void *data, size_t sz, bool no_pad); -mali_ptr pandev_upload_sequential(mali_ptr base, void *base_map, const void *data, size_t sz); /* Functions for the actual Galliumish driver */ mali_ptr panfrost_upload(struct panfrost_memory *mem, const void *data, size_t sz, bool no_pad); -mali_ptr panfrost_upload_sequential(struct panfrost_memory *mem, const void *data, size_t sz); struct panfrost_transfer panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz); @@ -114,9 +74,6 @@ panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz); mali_ptr panfrost_upload_transient(struct panfrost_context *ctx, const void *data, size_t sz); -void * -panfrost_allocate_transfer(struct panfrost_memory *mem, size_t sz, mali_ptr *gpu); - static inline mali_ptr panfrost_reserve(struct panfrost_memory *mem, size_t sz) { @@ -124,7 +81,4 @@ panfrost_reserve(struct panfrost_memory *mem, size_t sz) return mem->bo->gpu + (mem->stack_bottom - sz); } -struct panfrost_transfer -panfrost_allocate_chunk(struct panfrost_context *ctx, size_t size, unsigned heap_id); - #endif /* __PAN_ALLOCATE_H__ */ diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index cdff805ab13..5f6eaa42c98 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -633,54 +633,6 @@ panfrost_transfer_flush_region(struct pipe_context *pctx, } } -static struct pb_slab * -panfrost_slab_alloc(void *priv, unsigned heap, unsigned entry_size, unsigned group_index) -{ - struct panfrost_screen *screen = (struct panfrost_screen *) priv; - struct panfrost_memory *mem = rzalloc(screen, struct panfrost_memory); - - size_t slab_size = (1 << (MAX_SLAB_ENTRY_SIZE + 1)); - - mem->slab.num_entries = slab_size / entry_size; - mem->slab.num_free = mem->slab.num_entries; - - LIST_INITHEAD(&mem->slab.free); - for (unsigned i = 0; i < mem->slab.num_entries; ++i) { - /* Create a slab entry */ - struct panfrost_memory_entry *entry = rzalloc(mem, struct panfrost_memory_entry); - entry->offset = entry_size * i; - - entry->base.slab = &mem->slab; - entry->base.group_index = group_index; - - LIST_ADDTAIL(&entry->base.head, &mem->slab.free); - } - - /* Actually allocate the memory from kernel-space. Mapped, same_va, no - * special flags */ - - panfrost_drm_allocate_slab(screen, mem, slab_size / 4096, true, 0, 0, 0); - - return &mem->slab; -} - -static bool -panfrost_slab_can_reclaim(void *priv, struct pb_slab_entry *entry) -{ - struct panfrost_memory_entry *p_entry = (struct panfrost_memory_entry *) entry; - return p_entry->freed; -} - -static void -panfrost_slab_free(void *priv, struct pb_slab *slab) -{ - struct panfrost_memory *mem = (struct panfrost_memory *) slab; - struct panfrost_screen *screen = (struct panfrost_screen *) priv; - - panfrost_drm_free_slab(screen, mem); - ralloc_free(mem); -} - static void panfrost_invalidate_resource(struct pipe_context *pctx, struct pipe_resource *prsc) { @@ -791,24 +743,6 @@ panfrost_resource_screen_init(struct panfrost_screen *pscreen) pscreen->base.transfer_helper = u_transfer_helper_create(&transfer_vtbl, true, false, true, true); - - pb_slabs_init(&pscreen->slabs, - MIN_SLAB_ENTRY_SIZE, - MAX_SLAB_ENTRY_SIZE, - - 3, /* Number of heaps */ - - pscreen, - - panfrost_slab_can_reclaim, - panfrost_slab_alloc, - panfrost_slab_free); -} - -void -panfrost_resource_screen_deinit(struct panfrost_screen *pscreen) -{ - pb_slabs_deinit(&pscreen->slabs); } void diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h index f7c13e7ec10..3814c2b27eb 100644 --- a/src/gallium/drivers/panfrost/pan_resource.h +++ b/src/gallium/drivers/panfrost/pan_resource.h @@ -109,7 +109,6 @@ panfrost_get_texture_address( unsigned level, unsigned face); void panfrost_resource_screen_init(struct panfrost_screen *screen); -void panfrost_resource_screen_deinit(struct panfrost_screen *screen); void panfrost_resource_context_init(struct pipe_context *pctx); diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 599ef8a82e7..2d8ecdf2068 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -438,7 +438,6 @@ static void panfrost_destroy_screen(struct pipe_screen *pscreen) { struct panfrost_screen *screen = pan_screen(pscreen); - panfrost_resource_screen_deinit(screen); ralloc_free(screen); } diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h index 8a01baabaf4..3a0e544c1a6 100644 --- a/src/gallium/drivers/panfrost/pan_screen.h +++ b/src/gallium/drivers/panfrost/pan_screen.h @@ -85,9 +85,6 @@ struct panfrost_screen { struct renderonly *ro; - /* Memory management is based on subdividing slabs with AMD's allocator */ - struct pb_slabs slabs; - /* Transient memory management is based on borrowing fixed-size slabs * off the screen (loaning them out to the batch). Dynamic array * container of panfrost_bo */ diff --git a/src/panfrost/pandecode/decode.h b/src/panfrost/pandecode/decode.h index e1d09c6a90a..3db0c0d7091 100644 --- a/src/panfrost/pandecode/decode.h +++ b/src/panfrost/pandecode/decode.h @@ -26,6 +26,7 @@ #ifndef __PAN_DECODE_H__ #define __PAN_DECODE_H__ +#include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <panfrost-job.h> |