ReactOS 0.4.16-dev-2293-g4d8327b
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
 
ULONG_PTR VramAddress
 
ULONG VramSize
 
PCM_FRAMEBUF_DEVICE_DATA FrameBufferData = NULL
 

Macro Definition Documentation

◆ LOWEST_SUPPORTED_RES

#define LOWEST_SUPPORTED_RES   1

Definition at line 24 of file uefivid.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UI  )

◆ UefiInitializeVideo()

EFI_STATUS UefiInitializeVideo ( VOID  )

Definition at line 56 of file uefivid.c.

57{
60
62 EFI_PIXEL_BITMASK* pPixelBitmask;
63 ULONG BitsPerPixel;
64
66 if (Status != EFI_SUCCESS)
67 {
68 TRACE("Failed to find GOP with status %d\n", Status);
69 return Status;
70 }
71
72 /* We don't need high resolutions for freeldr */
73 gop->SetMode(gop, LOWEST_SUPPORTED_RES);
74
75 /* Physical format of the pixel */
76 PixelFormat = gop->Mode->Info->PixelFormat;
77 switch (PixelFormat)
78 {
81 {
82 pPixelBitmask = &EfiPixelMasks[PixelFormat];
84 break;
85 }
86
87 case PixelBitMask:
88 {
89 /*
90 * When the GOP pixel format is given by PixelBitMask, the pixel
91 * element size _may be_ different from 4 bytes.
92 * See UEFI Spec Rev.2.10 Section 12.9 "Graphics Output Protocol":
93 * example code "GetPixelElementSize()" function.
94 */
95 pPixelBitmask = &gop->Mode->Info->PixelInformation;
96 BitsPerPixel =
97 PixelBitmasksToBpp(pPixelBitmask->RedMask,
98 pPixelBitmask->GreenMask,
99 pPixelBitmask->BlueMask,
100 pPixelBitmask->ReservedMask);
101 break;
102 }
103
104 case PixelBltOnly:
105 default:
106 {
107 ERR("Unsupported UEFI GOP format %lu\n", PixelFormat);
108 pPixelBitmask = NULL;
109 BitsPerPixel = 0;
110 break;
111 }
112 }
113
114 VramAddress = (ULONG_PTR)gop->Mode->FrameBufferBase;
115 VramSize = gop->Mode->FrameBufferSize;
118 VramSize,
119 gop->Mode->Info->HorizontalResolution,
120 gop->Mode->Info->VerticalResolution,
121 gop->Mode->Info->PixelsPerScanLine,
122 BitsPerPixel,
123 (PPIXEL_BITMASK)pPixelBitmask))
124 {
125 ERR("Couldn't initialize video framebuffer\n");
127 }
128 return Status;
129}
EFI_GRAPHICS_PIXEL_FORMAT
@ PixelBitMask
@ PixelRedGreenBlueReserved8BitPerColor
@ PixelBlueGreenRedReserved8BitPerColor
@ PixelBltOnly
#define EFI_UNSUPPORTED
Definition: UefiBaseType.h:123
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
#define ULONG_PTR
Definition: config.h:101
INT PixelFormat
Status
Definition: gdiplustypes.h:25
if(dx< 0)
Definition: linetemp.h:194
#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
Definition: typedefs.h:59
EFI_GUID EfiGraphicsOutputProtocol
Definition: uefivid.c:18
ULONG_PTR VramAddress
Definition: uefivid.c:20
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16
#define LOWEST_SUPPORTED_RES
Definition: uefivid.c:24
PCM_FRAMEBUF_DEVICE_DATA FrameBufferData
Definition: uefivid.c:22
ULONG VramSize
Definition: uefivid.c:21
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.
Definition: vidfb.c:99
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 132 of file uefivid.c.

133{
134 FbConsClearScreen(Attr);
135}
VOID FbConsClearScreen(_In_ UCHAR Attr)
Definition: vidfb.c:413

Referenced by MachInit().

◆ UefiVideoCopyOffScreenBufferToVRAM()

VOID UefiVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 163 of file uefivid.c.

164{
166}
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:492

Referenced by MachInit().

◆ UefiVideoGetBufferSize()

ULONG UefiVideoGetBufferSize ( VOID  )

Definition at line 157 of file uefivid.c.

158{
159 return FbConsGetBufferSize();
160}
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:481

Referenced by MachInit().

◆ UefiVideoGetDisplaySize()

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

Definition at line 144 of file uefivid.c.

145{
147}
_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:462
_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 194 of file uefivid.c.

196{
197 /* Not supported */
198}

Referenced by MachInit().

◆ UefiVideoHideShowTextCursor()

VOID UefiVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 175 of file uefivid.c.

176{
177 /* We don't have a cursor yet */
178}

Referenced by MachInit().

◆ UefiVideoIsPaletteFixed()

BOOLEAN UefiVideoIsPaletteFixed ( VOID  )

Definition at line 181 of file uefivid.c.

182{
183 return 0;
184}

Referenced by MachInit().

◆ UefiVideoPutChar()

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

Definition at line 138 of file uefivid.c.

139{
140 FbConsPutChar(Ch, Attr, X, Y);
141}
#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:445

Referenced by MachInit(), and UefiConsPutChar().

◆ UefiVideoSetDisplayMode()

VIDEODISPLAYMODE UefiVideoSetDisplayMode ( PCSTR  DisplayMode,
BOOLEAN  Init 
)

Definition at line 150 of file uefivid.c.

151{
152 /* We only have one mode, semi-text */
153 return VideoTextMode;
154}
@ VideoTextMode
Definition: machine.h:35

Referenced by MachInit().

◆ UefiVideoSetPaletteColor()

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

Definition at line 187 of file uefivid.c.

189{
190 /* Not supported */
191}

Referenced by MachInit().

◆ UefiVideoSetTextCursorPosition()

VOID UefiVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 169 of file uefivid.c.

170{
171 /* We don't have a cursor yet */
172}

Referenced by MachInit().

Variable Documentation

◆ EfiGraphicsOutputProtocol

EFI_GUID EfiGraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID

Definition at line 18 of file uefivid.c.

Referenced by UefiInitializeVideo().

◆ FrameBufferData

PCM_FRAMEBUF_DEVICE_DATA FrameBufferData = NULL

Definition at line 22 of file uefivid.c.

Referenced by DetectDisplayController(), and UefiInitializeVideo().

◆ 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().

◆ VramAddress

ULONG_PTR VramAddress

Definition at line 20 of file uefivid.c.

Referenced by DetectDisplayController(), UefiInitializeVideo(), and VidInitialize().

◆ VramSize

ULONG VramSize

Definition at line 21 of file uefivid.c.

Referenced by DetectDisplayController(), UefiInitializeVideo(), and VidInitialize().