xref: /haiku/headers/private/graphics/common/edid.h (revision 9e25244c5e9051f6cd333820d6332397361abd6c)
1 /*
2  * Copyright 2003, Thomas Kurschel. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _EDID_H
6 #define _EDID_H
7 
8 //!	Extended Display Identification Data (EDID)
9 
10 #include "edid_raw.h"
11 
12 
13 // vendor info
14 typedef struct {
15 	char manufacturer[4];
16 	uint16 prod_id;
17 	uint32 serial;
18 	uint8 week;
19 	uint16 year;
20 } edid1_vendor;
21 
22 // version info
23 typedef struct {
24 	uint8 version;
25 	uint8 revision;
26 } edid1_version;
27 
28 // analog input parameters
29 typedef struct {
30 	uint8 input_voltage;	// 0=0.7V/0.3V, 1=0.714V/0.286,
31 				// 2=1V/0.4V, 3=0.7V/0V
32 	bool setup;		// true if voltage configurable
33 	bool sep_sync;
34 	bool comp_sync;
35 	bool sync_on_green;
36 	bool sync_serr;
37 } edid1_analog_params;
38 
39 
40 // digital input parameters
41 typedef struct {
42 	uint8 bit_depth;
43 	uint8 interface;
44 } edid1_digital_params;
45 
46 // display info
47 typedef struct {
48 	uint8 input_type;
49 	edid1_analog_params analog_params;
50 	edid1_digital_params digital_params;
51 
52 	uint8 h_size;
53 	uint8 v_size;
54 	uint8 gamma;	// (x+100)/100
55 	BBITFIELD8_7 (
56 		dpms_standby : 1,
57 		dpms_suspend : 1,
58 		dpms_off : 1,
59 		display_type : 2,	// 0=mono, 1=rgb, 2=multicolour
60 		// since EDID version 1.1
61 		std_colour_space : 1,
62 		preferred_timing_mode : 1,
63 		gtf_supported : 1
64 	);
65 	uint16 red_x;		// all colours are 0.10 fixed point
66 	uint16 red_y;
67 	uint16 green_x;
68 	uint16 green_y;
69 	uint16 blue_x;
70 	uint16 blue_y;
71 	uint16 white_x;
72 	uint16 white_y;
73 } edid1_display;
74 
75 // standard timing data
76 typedef struct {
77 	uint16 h_size;
78 	uint16 v_size;
79 	uint16 id;
80 	uint8 ratio;
81 	uint8 refresh;
82 } edid1_std_timing;
83 
84 // additional whitepoint
85 typedef struct {
86 	uint8 index;
87 	uint16 white_x;
88 	uint16 white_y;
89 	uint8 gamma;	// (x+100)/100
90 } edid1_whitepoint;
91 
92 // detailed timing description
93 typedef struct {
94 	uint16 pixel_clock; // in 10 kHz
95 	uint16 h_active;
96 	uint16 h_blank;
97 	uint16 v_active;
98 	uint16 v_blank;
99 	uint16 h_sync_off;
100 	uint16 h_sync_width;
101 	uint16 v_sync_off;
102 	uint16 v_sync_width;
103 	uint16 h_size;
104 	uint16 v_size;
105 	uint16 h_border;
106 	uint16 v_border;
107 	BBITFIELD8_4 (
108 		interlaced : 1,
109 		stereo : 2,		// upper bit set - left on sync
110 						// lower bit set - right on sync
111 		sync : 2,
112 		misc : 2
113 	);
114 } edid1_detailed_timing;
115 
116 // detailed monitor description
117 typedef struct {
118 	uint8 monitor_desc_type;
119 	union {
120 		char serial_number[EDID1_EXTRA_STRING_LEN];
121 		char ascii_data[EDID1_EXTRA_STRING_LEN];
122 		edid1_monitor_range monitor_range;
123 		char monitor_name[EDID1_EXTRA_STRING_LEN];
124 		edid1_whitepoint whitepoint[EDID1_NUM_EXTRA_WHITEPOINTS];
125 		edid1_std_timing std_timing[EDID1_NUM_EXTRA_STD_TIMING];
126 		edid1_detailed_timing detailed_timing;
127 	} data;
128 } edid1_detailed_monitor;
129 
130 // EDID data block
131 typedef struct edid1_info {
132 	edid1_vendor vendor;
133 	edid1_version version;
134 	edid1_display display;
135 	edid1_established_timing established_timing;
136 	edid1_std_timing std_timing[EDID1_NUM_STD_TIMING];
137 
138 	// since EDID version 1.2
139 	edid1_detailed_monitor detailed_monitor[EDID1_NUM_DETAILED_MONITOR_DESC];
140 
141 	uint8 num_sections;
142 } edid1_info;
143 
144 #define EDID_VERSION_1 1
145 
146 #ifdef __cplusplus
147 extern "C" {
148 #endif
149 
150 void edid_decode(edid1_info *edid, const edid1_raw *raw);
151 void edid_dump(edid1_info *edid);
152 
153 #ifdef __cplusplus
154 }
155 #endif
156 
157 #endif	// _EDID_H
158