Changeset 24609

Show
Ignore:
Timestamp:
03/27/08 08:48:39 (2 months ago)
Author:
axeld
Message:
* Rearranged EDID mode find process: in a first pass, we only accept hi- or
  true color resolutions, the second pass that also takes those into account
  will only be run if no mode could be found before.
* I hope this will improve Urias boot screen experience.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp

    r24453 r24609  
    11/* 
    2  * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. 
     2 * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. 
    33 * Distributed under the terms of the MIT License. 
    44 */ 
     
    7474{ 
    7575        video_mode *mode = NULL; 
    76         while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { 
     76        while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) 
     77                        != NULL) { 
    7778                int compare = compare_video_modes(videoMode, mode); 
    7879                if (compare == 0) { 
     
    8990 
    9091 
    91 //! Finds a video mode with the given resolution, prefers 16 bit modes 
     92//! Finds a video mode with the given resolution 
    9293static video_mode * 
    93 find_video_mode(int32 width, int32 height
     94find_video_mode(int32 width, int32 height, bool allowPalette
    9495{ 
    9596        video_mode *found = NULL; 
    9697        video_mode *mode = NULL; 
    97         while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { 
    98                 if (mode->width == width && mode->height == height) { 
     98        while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) 
     99                        != NULL) { 
     100                if (mode->width == width && mode->height == height 
     101                        && (mode->bits_per_pixel > 8 || allowPalette)) { 
    99102                        if (found == NULL || found->bits_per_pixel < mode->bits_per_pixel) 
    100103                                found = mode; 
     
    110113{ 
    111114        video_mode *mode = NULL; 
    112         while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { 
     115        while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) 
     116                        != NULL) { 
    113117                if (mode->width == width 
    114118                        && mode->height == height 
    115119                        && mode->bits_per_pixel == depth) { 
    116120                        return mode; 
     121                } 
     122        } 
     123 
     124        return NULL; 
     125} 
     126 
     127 
     128static video_mode * 
     129find_edid_mode(edid1_info &info, bool allowPalette) 
     130{ 
     131        video_mode *mode = NULL; 
     132 
     133        // try detailed timing first 
     134        for (int32 i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; i++) { 
     135                edid1_detailed_monitor &monitor = info.detailed_monitor[i]; 
     136 
     137                if (monitor.monitor_desc_type == EDID1_IS_DETAILED_TIMING) { 
     138                        mode = find_video_mode(monitor.data.detailed_timing.h_active, 
     139                                monitor.data.detailed_timing.v_active, allowPalette); 
     140                        if (mode != NULL) 
     141                                return mode; 
     142                } 
     143        } 
     144 
     145        // try standard timings next 
     146        for (int32 i = 0; i < EDID1_NUM_STD_TIMING; i++) { 
     147                if (info.std_timing[i].h_size <= 256) 
     148                        continue; 
     149 
     150                video_mode *found = find_video_mode(info.std_timing[i].h_size, 
     151                        info.std_timing[i].v_size, allowPalette); 
     152                if (found != NULL) { 
     153                        if (mode != NULL) { 
     154                                // prefer higher resolutions 
     155                                if (found->width > mode->width) 
     156                                        mode = found; 
     157                        } else 
     158                                mode = found; 
    117159                } 
    118160        } 
     
    861903                // we got EDID information from the monitor, try to find a new default 
    862904                // mode 
    863                 video_mode *defaultMode = NULL; 
    864  
    865                 // try detailed timing first 
    866                 for (int32 i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; i++) { 
    867                         edid1_detailed_monitor &monitor = info.detailed_monitor[i]; 
    868  
    869                         if (monitor.monitor_desc_type == EDID1_IS_DETAILED_TIMING) { 
    870                                 defaultMode = find_video_mode(monitor.data.detailed_timing.h_active, 
    871                                         monitor.data.detailed_timing.v_active); 
    872                                 if (defaultMode != NULL) 
    873                                         break; 
    874                         } 
    875                 } 
    876  
    877                 if (defaultMode == NULL) { 
    878                         // try standard timings next 
    879                         for (int32 i = 0; i < EDID1_NUM_STD_TIMING; i++) { 
    880                                 if (info.std_timing[i].h_size <= 256) 
    881                                         continue; 
    882  
    883                                 defaultMode = find_video_mode(info.std_timing[i].h_size, 
    884                                         info.std_timing[i].v_size); 
    885                                 if (defaultMode != NULL) 
    886                                         break; 
    887                         } 
    888                 } 
     905                video_mode *defaultMode = find_edid_mode(info, false); 
     906                if (defaultMode == NULL) 
     907                        find_edid_mode(info, true); 
    889908 
    890909                if (defaultMode != NULL) {