From 652c852666c8e0098ee2e84c8750a531f6796ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 28 Mar 2008 09:23:10 +0000 Subject: [PATCH] * The previous code to retrieve the standard video mode did rely on the fact that they are ordered by size. * This actually doesn't seem to be the case for all cards. Hence, we now search for an appropriate mode only after we've collected all modes. * Extended find_video_mode() to be able to ignore the height of a video mode; that way, we can prefer a horizontal resolution of 800 without having to care about the aspect ratio. * This fixes bug #1975. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24619 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/bios_ia32/video.cpp | 30 +++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/system/boot/platform/bios_ia32/video.cpp b/src/system/boot/platform/bios_ia32/video.cpp index c3875de405..90362b4c24 100644 --- a/src/system/boot/platform/bios_ia32/video.cpp +++ b/src/system/boot/platform/bios_ia32/video.cpp @@ -89,7 +89,11 @@ add_video_mode(video_mode *videoMode) } -//! Finds a video mode with the given resolution +/*! \brief Finds a video mode with the given resolution. + If \a allowPalette is true, 8-bit modes are considered, too. + If \a height is \c -1, the height is ignored, and only the width + matters. +*/ static video_mode * find_video_mode(int32 width, int32 height, bool allowPalette) { @@ -97,7 +101,7 @@ find_video_mode(int32 width, int32 height, bool allowPalette) video_mode *mode = NULL; while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { - if (mode->width == width && mode->height == height + if (mode->width == width && (height == -1 || mode->height == height) && (mode->bits_per_pixel > 8 || allowPalette)) { if (found == NULL || found->bits_per_pixel < mode->bits_per_pixel) found = mode; @@ -394,27 +398,19 @@ vesa_init(vbe_info_block *info, video_mode **_standardMode) videoMode->bits_per_pixel = 15; } - if (standardMode == NULL) - standardMode = videoMode; - else if (standardMode != NULL && modeInfo.bits_per_pixel <= 16) { - // for the standard mode, we prefer a bit depth of 16 - // switch to the one with the higher resolution - // 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.bits_per_pixel - >= standardMode->bits_per_pixel) - standardMode = videoMode; - } - } - add_video_mode(videoMode); } } else TRACE(("(failed)\n")); } + // Choose default resolution (when no EDID information is available) + // TODO: eventually enlarge this to 1024x768? + const uint32 kWidth = 800; + standardMode = find_video_mode(kWidth, -1, false); + if (standardMode == NULL) + standardMode = find_video_mode(kWidth, -1, true); + if (standardMode == NULL) { // no usable VESA mode found... return B_ERROR;