This is an automatic generated email to let you know that the following patch were queued:
Subject: edid-decode: add support for NVRDB Author: Hans Verkuil <hverkuil-ci...@xs4all.nl> Date: Thu Sep 16 11:47:56 2021 +0200 Support the Native Video Resolution Data Block as per CTA-861.6. Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl> edid-decode.h | 4 ++++ parse-cta-block.cpp | 35 +++++++++++++++++++++++++++++++++++ parse-displayid-block.cpp | 6 ++++++ 3 files changed, 45 insertions(+) --- diff --git a/edid-decode.h b/edid-decode.h index 41f8e6377042..932769441fa7 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -156,6 +156,7 @@ struct edid_state { cta.has_hdmi = cta.has_vcdb = cta.has_vfpdb = false; cta.previous_cta_tag = 0xfff; cta.have_hf_vsdb = cta.have_hf_scdb = false; + cta.image_width = cta.image_height = 0; cta.block_number = 0; cta.first_svd = true; cta.supported_hdmi_vic_codes = cta.supported_hdmi_vic_vsb_codes = 0; @@ -256,6 +257,8 @@ struct edid_state { std::vector<unsigned> found_tags; timings_ext t8vtdb; vec_timings_ext native_timings; + // in 0.1 mm units + unsigned image_width, image_height; bool has_vic_1; bool first_svd_might_be_preferred; unsigned char byte3; @@ -355,6 +358,7 @@ struct edid_state { void cta_y420cmdb(const unsigned char *x, unsigned length); void cta_print_svr(unsigned char svr, vec_timings_ext &vec_tim); void cta_vfpdb(const unsigned char *x, unsigned length); + void cta_nvrdb(const unsigned char *x, unsigned length); void cta_rcdb(const unsigned char *x, unsigned length); void cta_sldb(const unsigned char *x, unsigned length); void cta_preparse_sldb(const unsigned char *x, unsigned length); diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp index aafed1b495d5..6c21e8d50f79 100644 --- a/parse-cta-block.cpp +++ b/parse-cta-block.cpp @@ -628,6 +628,38 @@ void edid_state::cta_vfpdb(const unsigned char *x, unsigned length) cta_print_svr(x[i], cta.preferred_timings); } +void edid_state::cta_nvrdb(const unsigned char *x, unsigned length) +{ + if (length == 0) { + fail("Empty Data Block with length %u.\n", length); + return; + } + + unsigned char flags = length == 1 ? 0 : x[1]; + + cta.native_timings.clear(); + cta_print_svr(x[0], cta.native_timings); + if ((flags & 1) && length < 6) { + fail("Data Block too short for Image Size (length = %u).\n", length); + return; + } + if (flags & 0x7e) + fail("Bits F41-F46 must be 0.\n"); + if (!(flags & 1)) + return; + + unsigned w = (x[3] << 8) | x[2]; + unsigned h = (x[5] << 8) | x[4]; + + if (!w || !h) + fail("Image Size has a zero width and/or height.\n"); + + if (flags & 0x80) + printf(" Image Size: %ux%u mm\n", w, h); + else + printf(" Image Size: %.1fx%.1f mm\n", w / 10.0, h / 10.0); +} + static std::string hdmi_latency2s(unsigned char l, bool is_video) { if (!l) @@ -2087,6 +2119,7 @@ void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_ case 0x705: data_block = "Colorimetry Data Block"; break; case 0x706: data_block = "HDR Static Metadata Data Block"; break; case 0x707: data_block = "HDR Dynamic Metadata Data Block"; break; + case 0x708: data_block = "Native Video Resolution Data Block"; break; case 0x70d: data_block = "Video Format Preference Data Block"; break; case 0x70e: data_block = "YCbCr 4:2:0 Video Data Block"; break; @@ -2145,6 +2178,7 @@ void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_ case 0x702: case 0x705: case 0x706: + case 0x708: case 0x70d: case 0x70f: case 0x712: @@ -2197,6 +2231,7 @@ void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_ case 0x705: cta_colorimetry_block(x, length); break; case 0x706: cta_hdr_static_metadata_block(x, length); break; case 0x707: cta_hdr_dyn_metadata_block(x, length); break; + case 0x708: cta_nvrdb(x, length); return; case 0x70d: cta_vfpdb(x, length); break; case 0x70e: cta_svd(x, length, true); break; case 0x70f: cta_y420cmdb(x, length); break; diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp index dbc2a60dbabe..31bdcb68a28f 100644 --- a/parse-displayid-block.cpp +++ b/parse-displayid-block.cpp @@ -2024,6 +2024,12 @@ void edid_state::check_displayid_blocks() dispid.version >= 0x20 ? "VII" : "I"); if (dispid.preferred_timings.empty()) fail("DisplayID expects at least one preferred timing.\n"); + if (cta.image_width && dispid.image_width && + (cta.image_width != dispid.image_width || + cta.image_height != dispid.image_height)) + fail("Image size mismatch: CTA-861: %.1fx%.1fmm DisplayID: %.1fx%.1fmm.\n", + cta.image_width / 10.0, cta.image_height / 10.0, + dispid.image_width / 10.0, dispid.image_height / 10.0); if (dispid.image_width && dispid.image_width < 25600 && dispid.image_height < 25600 && (abs((int)dispid.image_width - (int)base.max_display_width_mm * 10) >= 100 || abs((int)dispid.image_height - (int)base.max_display_height_mm * 10) >= 100)) _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits