summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-08-31 13:41:02 +0200
committerAdam Jackson <ajax@redhat.com>2017-09-07 12:13:30 -0400
commitca252201ddfbf7ed99d54759b5b6a0e6274d87c7 (patch)
treef36bf2e64bfdf541475c4a00b94f24ae91fd16aa
parent4e3780670a33a7394f59c54fe2fa7bce7db914b9 (diff)
edid-decode: add support for the "More standard timings" block
Support display descriptor tag 0xFA which reports more standard timings. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--edid-decode.c88
1 files changed, 46 insertions, 42 deletions
diff --git a/edid-decode.c b/edid-decode.c
index 5a162b1..3ea3cb7 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -227,6 +227,47 @@ detailed_cvt_descriptor(unsigned char *x, int first)
return valid;
}
+static void print_standard_timing(uint8_t b1, uint8_t b2)
+{
+ const char *ratio;
+ unsigned int x, y, refresh;
+
+ if (b1 == 0x01 && b2 == 0x01)
+ return;
+
+ if (b1 == 0) {
+ printf("non-conformant standard timing (0 horiz)\n");
+ return;
+ }
+ x = (b1 + 31) * 8;
+ switch ((b2 >> 6) & 0x3) {
+ case 0x00:
+ if (claims_one_point_three) {
+ y = x * 10 / 16;
+ ratio = "16:10";
+ } else {
+ y = x;
+ ratio = "1:1";
+ }
+ break;
+ case 0x01:
+ y = x * 3 / 4;
+ ratio = "4:3";
+ break;
+ case 0x02:
+ y = x * 4 / 5;
+ ratio = "5:4";
+ break;
+ case 0x03:
+ y = x * 9 / 16;
+ ratio = "16:9";
+ break;
+ }
+ refresh = 60 + (b2 & 0x3f);
+
+ printf(" %dx%d@%dHz %s\n", x, y, refresh, ratio);
+}
+
/* extract a string from a detailed subblock, checking for termination */
static char *
extract_string(unsigned char *x, int *valid_termination, int len)
@@ -329,8 +370,9 @@ detailed_block(unsigned char *x, int in_extension)
printf("Color management data\n");
return 1;
case 0xFA:
- /* TODO */
- printf("More standard timings\n");
+ printf("More standard timings:\n");
+ for (i = 0; i < 6; i++)
+ print_standard_timing(x[5 + i * 2], x[5 + i * 2 + 1]);
return 1;
case 0xFB:
/* TODO */
@@ -2100,46 +2142,8 @@ int main(int argc, char **argv)
has_640x480p60_est_timing = edid[0x23] & 0x20;
printf("Standard timings supported:\n");
- for (i = 0; i < 8; i++) {
- const char *ratio;
- uint8_t b1 = edid[0x26 + i * 2], b2 = edid[0x26 + i * 2 + 1];
- unsigned int x, y, refresh;
-
- if (b1 == 0x01 && b2 == 0x01)
- continue;
-
- if (b1 == 0) {
- printf("non-conformant standard timing (0 horiz)\n");
- continue;
- }
- x = (b1 + 31) * 8;
- switch ((b2 >> 6) & 0x3) {
- case 0x00:
- if (claims_one_point_three) {
- y = x * 10 / 16;
- ratio = "16:10";
- } else {
- y = x;
- ratio = "1:1";
- }
- break;
- case 0x01:
- y = x * 3 / 4;
- ratio = "4:3";
- break;
- case 0x02:
- y = x * 4 / 5;
- ratio = "5:4";
- break;
- case 0x03:
- y = x * 9 / 16;
- ratio = "16:9";
- break;
- }
- refresh = 60 + (b2 & 0x3f);
-
- printf(" %dx%d@%dHz %s\n", x, y, refresh, ratio);
- }
+ for (i = 0; i < 8; i++)
+ print_standard_timing(edid[0x26 + i * 2], edid[0x26 + i * 2 + 1]);
/* detailed timings */
has_valid_detailed_blocks = detailed_block(edid + 0x36, 0);