The current sub-allocator default assumes that fences are enabled and while finding a hole during buffer allocation, it checks only till first hole. Disable fences immediately initalizing the SA manager so that, holes can be searched through out the sub-allocator while allocating buffer.
Signed-off-by: Satyanarayana K V P <[email protected]> Cc: Matthew Brost <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Michal Wajdeczko <[email protected]> Cc: Christian König <[email protected]> Cc: [email protected] --- drivers/gpu/drm/xe/xe_sa.c | 20 ++++++++++++++++++++ drivers/gpu/drm/xe/xe_sa.h | 1 + drivers/gpu/drm/xe/xe_sriov_vf_ccs.c | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c index f32045f40b7a..13f47db662a6 100644 --- a/drivers/gpu/drm/xe/xe_sa.c +++ b/drivers/gpu/drm/xe/xe_sa.c @@ -117,6 +117,26 @@ struct xe_sa_manager *__xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, return sa_manager; } +/** + * xe_sa_bo_manager_fence_disable() - Set the suballocator to disable fencing. + * @sa_manager: the XE sub allocator manager + * @disable: Disable fences + * + * When @fence_disabled is true allocation scans all holes without waiting on + * fences. When false, the manager tracks free suballocations behind fences + * and reuses them only after the fence signals. + * + * This should be called immediately after creating the suballocator and before + * any allocations are made. The behaviour is undefined if this is called after + * allocations have been made. + * + * Return: None. + */ +void xe_sa_bo_manager_fence_disable(struct xe_sa_manager *sa_manager, bool disable) +{ + drm_suballoc_manager_fence_disable(&sa_manager->base, disable); +} + /** * xe_sa_bo_swap_shadow() - Swap the SA BO with shadow BO. * @sa_manager: the XE sub allocator manager diff --git a/drivers/gpu/drm/xe/xe_sa.h b/drivers/gpu/drm/xe/xe_sa.h index 50218b0d1404..77b5520b04e8 100644 --- a/drivers/gpu/drm/xe/xe_sa.h +++ b/drivers/gpu/drm/xe/xe_sa.h @@ -17,6 +17,7 @@ struct xe_tile; #define XE_SA_BO_MANAGER_FLAG_SHADOW BIT(0) struct xe_sa_manager *__xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32 guard, u32 align, u32 flags); +void xe_sa_bo_manager_fence_disable(struct xe_sa_manager *sa_manager, bool disable); struct drm_suballoc *__xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size, gfp_t gfp); static inline struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32 align) diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c index db023fb66a27..0508847da468 100644 --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c @@ -152,7 +152,6 @@ static int alloc_bb_pool(struct xe_tile *tile, struct xe_sriov_vf_ccs_ctx *ctx) sa_manager = __xe_sa_bo_manager_init(tile, bb_pool_size, SZ_4K, SZ_16, XE_SA_BO_MANAGER_FLAG_SHADOW); - if (IS_ERR(sa_manager)) { xe_sriov_err(xe, "Suballocator init failed with error: %pe\n", sa_manager); @@ -160,6 +159,8 @@ static int alloc_bb_pool(struct xe_tile *tile, struct xe_sriov_vf_ccs_ctx *ctx) return err; } + xe_sa_bo_manager_fence_disable(sa_manager, true); + offset = 0; xe_map_memset(xe, &sa_manager->bo->vmap, offset, MI_NOOP, bb_pool_size); -- 2.43.0
