xref: /haiku/src/system/boot/platform/next_m68k/video.cpp (revision 410ed2fbba58819ac21e27d3676739728416761d)
1 /*
2  * Copyright 2008-2010, François Revol, revol@free.fr. All rights reserved.
3  * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 
8 #include "nextrom.h"
9 #include "video.h"
10 #include "mmu.h"
11 //#include "images.h"
12 
13 #include <algorithm>
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 
41 bool
42 video_mode_hook(Menu *menu, MenuItem *item)
43 {
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->AddItem(new(nothrow) MenuItem("Standard VGA"));
62 
63 	menu->AddSeparatorItem();
64 	menu->AddItem(item = new(nothrow) MenuItem("Return to main menu"));
65 	item->SetType(MENU_ITEM_NO_CHOICE);
66 
67 	return menu;
68 }
69 
70 
71 void
72 platform_blit4(addr_t frameBuffer, const uint8 *data,
73 	uint16 width, uint16 height, uint16 imageWidth, uint16 left, uint16 top)
74 {
75 	if (!data)
76 		return;
77 }
78 
79 
80 extern "C" void
81 platform_set_palette(const uint8 *palette)
82 {
83 }
84 
85 
86 //	#pragma mark -
87 
88 
89 extern "C" void
90 platform_switch_to_logo(void)
91 {
92 	// in debug mode, we'll never show the logo
93 	if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0)
94 		return;
95 
96 	// I believe we should use mg->km_coni.fb_num but turbo color has 0 here !?
97 	char fb_num = KM_CON_FRAMEBUFFER;
98 
99 	gKernelArgs.frame_buffer.width = mg->km_coni.dspy_w;
100 	gKernelArgs.frame_buffer.height = mg->km_coni.dspy_h;
101 	gKernelArgs.frame_buffer.bytes_per_row = mg->km_coni.bytes_per_scanline;
102 	// we fake 2bpp as 4bpp for simplicity
103 	gKernelArgs.frame_buffer.depth =
104 		std::max(4, 32 / mg->km_coni.pixels_per_word);
105 	gKernelArgs.frame_buffer.physical_buffer.size =
106 		mg->km_coni.map_addr[fb_num].size;
107 	gKernelArgs.frame_buffer.physical_buffer.start =
108 		mg->km_coni.map_addr[fb_num].phys_addr;
109 
110 	//TODO: pass a custom color_space in the KMessage?
111 
112 	gKernelArgs.frame_buffer.enabled = true;
113 	video_display_splash(mg->km_coni.map_addr[fb_num].virt_addr);
114 }
115 
116 
117 extern "C" void
118 platform_switch_to_text_mode(void)
119 {
120 	if (!gKernelArgs.frame_buffer.enabled) {
121 		return;
122 	}
123 
124 	gKernelArgs.frame_buffer.enabled = false;
125 }
126 
127 
128 extern "C" status_t
129 platform_init_video(void)
130 {
131 	gKernelArgs.frame_buffer.enabled = false;
132 
133 	return B_OK;
134 }
135 
136