Skip to content

Commit

Permalink
[BOOTVID] Fix bootvid forever
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkFire01 committed Dec 6, 2023
1 parent 19a08d9 commit 3c1d305
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 66 deletions.
33 changes: 5 additions & 28 deletions drivers/base/bootvid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@

spec2def(bootvid.dll bootvid.spec ADD_IMPORTLIB)

if((ARCH STREQUAL "i386") OR (ARCH STREQUAL "amd64"))
if(SARCH STREQUAL "pc98")
list(APPEND SOURCE
i386/pc98/pc98.h
i386/pc98/bootvid.c)
elseif(SARCH STREQUAL "xbox")
list(APPEND SOURCE
i386/xbox/xbox.h
i386/xbox/bootvid.c)
else()
list(APPEND SOURCE
i386/pc/pc.h
i386/pc/cmdcnst.h
i386/pc/bootvid.c
i386/pc/bootdata.c
i386/pc/vga.h
i386/pc/vga.c)
endif()
elseif(ARCH STREQUAL "arm")
list(APPEND SOURCE
arm/arm.h
arm/bootvid.c)
endif()
set(SOURCE)

list(APPEND SOURCE
framebuf/framebuf.h
framebuf/bootvid.c)

list(APPEND SOURCE
common.c
Expand All @@ -40,8 +22,3 @@ add_importlibs(bootvid ntoskrnl hal)
add_pch(bootvid precomp.h SOURCE)
add_dependencies(bootvid psdk)
add_cd_file(TARGET bootvid DESTINATION reactos/system32 NO_CAB FOR all)


## TEMPORARY HACKISH WAY TO COMPILE A SEPARATE FBBVID.DLL ##
## Used for UEFI or when (SARCH STREQUAL "xbox")
include(fbbvid.cmake)
51 changes: 13 additions & 38 deletions drivers/base/bootvid/framebuf/bootvid.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,54 +157,31 @@ VidInitialize(
}

/* Convert from bus-relative to physical address, and map it into system space */
PHYSICAL_ADDRESS TranslatedAddress;
// PHYSICAL_ADDRESS TranslatedAddress;
ULONG AddressSpace = 0;
if (!HalTranslateBusAddress(Interface,
BusNumber,
FrameBuffer,
&AddressSpace,
&TranslatedAddress))
DPRINT1("Framebuffer %p\n", FrameBuffer.QuadPart);
FrameBufferStart = (ULONG_PTR)MmMapIoSpace(FrameBuffer,
gBootDisp.BufferSize,
MmNonCached);
if (!FrameBufferStart)
{
DPRINT1("Could not map 0x%p\n", FrameBuffer.QuadPart);
DPRINT1("Out of memory!\n");
goto Failure;
}

if (AddressSpace == 0)
{
FrameBufferStart = (ULONG_PTR)MmMapIoSpace(TranslatedAddress,
gBootDisp.BufferSize,
MmNonCached);
if (!FrameBufferStart)
{
DPRINT1("Out of memory!\n");
goto Failure;
}
}
else
{
/* The base is the translated address, no need to map */
FrameBufferStart = (ULONG_PTR)TranslatedAddress.LowPart; // Yes, LowPart.
}
DPRINT1("Framebuffer mapped %p\n", FrameBufferStart);


/*
* Reserve off-screen area for the backbuffer that contains
* 8-bit indexed color screen image, plus preserved row data.
*/
ULONG BackBufferSize = SCREEN_WIDTH * (SCREEN_HEIGHT + (BOOTCHAR_HEIGHT + 1));

/* If there is enough video memory in the physical framebuffer,
* place the backbuffer in the hidden part of the framebuffer,
* otherwise allocate a zone for the backbuffer. */
if (gBootDisp.BufferSize >= FrameBufferSize + BackBufferSize)
{
/* Place backbuffer in the hidden part of framebuffer */
BackBuffer = (PUCHAR)(FrameBufferStart + gBootDisp.BufferSize - BackBufferSize);
}
else // if (gBootDisp.BufferSize - FrameBufferSize < BackBufferSize)
{

/* Allocate framebuffer. 600kb works out to 640x480@16bpp */
SIZE_T BackBufferSize = 600 * 1024;
SIZE_T BackBufferSize = gBootDisp.BufferSize;
// PHYSICAL_ADDRESS PhysicalAddress;
// PhysicalAddress.QuadPart = -1;
// BackBuffer = MmAllocateContiguousMemory(BackBufferSize, PhysicalAddress);
Expand All @@ -214,12 +191,13 @@ VidInitialize(
DPRINT1("Out of memory!\n");
goto Failure;
}
}


DPRINT1("everyting is setup\n");
/* Now check if we have to set the mode */
if (SetMode)
VidResetDisplay(TRUE);

DPRINT1("VidInitialize return true\n");
/* Video is ready */
return TRUE;

Expand Down Expand Up @@ -249,9 +227,6 @@ VidResetDisplay(
VidpCurrentY = 0;

/* Clear the screen with HAL if we were asked to */
if (HalReset)
HalResetDisplay();

/* Re-initialize the palette and fill the screen black */
RtlZeroMemory((PVOID)FrameBufferStart, gBootDisp.BufferSize);
InitializePalette();
Expand Down

0 comments on commit 3c1d305

Please sign in to comment.