From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
"Maarten Lankhorst" <dev@lankhorst.se>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [DO NOT REVIEW 05/11] drm/xe/display: Remove duplicated code
Date: Mon, 20 Jul 2026 18:14:57 +0200 [thread overview]
Message-ID: <20260720161451.384968-18-dev@lankhorst.se> (raw)
In-Reply-To: <20260720161451.384968-13-dev@lankhorst.se>
The order of pte vs checks isn't important, so read the pte
outside the if block. This makes it slightly more readable.
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/xe/display/xe_initial_plane.c | 33 ++++++-------------
1 file changed, 10 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
index 451c24a4ed8d5..1366b68f43fc2 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -45,7 +45,7 @@ initial_plane_bo(struct xe_device *xe,
struct xe_bo *bo;
resource_size_t phys_base;
u32 base, size, flags;
- u64 page_size = xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K;
+ u64 page_size = xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K, pte;
struct xe_ggtt_node *original_ggtt_node;
if (plane_config->size == 0)
@@ -58,16 +58,14 @@ initial_plane_bo(struct xe_device *xe,
page_size);
size -= base;
- if (IS_DGFX(xe)) {
- u64 pte = xe_ggtt_read_pte(tile0->mem.ggtt, base);
-
- if (is_pte_local(pte) != need_pte_local(xe)) {
- drm_err(&xe->drm, "Initial plane PTE has bad local memory bit\n");
- return NULL;
- }
-
- phys_base = pte & ~(page_size - 1);
+ pte = xe_ggtt_read_pte(tile0->mem.ggtt, base);
+ phys_base = pte & ~(page_size - 1);
+ if (is_pte_local(pte) != need_pte_local(xe)) {
+ drm_err(&xe->drm, "Initial plane PTE has bad local memory bit\n");
+ return NULL;
+ }
+ if (IS_DGFX(xe)) {
flags |= XE_BO_FLAG_VRAM0;
/*
@@ -85,24 +83,13 @@ initial_plane_bo(struct xe_device *xe,
"Using phys_base=%pa, based on initial plane programming\n",
&phys_base);
} else {
- struct ttm_resource_manager *stolen;
- u64 pte;
-
- stolen = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
- if (!stolen) {
+ if (!ttm_manager_type(&xe->ttm, XE_PL_STOLEN)) {
drm_dbg_kms(&xe->drm, "No stolen for initial FB\n");
return NULL;
}
- pte = xe_ggtt_read_pte(tile0->mem.ggtt, base);
-
- if (is_pte_local(pte) != need_pte_local(xe)) {
- drm_err(&xe->drm, "Initial plane PTE has bad local memory bit\n");
- return NULL;
- }
-
- phys_base = (pte & ~(page_size - 1)) - xe_ttm_stolen_gpu_offset(xe);
flags |= XE_BO_FLAG_STOLEN;
+ phys_base -= xe_ttm_stolen_gpu_offset(xe);
if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) &&
--
2.53.0
next prev parent reply other threads:[~2026-07-20 16:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 16:14 [PATCH 00/11] drm/xe/display: Transparant fallback from stolen to sysmem Maarten Lankhorst
2026-07-20 16:14 ` [DO NOT REVIEW 01/11] drm/xe/ggtt: Add xe_ggtt_reserve_area Maarten Lankhorst
2026-07-20 16:14 ` [DO NOT REVIEW 02/11] drm/xe/ggtt: Add xe_ggtt_node_remove_noclear Maarten Lankhorst
2026-07-20 16:14 ` [DO NOT REVIEW 03/11] drm/xe/display: Reserve the original GGTT space before creating a bo Maarten Lankhorst
2026-07-20 16:14 ` [DO NOT REVIEW 04/11] drm/xe/display: Use the correct calculation for phys_base on integrated Maarten Lankhorst
2026-07-20 16:14 ` Maarten Lankhorst [this message]
2026-07-20 16:14 ` [DO NOT REVIEW 06/11] drm/xe/ggtt: Remove xe_ggtt_insert_bo_at Maarten Lankhorst
2026-07-20 16:14 ` [PATCH 07/11] drm/xe/display: Avoid using stolen memory for framebuffer when media gt exists Maarten Lankhorst
2026-07-20 16:15 ` [PATCH 08/11] drm/xe/migrate: Support copying between sysmem and stolen Maarten Lankhorst
2026-07-20 19:09 ` Matthew Brost
2026-07-20 20:28 ` Maarten Lankhorst
2026-07-20 16:15 ` [PATCH 09/11] drm/xe: Raise gt frequency slightly earlier Maarten Lankhorst
2026-07-20 19:00 ` Matthew Brost
2026-07-20 16:15 ` [PATCH 10/11] HACK: Always fallback Maarten Lankhorst
2026-07-20 16:15 ` [PATCH 11/11] drm/i915: Introduce intel_bo_fbdev_bios_fb_takeover() Maarten Lankhorst
2026-07-20 22:44 ` ✓ i915.CI.BAT: success for drm/xe/display: Transparant fallback from stolen to sysmem 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=20260720161451.384968-18-dev@lankhorst.se \
--to=dev@lankhorst.se \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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