* Print the resolution the boot loader has chosen.

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23114 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-12-11 21:14:26 +00:00
parent 59b17b6be1
commit 9b13056ba2
+27 -21
View File
@@ -66,10 +66,9 @@ compare_video_modes(video_mode *a, video_mode *b)
} }
/** Insert the video mode into the list, sorted by resolution and bit depth. /*! Insert the video mode into the list, sorted by resolution and bit depth.
* Higher resolutions/depths come first. Higher resolutions/depths come first.
*/ */
static void static void
add_video_mode(video_mode *videoMode) add_video_mode(video_mode *videoMode)
{ {
@@ -202,7 +201,6 @@ vga_enable_bright_background_colors(void)
// #pragma mark - vesa // #pragma mark - vesa
// VESA functions
static status_t static status_t
@@ -329,17 +327,20 @@ vesa_init(vbe_info_block *info, video_mode **_standardMode)
modeInfo.memory_model, modeInfo.physical_base, modeInfo.num_planes, modeInfo.memory_model, modeInfo.physical_base, modeInfo.num_planes,
modeInfo.num_banks)); modeInfo.num_banks));
const uint32 requiredAttributes = MODE_ATTR_AVAILABLE | MODE_ATTR_GRAPHICS_MODE const uint32 requiredAttributes = MODE_ATTR_AVAILABLE
| MODE_ATTR_COLOR_MODE | MODE_ATTR_LINEAR_BUFFER; | MODE_ATTR_GRAPHICS_MODE | MODE_ATTR_COLOR_MODE
| MODE_ATTR_LINEAR_BUFFER;
if (modeInfo.width >= 640 if (modeInfo.width >= 640
&& modeInfo.physical_base != 0 && modeInfo.physical_base != 0
&& modeInfo.num_planes == 1 && modeInfo.num_planes == 1
&& (modeInfo.memory_model == MODE_MEMORY_PACKED_PIXEL && (modeInfo.memory_model == MODE_MEMORY_PACKED_PIXEL
|| modeInfo.memory_model == MODE_MEMORY_DIRECT_COLOR) || modeInfo.memory_model == MODE_MEMORY_DIRECT_COLOR)
&& (modeInfo.attributes & requiredAttributes) == requiredAttributes) { && (modeInfo.attributes & requiredAttributes)
== requiredAttributes) {
// this mode fits our needs // this mode fits our needs
video_mode *videoMode = (video_mode *)malloc(sizeof(struct video_mode)); video_mode *videoMode = (video_mode *)malloc(
sizeof(struct video_mode));
if (videoMode == NULL) if (videoMode == NULL)
continue; continue;
@@ -361,9 +362,11 @@ vesa_init(vbe_info_block *info, video_mode **_standardMode)
// for the standard mode, we prefer a bit depth of 16 // for the standard mode, we prefer a bit depth of 16
// switch to the one with the higher resolution // switch to the one with the higher resolution
// ToDo: is that always a good idea? for now we'll use 800x600 // ToDo: is that always a good idea? for now we'll use 800x600
if (modeInfo.width >= standardMode->width && modeInfo.width <= 800) { if (modeInfo.width >= standardMode->width
&& modeInfo.width <= 800) {
if (modeInfo.width != standardMode->width if (modeInfo.width != standardMode->width
|| modeInfo.bits_per_pixel >= standardMode->bits_per_pixel) || modeInfo.bits_per_pixel
>= standardMode->bits_per_pixel)
standardMode = videoMode; standardMode = videoMode;
} }
} }
@@ -500,9 +503,9 @@ video_mode_menu()
menu->AddItem(item = new(nothrow) MenuItem("Default")); menu->AddItem(item = new(nothrow) MenuItem("Default"));
item->SetMarked(true); item->SetMarked(true);
item->Select(true); item->Select(true);
item->SetHelpText("The Default video mode is the one currently configured in " item->SetHelpText("The Default video mode is the one currently configured "
"the system. If there is no mode configured yet, a viable mode will be chosen " "in the system. If there is no mode configured yet, a viable mode will "
"automatically."); "be chosen automatically.");
menu->AddItem(new(nothrow) MenuItem("Standard VGA")); menu->AddItem(new(nothrow) MenuItem("Standard VGA"));
@@ -761,11 +764,15 @@ fallback:
gKernelArgs.frame_buffer.height = 480; gKernelArgs.frame_buffer.height = 480;
gKernelArgs.frame_buffer.bytes_per_row = 640 / 2; gKernelArgs.frame_buffer.bytes_per_row = 640 / 2;
gKernelArgs.frame_buffer.depth = 4; gKernelArgs.frame_buffer.depth = 4;
gKernelArgs.frame_buffer.physical_buffer.size = gKernelArgs.frame_buffer.width gKernelArgs.frame_buffer.physical_buffer.size
= gKernelArgs.frame_buffer.width
* gKernelArgs.frame_buffer.height / 2; * gKernelArgs.frame_buffer.height / 2;
gKernelArgs.frame_buffer.physical_buffer.start = 0xa0000; gKernelArgs.frame_buffer.physical_buffer.start = 0xa0000;
} }
dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth);
gKernelArgs.frame_buffer.enabled = true; gKernelArgs.frame_buffer.enabled = true;
// If the new frame buffer is either larger than the old one or located at // If the new frame buffer is either larger than the old one or located at
@@ -785,13 +792,11 @@ fallback:
} }
// clear the video memory // clear the video memory
// ToDo: this shouldn't be necessary on real hardware (and Bochs), but memset((void *)sFrameBuffer, 0,
// at least booting with Qemu looks ugly when this is missing gKernelArgs.frame_buffer.physical_buffer.size);
memset((void *)sFrameBuffer, 0, gKernelArgs.frame_buffer.physical_buffer.size);
// ToDo: the boot image is only a temporary solution - it should be // TODO: The image should be compressed, and eventually added by
// provided by the loader itself, as well as the blitting routines. // the build process.
// The image should be compressed, too.
blit_8bit_image(kImageData, kWidth, kHeight, kPalette, blit_8bit_image(kImageData, kWidth, kHeight, kPalette,
gKernelArgs.frame_buffer.width - kWidth - 40, gKernelArgs.frame_buffer.width - kWidth - 40,
@@ -837,7 +842,8 @@ platform_init_video(void)
edid1_info info; edid1_info info;
if (vesa_get_edid(&info) == B_OK) { if (vesa_get_edid(&info) == B_OK) {
// we got EDID information from the monitor, try to find a new default mode // we got EDID information from the monitor, try to find a new default
// mode
video_mode *defaultMode = NULL; video_mode *defaultMode = NULL;
// try detailed timing first // try detailed timing first