Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/xe/display: Move dpt allocation to helper
@ 2025-01-14 18:04 Juha-Pekka Heikkila
  2025-01-14 18:04 ` [PATCH 2/2] drm/xe/display: Unify display page table mapping Juha-Pekka Heikkila
                   ` (10 more replies)
  0 siblings, 11 replies; 31+ messages in thread
From: Juha-Pekka Heikkila @ 2025-01-14 18:04 UTC (permalink / raw)
  To: intel-xe; +Cc: Juha-Pekka Heikkila

Simplify __xe_pin_fb_vma_dpt() by moving dpt allocation into helper.
This also fixes bug where dpt could have been allocated from system
memory when on dgfx.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 drivers/gpu/drm/xe/display/xe_fb_pin.c | 67 +++++++++++++++++---------
 1 file changed, 43 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index 9fa51b84737c..c28885316986 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -77,6 +77,47 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
 	*dpt_ofs = ALIGN(*dpt_ofs, 4096);
 }
 
+static struct xe_bo *xe_alloc_dpt_bo(struct xe_device *xe,
+				     struct xe_tile *tile0, u64 size,
+				     u64 physical_alignment)
+{
+	struct xe_bo *dpt;
+
+	/*
+	 * If DGFX: try VRAM0 only
+	 */
+	if (IS_DGFX(xe)) {
+		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
+						      size, ~0ull,
+						      ttm_bo_type_kernel,
+						      XE_BO_FLAG_VRAM0 |
+						      XE_BO_FLAG_GGTT |
+						      XE_BO_FLAG_PAGETABLE,
+						      physical_alignment);
+	} else {
+		/*
+		 * For IGFX: first try STOLEN. on fail try SYSTEM.
+		 */
+		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
+						      size, ~0ull,
+						      ttm_bo_type_kernel,
+						      XE_BO_FLAG_STOLEN |
+						      XE_BO_FLAG_GGTT |
+						      XE_BO_FLAG_PAGETABLE,
+						      physical_alignment);
+		if (IS_ERR(dpt)) {
+			dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
+							      size, ~0ull,
+							      ttm_bo_type_kernel,
+							      XE_BO_FLAG_SYSTEM |
+							      XE_BO_FLAG_GGTT |
+							      XE_BO_FLAG_PAGETABLE,
+							      physical_alignment);
+		}
+	}
+	return dpt;
+}
+
 static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
 			       const struct i915_gtt_view *view,
 			       struct i915_vma *vma,
@@ -99,30 +140,8 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
 		dpt_size = ALIGN(intel_rotation_info_size(&view->rotated) * 8,
 				 XE_PAGE_SIZE);
 
-	if (IS_DGFX(xe))
-		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
-						      dpt_size, ~0ull,
-						      ttm_bo_type_kernel,
-						      XE_BO_FLAG_VRAM0 |
-						      XE_BO_FLAG_GGTT |
-						      XE_BO_FLAG_PAGETABLE,
-						      physical_alignment);
-	else
-		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
-						      dpt_size,  ~0ull,
-						      ttm_bo_type_kernel,
-						      XE_BO_FLAG_STOLEN |
-						      XE_BO_FLAG_GGTT |
-						      XE_BO_FLAG_PAGETABLE,
-						      physical_alignment);
-	if (IS_ERR(dpt))
-		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
-						      dpt_size,  ~0ull,
-						      ttm_bo_type_kernel,
-						      XE_BO_FLAG_SYSTEM |
-						      XE_BO_FLAG_GGTT |
-						      XE_BO_FLAG_PAGETABLE,
-						      physical_alignment);
+	dpt = xe_alloc_dpt_bo(xe, tile0, dpt_size, physical_alignment);
+
 	if (IS_ERR(dpt))
 		return PTR_ERR(dpt);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [PATCH 1/2] drm/xe/display: Move dpt allocation to helper
@ 2025-05-13 14:14 Juha-Pekka Heikkila
  0 siblings, 0 replies; 31+ messages in thread
From: Juha-Pekka Heikkila @ 2025-05-13 14:14 UTC (permalink / raw)
  To: intel-xe; +Cc: Juha-Pekka Heikkila, Jonathan Cavitt, Maarten Lankhorst

Simplify __xe_pin_fb_vma_dpt() by moving dpt allocation into helper.
This also fixes bug where dpt could have been allocated from system
memory when on dgfx.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/xe/display/xe_fb_pin.c | 67 +++++++++++++++++---------
 1 file changed, 43 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index d918ae1c8061..540e5f31e655 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -79,6 +79,47 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
 	*dpt_ofs = ALIGN(*dpt_ofs, 4096);
 }
 
+static struct xe_bo *xe_alloc_dpt_bo(struct xe_device *xe,
+				     struct xe_tile *tile0, u64 size,
+				     unsigned int alignment)
+{
+	struct xe_bo *dpt;
+
+	/*
+	 * If DGFX: try VRAM0 only
+	 */
+	if (IS_DGFX(xe)) {
+		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
+						      size, ~0ull,
+						      ttm_bo_type_kernel,
+						      XE_BO_FLAG_VRAM0 |
+						      XE_BO_FLAG_GGTT |
+						      XE_BO_FLAG_PAGETABLE,
+						      alignment);
+	} else {
+		/*
+		 * For IGFX: first try STOLEN. on fail try SYSTEM.
+		 */
+		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
+						      size, ~0ull,
+						      ttm_bo_type_kernel,
+						      XE_BO_FLAG_STOLEN |
+						      XE_BO_FLAG_GGTT |
+						      XE_BO_FLAG_PAGETABLE,
+						      alignment);
+		if (IS_ERR(dpt)) {
+			dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
+							      size, ~0ull,
+							      ttm_bo_type_kernel,
+							      XE_BO_FLAG_SYSTEM |
+							      XE_BO_FLAG_GGTT |
+							      XE_BO_FLAG_PAGETABLE,
+							      alignment);
+		}
+	}
+	return dpt;
+}
+
 static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
 			       const struct i915_gtt_view *view,
 			       struct i915_vma *vma,
@@ -101,30 +142,8 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
 		dpt_size = ALIGN(intel_rotation_info_size(&view->rotated) * 8,
 				 XE_PAGE_SIZE);
 
-	if (IS_DGFX(xe))
-		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
-						      dpt_size, ~0ull,
-						      ttm_bo_type_kernel,
-						      XE_BO_FLAG_VRAM0 |
-						      XE_BO_FLAG_GGTT |
-						      XE_BO_FLAG_PAGETABLE,
-						      alignment);
-	else
-		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
-						      dpt_size,  ~0ull,
-						      ttm_bo_type_kernel,
-						      XE_BO_FLAG_STOLEN |
-						      XE_BO_FLAG_GGTT |
-						      XE_BO_FLAG_PAGETABLE,
-						      alignment);
-	if (IS_ERR(dpt))
-		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
-						      dpt_size,  ~0ull,
-						      ttm_bo_type_kernel,
-						      XE_BO_FLAG_SYSTEM |
-						      XE_BO_FLAG_GGTT |
-						      XE_BO_FLAG_PAGETABLE,
-						      alignment);
+	dpt = xe_alloc_dpt_bo(xe, tile0, dpt_size, alignment);
+
 	if (IS_ERR(dpt))
 		return PTR_ERR(dpt);
 
-- 
2.45.2


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

end of thread, other threads:[~2025-05-13 14:15 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 18:04 [PATCH 1/2] drm/xe/display: Move dpt allocation to helper Juha-Pekka Heikkila
2025-01-14 18:04 ` [PATCH 2/2] drm/xe/display: Unify display page table mapping Juha-Pekka Heikkila
2025-01-14 19:56   ` Cavitt, Jonathan
2025-02-04 11:25   ` Tvrtko Ursulin
2025-02-04 11:38     ` Tvrtko Ursulin
2025-02-04 12:10       ` Juha-Pekka Heikkilä
2025-02-04 12:31         ` Tvrtko Ursulin
2025-02-04 13:11           ` Juha-Pekka Heikkilä
2025-02-04 18:05             ` Tvrtko Ursulin
2025-02-07 14:33               ` Juha-Pekka Heikkilä
2025-02-11 11:22                 ` Tvrtko Ursulin
2025-01-14 19:22 ` [PATCH 1/2] drm/xe/display: Move dpt allocation to helper Cavitt, Jonathan
2025-01-15 10:19   ` Maarten Lankhorst
2025-01-15 15:09     ` Cavitt, Jonathan
2025-01-15 15:26       ` Cavitt, Jonathan
2025-01-16 15:33         ` Juha-Pekka Heikkilä
2025-01-14 19:39 ` ✓ CI.Patch_applied: success for series starting with [1/2] " Patchwork
2025-01-14 19:39 ` ✓ CI.checkpatch: " Patchwork
2025-01-14 19:40 ` ✓ CI.KUnit: " Patchwork
2025-01-14 19:58 ` ✓ CI.Build: " Patchwork
2025-01-14 20:01 ` ✓ CI.Hooks: " Patchwork
2025-01-14 20:02 ` ✓ CI.checksparse: " Patchwork
2025-01-14 20:28 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-14 23:24 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-03 13:07 ` [PATCH 1/2] " Jani Nikula
2025-02-03 15:36   ` Lucas De Marchi
2025-02-04 10:37     ` Jani Nikula
2025-02-04 14:59       ` Lucas De Marchi
2025-02-04 15:11         ` Jani Nikula
2025-02-04 16:07           ` Tvrtko Ursulin
  -- strict thread matches above, loose matches on Subject: below --
2025-05-13 14:14 Juha-Pekka Heikkila

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