diff options
author | Joursoir <chat@joursoir.net> | 2022-03-25 18:37:48 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-03-25 18:38:36 +0300 |
commit | 01a6d8366c5c3bf8c52f666a1c302fea035185da (patch) | |
tree | 52a53ef4dddf0f1ccbd0efed820234368e43279f /UefiMonitorTest/UefiMonitorTest.c | |
parent | e425501ea7af0e2cf0397b46bf65f9275f2a5659 (diff) | |
download | umt-01a6d8366c5c3bf8c52f666a1c302fea035185da.tar.gz umt-01a6d8366c5c3bf8c52f666a1c302fea035185da.tar.bz2 umt-01a6d8366c5c3bf8c52f666a1c302fea035185da.zip |
main: add graphics context
Diffstat (limited to 'UefiMonitorTest/UefiMonitorTest.c')
-rw-r--r-- | UefiMonitorTest/UefiMonitorTest.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c index 7cdff88..2d27013 100644 --- a/UefiMonitorTest/UefiMonitorTest.c +++ b/UefiMonitorTest/UefiMonitorTest.c @@ -10,6 +10,39 @@ #include <Protocol/GraphicsOutput.h> +#include "UefiMonitorTest.h" + +STATIC +VOID +PrepareGraphicsInfo ( + IN GRAPHICS_CONTEXT *Graphics, + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop + ) +{ + ASSERT (Graphics != NULL); + ASSERT (Gop != NULL); + + Graphics->Gop = Gop; + Graphics->Base = (UINT8 *)Gop->Mode->FrameBufferBase; + Graphics->Width = Gop->Mode->Info->HorizontalResolution; + Graphics->Height = Gop->Mode->Info->VerticalResolution; + Graphics->PixelWidth = 4; // A pixel is 32-bits + Graphics->Pitch = Graphics->PixelWidth * Gop->Mode->Info->PixelsPerScanLine; + + DEBUG (( + DEBUG_INFO, + "GOP information:\n" + "Mode: %d\n" + "Support a physical frame buffer: %s\n" + "Framebuffer address, size: %x, %d\n" + "Screen width x height: %d x %d\n", + Gop->Mode->Mode, + (Gop->Mode->Info->PixelFormat == PixelBltOnly) ? L"NO" : L"YES", + Gop->Mode->FrameBufferBase, Gop->Mode->FrameBufferSize, + Gop->Mode->Info->HorizontalResolution, Gop->Mode->Info->VerticalResolution + )); +} + STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL * GetGraphicsOutputProtocol ( @@ -57,6 +90,7 @@ UefiMain ( ) { EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop; + GRAPHICS_CONTEXT Graphics; Gop = GetGraphicsOutputProtocol (); if (Gop == NULL) { @@ -64,5 +98,7 @@ UefiMain ( return EFI_NOT_FOUND; } + PrepareGraphicsInfo (&Graphics, Gop); + return EFI_SUCCESS; } |