[PATCH 13/27] edid-decode: add horizontal freq and pixelclock
Hans Verkuil
hverkuil at xs4all.nl
Thu Aug 31 11:41:06 UTC 2017
From: Hans Verkuil <hans.verkuil at cisco.com>
Add the horizontal frequency and pixelclock information to the
established timings and VIC codes.
Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
---
edid-decode.c | 381 +++++++++++++++++++++++++++++++---------------------------
1 file changed, 201 insertions(+), 180 deletions(-)
diff --git a/edid-decode.c b/edid-decode.c
index 25b8ed81..a7875a6b 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -301,58 +301,59 @@ extract_string(unsigned char *x, int *valid_termination, int len)
}
static const struct {
- int x, y, refresh, ratio_w, ratio_h, rb;
+ int x, y, refresh, ratio_w, ratio_h;
+ int hor_freq_hz, pixclk_khz, rb;
} established_timings3[] = {
/* 0x06 bit 7 - 0 */
- {640, 350, 85, 64, 35},
- {640, 400, 85, 16, 10},
- {720, 400, 85, 9, 5},
- {640, 480, 85, 4, 3},
- {848, 480, 60, 53, 30},
- {800, 600, 85, 4, 3},
- {1024, 768, 85, 4, 3},
- {1152, 864, 75, 4, 3},
+ {640, 350, 85, 64, 35, 37900, 31500},
+ {640, 400, 85, 16, 10, 37900, 31500},
+ {720, 400, 85, 9, 5, 37900, 35500},
+ {640, 480, 85, 4, 3, 43300, 36000},
+ {848, 480, 60, 53, 30, 31000, 33750},
+ {800, 600, 85, 4, 3, 53700, 56250},
+ {1024, 768, 85, 4, 3, 68700, 94500},
+ {1152, 864, 75, 4, 3, 67500, 108000},
/* 0x07 bit 7 - 0 */
- {1280, 768, 60, 5, 3, 1},
- {1280, 768, 60, 5, 3},
- {1280, 768, 75, 5, 3},
- {1280, 768, 85, 5, 3},
- {1280, 960, 60, 4, 3},
- {1280, 960, 85, 4, 3},
- {1280, 1024, 60, 5, 4},
- {1280, 1024, 85, 5, 4},
+ {1280, 768, 60, 5, 3, 47400, 68250, 1},
+ {1280, 768, 60, 5, 3, 47800, 79500},
+ {1280, 768, 75, 5, 3, 60300, 102250},
+ {1280, 768, 85, 5, 3, 68600, 117500},
+ {1280, 960, 60, 4, 3, 60000, 108000},
+ {1280, 960, 85, 4, 3, 85900, 148500},
+ {1280, 1024, 60, 5, 4, 64000, 108000},
+ {1280, 1024, 85, 5, 4, 91100, 157500},
/* 0x08 bit 7 - 0 */
- {1360, 768, 60, 85, 48},
- {1440, 900, 60, 16, 10, 1},
- {1440, 900, 60, 16, 10},
- {1440, 900, 75, 16, 10},
- {1440, 900, 85, 16, 10},
- {1400, 1050, 60, 4, 3, 1},
- {1400, 1050, 60, 4, 3},
- {1400, 1050, 75, 4, 3},
+ {1360, 768, 60, 85, 48, 47700, 85500},
+ {1440, 900, 60, 16, 10, 55500, 88750, 1},
+ {1440, 900, 60, 16, 10, 65300, 121750},
+ {1440, 900, 75, 16, 10, 82300, 156000},
+ {1440, 900, 85, 16, 10, 93900, 179500},
+ {1400, 1050, 60, 4, 3, 64700, 101000, 1},
+ {1400, 1050, 60, 4, 3, 65300, 121750},
+ {1400, 1050, 75, 4, 3, 82300, 156000},
/* 0x09 bit 7 - 0 */
- {1400, 1050, 85, 4, 3},
- {1680, 1050, 60, 16, 10, 1},
- {1680, 1050, 60, 16, 10},
- {1680, 1050, 75, 16, 10},
- {1680, 1050, 85, 16, 10},
- {1600, 1200, 60, 4, 3},
- {1600, 1200, 65, 4, 3},
- {1600, 1200, 70, 4, 3},
+ {1400, 1050, 85, 4, 3, 93900, 179500},
+ {1680, 1050, 60, 16, 10, 64700, 119000, 1},
+ {1680, 1050, 60, 16, 10, 65300, 146250},
+ {1680, 1050, 75, 16, 10, 82300, 187000},
+ {1680, 1050, 85, 16, 10, 93900, 214750},
+ {1600, 1200, 60, 4, 3, 75000, 162000},
+ {1600, 1200, 65, 4, 3, 81300, 175500},
+ {1600, 1200, 70, 4, 3, 87500, 189000},
/* 0x0a bit 7 - 0 */
- {1600, 1200, 75, 4, 3},
- {1600, 1200, 85, 4, 3},
- {1792, 1344, 60, 4, 3},
- {1792, 1344, 75, 4, 3},
- {1856, 1392, 60, 4, 3},
- {1856, 1392, 75, 4, 3},
- {1920, 1200, 60, 16, 10, 1},
- {1920, 1200, 60, 16, 10},
+ {1600, 1200, 75, 4, 3, 93800, 202500},
+ {1600, 1200, 85, 4, 3, 106300, 229500},
+ {1792, 1344, 60, 4, 3, 83600, 204750},
+ {1792, 1344, 75, 4, 3, 106300, 261000},
+ {1856, 1392, 60, 4, 3, 86300, 218250},
+ {1856, 1392, 75, 4, 3, 112500, 288000},
+ {1920, 1200, 60, 16, 10, 74000, 154000, 1},
+ {1920, 1200, 60, 16, 10, 74600, 193250},
/* 0x0b bit 7 - 4 */
- {1920, 1200, 75, 16, 10},
- {1920, 1200, 85, 16, 10},
- {1920, 1440, 60, 4, 3},
- {1920, 1440, 75, 4, 3},
+ {1920, 1200, 75, 16, 10, 94000, 245250},
+ {1920, 1200, 85, 16, 10, 107200, 281250},
+ {1920, 1440, 60, 4, 3, 90000, 234000},
+ {1920, 1440, 75, 4, 3, 112500, 297000},
};
/* 1 means valid data */
@@ -804,114 +805,128 @@ cea_audio_block(unsigned char *x)
}
}
-static const char *edid_cea_modes[] = {
- "640x480 at 60Hz 4:3",
- "720x480 at 60Hz 4:3",
- "720x480 at 60Hz 16:9",
- "1280x720 at 60Hz 16:9",
- "1920x1080i at 60Hz 16:9",
- "1440x480i at 60Hz 4:3",
- "1440x480i at 60Hz 16:9",
- "1440x240 at 60Hz 4:3",
- "1440x240 at 60Hz 16:9",
- "2880x480i at 60Hz 4:3",
- "2880x480i at 60Hz 16:9",
- "2880x240 at 60Hz 4:3",
- "2880x240 at 60Hz 16:9",
- "1440x480 at 60Hz 4:3",
- "1440x480 at 60Hz 16:9",
- "1920x1080 at 60Hz 16:9",
- "720x576 at 50Hz 4:3",
- "720x576 at 50Hz 16:9",
- "1280x720 at 50Hz 16:9",
- "1920x1080i at 50Hz 16:9",
- "1440x576i at 50Hz 4:3",
- "1440x576i at 50Hz 16:9",
- "1440x288 at 50Hz 4:3",
- "1440x288 at 50Hz 16:9",
- "2880x576i at 50Hz 4:3",
- "2880x576i at 50Hz 16:9",
- "2880x288 at 50Hz 4:3",
- "2880x288 at 50Hz 16:9",
- "1440x576 at 50Hz 4:3",
- "1440x576 at 50Hz 16:9",
- "1920x1080 at 50Hz 16:9",
- "1920x1080 at 24Hz 16:9",
- "1920x1080 at 25Hz 16:9",
- "1920x1080 at 30Hz 16:9",
- "2880x480 at 60Hz 4:3",
- "2880x480 at 60Hz 16:9",
- "2880x576 at 50Hz 4:3",
- "2880x576 at 50Hz 16:9",
- "1920x1080i at 50Hz 16:9",
- "1920x1080i at 100Hz 16:9",
- "1280x720 at 100Hz 16:9",
- "720x576 at 100Hz 4:3",
- "720x576 at 100Hz 16:9",
- "1440x576 at 100Hz 4:3",
- "1440x576 at 100Hz 16:9",
- "1920x1080i at 120Hz 16:9",
- "1280x720 at 120Hz 16:9",
- "720x480 at 120Hz 4:3",
- "720x480 at 120Hz 16:9",
- "1440x480i at 120Hz 4:3",
- "1440x480i at 120Hz 16:9",
- "720x576 at 200Hz 4:3",
- "720x576 at 200Hz 16:9",
- "1440x576i at 200Hz 4:3",
- "1440x576i at 200Hz 16:9",
- "720x480 at 240Hz 4:3",
- "720x480 at 240Hz 16:9",
- "1440x480i at 240Hz 4:3",
- "1440x480i at 240Hz 16:9",
- "1280x720 at 24Hz 16:9",
- "1280x720 at 25Hz 16:9",
- "1280x720 at 30Hz 16:9",
- "1920x1080 at 120Hz 16:9",
- "1920x1080 at 100Hz 16:9",
- "1280x720 at 24Hz 64:27",
- "1280x720 at 25Hz 64:27",
- "1280x720 at 30Hz 64:27",
- "1280x720 at 50Hz 64:27",
- "1280x720 at 60Hz 64:27",
- "1280x720 at 100Hz 64:27",
- "1280x720 at 120Hz 64:27",
- "1920x1080 at 24Hz 64:27",
- "1920x1080 at 25Hz 64:27",
- "1920x1080 at 30Hz 64:27",
- "1920x1080 at 50Hz 64:27",
- "1920x1080 at 60Hz 64:27",
- "1920x1080 at 100Hz 64:27",
- "1920x1080 at 120Hz 64:27",
- "1680x720 at 24Hz 64:27",
- "1680x720 at 25Hz 64:27",
- "1680x720 at 30Hz 64:27",
- "1680x720 at 50Hz 64:27",
- "1680x720 at 60Hz 64:27",
- "1680x720 at 100Hz 64:27",
- "1680x720 at 120Hz 64:27",
- "2560x1080 at 24Hz 64:27",
- "2560x1080 at 25Hz 64:27",
- "2560x1080 at 30Hz 64:27",
- "2560x1080 at 50Hz 64:27",
- "2560x1080 at 60Hz 64:27",
- "2560x1080 at 100Hz 64:27",
- "2560x1080 at 120Hz 64:27",
- "3840x2160 at 24Hz 16:9",
- "3840x2160 at 25Hz 16:9",
- "3840x2160 at 30Hz 16:9",
- "3840x2160 at 50Hz 16:9",
- "3840x2160 at 60Hz 16:9",
- "4096x2160 at 24Hz 256:135",
- "4096x2160 at 25Hz 256:135",
- "4096x2160 at 30Hz 256:135",
- "4096x2160 at 50Hz 256:135",
- "4096x2160 at 60Hz 256:135",
- "3840x2160 at 24Hz 64:27",
- "3840x2160 at 25Hz 64:27",
- "3840x2160 at 30Hz 64:27",
- "3840x2160 at 50Hz 64:27",
- "3840x2160 at 60Hz 64:27",
+static struct {
+ const char *name;
+ int hor_freq_hz, pixclk_khz;
+} edid_cea_modes[] = {
+ /* VIC 1 */
+ {"640x480 at 60Hz 4:3", 31469, 25175},
+ {"720x480 at 60Hz 4:3", 31469, 27000},
+ {"720x480 at 60Hz 16:9", 31469, 27000},
+ {"1280x720 at 60Hz 16:9", 45000, 74250},
+ {"1920x1080i at 60Hz 16:9", 33750, 74250},
+ {"1440x480i at 60Hz 4:3", 15734, 27000},
+ {"1440x480i at 60Hz 16:9", 15734, 27000},
+ {"1440x240 at 60Hz 4:3", 15734, 27000},
+ {"1440x240 at 60Hz 16:9", 15734, 27000},
+ {"2880x480i at 60Hz 4:3", 15734, 54000},
+ /* VIC 11 */
+ {"2880x480i at 60Hz 16:9", 15734, 54000},
+ {"2880x240 at 60Hz 4:3", 15734, 54000},
+ {"2880x240 at 60Hz 16:9", 15734, 54000},
+ {"1440x480 at 60Hz 4:3", 31469, 54000},
+ {"1440x480 at 60Hz 16:9", 31469, 54000},
+ {"1920x1080 at 60Hz 16:9", 67500, 148500},
+ {"720x576 at 50Hz 4:3", 31250, 27000},
+ {"720x576 at 50Hz 16:9", 31250, 27000},
+ {"1280x720 at 50Hz 16:9", 37500, 74250},
+ {"1920x1080i at 50Hz 16:9", 28125, 74250},
+ /* VIC 21 */
+ {"1440x576i at 50Hz 4:3", 15625, 27000},
+ {"1440x576i at 50Hz 16:9", 15625, 27000},
+ {"1440x288 at 50Hz 4:3", 15625, 27000},
+ {"1440x288 at 50Hz 16:9", 15625, 27000},
+ {"2880x576i at 50Hz 4:3", 15625, 54000},
+ {"2880x576i at 50Hz 16:9", 15625, 54000},
+ {"2880x288 at 50Hz 4:3", 15625, 54000},
+ {"2880x288 at 50Hz 16:9", 15625, 54000},
+ {"1440x576 at 50Hz 4:3", 31250, 54000},
+ {"1440x576 at 50Hz 16:9", 31250, 54000},
+ /* VIC 31 */
+ {"1920x1080 at 50Hz 16:9", 56250, 148500},
+ {"1920x1080 at 24Hz 16:9", 27000, 74250},
+ {"1920x1080 at 25Hz 16:9", 28125, 74250},
+ {"1920x1080 at 30Hz 16:9", 33750, 74250},
+ {"2880x480 at 60Hz 4:3", 31469, 108000},
+ {"2880x480 at 60Hz 16:9", 31469, 108000},
+ {"2880x576 at 50Hz 4:3", 31250, 108000},
+ {"2880x576 at 50Hz 16:9", 31250, 108000},
+ {"1920x1080i at 50Hz 16:9", 31250, 72000},
+ {"1920x1080i at 100Hz 16:9", 56250, 148500},
+ /* VIC 41 */
+ {"1280x720 at 100Hz 16:9", 75000, 148500},
+ {"720x576 at 100Hz 4:3", 62500, 54000},
+ {"720x576 at 100Hz 16:9", 62500, 54000},
+ {"1440x576 at 100Hz 4:3", 31250, 54000},
+ {"1440x576 at 100Hz 16:9", 31250, 54000},
+ {"1920x1080i at 120Hz 16:9", 67500, 148500},
+ {"1280x720 at 120Hz 16:9", 90000, 148500},
+ {"720x480 at 120Hz 4:3", 62937, 54000},
+ {"720x480 at 120Hz 16:9", 62937, 54000},
+ {"1440x480i at 120Hz 4:3", 31469, 54000},
+ /* VIC 51 */
+ {"1440x480i at 120Hz 16:9", 31469, 54000},
+ {"720x576 at 200Hz 4:3", 125000, 108000},
+ {"720x576 at 200Hz 16:9", 125000, 108000},
+ {"1440x576i at 200Hz 4:3", 62500, 108000},
+ {"1440x576i at 200Hz 16:9", 62500, 108000},
+ {"720x480 at 240Hz 4:3", 125874, 108000},
+ {"720x480 at 240Hz 16:9", 125874, 108000},
+ {"1440x480i at 240Hz 4:3", 62937, 108000},
+ {"1440x480i at 240Hz 16:9", 62937, 108000},
+ {"1280x720 at 24Hz 16:9", 18000, 59400},
+ /* VIC 61 */
+ {"1280x720 at 25Hz 16:9", 18750, 74250},
+ {"1280x720 at 30Hz 16:9", 22500, 74250},
+ {"1920x1080 at 120Hz 16:9", 135000, 297000},
+ {"1920x1080 at 100Hz 16:9", 112500, 297000},
+ {"1280x720 at 24Hz 64:27", 18000, 59400},
+ {"1280x720 at 25Hz 64:27", 18750, 74250},
+ {"1280x720 at 30Hz 64:27", 22500, 74250},
+ {"1280x720 at 50Hz 64:27", 37500, 74250},
+ {"1280x720 at 60Hz 64:27", 45000, 74250},
+ {"1280x720 at 100Hz 64:27", 75000, 148500},
+ /* VIC 71 */
+ {"1280x720 at 120Hz 64:27", 91000, 148500},
+ {"1920x1080 at 24Hz 64:27", 27000, 74250},
+ {"1920x1080 at 25Hz 64:27", 28125, 74250},
+ {"1920x1080 at 30Hz 64:27", 33750, 74250},
+ {"1920x1080 at 50Hz 64:27", 56250, 148500},
+ {"1920x1080 at 60Hz 64:27", 67500, 148500},
+ {"1920x1080 at 100Hz 64:27", 112500, 297000},
+ {"1920x1080 at 120Hz 64:27", 135000, 297000},
+ {"1680x720 at 24Hz 64:27", 18000, 59400},
+ {"1680x720 at 25Hz 64:27", 18750, 59400},
+ /* VIC 81 */
+ {"1680x720 at 30Hz 64:27", 22500, 59400},
+ {"1680x720 at 50Hz 64:27", 37500, 82500},
+ {"1680x720 at 60Hz 64:27", 45000, 99000},
+ {"1680x720 at 100Hz 64:27", 82500, 165000},
+ {"1680x720 at 120Hz 64:27", 99000, 198000},
+ {"2560x1080 at 24Hz 64:27", 26400, 99000},
+ {"2560x1080 at 25Hz 64:27", 28125, 90000},
+ {"2560x1080 at 30Hz 64:27", 33750, 118800},
+ {"2560x1080 at 50Hz 64:27", 56250, 185625},
+ {"2560x1080 at 60Hz 64:27", 66000, 198000},
+ /* VIC 91 */
+ {"2560x1080 at 100Hz 64:27", 125000, 371250},
+ {"2560x1080 at 120Hz 64:27", 150000, 495000},
+ {"3840x2160 at 24Hz 16:9", 54000, 297000},
+ {"3840x2160 at 25Hz 16:9", 56250, 297000},
+ {"3840x2160 at 30Hz 16:9", 67500, 297000},
+ {"3840x2160 at 50Hz 16:9", 112500, 594000},
+ {"3840x2160 at 60Hz 16:9", 135000, 594000},
+ {"4096x2160 at 24Hz 256:135", 54000, 297000},
+ {"4096x2160 at 25Hz 256:135", 56250, 297000},
+ {"4096x2160 at 30Hz 256:135", 67500, 297000},
+ /* VIC 101 */
+ {"4096x2160 at 50Hz 256:135", 112500, 594000},
+ {"4096x2160 at 60Hz 256:135", 135000, 594000},
+ {"3840x2160 at 24Hz 64:27", 54000, 297000},
+ {"3840x2160 at 25Hz 64:27", 56250, 297000},
+ {"3840x2160 at 30Hz 64:27", 67500, 297000},
+ {"3840x2160 at 50Hz 64:27", 112500, 594000},
+ {"3840x2160 at 60Hz 64:27", 135000, 594000},
};
static void
@@ -937,7 +952,7 @@ cea_svd(unsigned char *x, int n)
}
if (vic > 0 && vic <= ARRAY_SIZE(edid_cea_modes))
- mode = edid_cea_modes[vic - 1];
+ mode = edid_cea_modes[vic - 1].name;
else
mode = "Unknown mode";
@@ -981,7 +996,7 @@ cea_vfpdb(unsigned char *x)
index = vic - 1;
if (index < ARRAY_SIZE(edid_cea_modes))
- mode = edid_cea_modes[vic];
+ mode = edid_cea_modes[vic].name;
else
mode = "Unknown mode";
@@ -993,11 +1008,14 @@ cea_vfpdb(unsigned char *x)
}
}
-static const char *edid_cea_hdmi_modes[] = {
- "3840x2160 at 30Hz 16:9",
- "3840x2160 at 25Hz 16:9",
- "3840x2160 at 24Hz 16:9",
- "4096x2160 at 24Hz 256:135",
+static struct {
+ const char *name;
+ int hor_freq_hz, pixclk_khz;
+} edid_cea_hdmi_modes[] = {
+ {"3840x2160 at 30Hz 16:9", 67500, 297000},
+ {"3840x2160 at 25Hz 16:9", 56250, 297000},
+ {"3840x2160 at 24Hz 16:9", 54000, 297000},
+ {"4096x2160 at 24Hz 256:135", 54000, 297000},
};
static void
@@ -1084,7 +1102,7 @@ cea_hdmi_block(unsigned char *x)
vic--;
if (vic < ARRAY_SIZE(edid_cea_hdmi_modes))
- mode = edid_cea_hdmi_modes[vic];
+ mode = edid_cea_hdmi_modes[vic].name;
else
mode = "Unknown mode";
@@ -1917,27 +1935,28 @@ extract_edid(int fd)
static const struct {
int x, y, refresh, ratio_w, ratio_h;
+ int hor_freq_hz, pixclk_khz, interlaced;
} established_timings[] = {
/* 0x23 bit 7 - 0 */
- {720, 400, 70, 9, 5},
- {720, 400, 88, 9, 5},
- {640, 480, 60, 4, 3},
- {640, 480, 67, 4, 3},
- {640, 480, 72, 4, 3},
- {640, 480, 75, 4, 3},
- {800, 600, 56, 4, 3},
- {800, 600, 60, 4, 3},
+ {720, 400, 70, 9, 5, 31469, 28320},
+ {720, 400, 88, 9, 5, 39500, 35500},
+ {640, 480, 60, 4, 3, 31469, 25175},
+ {640, 480, 67, 4, 3, 35000, 30240},
+ {640, 480, 72, 4, 3, 37900, 31500},
+ {640, 480, 75, 4, 3, 37500, 31500},
+ {800, 600, 56, 4, 3, 35200, 36000},
+ {800, 600, 60, 4, 3, 37900, 40000},
/* 0x24 bit 7 - 0 */
- {800, 600, 72, 4, 3},
- {800, 600, 75, 4, 3},
- {832, 624, 75, 4, 3},
- {1280, 768, 87, 5, 3},
- {1024, 768, 60, 4, 3},
- {1024, 768, 70, 4, 3},
- {1024, 768, 75, 4, 3},
- {1280, 1024, 75, 5, 4},
+ {800, 600, 72, 4, 3, 48100, 50000},
+ {800, 600, 75, 4, 3, 46900, 49500},
+ {832, 624, 75, 4, 3, 49726, 57284},
+ {1280, 768, 87, 5, 3, 35522, 44900, 1},
+ {1024, 768, 60, 4, 3, 48400, 65000},
+ {1024, 768, 70, 4, 3, 56500, 75000},
+ {1024, 768, 75, 4, 3, 60000, 78750},
+ {1280, 1024, 75, 5, 4, 80000, 135000},
/* 0x25 bit 7*/
- {1152, 870, 75, 192, 145},
+ {1152, 870, 75, 192, 145, 67500, 108000},
};
static void print_subsection(char *name, unsigned char *edid, int start,
@@ -2228,8 +2247,10 @@ int main(int argc, char **argv)
printf("Established timings supported:\n");
for (i = 0; i < 17; i++) {
if (edid[0x23 + i / 8] & (1 << (7 - i % 8))) {
- printf(" %dx%d@%dHz %u:%u\n", established_timings[i].x,
- established_timings[i].y, established_timings[i].refresh,
+ printf(" %dx%d%s@%dHz %u:%u\n",
+ established_timings[i].x, established_timings[i].y,
+ established_timings[i].interlaced ? "i" : "",
+ established_timings[i].refresh,
established_timings[i].ratio_w, established_timings[i].ratio_h);
}
}
--
2.14.1
More information about the xorg-devel
mailing list