The boot loader (BIOS IA32 only) now chooses the default video mode by looking at the

EDID info from the monitor if available through VESA/DDC.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19588 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-12-21 14:20:17 +00:00
parent bdb64116e9
commit d2de13bdd4
1 changed files with 56 additions and 3 deletions

View File

@ -88,6 +88,27 @@ add_video_mode(video_mode *videoMode)
}
//! Finds a video mode with the given resolution, prefers 16 bit modes
static video_mode *
find_video_mode(int32 width, int32 height)
{
video_mode *found = NULL;
video_mode *mode = NULL;
while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) {
if (mode->width == width && mode->height == height) {
// prefer 16 bit mode
if (mode->bits_per_pixel == 16)
return mode;
if (found == NULL || found->bits_per_pixel < mode->bits_per_pixel)
found = mode;
}
}
return found;
}
static video_mode *
find_video_mode(int32 width, int32 height, int32 depth)
{
@ -792,13 +813,45 @@ platform_init_video(void)
return B_ERROR;
}
sMode = sDefaultMode;
TRACE(("VESA compatible graphics!\n"));
edid1_info info;
vesa_get_edid(&info);
if (vesa_get_edid(&info) == B_OK) {
// we got EDID information from the monitor, try to find a new default mode
video_mode *defaultMode = NULL;
// try detailed timing first
for (int32 i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; i++) {
edid1_detailed_monitor &monitor = info.detailed_monitor[i];
if (monitor.monitor_desc_type == edid1_is_detailed_timing) {
defaultMode = find_video_mode(monitor.data.detailed_timing.h_active,
monitor.data.detailed_timing.v_active);
if (defaultMode != NULL)
break;
}
}
if (defaultMode == NULL) {
// try standard timings next
for (int32 i = 0; i < EDID1_NUM_STD_TIMING; i++) {
if (info.std_timing[i].h_size <= 256)
continue;
defaultMode = find_video_mode(info.std_timing[i].h_size,
info.std_timing[i].v_size);
if (defaultMode != NULL)
break;
}
}
if (defaultMode != NULL) {
// We found a new default mode to use!
sDefaultMode = defaultMode;
}
}
sMode = sDefaultMode;
return B_OK;
}