1 | /*
|
---|
2 | * edid.h: defines to parse an EDID block
|
---|
3 | *
|
---|
4 | * This file contains all information to interpret a standard EDIC block
|
---|
5 | * transmitted by a display device via DDC (Display Data Channel). So far
|
---|
6 | * there is no information to deal with optional EDID blocks.
|
---|
7 | * DDC is a Trademark of VESA (Video Electronics Standard Association).
|
---|
8 | *
|
---|
9 | * Copyright 1998 by Egbert Eich <[email protected]>
|
---|
10 | */
|
---|
11 |
|
---|
12 | #ifndef _EDID_H_
|
---|
13 | #define _EDID_H_
|
---|
14 |
|
---|
15 | /* read complete EDID record */
|
---|
16 | #define EDID1_LEN 128
|
---|
17 | #define BITS_PER_BYTE 9
|
---|
18 | #define NUM BITS_PER_BYTE*EDID1_LEN
|
---|
19 | #define HEADER 6
|
---|
20 |
|
---|
21 | #define STD_TIMINGS 8
|
---|
22 | #define DET_TIMINGS 4
|
---|
23 |
|
---|
24 | #ifdef _PARSE_EDID_
|
---|
25 |
|
---|
26 | /* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */
|
---|
27 | #define HEADER_SECTION 0
|
---|
28 | #define HEADER_LENGTH 8
|
---|
29 |
|
---|
30 | /* vendor section */
|
---|
31 | #define VENDOR_SECTION (HEADER_SECTION + HEADER_LENGTH)
|
---|
32 | #define V_MANUFACTURER 0
|
---|
33 | #define V_PROD_ID (V_MANUFACTURER + 2)
|
---|
34 | #define V_SERIAL (V_PROD_ID + 2)
|
---|
35 | #define V_WEEK (V_SERIAL + 4)
|
---|
36 | #define V_YEAR (V_WEEK + 1)
|
---|
37 | #define VENDOR_LENGTH (V_YEAR + 1)
|
---|
38 |
|
---|
39 | /* EDID version */
|
---|
40 | #define VERSION_SECTION (VENDOR_SECTION + VENDOR_LENGTH)
|
---|
41 | #define V_VERSION 0
|
---|
42 | #define V_REVISION (V_VERSION + 1)
|
---|
43 | #define VERSION_LENGTH (V_REVISION + 1)
|
---|
44 |
|
---|
45 | /* display information */
|
---|
46 | #define DISPLAY_SECTION (VERSION_SECTION + VERSION_LENGTH)
|
---|
47 | #define D_INPUT 0
|
---|
48 | #define D_HSIZE (D_INPUT + 1)
|
---|
49 | #define D_VSIZE (D_HSIZE + 1)
|
---|
50 | #define D_GAMMA (D_VSIZE + 1)
|
---|
51 | #define FEAT_S (D_GAMMA + 1)
|
---|
52 | #define D_RG_LOW (FEAT_S + 1)
|
---|
53 | #define D_BW_LOW (D_RG_LOW + 1)
|
---|
54 | #define D_REDX (D_BW_LOW + 1)
|
---|
55 | #define D_REDY (D_REDX + 1)
|
---|
56 | #define D_GREENX (D_REDY + 1)
|
---|
57 | #define D_GREENY (D_GREENX + 1)
|
---|
58 | #define D_BLUEX (D_GREENY + 1)
|
---|
59 | #define D_BLUEY (D_BLUEX + 1)
|
---|
60 | #define D_WHITEX (D_BLUEY + 1)
|
---|
61 | #define D_WHITEY (D_WHITEX + 1)
|
---|
62 | #define DISPLAY_LENGTH (D_WHITEY + 1)
|
---|
63 |
|
---|
64 | /* supported VESA and other standard timings */
|
---|
65 | #define ESTABLISHED_TIMING_SECTION (DISPLAY_SECTION + DISPLAY_LENGTH)
|
---|
66 | #define E_T1 0
|
---|
67 | #define E_T2 (E_T1 + 1)
|
---|
68 | #define E_TMANU (E_T2 + 1)
|
---|
69 | #define E_TIMING_LENGTH (E_TMANU + 1)
|
---|
70 |
|
---|
71 | /* non predefined standard timings supported by display */
|
---|
72 | #define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH)
|
---|
73 | #define STD_TIMING_INFO_LEN 2
|
---|
74 | #define STD_TIMING_INFO_NUM STD_TIMINGS
|
---|
75 | #define STD_TIMING_LENGTH (STD_TIMING_INFO_LEN * STD_TIMING_INFO_NUM)
|
---|
76 |
|
---|
77 | /* detailed timing info of non standard timings */
|
---|
78 | #define DET_TIMING_SECTION (STD_TIMING_SECTION + STD_TIMING_LENGTH)
|
---|
79 | #define DET_TIMING_INFO_LEN 18
|
---|
80 | #define MONITOR_DESC_LEN DET_TIMING_INFO_LEN
|
---|
81 | #define DET_TIMING_INFO_NUM DET_TIMINGS
|
---|
82 | #define DET_TIMING_LENGTH (DET_TIMING_INFO_LEN * DET_TIMING_INFO_NUM)
|
---|
83 |
|
---|
84 | /* number of EDID sections to follow */
|
---|
85 | #define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH)
|
---|
86 | /* one byte checksum */
|
---|
87 | #define CHECKSUM (NO_EDID + 1)
|
---|
88 |
|
---|
89 | #if (CHECKSUM != (EDID1_LEN - 1))
|
---|
90 | # error "EDID1 length != 128!"
|
---|
91 | #endif
|
---|
92 |
|
---|
93 |
|
---|
94 | #define SECTION(x,y) (Uchar *)(x + y)
|
---|
95 | #define GET_ARRAY(y) ((Uchar *)(c + y))
|
---|
96 | #define GET(y) *(Uchar *)(c + y)
|
---|
97 |
|
---|
98 | /* extract information from vendor section */
|
---|
99 | #define _PROD_ID(x) x[0] + (x[1] << 8);
|
---|
100 | #define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID))
|
---|
101 | #define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24)
|
---|
102 | #define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL))
|
---|
103 | #define _YEAR(x) (x & 0xFF) + 1990
|
---|
104 | #define YEAR _YEAR(GET(V_YEAR))
|
---|
105 | #define WEEK GET(V_WEEK) & 0xFF
|
---|
106 | #define _L1(x) ((x[0] & 0x7C) >> 2) + '@'
|
---|
107 | #define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'
|
---|
108 | #define _L3(x) (x[1] & 0x1F) + '@';
|
---|
109 | #define L1 _L1(GET_ARRAY(V_MANUFACTURER))
|
---|
110 | #define L2 _L2(GET_ARRAY(V_MANUFACTURER))
|
---|
111 | #define L3 _L3(GET_ARRAY(V_MANUFACTURER))
|
---|
112 |
|
---|
113 | /* extract information from version section */
|
---|
114 | #define VERSION GET(V_VERSION)
|
---|
115 | #define REVISION GET(V_REVISION)
|
---|
116 |
|
---|
117 | /* extract information from display section */
|
---|
118 | #define _INPUT_TYPE(x) ((x & 0x80) >> 7)
|
---|
119 | #define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT))
|
---|
120 | #define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5)
|
---|
121 | #define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT))
|
---|
122 | #define _SETUP(x) ((x & 0x10) >> 4)
|
---|
123 | #define SETUP _SETUP(GET(D_INPUT))
|
---|
124 | #define _SYNC(x) (x & 0x0F)
|
---|
125 | #define SYNC _SYNC(GET(D_INPUT))
|
---|
126 | #define _DFP(x) (x & 0x01)
|
---|
127 | #define DFP _DFP(GET(D_INPUT))
|
---|
128 | #define _BPC(x) ((x & 0x70) >> 4)
|
---|
129 | #define BPC _BPC(GET(D_INPUT))
|
---|
130 | #define _DIGITAL_INTERFACE(x) (x & 0x0F)
|
---|
131 | #define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT))
|
---|
132 | #define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0))
|
---|
133 | #define GAMMA _GAMMA(GET(D_GAMMA))
|
---|
134 | #define HSIZE_MAX GET(D_HSIZE)
|
---|
135 | #define VSIZE_MAX GET(D_VSIZE)
|
---|
136 | #define _DPMS(x) ((x & 0xE0) >> 5)
|
---|
137 | #define DPMS _DPMS(GET(FEAT_S))
|
---|
138 | #define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
|
---|
139 | #define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
|
---|
140 | #define _MSC(x) (x & 0x7)
|
---|
141 | #define MSC _MSC(GET(FEAT_S))
|
---|
142 |
|
---|
143 |
|
---|
144 | /* color characteristics */
|
---|
145 | #define CC_L(x,y) ((x & (0x03 << y)) >> y)
|
---|
146 | #define CC_H(x) (x << 2)
|
---|
147 | #define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
|
---|
148 | #define F_CC(x) ((x)/1024.0)
|
---|
149 | #define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
|
---|
150 | #define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
|
---|
151 | #define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
|
---|
152 | #define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
|
---|
153 | #define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
|
---|
154 | #define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
|
---|
155 | #define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
|
---|
156 | #define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
|
---|
157 |
|
---|
158 | /* extract information from standard timing section */
|
---|
159 | #define T1 GET(E_T1)
|
---|
160 | #define T2 GET(E_T2)
|
---|
161 | #define T_MANU GET(E_TMANU)
|
---|
162 |
|
---|
163 | /* extract information from estabished timing section */
|
---|
164 | #define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \
|
---|
165 | || ((x[0] == 0x00) && (x[1] == 0x00)) \
|
---|
166 | || ((x[0] == 0x20) && (x[1] == 0x20)) )
|
---|
167 | #define VALID_TIMING _VALID_TIMING(c)
|
---|
168 | #define _HSIZE1(x) ((x[0] + 31) * 8)
|
---|
169 | #define HSIZE1 _HSIZE1(c)
|
---|
170 | #define RATIO(x) ((x[1] & 0xC0) >> 6)
|
---|
171 | #define RATIO1_1 0
|
---|
172 | /* EDID Ver. 1.3 redefined this */
|
---|
173 | #define RATIO16_10 RATIO1_1
|
---|
174 | #define RATIO4_3 1
|
---|
175 | #define RATIO5_4 2
|
---|
176 | #define RATIO16_9 3
|
---|
177 | #define _VSIZE1(x,y,r) switch(RATIO(x)){ \
|
---|
178 | case RATIO1_1: y = ((v->version > 1 || v->revision > 2) \
|
---|
179 | ? (_HSIZE1(x) * 10) / 16 : _HSIZE1(x)); break; \
|
---|
180 | case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \
|
---|
181 | case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
|
---|
182 | case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
|
---|
183 | }
|
---|
184 | #define VSIZE1(x) _VSIZE1(c,x,v)
|
---|
185 | #define _REFRESH_R(x) (x[1] & 0x3F) + 60
|
---|
186 | #define REFRESH_R _REFRESH_R(c)
|
---|
187 | #define _ID_LOW(x) x[0]
|
---|
188 | #define ID_LOW _ID_LOW(c)
|
---|
189 | #define _ID_HIGH(x) (x[1] << 8)
|
---|
190 | #define ID_HIGH _ID_HIGH(c)
|
---|
191 | #define STD_TIMING_ID (ID_LOW | ID_HIGH)
|
---|
192 | #define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
|
---|
193 | #define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
|
---|
194 |
|
---|
195 |
|
---|
196 | /* EDID Ver. >= 1.2 */
|
---|
197 | /**
|
---|
198 | * Returns true if the pointer is the start of a monitor descriptor block
|
---|
199 | * instead of a detailed timing descriptor.
|
---|
200 | *
|
---|
201 | * Checking the reserved pad fields for zeroes fails on some monitors with
|
---|
202 | * broken empty ASCII strings. Only the first two bytes are reliable.
|
---|
203 | */
|
---|
204 | #define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0)
|
---|
205 | #define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
|
---|
206 | #define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
|
---|
207 | #define PIXEL_CLOCK _PIXEL_CLOCK(c)
|
---|
208 | #define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
|
---|
209 | #define H_ACTIVE _H_ACTIVE(c)
|
---|
210 | #define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
|
---|
211 | #define H_BLANK _H_BLANK(c)
|
---|
212 | #define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
|
---|
213 | #define V_ACTIVE _V_ACTIVE(c)
|
---|
214 | #define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
|
---|
215 | #define V_BLANK _V_BLANK(c)
|
---|
216 | #define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
|
---|
217 | #define H_SYNC_OFF _H_SYNC_OFF(c)
|
---|
218 | #define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
|
---|
219 | #define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
|
---|
220 | #define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
|
---|
221 | #define V_SYNC_OFF _V_SYNC_OFF(c)
|
---|
222 | #define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
|
---|
223 | #define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
|
---|
224 | #define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4))
|
---|
225 | #define H_SIZE _H_SIZE(c)
|
---|
226 | #define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8))
|
---|
227 | #define V_SIZE _V_SIZE(c)
|
---|
228 | #define _H_BORDER(x) (x[15])
|
---|
229 | #define H_BORDER _H_BORDER(c)
|
---|
230 | #define _V_BORDER(x) (x[16])
|
---|
231 | #define V_BORDER _V_BORDER(c)
|
---|
232 | #define _INTERLACED(x) ((x[17] & 0x80) >> 7)
|
---|
233 | #define INTERLACED _INTERLACED(c)
|
---|
234 | #define _STEREO(x) ((x[17] & 0x60) >> 5)
|
---|
235 | #define STEREO _STEREO(c)
|
---|
236 | #define _STEREO1(x) (x[17] & 0x1)
|
---|
237 | #define STEREO1 _STEREO(c)
|
---|
238 | #define _SYNC_T(x) ((x[17] & 0x18) >> 3)
|
---|
239 | #define SYNC_T _SYNC_T(c)
|
---|
240 | #define _MISC(x) ((x[17] & 0x06) >> 1)
|
---|
241 | #define MISC _MISC(c)
|
---|
242 |
|
---|
243 | #define _MONITOR_DESC_TYPE(x) x[3]
|
---|
244 | #define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
|
---|
245 | #define SERIAL_NUMBER 0xFF
|
---|
246 | #define ASCII_STR 0xFE
|
---|
247 | #define MONITOR_RANGES 0xFD
|
---|
248 | #define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255)
|
---|
249 | #define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255)
|
---|
250 | #define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255)
|
---|
251 | #define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255)
|
---|
252 | #define _MIN_V(x) x[5]
|
---|
253 | #define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c))
|
---|
254 | #define _MAX_V(x) x[6]
|
---|
255 | #define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c))
|
---|
256 | #define _MIN_H(x) x[7]
|
---|
257 | #define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c))
|
---|
258 | #define _MAX_H(x) x[8]
|
---|
259 | #define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c))
|
---|
260 | #define _MAX_CLOCK(x) x[9]
|
---|
261 | #define MAX_CLOCK _MAX_CLOCK(c)
|
---|
262 | #define _HAVE_2ND_GTF(x) (x[10] == 0x02)
|
---|
263 | #define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
|
---|
264 | #define _F_2ND_GTF(x) (x[12] * 2)
|
---|
265 | #define F_2ND_GTF _F_2ND_GTF(c)
|
---|
266 | #define _C_2ND_GTF(x) (x[13] / 2)
|
---|
267 | #define C_2ND_GTF _C_2ND_GTF(c)
|
---|
268 | #define _M_2ND_GTF(x) (x[14] + (x[15] << 8))
|
---|
269 | #define M_2ND_GTF _M_2ND_GTF(c)
|
---|
270 | #define _K_2ND_GTF(x) (x[16])
|
---|
271 | #define K_2ND_GTF _K_2ND_GTF(c)
|
---|
272 | #define _J_2ND_GTF(x) (x[17] / 2)
|
---|
273 | #define J_2ND_GTF _J_2ND_GTF(c)
|
---|
274 | #define _HAVE_CVT(x) (x[10] == 0x04)
|
---|
275 | #define HAVE_CVT _HAVE_CVT(c)
|
---|
276 | #define _MAX_CLOCK_KHZ(x) (x[12] >> 2)
|
---|
277 | #define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250)
|
---|
278 | #define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8)
|
---|
279 | #define MAXWIDTH _MAXWIDTH(c)
|
---|
280 | #define _SUPPORTED_ASPECT(x) x[14]
|
---|
281 | #define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c)
|
---|
282 | #define SUPPORTED_ASPECT_4_3 0x80
|
---|
283 | #define SUPPORTED_ASPECT_16_9 0x40
|
---|
284 | #define SUPPORTED_ASPECT_16_10 0x20
|
---|
285 | #define SUPPORTED_ASPECT_5_4 0x10
|
---|
286 | #define SUPPORTED_ASPECT_15_9 0x08
|
---|
287 | #define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5)
|
---|
288 | #define PREFERRED_ASPECT _PREFERRED_ASPECT(c)
|
---|
289 | #define PREFERRED_ASPECT_4_3 0
|
---|
290 | #define PREFERRED_ASPECT_16_9 1
|
---|
291 | #define PREFERRED_ASPECT_16_10 2
|
---|
292 | #define PREFERRED_ASPECT_5_4 3
|
---|
293 | #define PREFERRED_ASPECT_15_9 4
|
---|
294 | #define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3)
|
---|
295 | #define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c)
|
---|
296 | #define CVT_STANDARD 0x01
|
---|
297 | #define CVT_REDUCED 0x02
|
---|
298 | #define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4)
|
---|
299 | #define SUPPORTED_SCALING _SUPPORTED_SCALING(c)
|
---|
300 | #define SCALING_HSHRINK 0x08
|
---|
301 | #define SCALING_HSTRETCH 0x04
|
---|
302 | #define SCALING_VSHRINK 0x02
|
---|
303 | #define SCALING_VSTRETCH 0x01
|
---|
304 | #define _PREFERRED_REFRESH(x) x[17]
|
---|
305 | #define PREFERRED_REFRESH _PREFERRED_REFRESH(c)
|
---|
306 |
|
---|
307 | #define MONITOR_NAME 0xFC
|
---|
308 | #define ADD_COLOR_POINT 0xFB
|
---|
309 | #define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
|
---|
310 | #define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
|
---|
311 | #define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2))
|
---|
312 | #define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0))
|
---|
313 | #define _WHITE_INDEX1(x) x[5]
|
---|
314 | #define WHITE_INDEX1 _WHITE_INDEX1(c)
|
---|
315 | #define _WHITE_INDEX2(x) x[10]
|
---|
316 | #define WHITE_INDEX2 _WHITE_INDEX2(c)
|
---|
317 | #define WHITEX1 _WHITEX_ADD(c,6)
|
---|
318 | #define WHITEY1 _WHITEY_ADD(c,6)
|
---|
319 | #define WHITEX2 _WHITEX_ADD(c,12)
|
---|
320 | #define WHITEY2 _WHITEY_ADD(c,12)
|
---|
321 | #define _WHITE_GAMMA1(x) _GAMMA(x[9])
|
---|
322 | #define WHITE_GAMMA1 _WHITE_GAMMA1(c)
|
---|
323 | #define _WHITE_GAMMA2(x) _GAMMA(x[14])
|
---|
324 | #define WHITE_GAMMA2 _WHITE_GAMMA2(c)
|
---|
325 | #define ADD_STD_TIMINGS 0xFA
|
---|
326 | #define COLOR_MANAGEMENT_DATA 0xF9
|
---|
327 | #define CVT_3BYTE_DATA 0xF8
|
---|
328 | #define ADD_EST_TIMINGS 0xF7
|
---|
329 | #define ADD_DUMMY 0x10
|
---|
330 |
|
---|
331 | #define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
|
---|
332 | #define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
|
---|
333 |
|
---|
334 | #endif /* _PARSE_EDID_ */
|
---|
335 |
|
---|
336 | /* input type */
|
---|
337 | #define DIGITAL(x) x
|
---|
338 |
|
---|
339 | /* DFP */
|
---|
340 | #define DFP1(x) x
|
---|
341 |
|
---|
342 | /* input voltage level */
|
---|
343 | #define V070 0 /* 0.700V/0.300V */
|
---|
344 | #define V071 1 /* 0.714V/0.286V */
|
---|
345 | #define V100 2 /* 1.000V/0.400V */
|
---|
346 | #define V007 3 /* 0.700V/0.000V */
|
---|
347 |
|
---|
348 | /* Signal level setup */
|
---|
349 | #define SIG_SETUP(x) (x)
|
---|
350 |
|
---|
351 | /* sync characteristics */
|
---|
352 | #define SEP_SYNC(x) (x & 0x08)
|
---|
353 | #define COMP_SYNC(x) (x & 0x04)
|
---|
354 | #define SYNC_O_GREEN(x) (x & 0x02)
|
---|
355 | #define SYNC_SERR(x) (x & 0x01)
|
---|
356 |
|
---|
357 | /* DPMS features */
|
---|
358 | #define DPMS_STANDBY(x) (x & 0x04)
|
---|
359 | #define DPMS_SUSPEND(x) (x & 0x02)
|
---|
360 | #define DPMS_OFF(x) (x & 0x01)
|
---|
361 |
|
---|
362 | /* display type, analog */
|
---|
363 | #define DISP_MONO 0
|
---|
364 | #define DISP_RGB 1
|
---|
365 | #define DISP_MULTCOLOR 2
|
---|
366 |
|
---|
367 | /* display color encodings, digital */
|
---|
368 | #define DISP_YCRCB444 0x01
|
---|
369 | #define DISP_YCRCB422 0x02
|
---|
370 |
|
---|
371 | /* Msc stuff EDID Ver > 1.1 */
|
---|
372 | #define STD_COLOR_SPACE(x) (x & 0x4)
|
---|
373 | #define PREFERRED_TIMING_MODE(x) (x & 0x2)
|
---|
374 | #define GFT_SUPPORTED(x) (x & 0x1)
|
---|
375 | #define GTF_SUPPORTED(x) (x & 0x1)
|
---|
376 | #define CVT_SUPPORTED(x) (x & 0x1)
|
---|
377 |
|
---|
378 | /* detailed timing misc */
|
---|
379 | #define IS_INTERLACED(x) (x)
|
---|
380 | #define IS_STEREO(x) (x)
|
---|
381 | #define IS_RIGHT_STEREO(x) (x & 0x01)
|
---|
382 | #define IS_LEFT_STEREO(x) (x & 0x02)
|
---|
383 | #define IS_4WAY_STEREO(x) (x & 0x03)
|
---|
384 | #define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x)
|
---|
385 | #define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x)
|
---|
386 |
|
---|
387 |
|
---|
388 | typedef unsigned int Uint;
|
---|
389 | typedef unsigned char Uchar;
|
---|
390 |
|
---|
391 | struct vendor {
|
---|
392 | char name[4];
|
---|
393 | int prod_id;
|
---|
394 | Uint serial;
|
---|
395 | int week;
|
---|
396 | int year;
|
---|
397 | };
|
---|
398 |
|
---|
399 | struct edid_version {
|
---|
400 | int version;
|
---|
401 | int revision;
|
---|
402 | };
|
---|
403 |
|
---|
404 | struct disp_features {
|
---|
405 | unsigned int input_type:1;
|
---|
406 | unsigned int input_voltage:2;
|
---|
407 | unsigned int input_setup:1;
|
---|
408 | unsigned int input_sync:5;
|
---|
409 | unsigned int input_dfp:1;
|
---|
410 | unsigned int input_bpc:3;
|
---|
411 | unsigned int input_interface:4;
|
---|
412 | /* 15 bit hole */
|
---|
413 | int hsize;
|
---|
414 | int vsize;
|
---|
415 | float gamma;
|
---|
416 | unsigned int dpms:3;
|
---|
417 | unsigned int display_type:2;
|
---|
418 | unsigned int msc:3;
|
---|
419 | float redx;
|
---|
420 | float redy;
|
---|
421 | float greenx;
|
---|
422 | float greeny;
|
---|
423 | float bluex;
|
---|
424 | float bluey;
|
---|
425 | float whitex;
|
---|
426 | float whitey;
|
---|
427 | };
|
---|
428 |
|
---|
429 | struct established_timings {
|
---|
430 | Uchar t1;
|
---|
431 | Uchar t2;
|
---|
432 | Uchar t_manu;
|
---|
433 | };
|
---|
434 |
|
---|
435 | struct std_timings {
|
---|
436 | int hsize;
|
---|
437 | int vsize;
|
---|
438 | int refresh;
|
---|
439 | CARD16 id;
|
---|
440 | };
|
---|
441 |
|
---|
442 | struct detailed_timings {
|
---|
443 | int clock;
|
---|
444 | int h_active;
|
---|
445 | int h_blanking;
|
---|
446 | int v_active;
|
---|
447 | int v_blanking;
|
---|
448 | int h_sync_off;
|
---|
449 | int h_sync_width;
|
---|
450 | int v_sync_off;
|
---|
451 | int v_sync_width;
|
---|
452 | int h_size;
|
---|
453 | int v_size;
|
---|
454 | int h_border;
|
---|
455 | int v_border;
|
---|
456 | unsigned int interlaced:1;
|
---|
457 | unsigned int stereo:2;
|
---|
458 | unsigned int sync:2;
|
---|
459 | unsigned int misc:2;
|
---|
460 | unsigned int stereo_1:1;
|
---|
461 | };
|
---|
462 |
|
---|
463 | #define DT 0
|
---|
464 | #define DS_SERIAL 0xFF
|
---|
465 | #define DS_ASCII_STR 0xFE
|
---|
466 | #define DS_NAME 0xFC
|
---|
467 | #define DS_RANGES 0xFD
|
---|
468 | #define DS_WHITE_P 0xFB
|
---|
469 | #define DS_STD_TIMINGS 0xFA
|
---|
470 | #define DS_CMD 0xF9
|
---|
471 | #define DS_CVT 0xF8
|
---|
472 | #define DS_EST_III 0xF7
|
---|
473 | #define DS_DUMMY 0x10
|
---|
474 | #define DS_UNKOWN 0x100 /* type is an int */
|
---|
475 | #define DS_VENDOR 0x101
|
---|
476 | #define DS_VENDOR_MAX 0x110
|
---|
477 |
|
---|
478 | struct monitor_ranges {
|
---|
479 | int min_v;
|
---|
480 | int max_v;
|
---|
481 | int min_h;
|
---|
482 | int max_h;
|
---|
483 | int max_clock; /* in mhz */
|
---|
484 | int gtf_2nd_f;
|
---|
485 | int gtf_2nd_c;
|
---|
486 | int gtf_2nd_m;
|
---|
487 | int gtf_2nd_k;
|
---|
488 | int gtf_2nd_j;
|
---|
489 | int max_clock_khz;
|
---|
490 | int maxwidth; /* in pixels */
|
---|
491 | char supported_aspect;
|
---|
492 | char preferred_aspect;
|
---|
493 | char supported_blanking;
|
---|
494 | char supported_scaling;
|
---|
495 | int preferred_refresh; /* in hz */
|
---|
496 | };
|
---|
497 |
|
---|
498 | struct whitePoints{
|
---|
499 | int index;
|
---|
500 | float white_x;
|
---|
501 | float white_y;
|
---|
502 | float white_gamma;
|
---|
503 | };
|
---|
504 |
|
---|
505 | struct cvt_timings {
|
---|
506 | int width;
|
---|
507 | int height;
|
---|
508 | int rate;
|
---|
509 | int rates;
|
---|
510 | };
|
---|
511 |
|
---|
512 | /*
|
---|
513 | * Be careful when adding new sections; this structure can't grow, it's
|
---|
514 | * embedded in the middle of xf86Monitor which is ABI. Sizes below are
|
---|
515 | * in bytes, for ILP32 systems. If all else fails just copy the section
|
---|
516 | * literally like serial and friends.
|
---|
517 | */
|
---|
518 | struct detailed_monitor_section {
|
---|
519 | int type;
|
---|
520 | union {
|
---|
521 | struct detailed_timings d_timings; /* 56 */
|
---|
522 | Uchar serial[13];
|
---|
523 | Uchar ascii_data[13];
|
---|
524 | Uchar name[13];
|
---|
525 | struct monitor_ranges ranges; /* 56 */
|
---|
526 | struct std_timings std_t[5]; /* 80 */
|
---|
527 | struct whitePoints wp[2]; /* 32 */
|
---|
528 | /* color management data */
|
---|
529 | struct cvt_timings cvt[4]; /* 64 */
|
---|
530 | Uchar est_iii[6]; /* 6 */
|
---|
531 | } section; /* max: 80 */
|
---|
532 | };
|
---|
533 |
|
---|
534 | /* flags */
|
---|
535 | #define EDID_COMPLETE_RAWDATA 0x1
|
---|
536 |
|
---|
537 | typedef struct {
|
---|
538 | int scrnIndex;
|
---|
539 | struct vendor vendor;
|
---|
540 | struct edid_version ver;
|
---|
541 | struct disp_features features;
|
---|
542 | struct established_timings timings1;
|
---|
543 | struct std_timings timings2[8];
|
---|
544 | struct detailed_monitor_section det_mon[4];
|
---|
545 | unsigned long flags;
|
---|
546 | int no_sections;
|
---|
547 | Uchar *rawData;
|
---|
548 | } xf86Monitor, *xf86MonPtr;
|
---|
549 |
|
---|
550 | extern xf86MonPtr ConfiguredMonitor;
|
---|
551 |
|
---|
552 | #endif /* _EDID_H_ */
|
---|