lima: implement BO cache
Allocating BOs is expensive, so we should avoid doing that by caching freed BOs. BO cache is modelled after one in v3d driver and works as follows: - in lima_bo_create() check if we have matching BO in cache and return it if there's one, allocate new BO otherwise. - in lima_bo_unreference() (renamed from lima_bo_free()): put BO in cache instead of freeing it and remove all stale BOs from cache Reviewed-by: Qiang Yu <yuq825@gmail.com> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
This commit is contained in:
@@ -302,7 +302,7 @@ lima_delete_fs_state(struct pipe_context *pctx, void *hwcso)
|
||||
struct lima_fs_shader_state *so = hwcso;
|
||||
|
||||
if (so->bo)
|
||||
lima_bo_free(so->bo);
|
||||
lima_bo_unreference(so->bo);
|
||||
|
||||
ralloc_free(so);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ lima_delete_vs_state(struct pipe_context *pctx, void *hwcso)
|
||||
struct lima_vs_shader_state *so = hwcso;
|
||||
|
||||
if (so->bo)
|
||||
lima_bo_free(so->bo);
|
||||
lima_bo_unreference(so->bo);
|
||||
|
||||
ralloc_free(so);
|
||||
}
|
||||
|
Reference in New Issue
Block a user