diff mbox series

[v7,05/22] drm/edid: use VIC in AVI infoframe if sink lists it in CTA VDB

Message ID 775124fd07a5b7892e869becc3dd8dadb328ae5f.1672826282.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/edid: info & modes parsing and drm_edid refactors | expand

Commit Message

Jani Nikula Jan. 4, 2023, 10:05 a.m. UTC
Apparently there are HDMI 1.4 compatible displays out there that support
VICs from specs later than CTA-861-D, i.e. VIC > 64, although HDMI 1.4
references CTA-861-D only.

We try to avoid using VICs from the later specs in the AVI infoframes to
avoid upsetting sinks that conform to earlier specs.

However, it seems reasonable to do this when the sink claims it supports
the VIC. With the pre-parsed list of VICs handy, this is now trivial.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/6153
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: William Tseng <william.tseng@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä Jan. 18, 2023, 3:18 p.m. UTC | #1
On Wed, Jan 04, 2023 at 12:05:20PM +0200, Jani Nikula wrote:
> Apparently there are HDMI 1.4 compatible displays out there that support
> VICs from specs later than CTA-861-D, i.e. VIC > 64, although HDMI 1.4
> references CTA-861-D only.

Not 100% this is a real issue or not. IIRC we decided to 
play it safe regardless.

However later CTA specs do clarify the handling of VIC >=128 which
apparently are known to have issues, and we're even supposed to
use the presence of such SVDs to determine which version of the
AVI infoframe to transmit. Currently we don't handle that stuff
correctly, but looks like it'll be much easier to remedy now.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> We try to avoid using VICs from the later specs in the AVI infoframes to
> avoid upsetting sinks that conform to earlier specs.
> 
> However, it seems reasonable to do this when the sink claims it supports
> the VIC. With the pre-parsed list of VICs handy, this is now trivial.
> 
> References: https://gitlab.freedesktop.org/drm/intel/-/issues/6153
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: William Tseng <william.tseng@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 7f0386175230..3dfcd6450f10 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -5864,6 +5864,22 @@ static void parse_cta_vdb(struct drm_connector *connector, const struct cea_db *
>  	}
>  }
>  
> +static bool cta_vdb_has_vic(const struct drm_connector *connector, u8 vic)
> +{
> +	const struct drm_display_info *info = &connector->display_info;
> +	int i;
> +
> +	if (!vic || !info->vics)
> +		return false;
> +
> +	for (i = 0; i < info->vics_len; i++) {
> +		if (info->vics[i] == vic)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  static void drm_parse_vcdb(struct drm_connector *connector, const u8 *db)
>  {
>  	struct drm_display_info *info = &connector->display_info;
> @@ -6909,10 +6925,14 @@ static u8 drm_mode_cea_vic(const struct drm_connector *connector,
>   *
>   * HDMI 1.4 (CTA-861-D) VIC range: [1..64]
>   * HDMI 2.0 (CTA-861-F) VIC range: [1..107]
> + *
> + * If the sink lists the VIC in CTA VDB, assume it's fine, regardless of HDMI
> + * version.
>   */
>  static u8 vic_for_avi_infoframe(const struct drm_connector *connector, u8 vic)
>  {
> -	if (!is_hdmi2_sink(connector) && vic > 64)
> +	if (!is_hdmi2_sink(connector) && vic > 64 &&
> +	    !cta_vdb_has_vic(connector, vic))
>  		return 0;
>  
>  	return vic;
> -- 
> 2.34.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 7f0386175230..3dfcd6450f10 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5864,6 +5864,22 @@  static void parse_cta_vdb(struct drm_connector *connector, const struct cea_db *
 	}
 }
 
+static bool cta_vdb_has_vic(const struct drm_connector *connector, u8 vic)
+{
+	const struct drm_display_info *info = &connector->display_info;
+	int i;
+
+	if (!vic || !info->vics)
+		return false;
+
+	for (i = 0; i < info->vics_len; i++) {
+		if (info->vics[i] == vic)
+			return true;
+	}
+
+	return false;
+}
+
 static void drm_parse_vcdb(struct drm_connector *connector, const u8 *db)
 {
 	struct drm_display_info *info = &connector->display_info;
@@ -6909,10 +6925,14 @@  static u8 drm_mode_cea_vic(const struct drm_connector *connector,
  *
  * HDMI 1.4 (CTA-861-D) VIC range: [1..64]
  * HDMI 2.0 (CTA-861-F) VIC range: [1..107]
+ *
+ * If the sink lists the VIC in CTA VDB, assume it's fine, regardless of HDMI
+ * version.
  */
 static u8 vic_for_avi_infoframe(const struct drm_connector *connector, u8 vic)
 {
-	if (!is_hdmi2_sink(connector) && vic > 64)
+	if (!is_hdmi2_sink(connector) && vic > 64 &&
+	    !cta_vdb_has_vic(connector, vic))
 		return 0;
 
 	return vic;