edid.h revision deb4998ba50060c48cce222fd18a8eed053918d7
/* edid.h: defines to parse an EDID block
*
* This file contains all information to interpret a standard EDIC block
* transmitted by a display device via DDC (Display Data Channel). So far
* there is no information to deal with optional EDID blocks.
* DDC is a Trademark of VESA (Video Electronics Standard Association).
*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
#ifndef _EDID_H_
#define _EDID_H_
#include "vdif.h"
/* read complete EDID record */
#define EDID1_LEN 128
#define BITS_PER_BYTE 9
#define HEADER 6
#define STD_TIMINGS 8
#define DET_TIMINGS 4
#ifdef _PARSE_EDID_
/* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */
#define HEADER_SECTION 0
#define HEADER_LENGTH 8
/* vendor section */
#define V_MANUFACTURER 0
/* EDID version */
#define V_VERSION 0
/* display information */
#define D_INPUT 0
/* supported VESA and other standard timings */
#define E_T1 0
/* non predefined standard timings supported by display */
#define STD_TIMING_INFO_LEN 2
#define STD_TIMING_INFO_NUM STD_TIMINGS
/* detailed timing info of non standard timings */
#define DET_TIMING_INFO_LEN 18
#define MONITOR_DESC_LEN DET_TIMING_INFO_LEN
#define DET_TIMING_INFO_NUM DET_TIMINGS
/* number of EDID sections to follow */
/* one byte checksum */
# error "EDID1 length != 128!"
#endif
/* extract information from vendor section */
/* extract information from version section */
/* extract information from display section */
#define _SYNC(x) (x & 0x0F)
#define _DFP(x) (x & 0x01)
#define _MSC(x) (x & 0x7)
/* color characteristics */
#define CC_L(x,y) ((x & (0x03 << y)) >> y)
#define CC_H(x) (x << 2)
#define F_CC(x) ((x)/1024.0)
/* extract information from standard timing section */
/* extract information from estabished timing section */
|| ((x[0] == 0x00) && (x[1] == 0x00)) \
|| ((x[0] == 0x20) && (x[1] == 0x20)) )
#define VALID_TIMING _VALID_TIMING(c)
#define RATIO1_1 0
/* EDID Ver. 1.3 redefined this */
#define RATIO16_10 RATIO1_1
#define RATIO4_3 1
#define RATIO5_4 2
#define RATIO16_9 3
}
#define REFRESH_R _REFRESH_R(c)
#define _ID_LOW(x) x[0]
#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
/* EDID Ver. >= 1.2 */
#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
#define PIXEL_CLOCK _PIXEL_CLOCK(c)
#define H_SYNC_OFF _H_SYNC_OFF(c)
#define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
#define V_SYNC_OFF _V_SYNC_OFF(c)
#define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
#define _H_BORDER(x) (x[15])
#define _V_BORDER(x) (x[16])
#define INTERLACED _INTERLACED(c)
#define _MONITOR_DESC_TYPE(x) x[3]
#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
#define SERIAL_NUMBER 0xFF
#define ASCII_STR 0xFE
#define MONITOR_RANGES 0xFD
#define _MIN_V(x) x[5]
#define _MAX_V(x) x[6]
#define _MIN_H(x) x[7]
#define _MAX_H(x) x[8]
#define _MAX_CLOCK(x) x[9]
#define MAX_CLOCK _MAX_CLOCK(c)
#define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
#define F_2ND_GTF _F_2ND_GTF(c)
#define C_2ND_GTF _C_2ND_GTF(c)
#define M_2ND_GTF _M_2ND_GTF(c)
#define _K_2ND_GTF(x) (x[16])
#define K_2ND_GTF _K_2ND_GTF(c)
#define J_2ND_GTF _J_2ND_GTF(c)
#define MONITOR_NAME 0xFC
#define ADD_COLOR_POINT 0xFB
#define _WHITE_INDEX1(x) x[5]
#define WHITE_INDEX1 _WHITE_INDEX1(c)
#define _WHITE_INDEX2(x) x[10]
#define WHITE_INDEX2 _WHITE_INDEX2(c)
#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
#define ADD_STD_TIMINGS 0xFA
#define ADD_DUMMY 0x10
#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
#endif /* _PARSE_EDID_ */
/* input type */
#define DIGITAL(x) x
/* DFP */
#define DFP1(x) x
/* input voltage level */
#define V070 0 /* 0.700V/0.300V */
/* Signal level setup */
#define SIG_SETUP(x) (x)
/* sync characteristics */
#define SEP_SYNC(x) (x & 0x08)
#define COMP_SYNC(x) (x & 0x04)
#define SYNC_O_GREEN(x) (x & 0x02)
#define SYNC_SERR(x) (x & 0x01)
/* DPMS features */
#define DPMS_STANDBY(x) (x & 0x04)
#define DPMS_SUSPEND(x) (x & 0x02)
#define DPMS_OFF(x) (x & 0x01)
/* display type */
#define DISP_MONO 0
#define DISP_RGB 1
#define DISP_MULTCOLOR 2
/* Msc stuff EDID Ver > 1.1 */
#define STD_COLOR_SPACE(x) (x & 0x4)
#define PREFERRED_TIMING_MODE(x) (x & 0x2)
#define GFT_SUPPORTED(x) (x & 0x1)
/* detailed timing misc */
#define IS_INTERLACED(x) (x)
#define IS_STEREO(x) (x)
#define IS_RIGHT_STEREO(x) (x & 0x01)
#define IS_LEFT_STEREO(x) (x & 0x02)
#define IS_4WAY_STEREO(x) (x & 0x03)
#define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x)
#define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x)
typedef unsigned int Uint;
typedef unsigned char Uchar;
struct vendor {
char name[4];
int prod_id;
int week;
int year;
};
struct edid_version {
int version;
int revision;
};
struct disp_features {
unsigned int input_type:1;
unsigned int input_voltage:2;
unsigned int input_setup:1;
unsigned int input_sync:5;
unsigned int input_dfp:1;
int hsize;
int vsize;
float gamma;
unsigned int dpms:3;
unsigned int display_type:2;
unsigned int msc:3;
float redx;
float redy;
float greenx;
float greeny;
float bluex;
float bluey;
float whitex;
float whitey;
};
struct established_timings {
};
struct std_timings {
int hsize;
int vsize;
int refresh;
};
struct detailed_timings {
int clock;
int h_active;
int h_blanking;
int v_active;
int v_blanking;
int h_sync_off;
int h_sync_width;
int v_sync_off;
int v_sync_width;
int h_size;
int v_size;
int h_border;
int v_border;
unsigned int interlaced:1;
unsigned int stereo:2;
unsigned int sync:2;
unsigned int misc:2;
unsigned int stereo_1:1;
};
#define DT 0
#define DS_SERIAL 0xFF
#define DS_ASCII_STR 0xFE
#define DS_NAME 0xFC
#define DS_RANGES 0xFD
#define DS_WHITE_P 0xFB
#define DS_STD_TIMINGS 0xFA
#define DS_DUMMY 0x10
struct monitor_ranges {
int min_v;
int max_v;
int min_h;
int max_h;
int max_clock;
int gtf_2nd_f;
int gtf_2nd_c;
int gtf_2nd_m;
int gtf_2nd_k;
int gtf_2nd_j;
};
struct whitePoints{
int index;
float white_x;
float white_y;
float white_gamma;
};
struct detailed_monitor_section {
int type;
union {
struct detailed_timings d_timings;
struct monitor_ranges ranges;
} section;
};
typedef struct {
int scrnIndex;
struct edid_version ver;
struct disp_features features;
struct established_timings timings1;
int no_sections;
} xf86Monitor, *xf86MonPtr;
extern xf86MonPtr ConfiguredMonitor;
#endif /* _EDID_H_ */