static struct lima_bo *
lima_bo_cache_get(struct lima_screen *screen, uint32_t size, uint32_t flags)
{
+ /* we won't cache heap buffer */
+ if (flags & LIMA_BO_FLAG_HEAP)
+ return NULL;
+
struct lima_bo *bo = NULL;
mtx_lock(&screen->bo_cache_lock);
struct list_head *bucket = lima_bo_cache_get_bucket(screen, size);
bo->size = req.size;
bo->flags = req.flags;
bo->handle = req.handle;
- bo->cacheable = !(lima_debug & LIMA_DEBUG_NO_BO_CACHE);
+ bo->cacheable = !(lima_debug & LIMA_DEBUG_NO_BO_CACHE ||
+ flags & LIMA_BO_FLAG_HEAP);
p_atomic_set(&bo->refcnt, 1);
if (!lima_bo_get_info(bo))
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;
}
struct lima_bo *plb[LIMA_CTX_PLB_MAX_NUM];
struct lima_bo *gp_tile_heap[LIMA_CTX_PLB_MAX_NUM];
- #define gp_tile_heap_size 0x100000
+ uint32_t gp_tile_heap_size;
struct lima_bo *plb_gp_stream;
struct lima_bo *gp_output;
uint32_t gp_output_varyings_offt;
gp_frame_reg->plbu_cmd_start = plbu_cmd_va;
gp_frame_reg->plbu_cmd_end = plbu_cmd_va + plbu_cmd_size;
gp_frame_reg->tile_heap_start = ctx->gp_tile_heap[ctx->plb_index]->va;
- gp_frame_reg->tile_heap_end = ctx->gp_tile_heap[ctx->plb_index]->va + gp_tile_heap_size;
+ gp_frame_reg->tile_heap_end = ctx->gp_tile_heap[ctx->plb_index]->va + ctx->gp_tile_heap_size;
lima_dump_command_stream_print(
&gp_frame, sizeof(gp_frame), false, "add gp frame\n");
static bool
lima_screen_query_info(struct lima_screen *screen)
{
+ drmVersionPtr version = drmGetVersion(screen->fd);
+ if (!version)
+ return false;
+
+ if (version->version_major > 1 || version->version_minor > 0)
+ screen->has_growable_heap_buffer = true;
+
+ drmFreeVersion(version);
+
struct drm_lima_get_param param;
memset(¶m, 0, sizeof(param));
#define pp_clear_gl_pos_offset 0x0100
#define pp_buffer_size 0x1000
+ bool has_growable_heap_buffer;
};
static inline struct lima_screen *