aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-11-21 13:15:07 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-11-21 13:15:07 +0100
commit9e5323dfc606646b2c5a179562f587c1ac14761d (patch)
treebfdefa48c87a467e81e12eb89b3406084dacf570
parent712b37c54629da9f66a439584e751ce3ce3db184 (diff)
edid-decode: improve Block Map checks
Check the EDID 1.3 requirement for a Block Map if there are more than 2 blocks. If there is a Block Map in Block 128, then the maximum number of blocks in the EDID is 255, not 256. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--edid-decode.cpp2
-rw-r--r--edid-decode.h2
-rw-r--r--parse-base-block.cpp12
3 files changed, 13 insertions, 3 deletions
diff --git a/edid-decode.cpp b/edid-decode.cpp
index bf47313..61ffe30 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -993,6 +993,8 @@ void edid_state::parse_block_map(const unsigned char *x)
block_map.saw_block_1 = true;
else if (!block_map.saw_block_1)
fail("No EDID Block Map Extension found in block 1.\n");
+ else if (block_nr == 128)
+ block_map.saw_block_128 = true;
if (block_nr > 1)
offset = 128;
diff --git a/edid-decode.h b/edid-decode.h
index 9c2044d..bb00e9b 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -133,6 +133,7 @@ struct edid_state {
// Block Map block state
block_map.saw_block_1 = false;
+ block_map.saw_block_128 = false;
}
// Global state
@@ -224,6 +225,7 @@ struct edid_state {
// Block Map block state
struct {
bool saw_block_1;
+ bool saw_block_128;
} block_map;
std::string dtd_type(unsigned dtd);
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index 8d5d722..0042a39 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -1867,7 +1867,7 @@ void edid_state::check_base_block()
* Check if it is really out of range, or if it could be a rounding error.
* The EDID spec is not very clear about rounding.
*/
- bool fail =
+ bool out_of_range =
min_vert_freq_hz + 1.0 <= base.min_display_vert_freq_hz ||
(max_vert_freq_hz >= base.max_display_vert_freq_hz + 1.0 && base.max_display_vert_freq_hz) ||
min_hor_freq_hz + 1000 <= base.min_display_hor_freq_hz ||
@@ -1899,13 +1899,19 @@ void edid_state::check_base_block()
err += buf;
}
- if (!fail)
+ if (!out_of_range)
err += " Could be due to a Monitor Range off-by-one rounding issue\n";
/*
* EDID 1.4 states (in an Errata) that explicitly defined
* timings supersede the monitor range definition.
*/
- msg(!fail || base.edid_minor >= 4, "%s", err.c_str());
+ msg(!out_of_range || base.edid_minor >= 4, "%s", err.c_str());
}
+ if (base.edid_minor == 3 && num_blocks > 2 && !block_map.saw_block_1)
+ fail("EDID 1.3 requires a Block Map Extension in Block 1 if there are more than 2 blocks in the EDID\n");
+ if (base.edid_minor == 3 && num_blocks > 128 && !block_map.saw_block_128)
+ fail("EDID 1.3 requires a Block Map Extension in Block 128 if there are more than 128 blocks in the EDID\n");
+ if (block_map.saw_block_128 && num_blocks > 255)
+ fail("If there is a Block Map Extension in Block 128 then the maximum number of blocks is 255.\n");
}

Privacy Policy