aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-03-26 17:16:41 +0300
committerJoursoir <chat@joursoir.net>2022-03-26 17:16:41 +0300
commit444d9d9b38f94973f965e335719c6c46265f70ef (patch)
tree0ed0d5e9ff660d420df54c5c9515d43607801251
parent01a6d8366c5c3bf8c52f666a1c302fea035185da (diff)
downloadumt-444d9d9b38f94973f965e335719c6c46265f70ef.tar.gz
umt-444d9d9b38f94973f965e335719c6c46265f70ef.tar.bz2
umt-444d9d9b38f94973f965e335719c6c46265f70ef.zip
add double buffering
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c21
-rw-r--r--UefiMonitorTest/UefiMonitorTest.h10
2 files changed, 29 insertions, 2 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 2d27013..8dda9b7 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -23,7 +23,10 @@ PrepareGraphicsInfo (
ASSERT (Gop != NULL);
Graphics->Gop = Gop;
- Graphics->Base = (UINT8 *)Gop->Mode->FrameBufferBase;
+ Graphics->FrontBuffer = (UINT8 *)Gop->Mode->FrameBufferBase;
+ Graphics->BufferSize = Gop->Mode->FrameBufferSize;
+ Graphics->BackBuffer = AllocateCopyPool (Graphics->BufferSize, Graphics->FrontBuffer);
+ ASSERT (Graphics->BackBuffer != NULL);
Graphics->Width = Gop->Mode->Info->HorizontalResolution;
Graphics->Height = Gop->Mode->Info->VerticalResolution;
Graphics->PixelWidth = 4; // A pixel is 32-bits
@@ -44,6 +47,18 @@ PrepareGraphicsInfo (
}
STATIC
+VOID
+ForgetGraphicsInfo (
+ IN GRAPHICS_CONTEXT *Graphics
+ )
+{
+ ASSERT (Graphics != NULL);
+
+ // Should we zero all the data structure?
+
+ FreePool (Graphics->BackBuffer);
+}
+
EFI_GRAPHICS_OUTPUT_PROTOCOL *
GetGraphicsOutputProtocol (
VOID
@@ -100,5 +115,9 @@ UefiMain (
PrepareGraphicsInfo (&Graphics, Gop);
+
+
+ ForgetGraphicsInfo (&Graphics);
+
return EFI_SUCCESS;
}
diff --git a/UefiMonitorTest/UefiMonitorTest.h b/UefiMonitorTest/UefiMonitorTest.h
index d6306bc..97ada85 100644
--- a/UefiMonitorTest/UefiMonitorTest.h
+++ b/UefiMonitorTest/UefiMonitorTest.h
@@ -10,7 +10,15 @@ typedef struct {
/// Base address of graphics linear frame buffer.
/// Starts from the upper left pixel.
///
- UINT8 *Base;
+ UINT8 *FrontBuffer;
+ ///
+ /// Pointer to allocated memory. Secondary linear buffer.
+ ///
+ UINT8 *BackBuffer;
+ ///
+ /// Amount of frame buffer needed to support the active mode.
+ ///
+ UINTN BufferSize;
///
/// The size of video screen in pixels in the X dimension.
///