Author: andreasf Date: 2010-08-22 03:56:40 +0200 (Sun, 22 Aug 2010) New Revision: 38306 Changeset: http://dev.haiku-os.org/changeset/38306 Ticket: http://dev.haiku-os.org/ticket/6105 Modified: haiku/trunk/src/system/boot/platform/openfirmware/Jamfile haiku/trunk/src/system/boot/platform/openfirmware/video.cpp Log: 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. Modified: haiku/trunk/src/system/boot/platform/openfirmware/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/openfirmware/Jamfile 2010-08-22 00:57:20 UTC (rev 38305) +++ haiku/trunk/src/system/boot/platform/openfirmware/Jamfile 2010-08-22 01:56:40 UTC (rev 38306) @@ -4,6 +4,9 @@ local genericPlatformSources = text_menu.cpp + video_blit.cpp + video_rle.cpp + video_splash.cpp ; KernelMergeObject boot_platform_openfirmware.o : Modified: haiku/trunk/src/system/boot/platform/openfirmware/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/openfirmware/video.cpp 2010-08-22 00:57:20 UTC (rev 38305) +++ haiku/trunk/src/system/boot/platform/openfirmware/video.cpp 2010-08-22 01:56:40 UTC (rev 38306) @@ -7,16 +7,89 @@ #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 platform_switch_to_logo(void) { // in debug mode, we'll never show the logo 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 @@ { gKernelArgs.frame_buffer.enabled = false; - // ToDo: implement me return B_OK; }