From 1dc79194f9e99317a8156cc48287c0309bcdb185 Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 22 Sep 2021 16:03:14 +0000 Subject: [PATCH] Add a workaround for machines where the framebuffer size reported by the hardware is incorrect. In this case, make sure the amount of "stolen" memory is at least as large as the EFI framebuffer such that the driver doesn't use this memory until we've switched to the framebuffer allocated by the amdgpu(4) driver. Needs further investigation why the size reported by the hardware is incorrect. Tested by djm@ ok jsg@, deraadt@ --- sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c index ee053ed3775..ce7909f4e79 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c @@ -499,6 +499,15 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) } else { size = amdgpu_gmc_get_vbios_fb_size(adev); +#ifdef __amd64__ + /* + * XXX Workaround for machines where the framebuffer + * size reported by the hardware is incorrect. + */ + extern psize_t efifb_stolen(); + size = max(size, efifb_stolen()); +#endif + if (adev->mman.keep_stolen_vga_memory) size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION); } -- 2.20.1