xref: /haiku/src/add-ons/accelerants/common/dump_edid.c (revision db10640de90f7f9519ba2da9577b7c1af3c64f6b)
1 /*
2 	Copyright (c) 2003, Thomas Kurschel
3 
4 
5 	Part of DDC driver
6 
7 	Dumps EDID content
8 */
9 
10 #include "edid.h"
11 #include <KernelExport.h>
12 #include "ddc_int.h"
13 #include <stdio.h>
14 
15 void edid_dump( edid1_info *edid )
16 {
17 	int i, j;
18 	char buffer[256];
19 
20 	SHOW_INFO( 0, "Vendor: %s", edid->vendor.manufacturer );
21 	SHOW_INFO( 0, "Product ID: %d", (int)edid->vendor.prod_id );
22 	SHOW_INFO( 0, "Serial #: %d", (int)edid->vendor.serial );
23 	SHOW_INFO( 0, "Produced in week/year: %d/%d", edid->vendor.week, edid->vendor.year );
24 
25 	SHOW_INFO( 0, "EDID version: %d.%d", edid->version.version, edid->version.revision );
26 
27 	SHOW_INFO( 0, "Type: %s", edid->display.input_type ? "Digital" : "Analog" );
28 	SHOW_INFO( 0, "Size: %d cm x %d cm", edid->display.h_size, edid->display.v_size );
29 	SHOW_INFO( 0, "Gamma=%.3f", (edid->display.gamma + 100) / 100.0 );
30 	SHOW_INFO( 0, "White (X,Y)=(%.3f,%.3f)", edid->display.white_x / 1024.0, edid->display.white_y / 1024.0 );
31 
32 	SHOW_INFO0( 0, "Supported Future Video Modes:" );
33 	for( i = 0; i < EDID1_NUM_STD_TIMING; ++i ) {
34 		if( edid->std_timing[i].h_size <= 256 )
35 			continue;
36 
37 		SHOW_INFO( 0, "%dx%d@%dHz (id=%d)",
38 			edid->std_timing[i].h_size, edid->std_timing[i].v_size,
39 			edid->std_timing[i].refresh, edid->std_timing[i].id );
40 	}
41 
42 	SHOW_INFO0( 0, "Supported VESA Video Modes:" );
43 	if( edid->established_timing.res_720x400x70 )
44 		SHOW_INFO0( 0, "720x400@70" );
45 	if( edid->established_timing.res_720x400x88 )
46 		SHOW_INFO0( 0, "720x400@88" );
47 	if( edid->established_timing.res_640x480x60 )
48 		SHOW_INFO0( 0, "640x480@60" );
49 	if( edid->established_timing.res_640x480x67 )
50 		SHOW_INFO0( 0, "640x480x67" );
51 	if( edid->established_timing.res_640x480x72 )
52 		SHOW_INFO0( 0, "640x480x72" );
53 	if( edid->established_timing.res_640x480x75 )
54 		SHOW_INFO0( 0, "640x480x75" );
55 	if( edid->established_timing.res_800x600x56 )
56 		SHOW_INFO0( 0, "800x600@56" );
57 	if( edid->established_timing.res_800x600x60 )
58 		SHOW_INFO0( 0, "800x600@60" );
59 
60 	if( edid->established_timing.res_800x600x72 )
61 		SHOW_INFO0( 0, "800x600@72" );
62 	if( edid->established_timing.res_800x600x75 )
63 		SHOW_INFO0( 0, "800x600@75" );
64 	if( edid->established_timing.res_832x624x75 )
65 		SHOW_INFO0( 0, "832x624@75" );
66 	if( edid->established_timing.res_1024x768x87i )
67 		SHOW_INFO0( 0, "1024x768@87 interlaced" );
68 	if( edid->established_timing.res_1024x768x60 )
69 		SHOW_INFO0( 0, "1024x768@60" );
70 	if( edid->established_timing.res_1024x768x70 )
71 		SHOW_INFO0( 0, "1024x768@70" );
72 	if( edid->established_timing.res_1024x768x75 )
73 		SHOW_INFO0( 0, "1024x768@75" );
74 	if( edid->established_timing.res_1280x1024x75 )
75 		SHOW_INFO0( 0, "1280x1024@75" );
76 
77 	if( edid->established_timing.res_1152x870x75 )
78 		SHOW_INFO0( 0, "1152x870@75" );
79 
80 	for( i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; ++i ) {
81 		edid1_detailed_monitor *monitor = &edid->detailed_monitor[i];
82 
83 		switch( monitor->monitor_desc_type ) {
84 		case edid1_serial_number:
85 			SHOW_INFO( 0, "Serial Number: %s", monitor->data.serial_number );
86 			break;
87 		case edid1_ascii_data:
88 			SHOW_INFO( 0, " %s", monitor->data.serial_number );
89 			break;
90 		case edid1_monitor_ranges: {
91 			edid1_monitor_range monitor_range = monitor->data.monitor_range;
92 
93 			SHOW_INFO( 0, "Horizontal frequency range = %d..%d kHz",
94 				monitor_range.min_h, monitor_range.max_h );
95 			SHOW_INFO( 0, "Vertical frequency range = %d..%d Hz",
96 				monitor_range.min_v, monitor_range.max_v );
97 			SHOW_INFO( 0, "Maximum pixel clock = %d MHz", (uint16)monitor_range.max_clock * 10 );
98 			break; }
99 		case edid1_monitor_name:
100 			SHOW_INFO( 0, "Monitor Name: %s", monitor->data.serial_number );
101 			break;
102 		case edid1_add_colour_pointer: {
103 			for( j = 0; j < EDID1_NUM_EXTRA_WHITEPOINTS; ++j ) {
104 				edid1_whitepoint *whitepoint = &monitor->data.whitepoint[j];
105 
106 				if( whitepoint->index == 0 )
107 					continue;
108 
109 				sprintf( buffer, "Additional whitepoint: (X,Y)=(%f,%f) gamma=%f index=%i",
110 					whitepoint->white_x / 1024.0,
111 					whitepoint->white_y / 1024.0,
112 					(whitepoint->gamma + 100) / 100.0,
113 					whitepoint->index );
114 				SHOW_INFO( 0, "%s", buffer );
115 			}
116 			break; }
117 		case edid1_add_std_timing: {
118 			for( j = 0; j < EDID1_NUM_EXTRA_STD_TIMING; ++j ) {
119 				edid1_std_timing *timing = &monitor->data.std_timing[j];
120 
121 				if( timing->h_size <= 256 )
122 					continue;
123 
124 				SHOW_INFO( 0, "%dx%d@%dHz (id=%d)",
125 					timing->h_size, timing->v_size,
126 					timing->refresh, timing->id );
127 			}
128 			break; }
129 		case edid1_is_detailed_timing: {
130 			edid1_detailed_timing *timing = &monitor->data.detailed_timing;
131 
132 			SHOW_INFO0( 0, "Additional Video Mode:" );
133 			sprintf( buffer, "clock=%f MHz", timing->pixel_clock / 100.0 );
134 			SHOW_INFO( 0, "%s", buffer );
135 			SHOW_INFO( 0, "h: (%d, %d, %d, %d)",
136 				timing->h_active, timing->h_active + timing->h_sync_off,
137 				timing->h_active + timing->h_sync_off + timing->h_sync_width,
138 				timing->h_active + timing->h_blank );
139 			SHOW_INFO( 0, "v: (%d, %d, %d, %d)",
140 				timing->v_active, timing->v_active + timing->v_sync_off,
141 				timing->v_active + timing->v_sync_off + timing->v_sync_width,
142 				timing->v_active + timing->v_blank );
143 			sprintf( buffer, "size: %.1f cm x %.1f cm",
144 				timing->h_size / 10.0, timing->v_size / 10.0 );
145 			SHOW_INFO( 0, "%s", buffer );
146 			sprintf( buffer, "border: %.1f cm x %.1f cm",
147 				timing->h_border / 10.0, timing->v_border / 10.0 );
148 			SHOW_INFO( 0, "%s", buffer );
149 			break; }
150 		}
151 	}
152 }
153