EDID

From OSDev.wiki
Jump to navigation Jump to search

Extended Display IDentification is data about the monitor, which the monitor provides to the video card. EDID is the programmatical way to check if a video mode is supported. However, this procedure is rather complex. (See VBE.)

Reading EDID

The first step is, naturally, to actually get the data. This is done through the BIOS - INT 0x10, AX=4F15h, BL=01h, CX = Controller Unit, DX = EDID block, ES:DI = 128-Byte Buffer.

mov ax, 0x4f15
mov bl, 0x01
xor cx, cx
xor dx, dx
int 0x10
;AL = 0x4F if function supported
;AH = status (0 is success, 1 is fail)
;ES:DI contains the EDID

Note that this code will only run in Real Mode or Virtual 8086 Mode.

EDID Data

This page is a stub.
You can help the wiki by accurately adding more contents to it.

EDID record:

Offset (Bytes) Length Description
00h 8 Bytes Padding
08h 1 Word Manufacture ID (Big-Endian)
0Ah 1 Word EDID ID code
0Ch 1 DWord Serial Number
10h 1 Byte Manufacture Week
11h 1 Byte Manufacture Year
12h 1 Byte EDID Version
13h 1 Byte EDID Revision
14h 1 Byte Video Input Type
15h 1 Byte Max Horizontal Size (cm)
16h 1 Byte Max Vertical Size (cm)
17h 1 Byte Gama Factor
18h 1 Byte DPMS Flags
19h 10 Bytes Chroma Information
23h 1 Byte Established Timings 1
24h 1 Byte Established Timings 2
25h 1 Byte Manufacture's Reserved Timings
26h 8 Words Standard Timing Identification
36h 18 Bytes Detailed Timing Description 1
48h 18 Bytes Detailed Timing Description 2
5Ah 18 Bytes Detailed Timing Description 3
6Ch 18 Bytes Detailed Timing Description 4
7Eh 1 Byte Unused
7Fh 1 Byte Checksum (Low Byte of 16-bit sum of 00-7Eh)

Video Input Type:

Bit(s) Description
0 Separate Sync
1 Composite Sync
2 Sync on green
3-4 Unused?
5-6 Voltage Level
7 Digital Signal

DPMS Flags:

Bit(s) Description
0-2 Unused?
3 Display Type (1=RGB)
4 Unused?
5 Active Off Supported
6 Suspend Supported
7 Standby Supported

Chroma Information:

Byte Description
0 Green X'/Y' and Red X'/Y'
1 White X'/Y' and Blue X'/Y'
2 Red Y
3 Red X
4 Green Y
5 Green X
6 Blue Y
7 Blue X
8 White Y
9 White X

Detailed Timing Description:

Byte Description
0 Horizontal Frequency (kHz)
1 Vertical Frequency (Hz)
2 Horizontal Active Time
3 Horizontal Blanking Time
4 Horizontal Active Time / Horizontal Blanking Time
5 Vertical Active time
6 Vertical Blanking Time
7 Vertical Active Time / Vertical Blanking Time
8 Horizontal Sync Offset
9 Horizontal Sync Pulse-width
10 Vertical Sync Offset / Vertical Sync Pulse-width
11 Vertical/Horizontal Sync Offset / Pulse-width
12 Horizontal Image Size (mm)
13 Vertical Image Size (mm)
14 Horizontal Image Size / Vertical Image Size
15 Horizontal Border
16 Vertical Border
17 Type Of Display

Type Of Display:

Bit(s) Description
7 Interlaced
5-6 Stereo Mode (00 - No Stereo, 01 - Right Stereo Sync High, 10 - Left Stereo Sync High)
4-3 Sync Type (00 - Analog Composite, 01 - Bipolar Analog Composite, 10 - Digital Composite, 11 - Digital Separate)
2 Serrate (OR Vertical Sync Polarity IF 'Sync Type' == 11)
1 Sync Location (OR Horizontal Sync Polarity IF 'Sync Type' == 11)
0 Unused?

Get preferred resolution

void get_preferred_resolution(uint8_t *edid, int *x, int *y) {
    *x = edid[0x38] | ((int) (edid[0x3A] & 0xF0) << 4);
    *y = edid[0x3B] | ((int) (edid[0x3D] & 0xF0) << 4);
}

See Also

External Links