]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/QemuVideoDxe: round up FrameBufferSize to full page
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 26 Apr 2018 07:02:07 +0000 (09:02 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 26 Apr 2018 10:53:19 +0000 (12:53 +0200)
Guests do the same, because the framebuffer is mapped somewhere, which
obviously works with page granularity only.

When not rounding up to full page size we get messages like this one
(linux kernel):

    efifb: framebuffer at 0x80000000, using 1876k, total 1875k
                                            ^^^^^        ^^^^^
Also sysfb is confused and throws an error:

    sysfb: VRAM smaller than advertised

Cc: Phil Dennis-Jordan <phil@philjordan.eu>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: fix coding style]

OvmfPkg/QemuVideoDxe/Gop.c

index d51efc2a83d56a4496c9de592ad1863b86f18224..c9941ef138bd01caf819af8566cc221445218282 100644 (file)
@@ -69,6 +69,9 @@ QemuVideoCompleteModeData (
   Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin;\r
   Mode->FrameBufferSize = Info->HorizontalResolution * Info->VerticalResolution;\r
   Mode->FrameBufferSize = Mode->FrameBufferSize * ((ModeData->ColorDepth + 7) / 8);\r
+  Mode->FrameBufferSize = EFI_PAGES_TO_SIZE (\r
+                            EFI_SIZE_TO_PAGES (Mode->FrameBufferSize)\r
+                            );\r
   DEBUG ((EFI_D_INFO, "FrameBufferBase: 0x%Lx, FrameBufferSize: 0x%Lx\n",\r
     Mode->FrameBufferBase, (UINT64)Mode->FrameBufferSize));\r
 \r
@@ -107,6 +110,9 @@ QemuVideoVmwareSvgaCompleteModeData (
 \r
   Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin + FbOffset;\r
   Mode->FrameBufferSize = BytesPerLine * Info->VerticalResolution;\r
+  Mode->FrameBufferSize = EFI_PAGES_TO_SIZE (\r
+                            EFI_SIZE_TO_PAGES (Mode->FrameBufferSize)\r
+                            );\r
 \r
   FreePool (FrameBufDesc);\r
   return Status;\r