Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/xe/bo: Add xe_bo_addr_iter.
@ 2026-10-21 15:01 Maarten Lankhorst
  2026-10-21 15:01 ` [PATCH 2/2] drm/xe/display: Use xe_bo_addr_iter in remapped DPT pinning Maarten Lankhorst
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Maarten Lankhorst @ 2026-10-21 15:01 UTC (permalink / raw)
  To: intel-xe; +Cc: Maarten Lankhorst

For display we iterate often over the pinned VRAM/system memory BO.
Add some code to speed up DPT/GGTT programming.

Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/xe/xe_bo.c | 45 ++++++++++++++++++++++----------------
 drivers/gpu/drm/xe/xe_bo.h |  3 +++
 2 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index 12e523c61c1f3..5e48669732fdd 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -3434,6 +3434,30 @@ bool xe_bo_is_xe_bo(struct ttm_buffer_object *bo)
 	return false;
 }
 
+void xe_bo_addr_iter_first(struct xe_bo *bo, struct xe_res_cursor *cur, u64 offset, u64 size)
+{
+	struct xe_device *xe = xe_bo_device(bo);
+
+	if (!xe_bo_is_vram(bo) && !xe_bo_is_stolen(bo)) {
+		xe_assert(xe, bo->ttm.ttm);
+
+		xe_res_first_sg(xe_bo_sg(bo), offset, size, cur);
+	} else {
+		xe_res_first(bo->ttm.resource, offset, size, cur);
+
+		xe_assert(xe, !cur->dma_addr);
+		cur->dma_start = vram_region_gpu_offset(bo->ttm.resource);
+	}
+}
+
+dma_addr_t xe_bo_addr_iter_addr(struct xe_res_cursor *cur)
+{
+	if (cur->mem_type == XE_PL_TT)
+		return xe_res_dma(cur);
+
+	return cur->start + cur->dma_start;
+}
+
 /*
  * Resolve a BO address. There is no assert to check if the proper lock is held
  * so it should only be used in cases where it is not fatal to get the wrong
@@ -3442,27 +3466,10 @@ bool xe_bo_is_xe_bo(struct ttm_buffer_object *bo)
  */
 dma_addr_t __xe_bo_addr(struct xe_bo *bo, u64 offset, size_t page_size)
 {
-	struct xe_device *xe = xe_bo_device(bo);
 	struct xe_res_cursor cur;
-	u64 page;
-
-	xe_assert(xe, page_size <= PAGE_SIZE);
-	page = offset >> PAGE_SHIFT;
-	offset &= (PAGE_SIZE - 1);
 
-	if (!xe_bo_is_vram(bo) && !xe_bo_is_stolen(bo)) {
-		xe_assert(xe, bo->ttm.ttm);
-
-		xe_res_first_sg(xe_bo_sg(bo), page << PAGE_SHIFT,
-				page_size, &cur);
-		return xe_res_dma(&cur) + offset;
-	} else {
-		struct xe_res_cursor cur;
-
-		xe_res_first(bo->ttm.resource, page << PAGE_SHIFT,
-			     page_size, &cur);
-		return cur.start + offset + vram_region_gpu_offset(bo->ttm.resource);
-	}
+	xe_bo_addr_iter_first(bo, &cur, offset, page_size);
+	return xe_bo_addr_iter_addr(&cur);
 }
 
 dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset, size_t page_size)
diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
index 77b3a02e9b8eb..286f52225bc79 100644
--- a/drivers/gpu/drm/xe/xe_bo.h
+++ b/drivers/gpu/drm/xe/xe_bo.h
@@ -113,6 +113,7 @@ enum xe_madv_purgeable_state {
 };
 
 struct sg_table;
+struct xe_res_cursor;
 
 struct xe_bo *xe_bo_alloc(void);
 void xe_bo_free(struct xe_bo *bo);
@@ -375,6 +376,8 @@ static inline void xe_bo_unpin_map_no_vm(struct xe_bo *bo)
 }
 
 bool xe_bo_is_xe_bo(struct ttm_buffer_object *bo);
+void xe_bo_addr_iter_first(struct xe_bo *bo, struct xe_res_cursor *cur, u64 offset, u64 size);
+dma_addr_t xe_bo_addr_iter_addr(struct xe_res_cursor *cur);
 dma_addr_t __xe_bo_addr(struct xe_bo *bo, u64 offset, size_t page_size);
 dma_addr_t xe_bo_addr(struct xe_bo *bo, u64 offset, size_t page_size);
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH 0/2] drm/xe/display: Optimize remapped DPT pinning
@ 2026-06-12 14:11 Maarten Lankhorst
  2026-06-12 14:11 ` [PATCH 1/2] drm/xe/bo: Add xe_bo_addr_iter Maarten Lankhorst
  0 siblings, 1 reply; 10+ messages in thread
From: Maarten Lankhorst @ 2026-06-12 14:11 UTC (permalink / raw)
  To: intel-xe; +Cc: Maarten Lankhorst

Create and use xe_bo_addr_iter to improve the time complexity
of remapped framebuffers from O(N²) to O(N)

Maarten Lankhorst (2):
  drm/xe/bo: Add xe_bo_addr_iter.
  drm/xe/display: Use xe_bo_addr_iter in remapped DPT pinning

 drivers/gpu/drm/xe/display/xe_fb_pin.c | 24 +++++++-------
 drivers/gpu/drm/xe/xe_bo.c             | 45 +++++++++++++++-----------
 drivers/gpu/drm/xe/xe_bo.h             |  3 ++
 3 files changed, 41 insertions(+), 31 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-10-21 18:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 15:01 [PATCH 1/2] drm/xe/bo: Add xe_bo_addr_iter Maarten Lankhorst
2026-10-21 15:01 ` [PATCH 2/2] drm/xe/display: Use xe_bo_addr_iter in remapped DPT pinning Maarten Lankhorst
2026-10-21 15:20   ` sashiko-bot
2026-10-21 15:06 ` ✗ CI.checkpatch: warning for series starting with [1/2] drm/xe/bo: Add xe_bo_addr_iter Patchwork
2026-10-21 15:08 ` ✓ CI.KUnit: success " Patchwork
2026-10-21 15:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-21 18:11 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-21 18:33 ` [PATCH 1/2] " Matthew Brost
  -- strict thread matches above, loose matches on Subject: below --
2026-06-12 14:11 [PATCH 0/2] drm/xe/display: Optimize remapped DPT pinning Maarten Lankhorst
2026-06-12 14:11 ` [PATCH 1/2] drm/xe/bo: Add xe_bo_addr_iter Maarten Lankhorst
2026-06-12 16:10   ` Matthew Brost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox