1 /* 2 * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "console.h" 8 #include "video.h" 9 //#include "mmu.h" 10 //#include "images.h" 11 #include "graphics.h" 12 #include "virtio.h" 13 #include "FwCfg.h" 14 15 #include <arch/cpu.h> 16 #include <boot/stage2.h> 17 #include <boot/platform.h> 18 #include <boot/menu.h> 19 #include <boot/kernel_args.h> 20 #include <boot/platform/generic/video.h> 21 #include <util/list.h> 22 #include <drivers/driver_settings.h> 23 #include <GraphicsDefs.h> 24 25 #include <stdio.h> 26 #include <stdlib.h> 27 #include <string.h> 28 29 30 //#define TRACE_VIDEO 31 #ifdef TRACE_VIDEO 32 # define TRACE(x...) dprintf(x) 33 #else 34 # define TRACE(x...) ; 35 #endif 36 37 38 // #pragma mark - 39 40 bool 41 video_mode_hook(Menu* menu, MenuItem* item) 42 { 43 // nothing yet 44 return true; 45 } 46 47 48 Menu* 49 video_mode_menu() 50 { 51 Menu* menu = new(nothrow) Menu(CHOICE_MENU, "Select Video Mode"); 52 MenuItem* item; 53 54 menu->AddItem(item = new(nothrow) MenuItem("Default")); 55 item->SetMarked(true); 56 item->Select(true); 57 item->SetHelpText("The Default video mode is the one currently configured " 58 "in the system. If there is no mode configured yet, a viable mode will " 59 "be chosen automatically."); 60 61 menu->AddSeparatorItem(); 62 menu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); 63 item->SetType(MENU_ITEM_NO_CHOICE); 64 65 return menu; 66 } 67 68 69 // #pragma mark - blit 70 71 72 extern "C" void 73 platform_blit4(addr_t frameBuffer, const uint8* data, 74 uint16 width, uint16 height, uint16 imageWidth, uint16 left, uint16 top) 75 { 76 } 77 78 79 extern "C" void 80 platform_set_palette(const uint8* palette) 81 { 82 } 83 84 85 // #pragma mark - 86 87 88 extern "C" void 89 platform_switch_to_logo(void) 90 { 91 gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFramebuf.colors; 92 gKernelArgs.frame_buffer.physical_buffer.size 93 = 4 * gFramebuf.stride * gFramebuf.height; 94 gKernelArgs.frame_buffer.width = gFramebuf.width; 95 gKernelArgs.frame_buffer.height = gFramebuf.height; 96 gKernelArgs.frame_buffer.depth = 32; 97 gKernelArgs.frame_buffer.bytes_per_row = 4 * gFramebuf.stride; 98 gKernelArgs.frame_buffer.enabled = gFramebuf.width > 0 && gFramebuf.height > 0; 99 100 video_display_splash(gKernelArgs.frame_buffer.physical_buffer.start); 101 } 102 103 104 extern "C" void 105 platform_switch_to_text_mode(void) 106 { 107 gKernelArgs.frame_buffer.enabled = false; 108 } 109 110 111 extern "C" status_t 112 platform_init_video(void) 113 { 114 FwCfg::Init(); 115 virtio_init(); // we want heap initalized 116 Clear(gFramebuf, 0xff000000); 117 console_init(); 118 return B_OK; 119 } 120