diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-01-28 10:36:30 +0100 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-01-28 10:36:30 +0100 |
commit | 526a72d9e1f60dab364d1a2179ea1933eee1f463 (patch) | |
tree | 602e279d999f662bf046995382d6cd95c8db52af | |
parent | 770cfb947ea9d9eb5cda57a87dc66d13c60cfefc (diff) |
edid-decode: improve DisplayID native format handling
The DisplayID 1.3 reporting of the native format was off by 1.
Also check if the resolution is either all 0 (no native format
specified) or all non-0.
Finally check for consistency with the reported native resolution
by the CTA block.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r-- | edid-decode.h | 2 | ||||
-rw-r--r-- | parse-cta-block.cpp | 7 | ||||
-rw-r--r-- | parse-displayid-block.cpp | 22 |
3 files changed, 27 insertions, 4 deletions
diff --git a/edid-decode.h b/edid-decode.h index e24c300..51c6173 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -138,6 +138,7 @@ struct edid_state { // DisplayID block state dispid.version = 0; + dispid.native_width = dispid.native_height = 0; dispid.preparsed_color_ids = dispid.preparsed_xfer_ids = 0; dispid.preparsed_displayid_blocks = 0; dispid.is_base_block = true; @@ -246,6 +247,7 @@ struct edid_state { bool has_type_1_7; bool has_display_interface_features; vec_timings_ext preferred_timings; + unsigned native_width, native_height; // Keep track of the found CTA-861 Tag/Extended Tag pairs. // The unsigned value is equal to: (tag << 8) | ext_tag std::set<unsigned> found_tags; diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp index 8f759eb..aa19553 100644 --- a/parse-cta-block.cpp +++ b/parse-cta-block.cpp @@ -2438,4 +2438,11 @@ void edid_state::check_cta_blocks() warn("Native interlaced resolution of %ux%u is smaller than the max preferred interlaced resolution %ux%u.\n", native_ilace_hact, native_ilace_vact, max_pref_ilace_hact, max_pref_ilace_vact); + + if (dispid.native_width && native_prog_hact && + !native_prog_mixed_resolutions) { + if (dispid.native_width != native_prog_hact || + dispid.native_height != native_prog_vact) + fail("Mismatch between CTA-861 and DisplayID native progressive resolution.\n"); + } } diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp index 36985e2..ca3e73d 100644 --- a/parse-displayid-block.cpp +++ b/parse-displayid-block.cpp @@ -590,8 +590,15 @@ void edid_state::parse_displayid_display_device(const unsigned char *x) printf(" The backlight may be switched on and off\n"); if (x[4] & 0x04) printf(" The backlight's intensity can be controlled\n"); - printf(" Display native pixel format: %ux%u\n", - x[5] | (x[6] << 8), x[7] | (x[8] << 8)); + unsigned w = x[5] | (x[6] << 8); + unsigned h = x[7] | (x[8] << 8); + if (w && h) { + printf(" Display native pixel format: %ux%u\n", w + 1, h + 1); + dispid.native_width = w + 1; + dispid.native_height = h + 1; + } else if (w || h) { + fail("Invalid Native Pixel Format %ux%u.\n", w, h); + } printf(" Aspect ratio and orientation:\n"); printf(" Aspect Ratio: %.2f\n", (100 + x[9]) / 100.0); unsigned char v = x[0x0a]; @@ -1114,8 +1121,15 @@ void edid_state::parse_displayid_parameters_v2(const unsigned char *x, else printf(" Image size: %.1f mm x %.1f mm\n", hor_size / 10.0, vert_size / 10.0); - printf(" Pixels: %d x %d\n", - (x[8] << 8) + x[7], (x[10] << 8) + x[9]); + unsigned w = (x[8] << 8) + x[7]; + unsigned h = (x[10] << 8) + x[9]; + if (w && h) { + printf(" Native Format: %ux%u\n", w, h); + dispid.native_width = w; + dispid.native_height = h; + } else if (w || h) { + fail("Invalid Native Format %ux%u.\n", w, h); + } unsigned char v = x[11]; printf(" Scan Orientation: "); switch (v & 0x07) { |