int lima_ctx_num_plb = LIMA_CTX_PLB_DEF_NUM;
uint32_t
-lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff, unsigned submit)
+lima_ctx_buff_va(struct lima_context *ctx, enum lima_ctx_buff buff)
{
+ struct lima_submit *submit = lima_submit_get(ctx);
struct lima_ctx_buff_state *cbs = ctx->buffer_state + buff;
struct lima_resource *res = lima_resource(cbs->res);
+ int pipe = buff < lima_ctx_buff_num_gp ? LIMA_PIPE_GP : LIMA_PIPE_PP;
- if (submit & LIMA_CTX_BUFF_SUBMIT_GP)
- lima_submit_add_bo(ctx->gp_submit, res->bo, LIMA_SUBMIT_BO_READ);
- if (submit & LIMA_CTX_BUFF_SUBMIT_PP)
- lima_submit_add_bo(ctx->pp_submit, res->bo, LIMA_SUBMIT_BO_READ);
+ lima_submit_add_bo(submit, pipe, res->bo, LIMA_SUBMIT_BO_READ);
return res->bo->va + cbs->offset;
}
struct lima_context *ctx = lima_context(pctx);
struct lima_screen *screen = lima_screen(pctx->screen);
- if (ctx->pp_submit)
- lima_submit_free(ctx->pp_submit);
- if (ctx->gp_submit)
- lima_submit_free(ctx->gp_submit);
+ lima_submit_fini(ctx);
for (int i = 0; i < lima_ctx_buff_num; i++)
pipe_resource_reference(&ctx->buffer_state[i].res, NULL);
util_dynarray_init(&ctx->vs_cmd_array, ctx);
util_dynarray_init(&ctx->plbu_cmd_array, ctx);
+ util_dynarray_init(&ctx->plbu_cmd_head, ctx);
ctx->plb_size = screen->plb_max_blk * LIMA_CTX_PLB_BLK_SIZE;
ctx->plb_gp_size = screen->plb_max_blk * 4;
+ uint32_t heap_flags;
+ if (screen->has_growable_heap_buffer) {
+ /* growable size buffer, initially will allocate 32K (by default)
+ * backup memory in kernel driver, and will allocate more when GP
+ * get out of memory interrupt. Max to 16M set here.
+ */
+ ctx->gp_tile_heap_size = 0x1000000;
+ heap_flags = LIMA_BO_FLAG_HEAP;
+ } else {
+ /* fix size buffer */
+ ctx->gp_tile_heap_size = 0x100000;
+ heap_flags = 0;
+ }
+
for (int i = 0; i < lima_ctx_num_plb; i++) {
ctx->plb[i] = lima_bo_create(screen, ctx->plb_size, 0);
if (!ctx->plb[i])
goto err_out;
- ctx->gp_tile_heap[i] = lima_bo_create(screen, gp_tile_heap_size, 0);
+ ctx->gp_tile_heap[i] = lima_bo_create(screen, ctx->gp_tile_heap_size, heap_flags);
if (!ctx->gp_tile_heap[i])
goto err_out;
}
goto err_out;
}
- ctx->gp_submit = lima_submit_create(ctx, LIMA_PIPE_GP);
- if (!ctx->gp_submit)
- goto err_out;
-
- ctx->pp_submit = lima_submit_create(ctx, LIMA_PIPE_PP);
- if (!ctx->pp_submit)
+ if (!lima_submit_init(ctx))
goto err_out;
return &ctx->base;
lima_context_destroy(&ctx->base);
return NULL;
}
-
-bool
-lima_need_flush(struct lima_context *ctx, struct lima_bo *bo, bool write)
-{
- return lima_submit_has_bo(ctx->gp_submit, bo, write) ||
- lima_submit_has_bo(ctx->pp_submit, bo, write);
-}