From: Nicolai Hähnle <nicolai.haeh...@amd.com> --- src/gallium/drivers/freedreno/freedreno_context.c | 5 ++--- src/gallium/drivers/freedreno/freedreno_context.h | 2 +- src/gallium/drivers/freedreno/freedreno_resource.c | 4 ++-- src/gallium/drivers/freedreno/freedreno_screen.c | 4 ++++ src/gallium/drivers/freedreno/freedreno_screen.h | 3 +++ 5 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index f8604f1..0b12409 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -114,21 +114,21 @@ fd_context_destroy(struct pipe_context *pctx) if (ctx->blitter) util_blitter_destroy(ctx->blitter); if (ctx->clear_rs_state) pctx->delete_rasterizer_state(pctx, ctx->clear_rs_state); if (ctx->primconvert) util_primconvert_destroy(ctx->primconvert); - slab_destroy(&ctx->transfer_pool); + slab_destroy_child(&ctx->transfer_pool); for (i = 0; i < ARRAY_SIZE(ctx->pipe); i++) { struct fd_vsc_pipe *pipe = &ctx->pipe[i]; if (!pipe->bo) break; fd_bo_del(pipe->bo); } fd_device_del(ctx->dev); @@ -258,22 +258,21 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen, pctx->set_debug_callback = fd_set_debug_callback; /* TODO what about compute? Ideally it creates it's own independent * batches per compute job (since it isn't using tiling, so no point * in getting involved with the re-ordering madness).. */ if (!screen->reorder) { ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx); } - slab_create(&ctx->transfer_pool, sizeof(struct fd_transfer), - 16); + slab_create_child(&ctx->transfer_pool, &screen->transfer_pool); fd_draw_init(pctx); fd_resource_context_init(pctx); fd_query_context_init(pctx); fd_texture_init(pctx); fd_state_init(pctx); fd_hw_query_init(pctx); ctx->blitter = util_blitter_create(pctx); if (!ctx->blitter) diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index e1b7b23..c4c08a6 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -114,21 +114,21 @@ struct fd_context { struct fd_device *dev; struct fd_screen *screen; struct util_queue flush_queue; struct blitter_context *blitter; void *clear_rs_state; struct primconvert_context *primconvert; /* slab for pipe_transfer allocations: */ - struct slab_mempool transfer_pool; + struct slab_child_pool transfer_pool; /* slabs for fd_hw_sample and fd_hw_sample_period allocations: */ struct slab_mempool sample_pool; struct slab_mempool sample_period_pool; /* sample-providers for hw queries: */ const struct fd_hw_sample_provider *sample_providers[MAX_HW_SAMPLE_PROVIDERS]; /* list of active queries: */ struct list_head active_queries; diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 1874271..addfc40 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -418,21 +418,21 @@ fd_resource_transfer_unmap(struct pipe_context *pctx, fd_bo_cpu_fini(rsc->bo); if (rsc->stencil) fd_bo_cpu_fini(rsc->stencil->bo); } util_range_add(&rsc->valid_buffer_range, ptrans->box.x, ptrans->box.x + ptrans->box.width); pipe_resource_reference(&ptrans->resource, NULL); - slab_free_st(&ctx->transfer_pool, ptrans); + slab_free(&ctx->transfer_pool, ptrans); free(trans->staging); } static void * fd_resource_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, unsigned level, unsigned usage, const struct pipe_box *box, struct pipe_transfer **pptrans) @@ -444,21 +444,21 @@ fd_resource_transfer_map(struct pipe_context *pctx, struct pipe_transfer *ptrans; enum pipe_format format = prsc->format; uint32_t op = 0; uint32_t offset; char *buf; int ret = 0; DBG("prsc=%p, level=%u, usage=%x, box=%dx%d+%d,%d", prsc, level, usage, box->width, box->height, box->x, box->y); - ptrans = slab_alloc_st(&ctx->transfer_pool); + ptrans = slab_alloc(&ctx->transfer_pool); if (!ptrans) return NULL; /* slab_alloc_st() doesn't zero: */ trans = fd_transfer(ptrans); memset(trans, 0, sizeof(*trans)); pipe_resource_reference(&ptrans->resource, prsc); ptrans->level = level; ptrans->usage = usage; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 598a811..bc54539 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -131,20 +131,22 @@ fd_screen_destroy(struct pipe_screen *pscreen) struct fd_screen *screen = fd_screen(pscreen); if (screen->pipe) fd_pipe_del(screen->pipe); if (screen->dev) fd_device_del(screen->dev); fd_bc_fini(&screen->batch_cache); + slab_destroy_parent(&screen->transfer_pool); + pipe_mutex_destroy(screen->lock); free(screen); } /* TODO either move caps to a2xx/a3xx specific code, or maybe have some tables for things that differ if the delta is not too much.. */ static int @@ -689,18 +691,20 @@ fd_screen_create(struct fd_device *dev) pscreen->get_name = fd_screen_get_name; pscreen->get_vendor = fd_screen_get_vendor; pscreen->get_device_vendor = fd_screen_get_device_vendor; pscreen->get_timestamp = fd_screen_get_timestamp; pscreen->fence_reference = fd_screen_fence_ref; pscreen->fence_finish = fd_screen_fence_finish; + slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16); + util_format_s3tc_init(); return pscreen; fail: fd_screen_destroy(pscreen); return NULL; } diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index 03ee90a..db9050e 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -27,20 +27,21 @@ */ #ifndef FREEDRENO_SCREEN_H_ #define FREEDRENO_SCREEN_H_ #include <freedreno_drmif.h> #include <freedreno_ringbuffer.h> #include "pipe/p_screen.h" #include "util/u_memory.h" +#include "util/slab.h" #include "os/os_thread.h" #include "freedreno_batch_cache.h" struct fd_bo; struct fd_screen { struct pipe_screen base; pipe_mutex lock; @@ -48,20 +49,22 @@ struct fd_screen { /* it would be tempting to use pipe_reference here, but that * really doesn't work well if it isn't the first member of * the struct, so not quite so awesome to be adding refcnting * further down the inheritance hierarchy: */ int refcnt; /* place for winsys to stash it's own stuff: */ void *winsys_priv; + struct slab_parent_pool transfer_pool; + uint32_t gmemsize_bytes; uint32_t device_id; uint32_t gpu_id; /* 220, 305, etc */ uint32_t chip_id; /* coreid:8 majorrev:8 minorrev:8 patch:8 */ uint32_t max_freq; uint32_t max_rts; /* max # of render targets */ bool has_timestamp; void *compiler; /* currently unused for a2xx */ -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev