[Intel-gfx] [PATCH v7 09/22] drm/edid: fix and clarify HDMI VSDB audio latency parsing

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Jan 18 15:41:07 UTC 2023


On Wed, Jan 04, 2023 at 12:05:24PM +0200, Jani Nikula wrote:
> Add helpers for Latency_Fields_Present and I_Latency_Fields_Present
> bits, and fix the parsing:
> 
> - Respect specification regarding "I_Latency_Fields_Present shall be
>   zero if Latency_Fields_Present is zero".
> 
> - Don't claim latency fields are present if the data block isn't big
>   enough to hold them.
> 
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

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

> ---
>  drivers/gpu/drm/drm_edid.c | 27 +++++++++++++++++++--------
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 076ba125c38d..847076b29594 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4685,6 +4685,16 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure,
>  	return modes;
>  }
>  
> +static bool hdmi_vsdb_latency_present(const u8 *db)
> +{
> +	return db[8] & BIT(7);
> +}
> +
> +static bool hdmi_vsdb_i_latency_present(const u8 *db)
> +{
> +	return hdmi_vsdb_latency_present(db) && db[8] & BIT(6);
> +}
> +
>  /*
>   * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block
>   * @connector: connector corresponding to the HDMI sink
> @@ -5357,6 +5367,7 @@ drm_parse_hdr_metadata_block(struct drm_connector *connector, const u8 *db)
>  	}
>  }
>  
> +/* HDMI Vendor-Specific Data Block (HDMI VSDB, H14b-VSDB) */
>  static void
>  drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
>  {
> @@ -5364,18 +5375,18 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
>  
>  	if (len >= 6 && (db[6] & (1 << 7)))
>  		connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_SUPPORTS_AI;
> -	if (len >= 8) {
> -		connector->latency_present[0] = db[8] >> 7;
> -		connector->latency_present[1] = (db[8] >> 6) & 1;
> -	}
> -	if (len >= 9)
> +
> +	if (len >= 10 && hdmi_vsdb_latency_present(db)) {
> +		connector->latency_present[0] = true;
>  		connector->video_latency[0] = db[9];
> -	if (len >= 10)
>  		connector->audio_latency[0] = db[10];
> -	if (len >= 11)
> +	}
> +
> +	if (len >= 12 && hdmi_vsdb_i_latency_present(db)) {
> +		connector->latency_present[1] = true;
>  		connector->video_latency[1] = db[11];
> -	if (len >= 12)
>  		connector->audio_latency[1] = db[12];
> +	}
>  
>  	drm_dbg_kms(connector->dev,
>  		    "[CONNECTOR:%d:%s] HDMI: latency present %d %d, video latency %d %d, audio latency %d %d\n",
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list