Author: mmu_man Date: 2010-11-01 18:24:20 +0100 (Mon, 01 Nov 2010) New Revision: 39255 Changeset: http://dev.haiku-os.org/changeset/39255 Modified: haiku/trunk/src/system/boot/platform/amiga_m68k/Jamfile haiku/trunk/src/system/boot/platform/amiga_m68k/video.cpp Log: Some more work to get video support working, add generic code to support the boot splash in. However all modes available are planar, and there doesn't seem to be a way to tell it in the kernel args framebuffer struct... Modified: haiku/trunk/src/system/boot/platform/amiga_m68k/Jamfile =================================================================== --- haiku/trunk/src/system/boot/platform/amiga_m68k/Jamfile 2010-11-01 17:22:25 UTC (rev 39254) +++ haiku/trunk/src/system/boot/platform/amiga_m68k/Jamfile 2010-11-01 17:24:20 UTC (rev 39255) @@ -19,7 +19,14 @@ #SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; +local genericPlatformSources = + text_menu.cpp + video_blit.cpp + video_splash.cpp + video_rle.cpp +; + KernelMergeObject boot_platform_amiga_m68k_shell.o : shell.S : -Wa,--pcrel @@ -46,9 +53,8 @@ video.cpp #apm.cpp - # generic - text_menu.cpp - + $(genericPlatformSources) + # VESA/DDC EDID #decode_edid.c #dump_edid.c @@ -88,8 +94,7 @@ ChecksumAmigaLoader haiku_loader ; - -SEARCH on [ FGristFiles text_menu.cpp ] +SEARCH on [ FGristFiles $(genericPlatformSources) ] = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; # Tell the build system to where stage1.bin can be found, so it can be used Modified: haiku/trunk/src/system/boot/platform/amiga_m68k/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/amiga_m68k/video.cpp 2010-11-01 17:22:25 UTC (rev 39254) +++ haiku/trunk/src/system/boot/platform/amiga_m68k/video.cpp 2010-11-01 17:24:20 UTC (rev 39255) @@ -5,6 +5,7 @@ #include "rom_calls.h" +#include "console.h" #include "video.h" //#include "mmu.h" //#include "images.h" @@ -14,6 +15,7 @@ #include <boot/platform.h> #include <boot/menu.h> #include <boot/kernel_args.h> +#include <boot/platform/generic/video.h> #include <util/list.h> #include <drivers/driver_settings.h> #include <GraphicsDefs.h> @@ -30,10 +32,53 @@ # define TRACE(x) ; #endif +static addr_t sFrameBuffer; +static void +probe_video_mode() +{ + if (gScreen == NULL) { + gKernelArgs.frame_buffer.enabled = false; + return; + } + /* + if (gScreen->RastPort.BitMap->Depth < 8) { + gKernelArgs.frame_buffer.enabled = false; + return; + } + */ + /* + dprintf("Video mode:\n"); + dprintf("BytesPerRow %d\n", gScreen->RastPort.BitMap->BytesPerRow); + dprintf("Rows %d\n", gScreen->RastPort.BitMap->Rows); + dprintf("Flags %02x\n", gScreen->RastPort.BitMap->Flags); + dprintf("Depth %d\n", gScreen->RastPort.BitMap->Depth); + for (int i = 0; i < 8; i++) + dprintf("Planes[%d] %p\n", i, gScreen->RastPort.BitMap->Planes[i]); + */ + //XXX how do we tell it's a planar framebuffer ?? + + gKernelArgs.frame_buffer.width = gScreen->RastPort.BitMap->BytesPerRow * 8; + gKernelArgs.frame_buffer.height = gScreen->RastPort.BitMap->Rows; + gKernelArgs.frame_buffer.bytes_per_row = gScreen->RastPort.BitMap->BytesPerRow; + gKernelArgs.frame_buffer.depth = gScreen->RastPort.BitMap->Depth; + gKernelArgs.frame_buffer.physical_buffer.size + = gKernelArgs.frame_buffer.width + * gKernelArgs.frame_buffer.height + * gScreen->RastPort.BitMap->Depth / 8; + gKernelArgs.frame_buffer.physical_buffer.start + = (phys_addr_t)(gScreen->RastPort.BitMap->Planes[0]); + + dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width, + gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth); + + gKernelArgs.frame_buffer.enabled = true; +} + + // #pragma mark - @@ -89,8 +134,15 @@ continue;*/ if (info.NotAvailable) continue; + if (info.PropertyFlags & DIPF_IS_HAM) + continue; + if (info.PropertyFlags & DIPF_IS_DUALPF) + continue; if (dimension.MaxDepth < 4) continue; + // skip 5 & 6 bit modes + if (dimension.MaxDepth < 8 && dimension.MaxDepth != 4) + continue; //dprintf("name: %s\n", name.Name); /* dprintf("mode 0x%08lx: %dx%d flags: 0x%08lx bpp: %d\n", @@ -99,18 +151,19 @@ dprintf("mode: %dx%d -> %dx%d\n", dimension.MinRasterWidth, dimension.MinRasterHeight, dimension.MaxRasterWidth, dimension.MaxRasterHeight); + */ dprintf("mode: %dx%d %dbpp flags: 0x%08lx\n", dimension.Nominal.MaxX - dimension.Nominal.MinX + 1, dimension.Nominal.MaxY - dimension.Nominal.MinY + 1, dimension.MaxDepth, info.PropertyFlags); - */ + char label[128]; sprintf(label, "%ux%u %u bit %08lx%s%s", dimension.Nominal.MaxX - dimension.Nominal.MinX + 1, dimension.Nominal.MaxY - dimension.Nominal.MinY + 1, dimension.MaxDepth, info.PropertyFlags, - (info.PropertyFlags & DIPF_IS_LACE) ? "" : " i", - (info.PropertyFlags & DIPF_IS_PAL) ? "" : " pal"); + (info.PropertyFlags & DIPF_IS_LACE) ? " i" : "", + (info.PropertyFlags & DIPF_IS_PAL) ? " pal" : ""); menu->AddItem(item = new(nothrow) MenuItem(label)); item->SetData((void *)modeID); @@ -127,13 +180,62 @@ } +// #pragma mark - blit + + +extern "C" void +platform_blit4(addr_t frameBuffer, const uint8 *data, + uint16 width, uint16 height, uint16 imageWidth, uint16 left, uint16 top) +{ + if (!data) + return; + // TODO +} + + +extern "C" void +platform_set_palette(const uint8 *palette) +{ + switch (gKernelArgs.frame_buffer.depth) { + case 4: + //vga_set_palette((const uint8 *)kPalette16, 0, 16); + break; + case 8: + //if (vesa_set_palette((const uint8 *)palette, 0, 256) != B_OK) + // dprintf("set palette failed!\n"); + + break; + default: + break; + } +} + + // #pragma mark - extern "C" void platform_switch_to_logo(void) { + return; + // in debug mode, we'll never show the logo + if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0) + return; + + addr_t lastBase = gKernelArgs.frame_buffer.physical_buffer.start; + size_t lastSize = gKernelArgs.frame_buffer.physical_buffer.size; + // TODO: implement me + + probe_video_mode(); + + // map to virtual memory + // (should be ok in bootloader thanks to TT0) + + sFrameBuffer = gKernelArgs.frame_buffer.physical_buffer.start; + + video_display_splash(sFrameBuffer); + } @@ -148,6 +250,8 @@ platform_init_video(void) { // TODO: implement me + probe_video_mode(); + return B_OK; }