1 /* 2 * Copyright 2003, Thomas Kurschel. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "edid.h" 8 #if !defined(_KERNEL_MODE) && !defined(_BOOT_MODE) 9 # include "ddc_int.h" 10 #endif 11 12 #include <KernelExport.h> 13 14 15 void 16 edid_dump(edid1_info *edid) 17 { 18 int i, j; 19 20 dprintf("EDID info:\n"); 21 dprintf(" Vendor: %s\n", edid->vendor.manufacturer); 22 dprintf(" Product ID: %d\n", (int)edid->vendor.prod_id); 23 dprintf(" Serial #: %d\n", (int)edid->vendor.serial); 24 dprintf(" Produced in week/year: %d/%d\n", edid->vendor.week, 25 edid->vendor.year); 26 27 dprintf(" EDID version: %d.%d\n", edid->version.version, 28 edid->version.revision); 29 30 dprintf(" Type: %s\n", edid->display.input_type != 0 ? "Digital" : "Analog"); 31 if (edid->display.input_type != 0) 32 dprintf(" Digital Bit Depth: %d\n", edid->display.digital_params.bit_depth); 33 dprintf(" Size: %d cm x %d cm\n", edid->display.h_size, 34 edid->display.v_size); 35 dprintf(" Gamma=%.3f\n", (edid->display.gamma + 100) / 100.0); 36 dprintf(" White (X,Y)=(%.3f,%.3f)\n", edid->display.white_x / 1024.0, 37 edid->display.white_y / 1024.0); 38 39 dprintf("Supported Future Video Modes:\n"); 40 for (i = 0; i < EDID1_NUM_STD_TIMING; ++i) { 41 if (edid->std_timing[i].h_size <= 256) 42 continue; 43 44 dprintf("%dx%d@%dHz (id=%d)\n", 45 edid->std_timing[i].h_size, edid->std_timing[i].v_size, 46 edid->std_timing[i].refresh, edid->std_timing[i].id); 47 } 48 49 dprintf("Supported VESA Video Modes:\n"); 50 if (edid->established_timing.res_720x400x70) 51 dprintf("720x400@70Hz\n"); 52 if (edid->established_timing.res_720x400x88) 53 dprintf("720x400@88Hz\n"); 54 if (edid->established_timing.res_640x480x60) 55 dprintf("640x480@60Hz\n"); 56 if (edid->established_timing.res_640x480x67) 57 dprintf("640x480@67Hz\n"); 58 if (edid->established_timing.res_640x480x72) 59 dprintf("640x480@72Hz\n"); 60 if (edid->established_timing.res_640x480x75) 61 dprintf("640x480@75Hz\n"); 62 if (edid->established_timing.res_800x600x56) 63 dprintf("800x600@56Hz\n"); 64 if (edid->established_timing.res_800x600x60) 65 dprintf("800x600@60Hz\n"); 66 67 if (edid->established_timing.res_800x600x72) 68 dprintf("800x600@72Hz\n"); 69 if (edid->established_timing.res_800x600x75) 70 dprintf("800x600@75Hz\n"); 71 if (edid->established_timing.res_832x624x75) 72 dprintf("832x624@75Hz\n"); 73 if (edid->established_timing.res_1024x768x87i) 74 dprintf("1024x768@87Hz interlaced\n"); 75 if (edid->established_timing.res_1024x768x60) 76 dprintf("1024x768@60Hz\n"); 77 if (edid->established_timing.res_1024x768x70) 78 dprintf("1024x768@70Hz\n"); 79 if (edid->established_timing.res_1024x768x75) 80 dprintf("1024x768@75Hz\n"); 81 if (edid->established_timing.res_1280x1024x75) 82 dprintf("1280x1024@75Hz\n"); 83 84 if (edid->established_timing.res_1152x870x75) 85 dprintf("1152x870@75Hz\n"); 86 87 for (i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; ++i) { 88 edid1_detailed_monitor *monitor = &edid->detailed_monitor[i]; 89 90 switch(monitor->monitor_desc_type) { 91 case EDID1_SERIAL_NUMBER: 92 dprintf("Serial Number: %s\n", monitor->data.serial_number); 93 break; 94 95 case EDID1_ASCII_DATA: 96 dprintf("Ascii Data: %s\n", monitor->data.ascii_data); 97 break; 98 99 case EDID1_MONITOR_RANGES: 100 { 101 edid1_monitor_range monitor_range = monitor->data.monitor_range; 102 103 dprintf("Horizontal frequency range = %d..%d kHz\n", 104 monitor_range.min_h, monitor_range.max_h); 105 dprintf("Vertical frequency range = %d..%d Hz\n", 106 monitor_range.min_v, monitor_range.max_v); 107 dprintf("Maximum pixel clock = %d MHz\n", 108 (uint16)monitor_range.max_clock * 10); 109 break; 110 } 111 112 case EDID1_MONITOR_NAME: 113 dprintf("Monitor Name: %s\n", monitor->data.monitor_name); 114 break; 115 116 case EDID1_ADD_COLOUR_POINTER: 117 { 118 for (j = 0; j < EDID1_NUM_EXTRA_WHITEPOINTS; ++j) { 119 edid1_whitepoint *whitepoint = &monitor->data.whitepoint[j]; 120 121 if (whitepoint->index == 0) 122 continue; 123 124 dprintf("Additional whitepoint: (X,Y)=(%f,%f) gamma=%f " 125 "index=%i\n", whitepoint->white_x / 1024.0, 126 whitepoint->white_y / 1024.0, 127 (whitepoint->gamma + 100) / 100.0, whitepoint->index); 128 } 129 break; 130 } 131 132 case EDID1_ADD_STD_TIMING: 133 { 134 for (j = 0; j < EDID1_NUM_EXTRA_STD_TIMING; ++j) { 135 edid1_std_timing *timing = &monitor->data.std_timing[j]; 136 137 if (timing->h_size <= 256) 138 continue; 139 140 dprintf("%dx%d@%dHz (id=%d)\n", 141 timing->h_size, timing->v_size, 142 timing->refresh, timing->id); 143 } 144 break; 145 } 146 147 case EDID1_IS_DETAILED_TIMING: 148 { 149 edid1_detailed_timing *timing = &monitor->data.detailed_timing; 150 if (timing->h_active + timing->h_blank == 0 151 || timing->v_active + timing->v_blank == 0) { 152 dprintf("Invalid video mode (%dx%d)\n", timing->h_active, 153 timing->v_active); 154 continue; 155 } 156 dprintf("Additional Video Mode (%dx%d@%dHz):\n", 157 timing->h_active, timing->v_active, 158 (timing->pixel_clock * 10000 159 / (timing->h_active + timing->h_blank) 160 / (timing->v_active + timing->v_blank))); 161 // Refresh rate = pixel clock in MHz / Htotal / Vtotal 162 163 dprintf("clock=%f MHz\n", timing->pixel_clock / 100.0); 164 dprintf("h: (%d, %d, %d, %d)\n", 165 timing->h_active, timing->h_active + timing->h_sync_off, 166 timing->h_active + timing->h_sync_off 167 + timing->h_sync_width, 168 timing->h_active + timing->h_blank); 169 dprintf("v: (%d, %d, %d, %d)\n", 170 timing->v_active, timing->v_active + timing->v_sync_off, 171 timing->v_active + timing->v_sync_off 172 + timing->v_sync_width, 173 timing->v_active + timing->v_blank); 174 dprintf("size: %.1f cm x %.1f cm\n", 175 timing->h_size / 10.0, timing->v_size / 10.0); 176 dprintf("border: %.1f cm x %.1f cm\n", 177 timing->h_border / 10.0, timing->v_border / 10.0); 178 break; 179 } 180 } 181 } 182 } 183