From 039f3f6adb815dfd4ab8059c1f5ec44e8e6190ae Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sun, 24 Nov 2019 14:37:32 -0800 Subject: [PATCH] lima: drop suballocator Since we're using a separate per-draw BO for GP outputs we don't need suballocator anymore. Reviewed-by: Erico Nunes Signed-off-by: Vasily Khoruzhick Tested-by: Marge Bot Part-of: --- src/gallium/drivers/lima/lima_context.c | 21 +++------------------ src/gallium/drivers/lima/lima_context.h | 3 +-- src/gallium/drivers/lima/lima_draw.c | 18 +++++++++--------- src/gallium/drivers/lima/lima_texture.c | 2 +- 4 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/gallium/drivers/lima/lima_context.c b/src/gallium/drivers/lima/lima_context.c index a031222a423..44f627ac1da 100644 --- a/src/gallium/drivers/lima/lima_context.c +++ b/src/gallium/drivers/lima/lima_context.c @@ -29,7 +29,6 @@ #include "util/u_debug.h" #include "util/ralloc.h" #include "util/u_inlines.h" -#include "util/u_suballoc.h" #include "util/hash_table.h" #include "lima_screen.h" @@ -70,19 +69,15 @@ lima_ctx_buff_map(struct lima_context *ctx, enum lima_ctx_buff buff) void * lima_ctx_buff_alloc(struct lima_context *ctx, enum lima_ctx_buff buff, - unsigned size, bool uploader) + unsigned size) { struct lima_ctx_buff_state *cbs = ctx->buffer_state + buff; void *ret = NULL; cbs->size = align(size, 0x40); - if (uploader) - u_upload_alloc(ctx->uploader, 0, cbs->size, 0x40, &cbs->offset, - &cbs->res, &ret); - else - u_suballocator_alloc(ctx->suballocator, cbs->size, 0x10, - &cbs->offset, &cbs->res); + u_upload_alloc(ctx->uploader, 0, cbs->size, 0x40, &cbs->offset, + &cbs->res, &ret); return ret; } @@ -128,9 +123,6 @@ lima_context_destroy(struct pipe_context *pctx) if (ctx->blitter) util_blitter_destroy(ctx->blitter); - if (ctx->suballocator) - u_suballocator_destroy(ctx->suballocator); - if (ctx->uploader) u_upload_destroy(ctx->uploader); @@ -220,13 +212,6 @@ lima_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) ctx->base.stream_uploader = ctx->uploader; ctx->base.const_uploader = ctx->uploader; - /* for varying output which need not mmap */ - ctx->suballocator = - u_suballocator_create(&ctx->base, 1024 * 1024, 0, - PIPE_USAGE_STREAM, 0, false); - if (!ctx->suballocator) - goto err_out; - util_dynarray_init(&ctx->vs_cmd_array, ctx); util_dynarray_init(&ctx->plbu_cmd_array, ctx); diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h index 1b6a89a7bc1..b2fa8d1d483 100644 --- a/src/gallium/drivers/lima/lima_context.h +++ b/src/gallium/drivers/lima/lima_context.h @@ -188,7 +188,6 @@ struct lima_context { } dirty; struct u_upload_mgr *uploader; - struct u_suballocator *suballocator; struct blitter_context *blitter; struct slab_child_pool transfer_pool; @@ -282,7 +281,7 @@ uint32_t lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff, unsigned submit); void *lima_ctx_buff_map(struct lima_context *ctx, enum lima_ctx_buff buff); void *lima_ctx_buff_alloc(struct lima_context *ctx, enum lima_ctx_buff buff, - unsigned size, bool uploader); + unsigned size); void lima_state_init(struct lima_context *ctx); void lima_state_fini(struct lima_context *ctx); diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index b2018b3bcfb..2f35d9a3db3 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -984,7 +984,7 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in { struct lima_render_state *render = lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_plb_rsw, - sizeof(*render), true); + sizeof(*render)); /* do hw support RGBA independ blend? * PIPE_CAP_INDEP_BLEND_ENABLE @@ -1146,7 +1146,7 @@ lima_update_gp_attribute_info(struct lima_context *ctx, const struct pipe_draw_i uint32_t *attribute = lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_attribute_info, - MAX2(1, ve->num_elements) * 8, true); + MAX2(1, ve->num_elements) * 8); int n = 0; for (int i = 0; i < ve->num_elements; i++) { @@ -1182,7 +1182,7 @@ lima_update_gp_uniform(struct lima_context *ctx) int size = vs->uniform_pending_offset + vs->constant_size + 32; void *vs_const_buff = - lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_uniform, size, true); + lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_uniform, size); if (ccb->buffer) memcpy(vs_const_buff, ccb->buffer, ccb->size); @@ -1215,10 +1215,10 @@ lima_update_pp_uniform(struct lima_context *ctx) uint16_t *fp16_const_buff = lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_uniform, - const_buff_size * sizeof(uint16_t), true); + const_buff_size * sizeof(uint16_t)); uint32_t *array = - lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_uniform_array, 4, true); + lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_uniform_array, 4); for (int i = 0; i < const_buff_size; i++) fp16_const_buff[i] = util_float_to_half(const_buff[i]); @@ -1242,7 +1242,7 @@ lima_update_varying(struct lima_context *ctx, const struct pipe_draw_info *info) uint32_t *varying = lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_varying_info, - vs->num_outputs * 8, true); + vs->num_outputs * 8); int n = 0; int offset = 0; @@ -1577,7 +1577,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame) if (vs_cmd_size) { void *vs_cmd = - lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_vs_cmd, vs_cmd_size, true); + lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_vs_cmd, vs_cmd_size); memcpy(vs_cmd, util_dynarray_begin(&ctx->vs_cmd_array), vs_cmd_size); util_dynarray_clear(&ctx->vs_cmd_array); vs_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_vs_cmd, @@ -1589,7 +1589,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame) } void *plbu_cmd = - lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_plbu_cmd, plbu_cmd_size, true); + lima_ctx_buff_alloc(ctx, lima_ctx_buff_gp_plbu_cmd, plbu_cmd_size); memcpy(plbu_cmd, util_dynarray_begin(&ctx->plbu_cmd_array), plbu_cmd_size); util_dynarray_clear(&ctx->plbu_cmd_array); plbu_cmd_va = lima_ctx_buff_va(ctx, lima_ctx_buff_gp_plbu_cmd, @@ -1638,7 +1638,7 @@ _lima_flush(struct lima_context *ctx, bool end_of_frame) uint32_t pp_stack_va = 0; if (ctx->pp_max_stack_size) { lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_stack, screen->num_pp * - ctx->pp_max_stack_size * pp_stack_pp_size, true); + ctx->pp_max_stack_size * pp_stack_pp_size); pp_stack_va = lima_ctx_buff_va(ctx, lima_ctx_buff_pp_stack, LIMA_CTX_BUFF_SUBMIT_PP); } diff --git a/src/gallium/drivers/lima/lima_texture.c b/src/gallium/drivers/lima/lima_texture.c index 307cf8e2491..b5a6103093c 100644 --- a/src/gallium/drivers/lima/lima_texture.c +++ b/src/gallium/drivers/lima/lima_texture.c @@ -255,7 +255,7 @@ lima_update_textures(struct lima_context *ctx) } uint32_t *descs = - lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_tex_desc, size, true); + lima_ctx_buff_alloc(ctx, lima_ctx_buff_pp_tex_desc, size); off_t offset = lima_tex_list_size; for (int i = 0; i < lima_tex->num_samplers; i++) { -- 2.30.2