drm/xe: Map initial FB at the same place in GGTT too

I saw a flicker when booting xe, and it's very likely that the original
FB was not mapped at the same place when inheriting, fix it.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
Maarten Lankhorst
2023-01-24 18:28:03 +01:00
committed by Rodrigo Vivi
parent 09a68b4a76
commit 9b6483af37
3 changed files with 20 additions and 4 deletions
+6 -1
View File
@@ -1110,7 +1110,12 @@ xe_bo_create_locked_range(struct xe_device *xe,
XE_BUG_ON(!gt);
err = xe_ggtt_insert_bo(gt->mem.ggtt, bo);
if (flags & XE_BO_CREATE_STOLEN_BIT &&
flags & XE_BO_FIXED_PLACEMENT_BIT) {
err = xe_ggtt_insert_bo_at(gt->mem.ggtt, bo, start);
} else {
err = xe_ggtt_insert_bo(gt->mem.ggtt, bo);
}
if (err)
goto err_unlock_put_bo;
}
+13 -3
View File
@@ -256,7 +256,7 @@ void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
xe_ggtt_invalidate(ggtt->gt);
}
int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, u64 start, u64 end)
{
int err;
@@ -271,12 +271,22 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
return err;
mutex_lock(&ggtt->lock);
err = drm_mm_insert_node(&ggtt->mm, &bo->ggtt_node, bo->size);
err = drm_mm_insert_node_in_range(&ggtt->mm, &bo->ggtt_node, bo->size, 0, 0, start, end, 0);
if (!err)
xe_ggtt_map_bo(ggtt, bo);
mutex_unlock(&ggtt->lock);
return 0;
return err;
}
int xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, u64 ofs)
{
return __xe_ggtt_insert_bo_at(ggtt, bo, ofs, ofs + bo->size);
}
int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
{
return __xe_ggtt_insert_bo_at(ggtt, bo, 0, U64_MAX);
}
void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node)
+1
View File
@@ -23,6 +23,7 @@ int xe_ggtt_insert_special_node_locked(struct xe_ggtt *ggtt,
void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node);
void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
int xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, u64 ofs);
void xe_ggtt_remove_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
#endif