Skip to content

Commit

Permalink
stage1(nvda): set the framebuffer offset to zero like OS9 NDRV does
Browse files Browse the repository at this point in the history
should fix framebuffer weirdness.
  • Loading branch information
Wack0 committed Oct 21, 2024
1 parent ad49c4b commit 12c614b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions arcloader_grackle/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,11 +908,9 @@ static bool FbSetDepthNv(OFHANDLE Screen) {
NV_PRMCIO_CRTC[1] = 0x57; // NV_CIO_SR_UNLOCK_RW
__asm__ volatile ("eieio");
// OS9 driver sets the framebuffer offset here
#if 0
volatile U32LE* NV_PCRTC_START = (volatile ULONG*)(PCRTC + 0x800);
NV_PCRTC_START->v = 0;
__asm__ volatile ("eieio");
#endif
// Set CRTC pixel depth 32bpp
NV_PRMCIO_CRTC[0] = 0x28;
__asm__ volatile ("eieio");
Expand Down Expand Up @@ -1011,7 +1009,12 @@ static void FbGetDetails(OFHANDLE Screen, PHW_DESCRIPTION HwDesc, bool OverrideS
FbAddr = Arg.Int;
}

if (OverrideStride) Stride *= sizeof(ULONG);
if (OverrideStride) {
Stride *= sizeof(ULONG);
ULONG FbOffset = 0;
if (ARC_SUCCESS(OfGetPropInt(Screen, "fboffset", &FbOffset)))
FbAddr -= FbOffset;
}

// Wipe the screen
memset((PVOID)FbAddr, 0, Height * Stride);
Expand Down
9 changes: 6 additions & 3 deletions arcloader_unin/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,9 @@ static bool FbSetDepthNv(OFHANDLE Screen) {
NV_PRMCIO_CRTC[1] = 0x57; // NV_CIO_SR_UNLOCK_RW
__asm__ volatile ("eieio");
// OS9 driver sets the framebuffer offset here
#if 0
volatile U32LE* NV_PCRTC_START = (volatile ULONG*)(PCRTC + 0x800);
NV_PCRTC_START->v = 0;
__asm__ volatile ("eieio");
#endif
// Set CRTC pixel depth 32bpp
NV_PRMCIO_CRTC[0] = 0x28;
__asm__ volatile ("eieio");
Expand Down Expand Up @@ -1031,7 +1029,12 @@ static void FbGetDetails(OFHANDLE Screen, PHW_DESCRIPTION HwDesc, bool OverrideS
FbAddr = Arg.Int;
}

if (OverrideStride) Stride *= sizeof(ULONG);
if (OverrideStride) {
Stride *= sizeof(ULONG);
ULONG FbOffset = 0;
if (ARC_SUCCESS(OfGetPropInt(Screen, "fboffset", &FbOffset)))
FbAddr -= FbOffset;
}

// Wipe the screen
memset((PVOID)FbAddr, 0, Height * Stride);
Expand Down

0 comments on commit 12c614b

Please sign in to comment.