VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/XFree86-4.3/Xserver/edid.h@ 69098

Last change on this file since 69098 was 69098, checked in by vboxsync, 7 years ago

Clean up XFree86 driver header files.
bugref:3810: X11 Guest Additions maintenance
Over the years we have cleaned up the layout in the tree of the X.Org
header files we use to build drivers. The XFree86 ones were still in their
original, rather sub-optimal layout. This change fixes that.

  • Property svn:eol-style set to native
File size: 11.6 KB
Line 
1/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/edid.h,v 1.7 2000/04/20 21:28:26 tsi 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_ 1
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 _GAMMA(x) ((x + 100.0)/100.0)
130#define GAMMA _GAMMA(GET(D_GAMMA))
131#define HSIZE_MAX GET(D_HSIZE)
132#define VSIZE_MAX GET(D_VSIZE)
133#define _DPMS(x) ((x & 0xE0) >> 5)
134#define DPMS _DPMS(GET(FEAT_S))
135#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
136#define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
137#define _MSC(x) (x & 0x7)
138#define MSC _MSC(GET(FEAT_S))
139
140
141/* color characteristics */
142#define CC_L(x,y) ((x & (0x03 << y)) >> y)
143#define CC_H(x) (x << 2)
144#define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
145#define F_CC(x) ((x)/1024.0)
146#define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
147#define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
148#define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
149#define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
150#define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
151#define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
152#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
153#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
154
155/* extract information from standard timing section */
156#define T1 GET(E_T1)
157#define T2 GET(E_T2)
158#define T_MANU GET(E_TMANU)
159
160/* extract information from estabished timing section */
161#define _HSIZE1(x) ((x[0] + 31) * 8)
162#define HSIZE1 _HSIZE1(c)
163#define RATIO(x) ((x[1] & 0xC0) >> 6)
164#define RATIO1_1 0
165#define RATIO4_3 1
166#define RATIO5_4 2
167#define RATIO16_9 3
168#define _VSIZE1(x,y) switch(RATIO(x)){ \
169 case RATIO1_1: y = _HSIZE1(x); break; \
170 case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \
171 case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
172 case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
173 }
174#define VSIZE1(x) _VSIZE1(c,x)
175#define _REFRESH_R(x) (x[1] & 0x3F) + 60
176#define REFRESH_R _REFRESH_R(c)
177#define _ID_LOW(x) x[0]
178#define ID_LOW _ID_LOW(c)
179#define _ID_HIGH(x) (x[1] << 8)
180#define ID_HIGH _ID_HIGH(c)
181#define STD_TIMING_ID (ID_LOW | ID_HIGH)
182#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
183#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
184
185
186/* EDID Ver. > 1.2 */
187#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0 && x[2] == 0 && x[4] == 0)
188#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
189#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
190#define PIXEL_CLOCK _PIXEL_CLOCK(c)
191#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
192#define H_ACTIVE _H_ACTIVE(c)
193#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
194#define H_BLANK _H_BLANK(c)
195#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
196#define V_ACTIVE _V_ACTIVE(c)
197#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
198#define V_BLANK _V_BLANK(c)
199#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
200#define H_SYNC_OFF _H_SYNC_OFF(c)
201#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
202#define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
203#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
204#define V_SYNC_OFF _V_SYNC_OFF(c)
205#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
206#define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
207#define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4))
208#define H_SIZE _H_SIZE(c)
209#define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8))
210#define V_SIZE _V_SIZE(c)
211#define _H_BORDER(x) (x[15])
212#define H_BORDER _H_BORDER(c)
213#define _V_BORDER(x) (x[16])
214#define V_BORDER _V_BORDER(c)
215#define _INTERLACED(x) ((x[17] & 0x80) >> 7)
216#define INTERLACED _INTERLACED(c)
217#define _STEREO(x) ((x[17] & 0x60) >> 6)
218#define STEREO _STEREO(c)
219#define _SYNC_T(x) ((x[17] & 0x18) >> 4)
220#define SYNC_T _SYNC_T(c)
221#define _MISC(x) ((x[17] & 0x06) >> 2)
222#define MISC _MISC(c)
223
224#define _MONITOR_DESC_TYPE(x) x[3]
225#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
226#define SERIAL_NUMBER 0xFF
227#define ASCII_STR 0xFE
228#define MONITOR_RANGES 0xFD
229#define _MIN_V(x) x[5]
230#define MIN_V _MIN_V(c)
231#define _MAX_V(x) x[6]
232#define MAX_V _MAX_V(c)
233#define _MIN_H(x) x[7]
234#define MIN_H _MIN_H(c)
235#define _MAX_H(x) x[8]
236#define MAX_H _MAX_H(c)
237#define _MAX_CLOCK(x) x[9]
238#define MAX_CLOCK _MAX_CLOCK(c)
239#define MONITOR_NAME 0xFC
240#define ADD_COLOR_POINT 0xFB
241#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
242#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
243#define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2))
244#define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0))
245#define _WHITE_INDEX1(x) x[5]
246#define WHITE_INDEX1 _WHITE_INDEX1(c)
247#define _WHITE_INDEX2(x) x[10]
248#define WHITE_INDEX2 _WHITE_INDEX2(c)
249#define WHITEX1 _WHITEX_ADD(c,6)
250#define WHITEY1 _WHITEY_ADD(c,6)
251#define WHITEX2 _WHITEX_ADD(c,12)
252#define WHITEY2 _WHITEY_ADD(c,12)
253#define _WHITE_GAMMA1(x) _GAMMA(x[9])
254#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
255#define _WHITE_GAMMA2(x) _GAMMA(x[14])
256#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
257#define ADD_STD_TIMINGS 0xFA
258
259#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
260#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
261
262#endif /* _PARSE_EDID_ */
263
264/* input type */
265#define DIGITAL(x) x
266
267/* input voltage level */
268#define V070 0 /* 0.700V/0.300V */
269#define V071 1 /* 0.714V/0.286V */
270#define V100 2 /* 1.000V/0.400V */
271#define V007 3 /* 0.700V/0.000V */
272
273/* Signal level setup */
274#define SIG_SETUP(x) (x)
275
276/* sync characteristics */
277#define SEP_SYNC(x) (x & 0x08)
278#define COMP_SYNC(x) (x & 0x04)
279#define SYNC_O_GREEN(x) (x & 0x02)
280#define SYNC_SERR(x) (x & 0x01)
281
282/* DPMS features */
283#define DPMS_STANDBY(x) (x & 0x04)
284#define DPMS_SUSPEND(x) (x & 0x02)
285#define DPMS_OFF(x) (x & 0x01)
286
287/* display type */
288#define DISP_MONO 0
289#define DISP_RGB 1
290#define DISP_MULTCOLOR 2
291
292/* Msc stuff EDID Ver > 1.1 */
293#define STD_COLOR_SPACE(x) (x & 0x4)
294#define PREFERRED_TIMING_MODE(x) (x & 0x2)
295#define GFT_SUPPORTED(x) (x & 0x1)
296
297/* detailed timing misc */
298#define IS_INTERLACED(x) (x)
299#define IS_STEREO(x) (x)
300#define IS_RIGHT_ON_SYNC(x) (x & 0x01)
301#define IS_LEFT_ON_SYNC(x) (x & 0x02)
302
303typedef unsigned int Uint;
304typedef unsigned char Uchar;
305
306struct vendor {
307 char name[4];
308 int prod_id;
309 Uint serial;
310 int week;
311 int year;
312};
313
314struct edid_version {
315 int version;
316 int revision;
317};
318
319struct disp_features {
320 unsigned int input_type:1;
321 unsigned int input_voltage:2;
322 unsigned int input_setup:1;
323 unsigned int input_sync:5;
324 int hsize;
325 int vsize;
326 float gamma;
327 unsigned int dpms:3;
328 unsigned int display_type:2;
329 unsigned int msc:3;
330 float redx;
331 float redy;
332 float greenx;
333 float greeny;
334 float bluex;
335 float bluey;
336 float whitex;
337 float whitey;
338};
339
340struct established_timings {
341 Uchar t1;
342 Uchar t2;
343 Uchar t_manu;
344};
345
346struct std_timings {
347 int hsize;
348 int vsize;
349 int refresh;
350 CARD16 id;
351};
352
353struct detailed_timings {
354 int clock;
355 int h_active;
356 int h_blanking;
357 int v_active;
358 int v_blanking;
359 int h_sync_off;
360 int h_sync_width;
361 int v_sync_off;
362 int v_sync_width;
363 int h_size;
364 int v_size;
365 int h_border;
366 int v_border;
367 unsigned int interlaced:1;
368 unsigned int stereo:2;
369 unsigned int sync:2;
370 unsigned int misc:2;
371};
372
373#define DT 0
374#define DS_SERIAL 0xFF
375#define DS_ASCII_STR 0xFE
376#define DS_NAME 0xFC
377#define DS_RANGES 0xFD
378#define DS_WHITE_P 0xFB
379#define DS_STD_TIMINGS 0xFA
380
381struct monitor_ranges {
382 int min_v;
383 int max_v;
384 int min_h;
385 int max_h;
386 int max_clock;
387};
388
389struct whitePoints{
390 int index;
391 float white_x;
392 float white_y;
393 float white_gamma;
394};
395
396struct detailed_monitor_section {
397 int type;
398 union {
399 struct detailed_timings d_timings;
400 Uchar serial[13];
401 Uchar ascii_data[13];
402 Uchar name[13];
403 struct monitor_ranges ranges;
404 struct std_timings std_t[5];
405 struct whitePoints wp[2];
406 } section;
407};
408
409typedef struct {
410 int scrnIndex;
411 struct vendor vendor;
412 struct edid_version ver;
413 struct disp_features features;
414 struct established_timings timings1;
415 struct std_timings timings2[8];
416 struct detailed_monitor_section det_mon[4];
417 xf86vdifPtr vdif;
418 int no_sections;
419 Uchar *rawData;
420} xf86Monitor, *xf86MonPtr;
421
422extern xf86MonPtr ConfiguredMonitor;
423
424#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