45#define BMP_SIGNATURE 0x4D42
48#define BGRT_STATUS_ORIENTATION_MASK (0x3 << 1)
49#define BGRT_ORIENTATION_0 0
50#define BGRT_ORIENTATION_90 1
51#define BGRT_ORIENTATION_180 2
52#define BGRT_ORIENTATION_270 3
54#define LOWEST_SUPPORTED_RES 1
88#ifdef EFI_UGA_DRAW_PROTOCOL_GUID
97#ifdef EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
107 {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000},
108 {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000},
123 Stride =
ROUND_UP(BitsPerRow, 32) / 8;
127 *RowStride = (
ULONG)Stride;
140 if (BitmapSize >= ScreenSize)
144 *DrawSize = ScreenSize;
149 *DrawSize = BitmapSize;
166 if (RequestedOffset >= ScreenSize)
172 *DrawSize =
min(BitmapSize, ScreenSize - RequestedOffset);
185 *
Width = Logo->Height;
190 *
Width = Logo->Width;
203 switch (Logo->Orientation)
207 *SourceY = Logo->Height - 1 -
X;
211 *SourceX = Logo->Width - 1 -
X;
212 *SourceY = Logo->Height - 1 -
Y;
216 *SourceX = Logo->Width - 1 -
Y;
236 ULONG SourceRowIndex;
238 SourceRowIndex = (Logo->TopDown ?
Y : (Logo->Height - 1 -
Y));
239 return Logo->PixelData +
240 SourceRowIndex * Logo->RowStride +
241 X * (Logo->BitsPerPixel / 8);
251 ULONG RowStride, HeaderSize;
253 ULONG RotatedWidth, RotatedHeight;
269 if (BgrtTable ==
NULL)
271 TRACE(
"No BGRT table found\n");
283 TRACE(
"BGRT image is not marked valid\n");
289 WARN(
"Unsupported BGRT image type %u\n", BgrtTable->
ImageType);
296 WARN(
"Unsupported BGRT logo address 0x%llx\n", BgrtTable->
LogoAddress);
303 WARN(
"BGRT logo does not contain a BMP signature\n");
307 if (FileHeader->
Size <
sizeof(*FileHeader) +
sizeof(*InfoHeader))
309 WARN(
"BGRT BMP is too small for a BITMAPINFOHEADER (%lu)\n",
315 if ((InfoHeader->
Size <
sizeof(*InfoHeader)) ||
316 (InfoHeader->
Size > FileHeader->
Size -
sizeof(*FileHeader)))
318 WARN(
"Unsupported BMP info header size %lu\n", InfoHeader->
Size);
323 if ((InfoHeader->
Width <= 0) || (SignedHeight == 0))
325 WARN(
"Unsupported BMP dimensions %ld x %ld\n",
330 if (InfoHeader->
Planes != 1)
332 WARN(
"Unsupported BMP plane count %u\n", InfoHeader->
Planes);
338 WARN(
"Unsupported BMP bit depth %u\n", InfoHeader->
BitCount);
353 WARN(
"BMP row stride overflows\n");
359 WARN(
"BMP header size overflows\n");
363 HeaderSize =
sizeof(*FileHeader) + InfoHeader->
Size;
370 WARN(
"BGRT BMP image bounds are invalid\n");
386 UseFirmwarePlacement =
392 if (UseFirmwarePlacement)
423 TRACE(
"BGRT logo ready: %lux%lu rot=%u @ (%lu,%lu), crop (%lu,%lu) -> %lux%lu\n",
456 DestinationRow = (
PULONG)(VramBase +
462 ULONG SourceX, SourceY;
473 DestinationRow[Col] = 0xFF000000 |
474 (SourcePixel[2] << 16) |
475 (SourcePixel[1] << 8) |
495 TRACE(
"Failed to find GOP with status %d\n",
Status);
535 pPixelBitmask =
NULL;
552 ERR(
"Couldn't initialize video framebuffer\n");
576 ERR(
"Failed to find Apple Graphics Info with status %d\n",
Status);
590 ERR(
"Failed to get graphics info from Apple Scren Info: %d\n",
Status);
608 ERR(
"Couldn't initialize video framebuffer\n");
630 TRACE(
"Failed to detect GOP, trying Apple Graphics Info\n");
636 ERR(
"Cannot find framebuffer!\n");
#define APPLE_GRAPH_INFO_PROTOCOL_GUID
EFI_GRAPHICS_PIXEL_FORMAT
@ PixelRedGreenBlueReserved8BitPerColor
@ PixelBlueGreenRedReserved8BitPerColor
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
COMPILER_DEPENDENT_UINT64 UINT64
#define DBG_DEFAULT_CHANNEL(ch)
enum tagVIDEODISPLAYMODE VIDEODISPLAYMODE
UI_PROGRESS_BAR UiProgressBar
#define ROUND_UP(n, align)
static UCHAR BytesPerPixel
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
#define RTL_BITS_OF(sizeOfArg)
static ULONG ScreenHeight
static VIDEODISPLAYMODE DisplayMode
#define BGRT_STATUS_IMAGE_VALID
struct _BGRT_TABLE * PBGRT_TABLE
EFI_LOCATE_PROTOCOL LocateProtocol
EFI_PHYSICAL_ADDRESS FrameBufferBase
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
EFI_BOOT_SERVICES * BootServices
DESCRIPTION_HEADER Header
ReactOS Framebuffer-specific video device configuration data.
ULONG BitsPerPixel
Pixel depth.
ULONG PixelsPerScanLine
Pitch/stride in pixels.
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode
Physical format of an RGB pixel, specified with per-component bit-masks. A bit being set defines thos...
#define RtlZeroMemory(Destination, Length)
PDESCRIPTION_HEADER UefiFindAcpiTable(_In_ ULONG Signature)
VOID UefiVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
EFI_GUID EfiGraphicsOutputProtocol
VIDEODISPLAYMODE UefiVideoSetDisplayMode(PCSTR DisplayMode, BOOLEAN Init)
struct _BMP_INFO_HEADER * PBMP_INFO_HEADER
VOID UefiVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
VOID UefiVideoClearScreen(UCHAR Attr)
struct _UEFI_BGRT_LOGO UEFI_BGRT_LOGO
VOID UefiVideoHideShowTextCursor(BOOLEAN Show)
ULONG UefiVideoGetBufferSize(VOID)
static VOID UefiPreparePositionedLogoAxis(_In_ ULONG BitmapSize, _In_ ULONG ScreenSize, _In_ ULONG RequestedOffset, _Out_ PULONG SourceOffset, _Out_ PULONG DestinationOffset, _Out_ PULONG DrawSize)
static VOID UefiInitializeBgrtLogo(VOID)
static __inline PUCHAR UefiGetLogoPixelAddress(_In_ PUEFI_BGRT_LOGO Logo, _In_ ULONG X, _In_ ULONG Y)
struct _BMP_FILE_HEADER * PBMP_FILE_HEADER
#define BGRT_ORIENTATION_270
EFI_STATUS UefiInitializeVideo(VOID)
VOID UefiVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
VOID UefiVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
EFI_SYSTEM_TABLE * GlobalSystemTable
#define LOWEST_SUPPORTED_RES
EFI_GUID AppleGraphInfoProtocol
static EFI_STATUS UefiInitializeAppleGraphics(VOID)
static UEFI_BGRT_LOGO UefiBgrtLogo
static VOID UefiDrawBgrtLogo(VOID)
PCM_FRAMEBUF_DEVICE_DATA FrameBufferData
static VOID UefiGetLogoSourceCoordinates(_In_ PUEFI_BGRT_LOGO Logo, _In_ ULONG X, _In_ ULONG Y, _Out_ PULONG SourceX, _Out_ PULONG SourceY)
#define BGRT_STATUS_ORIENTATION_MASK
VOID UefiVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
struct _BMP_FILE_HEADER BMP_FILE_HEADER
VOID UefiVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
static VOID UefiPrepareCenteredLogoAxis(_In_ ULONG BitmapSize, _In_ ULONG ScreenSize, _Out_ PULONG SourceOffset, _Out_ PULONG DestinationOffset, _Out_ PULONG DrawSize)
struct _BMP_INFO_HEADER BMP_INFO_HEADER
static VOID UefiGetRotatedLogoSize(_In_ PUEFI_BGRT_LOGO Logo, _Out_ PULONG Width, _Out_ PULONG Height)
#define BGRT_ORIENTATION_180
static EFI_STATUS UefiInitializeGop(VOID)
EFI_HANDLE GlobalImageHandle
struct _UEFI_BGRT_LOGO * PUEFI_BGRT_LOGO
BOOLEAN UefiVideoIsPaletteFixed(VOID)
#define BGRT_ORIENTATION_90
BOOLEAN UefiCalculateBmpRowStride(_In_ ULONG Width, _In_ USHORT BitsPerPixel, _Out_ PULONG RowStride)
#define BGRT_ORIENTATION_0
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
_In_ HFONT _Out_ PUINT Height
VOID FbConsClearScreen(_In_ UCHAR Attr)
VOID FbConsGetDisplaySize(_Out_ PULONG Width, _Out_ PULONG Height, _Out_ PULONG Depth)
Returns the width and height in number of CGA characters/attributes, of a full text-mode CGA-style ch...
ULONG FbConsGetBufferSize(VOID)
Returns the size in bytes, of a full text-mode CGA-style character buffer rectangle that can fill the...
VOID FbConsPutChar(_In_ UCHAR Char, _In_ UCHAR Attr, _In_ ULONG Column, _In_ ULONG Row)
Displays a character with specific text attributes at a given position.
VOID FbConsCopyOffScreenBufferToVRAM(_In_ PVOID Buffer)
Copies a full text-mode CGA-style character buffer rectangle to the console.
BOOLEAN VidFbInitializeVideo(_Out_opt_ PCM_FRAMEBUF_DEVICE_DATA *pFbData, _In_ ULONG_PTR BaseAddress, _In_ ULONG BufferSize, _In_ UINT32 ScreenWidth, _In_ UINT32 ScreenHeight, _In_ UINT32 PixelsPerScanLine, _In_ UINT32 BitsPerPixel, _In_opt_ PPIXEL_BITMASK PixelMasks)
Initializes internal framebuffer information based on the given parameters.
FORCEINLINE ULONG PixelBitmasksToBpp(_In_ ULONG RedMask, _In_ ULONG GreenMask, _In_ ULONG BlueMask, _In_ ULONG ReservedMask)
Calculates the number of bits per pixel ("PixelDepth") for the given pixel format,...
struct _PIXEL_BITMASK * PPIXEL_BITMASK
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t DestinationOffset
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth