edid.h revision 61cb83a8ccd1dd7f671f31fa93c9d8b7be09b4cc
/*
* 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_
#ifndef _X_EXPORT
#include <X11/Xfuncproto.h>
#endif
/* 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 _DIGITAL_INTERFACE(x) (x & 0x0F)
#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 */
/**
* Returns true if the pointer is the start of a monitor descriptor block
* instead of a detailed timing descriptor.
*
* Checking the reserved pad fields for zeroes fails on some monitors with
* broken empty ASCII strings. Only the first two bytes are reliable.
*/
#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0)
#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 _SUPPORTED_ASPECT(x) x[14]
#define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c)
#define SUPPORTED_ASPECT_4_3 0x80
#define SUPPORTED_ASPECT_16_9 0x40
#define SUPPORTED_ASPECT_16_10 0x20
#define SUPPORTED_ASPECT_5_4 0x10
#define SUPPORTED_ASPECT_15_9 0x08
#define PREFERRED_ASPECT _PREFERRED_ASPECT(c)
#define PREFERRED_ASPECT_4_3 0
#define PREFERRED_ASPECT_16_9 1
#define PREFERRED_ASPECT_16_10 2
#define PREFERRED_ASPECT_5_4 3
#define PREFERRED_ASPECT_15_9 4
#define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c)
#define CVT_STANDARD 0x01
#define CVT_REDUCED 0x02
#define SUPPORTED_SCALING _SUPPORTED_SCALING(c)
#define SCALING_HSHRINK 0x08
#define SCALING_HSTRETCH 0x04
#define SCALING_VSHRINK 0x02
#define SCALING_VSTRETCH 0x01
#define _PREFERRED_REFRESH(x) x[17]
#define PREFERRED_REFRESH _PREFERRED_REFRESH(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 COLOR_MANAGEMENT_DATA 0xF9
#define CVT_3BYTE_DATA 0xF8
#define ADD_EST_TIMINGS 0xF7
#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, analog */
#define DISP_MONO 0
#define DISP_RGB 1
#define DISP_MULTCOLOR 2
/* display color encodings, digital */
#define DISP_YCRCB444 0x01
#define DISP_YCRCB422 0x02
/* 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)
#define GTF_SUPPORTED(x) (x & 0x1)
#define CVT_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;
unsigned int input_bpc:3;
unsigned int input_interface:4;
/* 15 bit hole */
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_CMD 0xF9
#define DS_CVT 0xF8
#define DS_EST_III 0xF7
#define DS_DUMMY 0x10
#define DS_VENDOR 0x101
#define DS_VENDOR_MAX 0x110
struct monitor_ranges {
int min_v;
int max_v;
int min_h;
int max_h;
int max_clock; /* in mhz */
int gtf_2nd_f;
int gtf_2nd_c;
int gtf_2nd_m;
int gtf_2nd_k;
int gtf_2nd_j;
int max_clock_khz;
int maxwidth; /* in pixels */
char supported_aspect;
char preferred_aspect;
char supported_blanking;
char supported_scaling;
int preferred_refresh; /* in hz */
};
struct whitePoints {
int index;
float white_x;
float white_y;
float white_gamma;
};
struct cvt_timings {
int width;
int height;
int rate;
int rates;
};
/*
* Be careful when adding new sections; this structure can't grow, it's
* embedded in the middle of xf86Monitor which is ABI. Sizes below are
* in bytes, for ILP32 systems. If all else fails just copy the section
* literally like serial and friends.
*/
struct detailed_monitor_section {
int type;
union {
/* color management data */
} section; /* max: 80 */
};
/* flags */
#define MONITOR_EDID_COMPLETE_RAWDATA 0x01
/* old, don't use */
#define EDID_COMPLETE_RAWDATA 0x01
#define MONITOR_DISPLAYID 0x02
/*
* For DisplayID devices, only the scrnIndex, flags, and rawData fields
* are meaningful. For EDID, they all are.
*/
typedef struct {
int scrnIndex;
struct edid_version ver;
struct disp_features features;
struct established_timings timings1;
unsigned long flags;
int no_sections;
} xf86Monitor, *xf86MonPtr;
#define EXT_TAG 0
#define EXT_REV 1
#define CEA_EXT 0x02
#define VTB_EXT 0x10
#define DI_EXT 0x40
#define LS_EXT 0x50
#define MI_EXT 0x60
#define CEA_EXT_MIN_DATA_OFFSET 4
#define CEA_EXT_MAX_DATA_OFFSET 127
#define CEA_EXT_DET_TIMING_NUM 6
#define IEEE_ID_HDMI 0x000C03
#define CEA_AUDIO_BLK 1
#define CEA_VIDEO_BLK 2
#define CEA_VENDOR_BLK 3
#define CEA_SPEAKER_ALLOC_BLK 4
#define CEA_VESA_DTC_BLK 5
#define VENDOR_SUPPORT_AI(x) ((x) >> 7)
#define VENDOR_LATENCY_PRESENT(x) ( (x) >> 7)
#define HDMI_MAX_TMDS_UNIT (5000)
struct cea_video_block {
};
struct cea_audio_block_descriptor {
};
struct cea_audio_block {
};
struct cea_vendor_block_hdmi {
};
struct cea_vendor_block {
unsigned char ieee_id[3];
union {
struct cea_vendor_block_hdmi hdmi;
/* any other vendor blocks we know about */
} dummy;
};
struct cea_speaker_block {
};
struct cea_data_block {
union {
struct cea_video_block video;
struct cea_audio_block audio;
struct cea_vendor_block vendor;
struct cea_speaker_block speaker;
} u;
};
struct cea_ext_body {
struct cea_data_block data_collection;
};
#endif /* _EDID_H_ */