Changeset 24609
- Timestamp:
- 03/27/08 08:48:39 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp
r24453 r24609 1 1 /* 2 * Copyright 2004-200 7, Axel Dörfler, axeld@pinc-software.de.2 * Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. 3 3 * Distributed under the terms of the MIT License. 4 4 */ … … 74 74 { 75 75 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) { 77 78 int compare = compare_video_modes(videoMode, mode); 78 79 if (compare == 0) { … … 89 90 90 91 91 //! Finds a video mode with the given resolution , prefers 16 bit modes92 //! Finds a video mode with the given resolution 92 93 static video_mode * 93 find_video_mode(int32 width, int32 height )94 find_video_mode(int32 width, int32 height, bool allowPalette) 94 95 { 95 96 video_mode *found = NULL; 96 97 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)) { 99 102 if (found == NULL || found->bits_per_pixel < mode->bits_per_pixel) 100 103 found = mode; … … 110 113 { 111 114 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) { 113 117 if (mode->width == width 114 118 && mode->height == height 115 119 && mode->bits_per_pixel == depth) { 116 120 return mode; 121 } 122 } 123 124 return NULL; 125 } 126 127 128 static video_mode * 129 find_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; 117 159 } 118 160 } … … 861 903 // we got EDID information from the monitor, try to find a new default 862 904 // 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); 889 908 890 909 if (defaultMode != NULL) {
