* closest_video_mode() now only returns modes with a width less or equal than

the one specified. This should fix the "video mode out of range" message of
  your monitor during boot, in case you had that one. Thanks to Hartmut Reh
  for his help to be able to spot this.
* The mode returned by find_edid_mode(..., true) was never used.
* find_edid_mode() did not return any mode if there were no detailed modes
  available.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27390 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-09-09 15:18:51 +00:00
parent f8a63d3a0b
commit ca6210d5e9
1 changed files with 12 additions and 2 deletions

View File

@ -117,6 +117,10 @@ find_video_mode(int32 width, int32 height, bool allowPalette)
}
/*! Returns the VESA mode closest to the one specified, with a width less or
equal as specified.
The height as well as the depth may vary in both directions, though.
*/
static video_mode *
closest_video_mode(int32 width, int32 height, int32 depth)
{
@ -126,6 +130,12 @@ closest_video_mode(int32 width, int32 height, int32 depth)
video_mode *mode = NULL;
while ((mode = (video_mode *)list_get_next_item(&sModeList, mode))
!= NULL) {
if (mode->width > width) {
// Only choose modes with a width less or equal than the searched
// one; or else it might well be that the monitor cannot keep up.
continue;
}
uint32 diff = 2 * abs(mode->width - width) + abs(mode->height - height)
+ abs(mode->bits_per_pixel - depth);
@ -173,7 +183,7 @@ find_edid_mode(edid1_info &info, bool allowPalette)
}
}
return NULL;
return mode;
}
@ -1097,7 +1107,7 @@ platform_init_video(void)
// mode
video_mode *defaultMode = find_edid_mode(info, false);
if (defaultMode == NULL)
find_edid_mode(info, true);
defaultMode = find_edid_mode(info, true);
if (defaultMode != NULL) {
// We found a new default mode to use!