ReactOS 0.4.16-dev-2104-gb84fa49
uefivid.c File Reference
#include <uefildr.h>
#include "../vidfb.h"
#include <debug.h>
Include dependency graph for uefivid.c:

Go to the source code of this file.

Macros

#define LOWEST_SUPPORTED_RES   1
 

Functions

 DBG_DEFAULT_CHANNEL (UI)
 
EFI_STATUS UefiInitializeVideo (VOID)
 
VOID UefiVideoClearScreen (UCHAR Attr)
 
VOID UefiVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
VOID UefiVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
VIDEODISPLAYMODE UefiVideoSetDisplayMode (PCSTR DisplayMode, BOOLEAN Init)
 
ULONG UefiVideoGetBufferSize (VOID)
 
VOID UefiVideoCopyOffScreenBufferToVRAM (PVOID Buffer)
 
VOID UefiVideoSetTextCursorPosition (UCHAR X, UCHAR Y)
 
VOID UefiVideoHideShowTextCursor (BOOLEAN Show)
 
BOOLEAN UefiVideoIsPaletteFixed (VOID)
 
VOID UefiVideoSetPaletteColor (UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 
VOID UefiVideoGetPaletteColor (UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 

Variables

EFI_SYSTEM_TABLEGlobalSystemTable
 
EFI_HANDLE GlobalImageHandle
 
EFI_GUID EfiGraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID
 

Macro Definition Documentation

◆ LOWEST_SUPPORTED_RES

#define LOWEST_SUPPORTED_RES   1

Definition at line 20 of file uefivid.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UI  )

◆ UefiInitializeVideo()

EFI_STATUS UefiInitializeVideo ( VOID  )

Definition at line 52 of file uefivid.c.

53{
55 EFI_PIXEL_BITMASK* pPixelBitmask;
56 ULONG BitsPerPixel;
57
60
62 if (Status != EFI_SUCCESS)
63 {
64 TRACE("Failed to find GOP with status %d\n", Status);
65 return Status;
66 }
67
68 /* We don't need high resolutions for freeldr */
69 gop->SetMode(gop, LOWEST_SUPPORTED_RES);
70
71 /* Physical format of the pixel */
72 PixelFormat = gop->Mode->Info->PixelFormat;
73 switch (PixelFormat)
74 {
77 {
78 pPixelBitmask = &EfiPixelMasks[PixelFormat];
80 break;
81 }
82
83 case PixelBitMask:
84 {
85 /*
86 * When the GOP pixel format is given by PixelBitMask, the pixel
87 * element size _may be_ different from 4 bytes.
88 * See UEFI Spec Rev.2.10 Section 12.9 "Graphics Output Protocol":
89 * example code "GetPixelElementSize()" function.
90 */
91 pPixelBitmask = &gop->Mode->Info->PixelInformation;
92 BitsPerPixel =
93 PixelBitmasksToBpp(pPixelBitmask->RedMask,
94 pPixelBitmask->GreenMask,
95 pPixelBitmask->BlueMask,
96 pPixelBitmask->ReservedMask);
97 break;
98 }
99
100 case PixelBltOnly:
101 default:
102 {
103 ERR("Unsupported UFEI GOP format %lu\n", PixelFormat);
104 pPixelBitmask = NULL;
105 BitsPerPixel = 0;
106 break;
107 }
108 }
109
110 VidFbInitializeVideo((ULONG_PTR)gop->Mode->FrameBufferBase,
111 gop->Mode->FrameBufferSize,
112 gop->Mode->Info->HorizontalResolution,
113 gop->Mode->Info->VerticalResolution,
114 gop->Mode->Info->PixelsPerScanLine,
115 BitsPerPixel,
116 (PPIXEL_BITMASK)pPixelBitmask);
117 return Status;
118}
EFI_GRAPHICS_PIXEL_FORMAT
@ PixelBitMask
@ PixelRedGreenBlueReserved8BitPerColor
@ PixelBlueGreenRedReserved8BitPerColor
@ PixelBltOnly
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:31
#define EFI_SUCCESS
Definition: UefiBaseType.h:120
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
INT PixelFormat
Status
Definition: gdiplustypes.h:25
#define RTL_BITS_OF(sizeOfArg)
Definition: ntbasedef.h:680
#define TRACE(s)
Definition: solgame.cpp:4
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:1873
EFI_BOOT_SERVICES * BootServices
Definition: UefiSpec.h:1959
Physical format of an RGB pixel, specified with per-component bit-masks. A bit being set defines thos...
Definition: vidfb.h:22
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
EFI_GUID EfiGraphicsOutputProtocol
Definition: uefivid.c:18
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16
#define LOWEST_SUPPORTED_RES
Definition: uefivid.c:20
BOOLEAN VidFbInitializeVideo(_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.
Definition: vidfb.c:97
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,...
Definition: vidfb.h:41

Referenced by MachInit().

◆ UefiVideoClearScreen()

VOID UefiVideoClearScreen ( UCHAR  Attr)

Definition at line 121 of file uefivid.c.

122{
123 FbConsClearScreen(Attr);
124}
VOID FbConsClearScreen(_In_ UCHAR Attr)
Definition: vidfb.c:377

Referenced by MachInit().

◆ UefiVideoCopyOffScreenBufferToVRAM()

VOID UefiVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 152 of file uefivid.c.

153{
155}
Definition: bufpool.h:45
VOID FbConsCopyOffScreenBufferToVRAM(_In_ PVOID Buffer)
Copies a full text-mode CGA-style character buffer rectangle to the console.
Definition: vidfb.c:456

Referenced by MachInit().

◆ UefiVideoGetBufferSize()

ULONG UefiVideoGetBufferSize ( VOID  )

Definition at line 146 of file uefivid.c.

147{
148 return FbConsGetBufferSize();
149}
ULONG FbConsGetBufferSize(VOID)
Returns the size in bytes, of a full text-mode CGA-style character buffer rectangle that can fill the...
Definition: vidfb.c:445

Referenced by MachInit().

◆ UefiVideoGetDisplaySize()

VOID UefiVideoGetDisplaySize ( PULONG  Width,
PULONG  Height,
PULONG  Depth 
)

Definition at line 133 of file uefivid.c.

134{
136}
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
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...
Definition: vidfb.c:426
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819

Referenced by MachInit(), and UefiConsPutChar().

◆ UefiVideoGetPaletteColor()

VOID UefiVideoGetPaletteColor ( UCHAR  Color,
UCHAR Red,
UCHAR Green,
UCHAR Blue 
)

Definition at line 183 of file uefivid.c.

185{
186 /* Not supported */
187}

Referenced by MachInit().

◆ UefiVideoHideShowTextCursor()

VOID UefiVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 164 of file uefivid.c.

165{
166 /* We don't have a cursor yet */
167}

Referenced by MachInit().

◆ UefiVideoIsPaletteFixed()

BOOLEAN UefiVideoIsPaletteFixed ( VOID  )

Definition at line 170 of file uefivid.c.

171{
172 return 0;
173}

Referenced by MachInit().

◆ UefiVideoPutChar()

VOID UefiVideoPutChar ( int  Ch,
UCHAR  Attr,
unsigned  X,
unsigned  Y 
)

Definition at line 127 of file uefivid.c.

128{
129 FbConsPutChar(Ch, Attr, X, Y);
130}
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
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.
Definition: vidfb.c:409

Referenced by MachInit(), and UefiConsPutChar().

◆ UefiVideoSetDisplayMode()

VIDEODISPLAYMODE UefiVideoSetDisplayMode ( PCSTR  DisplayMode,
BOOLEAN  Init 
)

Definition at line 139 of file uefivid.c.

140{
141 /* We only have one mode, semi-text */
142 return VideoTextMode;
143}
@ VideoTextMode
Definition: machine.h:35

Referenced by MachInit().

◆ UefiVideoSetPaletteColor()

VOID UefiVideoSetPaletteColor ( UCHAR  Color,
UCHAR  Red,
UCHAR  Green,
UCHAR  Blue 
)

Definition at line 176 of file uefivid.c.

178{
179 /* Not supported */
180}

Referenced by MachInit().

◆ UefiVideoSetTextCursorPosition()

VOID UefiVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 158 of file uefivid.c.

159{
160 /* We don't have a cursor yet */
161}

Referenced by MachInit().

Variable Documentation

◆ EfiGraphicsOutputProtocol

◆ GlobalImageHandle

EFI_HANDLE GlobalImageHandle
extern

Definition at line 15 of file uefildr.c.

Referenced by EfiEntry().

◆ GlobalSystemTable

EFI_SYSTEM_TABLE* GlobalSystemTable
extern

Definition at line 16 of file uefildr.c.

Referenced by EfiEntry(), and UefiInitializeVideo().