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 <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3158>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3158>
This commit is contained in:
Vasily Khoruzhick 2019-11-24 14:37:32 -08:00
parent 9f72d7195a
commit 039f3f6adb
4 changed files with 14 additions and 30 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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++) {