This is an automatic generated email to let you know that the following patch 
were queued:

Subject: edid-decode: issue warning if sRGB support isn't indicated
Author:  Hans Verkuil <[email protected]>
Date:    Tue Apr 5 08:58:34 2022 +0200

RGB colorimetry is ambiguous: it can be interpreted as either sRGB
(Windows and linux display drivers assume sRGB) or as using the
default RGB colorimetry as defined in the base block (Mac drivers
do this).

This is not a problem if the base colorimetry is equal to sRGB, but if
it differs, then it is recommended to indicate sRGB explicitly in the
Colorimetry Data Block. Support for this bit was added in CTA-861.6.

Signed-off-by: Hans Verkuil <[email protected]>

 edid-decode.h        |  6 +++++-
 parse-base-block.cpp |  2 ++
 parse-cta-block.cpp  | 15 ++++++++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

---

diff --git a/edid-decode.h b/edid-decode.h
index ceb39b522fef..bdc6ab67c752 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -159,6 +159,7 @@ struct edid_state {
                base.sec_gtf_start_freq = 0;
                base.C = base.M = base.K = base.J = 0;
                base.max_pos_neg_hor_freq_khz = 0;
+               base.uses_srgb = false;
                base.detailed_block_cnt = base.dtd_cnt = 0;
 
                base.min_display_hor_freq_hz = base.max_display_hor_freq_hz =
@@ -168,7 +169,7 @@ struct edid_state {
 
                // CTA-861 block state
                cta.has_vic_1 = cta.first_svd_might_be_preferred = cta.has_sldb 
=
-                       cta.has_hdmi = cta.has_vcdb = cta.has_vfpdb = false;
+                       cta.has_hdmi = cta.has_vcdb = cta.has_vfpdb = 
cta.has_cdb = false;
                cta.previous_cta_tag = 0xfff;
                cta.have_hf_vsdb = cta.have_hf_scdb = false;
                cta.image_width = cta.image_height = 0;
@@ -244,6 +245,7 @@ struct edid_state {
                double C, M, K, J;
                bool supports_cvt;
                bool has_spwg;
+               bool uses_srgb;
                unsigned detailed_block_cnt;
                unsigned dtd_cnt;
                bool seen_non_detailed_descriptor;
@@ -283,6 +285,7 @@ struct edid_state {
                bool has_hdmi;
                bool has_vcdb;
                bool has_vfpdb;
+               bool has_cdb;
                unsigned preparsed_speaker_count;
                bool preparsed_sld_has_coord;
                bool preparsed_sld;
@@ -385,6 +388,7 @@ struct edid_state {
        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);
+       void cta_colorimetry_block(const unsigned char *x, unsigned length);
        void cta_hdmi_block(const unsigned char *x, unsigned length);
        void cta_displayid_type_7(const unsigned char *x, unsigned length);
        void cta_displayid_type_8(const unsigned char *x, unsigned length);
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index aec665586a5b..f65cd9c21342 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -1497,8 +1497,10 @@ void edid_state::parse_base_block(const unsigned char *x)
                        fail("sRGB is signaled, but the chromaticities do not 
match.\n");
                if (x[0x17] != 120)
                        warn("sRGB is signaled, but the gamma != 2.2.\n");
+               base.uses_srgb = true;
        } else if (!memcmp(x + 0x19, srgb_chromaticity, 
sizeof(srgb_chromaticity))) {
                fail("The chromaticities match sRGB, but sRGB is not 
signaled.\n");
+               base.uses_srgb = true;
        }
 
        if (base.edid_minor >= 4) {
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index eff316f594a0..1e4a0c829eff 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2074,7 +2074,7 @@ static const char *colorimetry2_map[] = {
        "ST2113RGB",
 };
 
-static void cta_colorimetry_block(const unsigned char *x, unsigned length)
+void edid_state::cta_colorimetry_block(const unsigned char *x, unsigned length)
 {
        unsigned i;
 
@@ -2090,6 +2090,15 @@ static void cta_colorimetry_block(const unsigned char 
*x, unsigned length)
        for (i = 0; i < ARRAY_SIZE(colorimetry2_map); i++)
                if (x[1] & (1 << i))
                        printf("    %s\n", colorimetry2_map[i]);
+       // The sRGB bit (added in CTA-861.6) allows sources to explicitly
+       // signal sRGB colorimetry. Without this the default colorimetry
+       // of an RGB video is either sRGB or defaultRGB. It depends on the
+       // Source which is used, and the Sink has no idea what it is getting.
+       //
+       // For proper compatibility with PCs enabling sRGB support is
+       // desirable.
+       if (!base.uses_srgb && !(x[1] & 0x20))
+               warn("Set the sRGB colorimetry bit to avoid interop issues.\n");
 }
 
 static const char *eotf_map[] = {
@@ -2561,6 +2570,8 @@ void edid_state::preparse_cta_block(const unsigned char 
*x)
                case 0x07:
                        if (x[i + 1] == 0x0d)
                                cta.has_vfpdb = true;
+                       if (x[i + 1] == 0x05)
+                               cta.has_cdb = true;
                        if (x[i + 1] == 0x13 && (x[i + 2] & 0x40)) {
                                cta.preparsed_speaker_count = 1 + (x[i + 2] & 
0x1f);
                                cta.preparsed_sld = x[i + 2] & 0x20;
@@ -2709,6 +2720,8 @@ void edid_state::parse_cta_block(const unsigned char *x)
                fail("HDMI VIC Codes must have their CTA-861 VIC equivalents in 
the VSB.\n");
        if (!cta.has_vcdb)
                fail("Missing VCDB, needed for Set Selectable RGB Quantization 
to avoid interop issues.\n");
+       if (!base.uses_srgb && !cta.has_cdb)
+               warn("Add a Colorimetry Data Block with the sRGB colorimetry 
bit set to avoid interop issues.\n");
 }
 
 void edid_state::cta_resolve_svr(vec_timings_ext::iterator iter)

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to