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 "video.h" 8 //#include "mmu.h" 9 //#include "images.h" 10 11 #include <arch/cpu.h> 12 #include <boot/stage2.h> 13 #include <boot/platform.h> 14 #include <boot/menu.h> 15 #include <boot/kernel_args.h> 16 #include <util/list.h> 17 #include <drivers/driver_settings.h> 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <string.h> 22 23 24 //#define TRACE_VIDEO 25 #ifdef TRACE_VIDEO 26 # define TRACE(x) dprintf x 27 #else 28 # define TRACE(x) ; 29 #endif 30 31 32 // XXX: use falcon video monitor detection and build possible mode list there... 33 34 35 // #pragma mark - 36 37 38 bool 39 video_mode_hook(Menu *menu, MenuItem *item) 40 { 41 // nothing yet 42 #if 0 43 // find selected mode 44 video_mode *mode = NULL; 45 46 menu = item->Submenu(); 47 item = menu->FindMarked(); 48 if (item != NULL) { 49 switch (menu->IndexOf(item)) { 50 case 0: 51 // "Default" mode special 52 sMode = sDefaultMode; 53 sModeChosen = false; 54 return true; 55 case 1: 56 // "Standard VGA" mode special 57 // sets sMode to NULL which triggers VGA mode 58 break; 59 default: 60 mode = (video_mode *)item->Data(); 61 break; 62 } 63 } 64 65 if (mode != sMode) { 66 // update standard mode 67 // ToDo: update fb settings! 68 sMode = mode; 69 } 70 71 sModeChosen = true; 72 #endif 73 return true; 74 } 75 76 77 Menu * 78 video_mode_menu() 79 { 80 Menu *menu = new(nothrow) Menu(CHOICE_MENU, "Select Video Mode"); 81 MenuItem *item; 82 83 menu->AddItem(item = new(nothrow) MenuItem("Default")); 84 item->SetMarked(true); 85 item->Select(true); 86 item->SetHelpText("The Default video mode is the one currently configured " 87 "in the system. If there is no mode configured yet, a viable mode will " 88 "be chosen automatically."); 89 90 #if 0 91 menu->AddItem(new(nothrow) MenuItem("Standard VGA")); 92 93 video_mode *mode = NULL; 94 while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { 95 char label[64]; 96 sprintf(label, "%ux%u %u bit", mode->width, mode->height, 97 mode->bits_per_pixel); 98 99 menu->AddItem(item = new(nothrow) MenuItem(label)); 100 item->SetData(mode); 101 } 102 #endif 103 104 menu->AddSeparatorItem(); 105 menu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); 106 item->SetType(MENU_ITEM_NO_CHOICE); 107 108 return menu; 109 } 110 111 112 // #pragma mark - 113 114 115 extern "C" void 116 platform_switch_to_logo(void) 117 { 118 // ToDo: implement me 119 } 120 121 122 extern "C" void 123 platform_switch_to_text_mode(void) 124 { 125 // ToDo: implement me 126 } 127 128 129 extern "C" status_t 130 platform_init_video(void) 131 { 132 // ToDo: implement me 133 return B_OK; 134 } 135 136