From: Richard Lane <richardlanedev@gmail.com>
To: amd-gfx@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <siqueira@igalia.com>,
"Mario Limonciello" <mario.limonciello@amd.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Richard Lane" <richardlanedev@gmail.com>
Subject: [PATCH v2 1/3] drm/amdgpu: use pitch and surface offset for GMC v7/v8 fb size
Date: Sun, 1 Nov 2026 23:23:49 +0000 [thread overview]
Message-ID: <54c182e5-1474-47af-ae72-d28560a12bcf@gmail.com> (raw)
gmc_v7_0_get_vbios_fb_size() and gmc_v8_0_get_vbios_fb_size() currently
calculate the pre-OS framebuffer reservation as VIEWPORT_WIDTH *
VIEWPORT_HEIGHT * 4, assuming the scanout stride matches the viewport
width and that the surface starts at offset 0 of VRAM.
On Apple 27" 5K iMacs, EFI initializes a single 2560x2880 viewport at
boot but allocates a 5120-pixel stride surface (mmGRPH_PITCH = 5120)
and places mmGRPH_PRIMARY_SURFACE_ADDRESS at a 3 MiB offset (0x300000)
from vram_start, spanning [3 MiB, 59.25 MiB) in VRAM. Reserving only
2560 * 2880 * 4 bytes allows permanent TTM driver BOs to overlap the
active scanout and corrupt the boot splash screen.
Calculate the reservation size using mmGRPH_PITCH instead of
VIEWPORT_WIDTH and add the mmGRPH_PRIMARY_SURFACE_ADDRESS offset from
vram_start so the full active pre-OS scanout region is preserved.
Signed-off-by: Richard Lane <richardlanedev@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 8 +++++---
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index c09f5153679e..00704dbfc1bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -929,9 +929,11 @@ static unsigned int gmc_v7_0_get_vbios_fb_size(struct amdgpu_device *adev)
} else {
u32 viewport = RREG32(mmVIEWPORT_SIZE);
- size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
- REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_WIDTH) *
- 4);
+ size = REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
+ RREG32(mmGRPH_PITCH) * 4;
+ if (size)
+ size += RREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS) -
+ lower_32_bits(adev->gmc.vram_start);
}
return size;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 15592027e7c0..a64a3cc07858 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1037,9 +1037,11 @@ static unsigned int gmc_v8_0_get_vbios_fb_size(struct amdgpu_device *adev)
} else {
u32 viewport = RREG32(mmVIEWPORT_SIZE);
- size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
- REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_WIDTH) *
- 4);
+ size = REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
+ RREG32(mmGRPH_PITCH) * 4;
+ if (size)
+ size += RREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS) -
+ lower_32_bits(adev->gmc.vram_start);
}
return size;
--
2.55.0
reply other threads:[~2026-11-01 23:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=54c182e5-1474-47af-ae72-d28560a12bcf@gmail.com \
--to=richardlanedev@gmail.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@amd.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
all inboxes | Powered by JetHome®