VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.1.0/edid.h@ 78293

Last change on this file since 78293 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 12.9 KB
Line 
1/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.h,v 1.6 2000/04/17 16:29:55 eich Exp $ */
2
3/* edid.h: defines to parse an EDID block
4 *
5 * This file contains all information to interpret a standard EDIC block
6 * transmitted by a display device via DDC (Display Data Channel). So far
7 * there is no information to deal with optional EDID blocks.
8 * DDC is a Trademark of VESA (Video Electronics Standard Association).
9 *
10 * Copyright 1998 by Egbert Eich <[email protected]>
11 */
12
13#ifndef _EDID_H_
14#define _EDID_H_
15
16#include "vdif.h"
17
18/* read complete EDID record */
19#define EDID1_LEN 128
20#define BITS_PER_BYTE 9
21#define NUM BITS_PER_BYTE*EDID1_LEN
22#define HEADER 6
23
24#define STD_TIMINGS 8
25#define DET_TIMINGS 4
26
27#ifdef _PARSE_EDID_
28
29/* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */
30#define HEADER_SECTION 0
31#define HEADER_LENGTH 8
32
33/* vendor section */
34#define VENDOR_SECTION (HEADER_SECTION + HEADER_LENGTH)
35#define V_MANUFACTURER 0
36#define V_PROD_ID (V_MANUFACTURER + 2)
37#define V_SERIAL (V_PROD_ID + 2)
38#define V_WEEK (V_SERIAL + 4)
39#define V_YEAR (V_WEEK + 1)
40#define VENDOR_LENGTH (V_YEAR + 1)
41
42/* EDID version */
43#define VERSION_SECTION (VENDOR_SECTION + VENDOR_LENGTH)
44#define V_VERSION 0
45#define V_REVISION (V_VERSION + 1)
46#define VERSION_LENGTH (V_REVISION + 1)
47
48/* display information */
49#define DISPLAY_SECTION (VERSION_SECTION + VERSION_LENGTH)
50#define D_INPUT 0
51#define D_HSIZE (D_INPUT + 1)
52#define D_VSIZE (D_HSIZE + 1)
53#define D_GAMMA (D_VSIZE + 1)
54#define FEAT_S (D_GAMMA + 1)
55#define D_RG_LOW (FEAT_S + 1)
56#define D_BW_LOW (D_RG_LOW + 1)
57#define D_REDX (D_BW_LOW + 1)
58#define D_REDY (D_REDX + 1)
59#define D_GREENX (D_REDY + 1)
60#define D_GREENY (D_GREENX + 1)
61#define D_BLUEX (D_GREENY + 1)
62#define D_BLUEY (D_BLUEX + 1)
63#define D_WHITEX (D_BLUEY + 1)
64#define D_WHITEY (D_WHITEX + 1)
65#define DISPLAY_LENGTH (D_WHITEY + 1)
66
67/* supported VESA and other standard timings */
68#define ESTABLISHED_TIMING_SECTION (DISPLAY_SECTION + DISPLAY_LENGTH)
69#define E_T1 0
70#define E_T2 (E_T1 + 1)
71#define E_TMANU (E_T2 + 1)
72#define E_TIMING_LENGTH (E_TMANU + 1)
73
74/* non predefined standard timings supported by display */
75#define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH)
76#define STD_TIMING_INFO_LEN 2
77#define STD_TIMING_INFO_NUM STD_TIMINGS
78#define STD_TIMING_LENGTH (STD_TIMING_INFO_LEN * STD_TIMING_INFO_NUM)
79
80/* detailed timing info of non standard timings */
81#define DET_TIMING_SECTION (STD_TIMING_SECTION + STD_TIMING_LENGTH)
82#define DET_TIMING_INFO_LEN 18
83#define MONITOR_DESC_LEN DET_TIMING_INFO_LEN
84#define DET_TIMING_INFO_NUM DET_TIMINGS
85#define DET_TIMING_LENGTH (DET_TIMING_INFO_LEN * DET_TIMING_INFO_NUM)
86
87/* number of EDID sections to follow */
88#define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH)
89/* one byte checksum */
90#define CHECKSUM (NO_EDID + 1)
91
92#if (CHECKSUM != (EDID1_LEN - 1))
93# error "EDID1 length != 128!"
94#endif
95
96
97#define SECTION(x,y) (Uchar *)(x + y)
98#define GET_ARRAY(y) ((Uchar *)(c + y))
99#define GET(y) *(Uchar *)(c + y)
100
101/* extract information from vendor section */
102#define _PROD_ID(x) x[0] + (x[1] << 8);
103#define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID))
104#define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24)
105#define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL))
106#define _YEAR(x) (x & 0xFF) + 1990
107#define YEAR _YEAR(GET(V_YEAR))
108#define WEEK GET(V_WEEK) & 0xFF
109#define _L1(x) ((x[0] & 0x7C) >> 2) + '@'
110#define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'
111#define _L3(x) (x[1] & 0x1F) + '@';
112#define L1 _L1(GET_ARRAY(V_MANUFACTURER))
113#define L2 _L2(GET_ARRAY(V_MANUFACTURER))
114#define L3 _L3(GET_ARRAY(V_MANUFACTURER))
115
116/* extract information from version section */
117#define VERSION GET(V_VERSION)
118#define REVISION GET(V_REVISION)
119
120/* extract information from display section */
121#define _INPUT_TYPE(x) ((x & 0x80) >> 7)
122#define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT))
123#define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5)
124#define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT))
125#define _SETUP(x) ((x & 0x10) >> 4)
126#define SETUP _SETUP(GET(D_INPUT))
127#define _SYNC(x) (x & 0x0F)
128#define SYNC _SYNC(GET(D_INPUT))
129#define _DFP(x) (x & 0x01)
130#define DFP _DFP(GET(D_INPUT))
131#define _GAMMA(x) (x == 0xff ? 1.0 : ((x + 100.0)/100.0))
132#define GAMMA _GAMMA(GET(D_GAMMA))
133#define HSIZE_MAX GET(D_HSIZE)
134#define VSIZE_MAX GET(D_VSIZE)
135#define _DPMS(x) ((x & 0xE0) >> 5)
136#define DPMS _DPMS(GET(FEAT_S))
137#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
138#define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
139#define _MSC(x) (x & 0x7)
140#define MSC _MSC(GET(FEAT_S))
141
142
143/* color characteristics */
144#define CC_L(x,y) ((x & (0x03 << y)) >> y)
145#define CC_H(x) (x << 2)
146#define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
147#define F_CC(x) ((x)/1024.0)
148#define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
149#define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
150#define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
151#define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
152#define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
153#define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
154#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
155#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
156
157/* extract information from standard timing section */
158#define T1 GET(E_T1)
159#define T2 GET(E_T2)
160#define T_MANU GET(E_TMANU)
161
162/* extract information from estabished timing section */
163#define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \
164 || ((x[0] == 0x00) && (x[1] == 0x00)) \
165 || ((x[0] == 0x20) && (x[1] == 0x20)) )
166#define VALID_TIMING _VALID_TIMING(c)
167#define _HSIZE1(x) ((x[0] + 31) * 8)
168#define HSIZE1 _HSIZE1(c)
169#define RATIO(x) ((x[1] & 0xC0) >> 6)
170#define RATIO1_1 0
171/* EDID Ver. 1.3 redefined this */
172#define RATIO16_10 RATIO1_1
173#define RATIO4_3 1
174#define RATIO5_4 2
175#define RATIO16_9 3
176#define _VSIZE1(x,y,r) switch(RATIO(x)){ \
177 case RATIO1_1: y = ((v->version > 1 || v->revision > 2) \
178 ? (_HSIZE1(x) * 10) / 16 : _HSIZE1(x)); break; \
179 case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \
180 case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
181 case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
182 }
183#define VSIZE1(x) _VSIZE1(c,x,v)
184#define _REFRESH_R(x) (x[1] & 0x3F) + 60
185#define REFRESH_R _REFRESH_R(c)
186#define _ID_LOW(x) x[0]
187#define ID_LOW _ID_LOW(c)
188#define _ID_HIGH(x) (x[1] << 8)
189#define ID_HIGH _ID_HIGH(c)
190#define STD_TIMING_ID (ID_LOW | ID_HIGH)
191#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
192#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
193
194
195/* EDID Ver. >= 1.2 */
196#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0 && x[2] == 0 && x[4] == 0)
197#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
198#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
199#define PIXEL_CLOCK _PIXEL_CLOCK(c)
200#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
201#define H_ACTIVE _H_ACTIVE(c)
202#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
203#define H_BLANK _H_BLANK(c)
204#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
205#define V_ACTIVE _V_ACTIVE(c)
206#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
207#define V_BLANK _V_BLANK(c)
208#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
209#define H_SYNC_OFF _H_SYNC_OFF(c)
210#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
211#define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
212#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
213#define V_SYNC_OFF _V_SYNC_OFF(c)
214#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
215#define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
216#define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4))
217#define H_SIZE _H_SIZE(c)
218#define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8))
219#define V_SIZE _V_SIZE(c)
220#define _H_BORDER(x) (x[15])
221#define H_BORDER _H_BORDER(c)
222#define _V_BORDER(x) (x[16])
223#define V_BORDER _V_BORDER(c)
224#define _INTERLACED(x) ((x[17] & 0x80) >> 7)
225#define INTERLACED _INTERLACED(c)
226#define _STEREO(x) ((x[17] & 0x60) >> 5)
227#define STEREO _STEREO(c)
228#define _STEREO1(x) (x[17] & 0x1)
229#define STEREO1 _STEREO(c)
230#define _SYNC_T(x) ((x[17] & 0x18) >> 3)
231#define SYNC_T _SYNC_T(c)
232#define _MISC(x) ((x[17] & 0x06) >> 1)
233#define MISC _MISC(c)
234
235#define _MONITOR_DESC_TYPE(x) x[3]
236#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
237#define SERIAL_NUMBER 0xFF
238#define ASCII_STR 0xFE
239#define MONITOR_RANGES 0xFD
240#define _MIN_V(x) x[5]
241#define MIN_V _MIN_V(c)
242#define _MAX_V(x) x[6]
243#define MAX_V _MAX_V(c)
244#define _MIN_H(x) x[7]
245#define MIN_H _MIN_H(c)
246#define _MAX_H(x) x[8]
247#define MAX_H _MAX_H(c)
248#define _MAX_CLOCK(x) x[9]
249#define MAX_CLOCK _MAX_CLOCK(c)
250#define _HAVE_2ND_GTF(x) (x[10] == 0x02)
251#define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
252#define _F_2ND_GTF(x) (x[12] * 2)
253#define F_2ND_GTF _F_2ND_GTF(c)
254#define _C_2ND_GTF(x) (x[13] / 2)
255#define C_2ND_GTF _C_2ND_GTF(c)
256#define _M_2ND_GTF(x) (x[14] + (x[15] << 8))
257#define M_2ND_GTF _M_2ND_GTF(c)
258#define _K_2ND_GTF(x) (x[16])
259#define K_2ND_GTF _K_2ND_GTF(c)
260#define _J_2ND_GTF(x) (x[17] / 2)
261#define J_2ND_GTF _J_2ND_GTF(c)
262#define MONITOR_NAME 0xFC
263#define ADD_COLOR_POINT 0xFB
264#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
265#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
266#define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2))
267#define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0))
268#define _WHITE_INDEX1(x) x[5]
269#define WHITE_INDEX1 _WHITE_INDEX1(c)
270#define _WHITE_INDEX2(x) x[10]
271#define WHITE_INDEX2 _WHITE_INDEX2(c)
272#define WHITEX1 _WHITEX_ADD(c,6)
273#define WHITEY1 _WHITEY_ADD(c,6)
274#define WHITEX2 _WHITEX_ADD(c,12)
275#define WHITEY2 _WHITEY_ADD(c,12)
276#define _WHITE_GAMMA1(x) _GAMMA(x[9])
277#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
278#define _WHITE_GAMMA2(x) _GAMMA(x[14])
279#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
280#define ADD_STD_TIMINGS 0xFA
281#define ADD_DUMMY 0x10
282
283#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
284#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
285
286#endif /* _PARSE_EDID_ */
287
288/* input type */
289#define DIGITAL(x) x
290
291/* DFP */
292#define DFP1(x) x
293
294/* input voltage level */
295#define V070 0 /* 0.700V/0.300V */
296#define V071 1 /* 0.714V/0.286V */
297#define V100 2 /* 1.000V/0.400V */
298#define V007 3 /* 0.700V/0.000V */
299
300/* Signal level setup */
301#define SIG_SETUP(x) (x)
302
303/* sync characteristics */
304#define SEP_SYNC(x) (x & 0x08)
305#define COMP_SYNC(x) (x & 0x04)
306#define SYNC_O_GREEN(x) (x & 0x02)
307#define SYNC_SERR(x) (x & 0x01)
308
309/* DPMS features */
310#define DPMS_STANDBY(x) (x & 0x04)
311#define DPMS_SUSPEND(x) (x & 0x02)
312#define DPMS_OFF(x) (x & 0x01)
313
314/* display type */
315#define DISP_MONO 0
316#define DISP_RGB 1
317#define DISP_MULTCOLOR 2
318
319/* Msc stuff EDID Ver > 1.1 */
320#define STD_COLOR_SPACE(x) (x & 0x4)
321#define PREFERRED_TIMING_MODE(x) (x & 0x2)
322#define GFT_SUPPORTED(x) (x & 0x1)
323
324/* detailed timing misc */
325#define IS_INTERLACED(x) (x)
326#define IS_STEREO(x) (x)
327#define IS_RIGHT_STEREO(x) (x & 0x01)
328#define IS_LEFT_STEREO(x) (x & 0x02)
329#define IS_4WAY_STEREO(x) (x & 0x03)
330#define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x)
331#define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x)
332
333
334typedef unsigned int Uint;
335typedef unsigned char Uchar;
336
337struct vendor {
338 char name[4];
339 int prod_id;
340 Uint serial;
341 int week;
342 int year;
343};
344
345struct edid_version {
346 int version;
347 int revision;
348};
349
350struct disp_features {
351 unsigned int input_type:1;
352 unsigned int input_voltage:2;
353 unsigned int input_setup:1;
354 unsigned int input_sync:5;
355 unsigned int input_dfp:1;
356 int hsize;
357 int vsize;
358 float gamma;
359 unsigned int dpms:3;
360 unsigned int display_type:2;
361 unsigned int msc:3;
362 float redx;
363 float redy;
364 float greenx;
365 float greeny;
366 float bluex;
367 float bluey;
368 float whitex;
369 float whitey;
370};
371
372struct established_timings {
373 Uchar t1;
374 Uchar t2;
375 Uchar t_manu;
376};
377
378struct std_timings {
379 int hsize;
380 int vsize;
381 int refresh;
382 CARD16 id;
383};
384
385struct detailed_timings {
386 int clock;
387 int h_active;
388 int h_blanking;
389 int v_active;
390 int v_blanking;
391 int h_sync_off;
392 int h_sync_width;
393 int v_sync_off;
394 int v_sync_width;
395 int h_size;
396 int v_size;
397 int h_border;
398 int v_border;
399 unsigned int interlaced:1;
400 unsigned int stereo:2;
401 unsigned int sync:2;
402 unsigned int misc:2;
403 unsigned int stereo_1:1;
404};
405
406#define DT 0
407#define DS_SERIAL 0xFF
408#define DS_ASCII_STR 0xFE
409#define DS_NAME 0xFC
410#define DS_RANGES 0xFD
411#define DS_WHITE_P 0xFB
412#define DS_STD_TIMINGS 0xFA
413#define DS_DUMMY 0x10
414#define DS_UNKOWN 0x100 /* type is an int */
415
416struct monitor_ranges {
417 int min_v;
418 int max_v;
419 int min_h;
420 int max_h;
421 int max_clock;
422 int gtf_2nd_f;
423 int gtf_2nd_c;
424 int gtf_2nd_m;
425 int gtf_2nd_k;
426 int gtf_2nd_j;
427};
428
429struct whitePoints{
430 int index;
431 float white_x;
432 float white_y;
433 float white_gamma;
434};
435
436struct detailed_monitor_section {
437 int type;
438 union {
439 struct detailed_timings d_timings;
440 Uchar serial[13];
441 Uchar ascii_data[13];
442 Uchar name[13];
443 struct monitor_ranges ranges;
444 struct std_timings std_t[5];
445 struct whitePoints wp[2];
446 } section;
447};
448
449typedef struct {
450 int scrnIndex;
451 struct vendor vendor;
452 struct edid_version ver;
453 struct disp_features features;
454 struct established_timings timings1;
455 struct std_timings timings2[8];
456 struct detailed_monitor_section det_mon[4];
457 xf86vdifPtr vdif;
458 int no_sections;
459 Uchar *rawData;
460} xf86Monitor, *xf86MonPtr;
461
462extern xf86MonPtr ConfiguredMonitor;
463
464#endif /* _EDID_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette