mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 14:34:57 +08:00
[FREELDR:PC] Cache the type of video card installed on the system (#8505)
Cache the type when initializing the video, instead of invoking every time `PcVideoDetectVideoCard()`. Indeed, the video card is not going to change magically at runtime by the user :D
This commit is contained in:
@@ -1807,6 +1807,7 @@ MachInit(const char *CmdLine)
|
||||
MachVtbl.HwIdle = PcHwIdle;
|
||||
|
||||
HalpCalibrateStallExecution();
|
||||
PcVideoInit();
|
||||
}
|
||||
|
||||
VOID
|
||||
|
||||
@@ -110,6 +110,7 @@ typedef struct
|
||||
|
||||
UCHAR MachDefaultTextColor = COLOR_GRAY;
|
||||
|
||||
static ULONG VideoCard = VIDEOCARD_CGA_OR_OTHER; /* Type of video card installed on the system */
|
||||
static USHORT BiosVideoMode; /* Current video mode as known by BIOS */
|
||||
static ULONG ScreenWidth = 80; /* Screen Width in characters */
|
||||
static ULONG ScreenHeight = 25; /* Screen Height in characters */
|
||||
@@ -587,7 +588,7 @@ PcVideoSetMode80x25(VOID)
|
||||
static BOOLEAN
|
||||
PcVideoSetMode80x50_80x43(VOID)
|
||||
{
|
||||
if (VIDEOCARD_VGA == PcVideoDetectVideoCard())
|
||||
if (VideoCard == VIDEOCARD_VGA)
|
||||
{
|
||||
PcVideoSetBiosMode(0x03);
|
||||
PcVideoSetFont8x8();
|
||||
@@ -597,7 +598,7 @@ PcVideoSetMode80x50_80x43(VOID)
|
||||
ScreenWidth = 80;
|
||||
ScreenHeight = 50;
|
||||
}
|
||||
else if (VIDEOCARD_EGA == PcVideoDetectVideoCard())
|
||||
else if (VideoCard == VIDEOCARD_EGA)
|
||||
{
|
||||
PcVideoSetBiosMode(0x03);
|
||||
PcVideoSetFont8x8();
|
||||
@@ -843,6 +844,13 @@ PcVideoSetMemoryBank(USHORT BankNumber)
|
||||
CurrentMemoryBank = BankNumber;
|
||||
}
|
||||
|
||||
VOID
|
||||
PcVideoInit(VOID)
|
||||
{
|
||||
/* Detect the installed video card */
|
||||
VideoCard = PcVideoDetectVideoCard();
|
||||
}
|
||||
|
||||
VIDEODISPLAYMODE
|
||||
PcVideoSetDisplayMode(PCSTR DisplayModeName, BOOLEAN Init)
|
||||
{
|
||||
@@ -854,21 +862,21 @@ PcVideoSetDisplayMode(PCSTR DisplayModeName, BOOLEAN Init)
|
||||
return DisplayMode;
|
||||
}
|
||||
|
||||
if (VIDEOCARD_CGA_OR_OTHER == PcVideoDetectVideoCard())
|
||||
if (VideoCard == VIDEOCARD_CGA_OR_OTHER)
|
||||
{
|
||||
TRACE("CGA or other display adapter detected.\n");
|
||||
printf("CGA or other display adapter detected.\n");
|
||||
printf("Using 80x25 text mode.\n");
|
||||
VideoMode = VIDEOMODE_NORMAL_TEXT;
|
||||
}
|
||||
else if (VIDEOCARD_EGA == PcVideoDetectVideoCard())
|
||||
else if (VideoCard == VIDEOCARD_EGA)
|
||||
{
|
||||
TRACE("EGA display adapter detected.\n");
|
||||
printf("EGA display adapter detected.\n");
|
||||
printf("Using 80x25 text mode.\n");
|
||||
VideoMode = VIDEOMODE_NORMAL_TEXT;
|
||||
}
|
||||
else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
|
||||
else /* VIDEOCARD_VGA */
|
||||
{
|
||||
TRACE("VGA display adapter detected.\n");
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ VOID PcConsPutChar(int Ch);
|
||||
BOOLEAN PcConsKbHit(VOID);
|
||||
int PcConsGetCh(VOID);
|
||||
|
||||
VOID PcVideoInit(VOID);
|
||||
VOID PcVideoClearScreen(UCHAR Attr);
|
||||
VIDEODISPLAYMODE PcVideoSetDisplayMode(PCSTR DisplayMode, BOOLEAN Init);
|
||||
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
|
||||
|
||||
Reference in New Issue
Block a user