boot_loader_openfirmware: Add frame buffer support

Use the OF "screen" device alias to query frame buffer properties. Postpone
the opening of the device as far as possible as it erases the screen output.
Initialize the kernel arguments and hook into generic code to display the
splash screen.

Like on x86, the frame buffer is enabled by default. To disable it, either
press ESC during early boot or, for debugging, make sure in start.cpp that
platform_boot_options() has the BOOT_OPTION_DEBUG_OUTPUT flag set.

Resolves ticket #6105.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38306 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Andreas Färber 2010-08-22 01:56:40 +00:00
parent e633c3c15b
commit 36ee6a8731
2 changed files with 77 additions and 2 deletions

View File

@ -4,6 +4,9 @@ SubDirC++Flags -D_BOOT_MODE -fno-rtti ;
local genericPlatformSources =
text_menu.cpp
video_blit.cpp
video_rle.cpp
video_splash.cpp
;
KernelMergeObject boot_platform_openfirmware.o :

View File

@ -7,6 +7,40 @@
#include <boot/platform.h>
#include <boot/stage2.h>
#include <boot/platform/generic/video.h>
#include <platform/openfirmware/openfirmware.h>
static int sScreen;
void
platform_blit4(addr_t frameBuffer, const uint8 *data,
uint16 width, uint16 height, uint16 imageWidth, uint16 left, uint16 top)
{
panic("platform_blit4(): not implemented\n");
}
extern "C" void
platform_set_palette(const uint8 *palette)
{
switch (gKernelArgs.frame_buffer.depth) {
case 8:
if (of_call_method(sScreen, "set-colors", 3, 0,
256, 0, palette) == OF_FAILED) {
for (int index = 0; index < 256; index++) {
of_call_method(sScreen, "color!", 4, 0, index,
palette[index * 3 + 2],
palette[index * 3 + 1],
palette[index * 3 + 0]);
}
}
break;
default:
break;
}
}
extern "C" void
@ -16,7 +50,46 @@ platform_switch_to_logo(void)
if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0)
return;
// ToDo: implement me
sScreen = of_open("screen");
if (sScreen == OF_FAILED)
return;
int package = of_instance_to_package(sScreen);
if (package == OF_FAILED)
return;
uint32 width, height;
if (of_call_method(sScreen, "dimensions", 0, 2, &height, &width)
== OF_FAILED) {
if (of_getprop(package, "width", &width, sizeof(int32)) == OF_FAILED)
return;
if (of_getprop(package, "height", &height, sizeof(int32)) == OF_FAILED)
return;
}
uint32 depth;
if (of_getprop(package, "depth", &depth, sizeof(uint32)) == OF_FAILED)
return;
uint32 lineBytes;
if (of_getprop(package, "linebytes", &lineBytes, sizeof(uint32))
== OF_FAILED)
return;
uint32 address;
// address is always 32 bit
if (of_getprop(package, "address", &address, sizeof(uint32)) == OF_FAILED)
return;
gKernelArgs.frame_buffer.physical_buffer.start = address;
gKernelArgs.frame_buffer.physical_buffer.size = lineBytes * height;
gKernelArgs.frame_buffer.width = width;
gKernelArgs.frame_buffer.height = height;
gKernelArgs.frame_buffer.depth = depth;
gKernelArgs.frame_buffer.bytes_per_row = lineBytes;
dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth);
gKernelArgs.frame_buffer.enabled = true;
// the memory will be identity-mapped already
video_display_splash(gKernelArgs.frame_buffer.physical_buffer.start);
}
@ -38,7 +111,6 @@ platform_init_video(void)
{
gKernelArgs.frame_buffer.enabled = false;
// ToDo: implement me
return B_OK;
}