From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Subject: [CI 06/14] drm/xe/display: Dont poke into GGTT internals to fill a DPT
Date: Mon, 7 Apr 2025 15:04:41 +0200 [thread overview]
Message-ID: <20250407130449.1010470-7-dev@lankhorst.se> (raw)
In-Reply-To: <20250407130449.1010470-1-dev@lankhorst.se>
For DPT, it is sufficient to get the GGTT encode flags to fill the DPT.
Create a function to return the encode flags, and then encode using the
BO address.
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
drivers/gpu/drm/xe/display/xe_fb_pin.c | 20 +++++++++-----------
drivers/gpu/drm/xe/xe_ggtt.c | 15 +++++++++++++++
drivers/gpu/drm/xe/xe_ggtt.h | 2 ++
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index d509def82b134..5392e46a3a134 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -23,6 +23,7 @@ write_dpt_rotated(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs, u32 bo_
struct xe_device *xe = xe_bo_device(bo);
struct xe_ggtt *ggtt = xe_device_get_root_tile(xe)->mem.ggtt;
u32 column, row;
+ u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
/* TODO: Maybe rewrite so we can traverse the bo addresses sequentially,
* by writing dpt/ggtt in a different order?
@@ -32,10 +33,9 @@ write_dpt_rotated(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs, u32 bo_
u32 src_idx = src_stride * (height - 1) + column + bo_ofs;
for (row = 0; row < height; row++) {
- u64 pte = ggtt->pt_ops->pte_encode_bo(bo, src_idx * XE_PAGE_SIZE,
- xe->pat.idx[XE_CACHE_NONE]);
+ u64 addr = xe_bo_addr(bo, src_idx * XE_PAGE_SIZE, XE_PAGE_SIZE);
- iosys_map_wr(map, *dpt_ofs, u64, pte);
+ iosys_map_wr(map, *dpt_ofs, u64, pte | addr);
*dpt_ofs += 8;
src_idx -= src_stride;
}
@@ -55,17 +55,15 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
{
struct xe_device *xe = xe_bo_device(bo);
struct xe_ggtt *ggtt = xe_device_get_root_tile(xe)->mem.ggtt;
- u64 (*pte_encode_bo)(struct xe_bo *bo, u64 bo_offset, u16 pat_index)
- = ggtt->pt_ops->pte_encode_bo;
u32 column, row;
+ u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
for (row = 0; row < height; row++) {
u32 src_idx = src_stride * row + bo_ofs;
for (column = 0; column < width; column++) {
- iosys_map_wr(map, *dpt_ofs, u64,
- pte_encode_bo(bo, src_idx * XE_PAGE_SIZE,
- xe->pat.idx[XE_CACHE_NONE]));
+ u64 addr = xe_bo_addr(bo, src_idx * XE_PAGE_SIZE, XE_PAGE_SIZE);
+ iosys_map_wr(map, *dpt_ofs, u64, pte | addr);
*dpt_ofs += 8;
src_idx++;
@@ -129,13 +127,13 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
return PTR_ERR(dpt);
if (view->type == I915_GTT_VIEW_NORMAL) {
+ u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
u32 x;
for (x = 0; x < size / XE_PAGE_SIZE; x++) {
- u64 pte = ggtt->pt_ops->pte_encode_bo(bo, x * XE_PAGE_SIZE,
- xe->pat.idx[XE_CACHE_NONE]);
+ u64 addr = xe_bo_addr(bo, x * XE_PAGE_SIZE, XE_PAGE_SIZE);
- iosys_map_wr(&dpt->vmap, x * 8, u64, pte);
+ iosys_map_wr(&dpt->vmap, x * 8, u64, pte | addr);
}
} else if (view->type == I915_GTT_VIEW_REMAPPED) {
const struct intel_remapped_info *remap_info = &view->remapped;
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 8e1976bceb44f..5ea2f9fac85d4 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -918,3 +918,18 @@ u64 xe_ggtt_print_holes(struct xe_ggtt *ggtt, u64 alignment, struct drm_printer
return total;
}
+
+/**
+ * xe_ggtt_encode_pte_flags - Get PTE encoding flags for BO
+ * @ggtt: &xe_ggtt
+ * @bo: &xe_bo
+ * @pat_index: The pat_index for the PTE.
+ *
+ * This function returns the pte_flags for a given BO, without address.
+ * It's used for DPT to fill a GGTT mapped BO with a linear lookup table.
+ */
+u64 xe_ggtt_encode_pte_flags(struct xe_ggtt *ggtt,
+ struct xe_bo *bo, u16 pat_index)
+{
+ return ggtt->pt_ops->pte_encode_flags(bo, pat_index);
+}
diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
index c48da99908848..437ba65f33860 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.h
+++ b/drivers/gpu/drm/xe/xe_ggtt.h
@@ -49,4 +49,6 @@ static inline void xe_ggtt_might_lock(struct xe_ggtt *ggtt)
void xe_ggtt_might_lock(struct xe_ggtt *ggtt);
#endif
+u64 xe_ggtt_encode_pte_flags(struct xe_ggtt *ggtt, struct xe_bo *bo, u16 pat_index);
+
#endif
--
2.45.2
next prev parent reply other threads:[~2025-04-07 13:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 13:04 [CI 00/14] drm/xe: Use migration for display GGTT updates Maarten Lankhorst
2025-04-07 13:04 ` [CI 01/14] drm/xe: Use xe_ggtt_map_bo_unlocked for resume Maarten Lankhorst
2025-04-07 13:04 ` [CI 02/14] drm/xe: Add xe_ggtt_might_lock Maarten Lankhorst
2025-04-07 13:04 ` [CI 03/14] drm/xe: Add xe_ggtt_alloc Maarten Lankhorst
2025-04-07 13:04 ` [CI 04/14] drm/xe/display: Remove dereferences of ggtt for tile id Maarten Lankhorst
2025-04-07 13:04 ` [CI 05/14] drm/xe/ggtt: Seperate flags and address in PTE encoding Maarten Lankhorst
2025-04-07 13:04 ` Maarten Lankhorst [this message]
2025-04-07 13:04 ` [CI 07/14] drm/xe/display: Convert GGTT mapping to use pte_encode_flags Maarten Lankhorst
2025-04-07 13:04 ` [CI 08/14] drm/xe: Remove pte_encode_bo callback Maarten Lankhorst
2025-04-07 13:04 ` [CI 09/14] drm/xe: Implement a helper for reading out a GGTT PTE at a specified offset Maarten Lankhorst
2025-04-07 13:04 ` [CI 10/14] drm/xe: Do not rely on GGTT internals in xe_guc_buf kunit tests Maarten Lankhorst
2025-04-07 13:04 ` [CI 11/14] drm/xe: Add GGTT updates to migration engine Maarten Lankhorst
2025-04-07 13:04 ` [CI 12/14] drm/xe: Convert xe_fb_pin to use a callback for insertion into GGTT Maarten Lankhorst
2025-04-07 13:04 ` [CI 13/14] drm/xe: Allow for optimization of xe_ggtt_map_bo Maarten Lankhorst
2025-04-07 13:04 ` [CI 14/14] drm/xe: Move struct xe_ggtt to xe_ggtt.c Maarten Lankhorst
2025-04-07 14:28 ` ✓ CI.Patch_applied: success for drm/xe: Use migration for display GGTT updates Patchwork
2025-04-07 14:28 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-07 14:29 ` ✓ CI.KUnit: success " Patchwork
2025-04-07 14:33 ` ✗ CI.Build: failure " Patchwork
2025-04-09 12:18 ` ✓ CI.Patch_applied: success for drm/xe: Use migration for display GGTT updates. (rev2) Patchwork
2025-04-09 12:19 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-09 12:20 ` ✓ CI.KUnit: success " Patchwork
2025-04-09 12:36 ` ✓ CI.Build: " Patchwork
2025-04-09 12:38 ` ✗ CI.Hooks: failure " Patchwork
2025-04-09 12:40 ` ✓ CI.checksparse: success " Patchwork
2025-04-09 13:31 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-10 4:56 ` ✗ Xe.CI.BAT: " Patchwork
2025-04-10 6:12 ` ✓ CI.Patch_applied: success " Patchwork
2025-04-10 6:13 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-10 6:14 ` ✓ CI.KUnit: success " Patchwork
2025-04-10 6:22 ` ✓ CI.Build: " Patchwork
2025-04-10 6:38 ` ✓ CI.Patch_applied: " Patchwork
2025-04-10 6:38 ` ✗ CI.checkpatch: warning " Patchwork
2025-04-10 6:39 ` ✓ CI.KUnit: success " Patchwork
2025-04-10 6:48 ` ✓ CI.Build: " Patchwork
2025-04-10 6:50 ` ✗ CI.Hooks: failure " Patchwork
2025-04-10 6:51 ` ✓ CI.checksparse: success " Patchwork
2025-04-10 7:07 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-04-10 7:58 ` ✗ Xe.CI.Full: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250407130449.1010470-7-dev@lankhorst.se \
--to=dev@lankhorst.se \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox