[haiku-commits] haiku: hrev50776 - src/system/boot/platform/efi

  • From: jessica.l.hamilton@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 19 Dec 2016 08:19:17 +0100 (CET)

hrev50776 adds 1 changeset to branch 'master'
old head: ebdee3ef35680a6adb25fedf6ab51d295cc5b5ee
new head: 4ff3f10852745c4d47370c01ba2f4e1d59e38056
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=4ff3f1085274+%5Eebdee3ef3568

----------------------------------------------------------------------------

4ff3f1085274: UEFI: improve setting up of the framebuffer.
  
  * Even if we get dropped into the boot menu, we still want
    to have the framebuffer enabled, else we never switch
    back into graphics mode.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50776
Commit:      4ff3f10852745c4d47370c01ba2f4e1d59e38056
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4ff3f1085274
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Mon Dec 19 07:16:52 2016 UTC

----------------------------------------------------------------------------

2 files changed, 20 insertions(+), 4 deletions(-)
src/system/boot/platform/efi/console.cpp |  1 -
src/system/boot/platform/efi/video.cpp   | 23 ++++++++++++++++++++---

----------------------------------------------------------------------------

diff --git a/src/system/boot/platform/efi/console.cpp 
b/src/system/boot/platform/efi/console.cpp
index 35500e7..ebfd21f 100644
--- a/src/system/boot/platform/efi/console.cpp
+++ b/src/system/boot/platform/efi/console.cpp
@@ -243,5 +243,4 @@ platform_switch_to_text_mode(void)
 {
        kSystemTable->ConOut->Reset(kSystemTable->ConOut, false);
        kSystemTable->ConOut->SetMode(kSystemTable->ConOut, sScreenMode);
-       gKernelArgs.frame_buffer.enabled = false;
 }
diff --git a/src/system/boot/platform/efi/video.cpp 
b/src/system/boot/platform/efi/video.cpp
index 9c21c01..1e78a79 100644
--- a/src/system/boot/platform/efi/video.cpp
+++ b/src/system/boot/platform/efi/video.cpp
@@ -8,6 +8,7 @@
 #include <boot/platform.h>
 #include <boot/platform/generic/video.h>
 #include <boot/stage2.h>
+#include <boot/stdio.h>
 
 #include "efi_platform.h"
 
@@ -38,24 +39,39 @@ platform_init_video(void)
        UINTN bestArea = 0;
        UINTN bestDepth = 0;
 
+       dprintf("looking for best graphics mode...\n");
+
        for (UINTN mode = 0; mode < sGraphicsOutput->Mode->MaxMode; ++mode) {
                EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
                UINTN size, depth;
                sGraphicsOutput->QueryMode(sGraphicsOutput, mode, &size, &info);
                UINTN area = info->HorizontalResolution * 
info->VerticalResolution;
+               dprintf("  mode: %lu\n", mode);
+               dprintf("  width: %u\n", info->HorizontalResolution);
+               dprintf("  height: %u\n", info->VerticalResolution);
+               dprintf("  area: %lu\n", area);
                if (info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor)
                        depth = 32;
+               else if (info->PixelFormat == 
PixelBlueGreenRedReserved8BitPerColor)
+                       // seen this in the wild, but acts like RGB, go 
figure...
+                       depth = 32;
                else if (info->PixelFormat == PixelBitMask
                        && info->PixelInformation.RedMask == 0xFF0000
                        && info->PixelInformation.GreenMask == 0x00FF00
                        && info->PixelInformation.BlueMask == 0x0000FF
                        && info->PixelInformation.ReservedMask == 0)
                        depth = 24;
-               else
+               else {
+                       dprintf("  pixel format: %x unsupported\n",
+                               info->PixelFormat);
                        continue;
+               }
+               dprintf("  depth: %lu\n", depth);
 
                area *= depth;
+               dprintf("  area (w/depth): %lu\n", area);
                if (area >= bestArea) {
+                       dprintf("selected new best mode: %lu\n", mode);
                        bestArea = area;
                        bestDepth = depth;
                        sGraphicsMode = mode;
@@ -64,9 +80,11 @@ platform_init_video(void)
 
        if (bestArea == 0 || bestDepth == 0) {
                sGraphicsOutput = NULL;
+               gKernelArgs.frame_buffer.enabled = false;
                return B_ERROR;
        }
 
+       gKernelArgs.frame_buffer.enabled = true;
        return B_OK;
 }
 
@@ -74,11 +92,10 @@ platform_init_video(void)
 extern "C" void
 platform_switch_to_logo(void)
 {
-       if (sGraphicsOutput == NULL || gKernelArgs.frame_buffer.enabled)
+       if (sGraphicsOutput == NULL || !gKernelArgs.frame_buffer.enabled)
                return;
 
        sGraphicsOutput->SetMode(sGraphicsOutput, sGraphicsMode);
-       gKernelArgs.frame_buffer.enabled = true;
        gKernelArgs.frame_buffer.physical_buffer.start =
                sGraphicsOutput->Mode->FrameBufferBase;
        gKernelArgs.frame_buffer.physical_buffer.size =


Other related posts: