On Thu, Jan 19, 2023 at 05:46:28PM +0200, Jani Nikula wrote:
> Separate the parsing of display info and modes from the HDMI VSDB. This
> is prerequisite work for overall better separation of the two parsing
> steps.
> 
> The info parsing is about figuring out whether the sink supports HDMI
> infoframes. Since they were added in HDMI 1.4, assume the sink supports
> HDMI infoframes if it has the HDMI_Video_present bit set (introduced in
> HDMI 1.4). For details, see commit f1781e9bb2dd ("drm/edid: Allow HDMI
> infoframe without VIC or S3D").
> 
> The logic is not exactly the same, but since it was somewhat heuristic
> to begin with, assume this is close enough.
> 
> v2:
> - Simplify to only check HDMI_Video_present bit (Ville)
> - Drop cea_db_raw_size() helper (Ville)
> 
> Cc: Ville Syrjälä <ville.syrj...@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nik...@intel.com>

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

> ---
>  drivers/gpu/drm/drm_edid.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index e8b67f3f5c91..ee453e39562a 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4713,7 +4713,6 @@ static int hdmi_vsdb_latency_length(const u8 *db)
>  static int
>  do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len)
>  {
> -     struct drm_display_info *info = &connector->display_info;
>       int modes = 0, offset = 0, i, multi_present = 0, multi_len;
>       u8 vic_len, hdmi_3d_len = 0;
>       u16 mask;
> @@ -4831,8 +4830,6 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, 
> const u8 *db, u8 len)
>       }
>  
>  out:
> -     if (modes > 0)
> -             info->has_hdmi_infoframe = true;
>       return modes;
>  }
>  
> @@ -6153,6 +6150,7 @@ static void drm_parse_hdmi_deep_color_info(struct 
> drm_connector *connector,
>       }
>  }
>  
> +/* HDMI Vendor-Specific Data Block (HDMI VSDB, H14b-VSDB) */
>  static void
>  drm_parse_hdmi_vsdb_video(struct drm_connector *connector, const u8 *db)
>  {
> @@ -6166,6 +6164,15 @@ drm_parse_hdmi_vsdb_video(struct drm_connector 
> *connector, const u8 *db)
>       if (len >= 7)
>               info->max_tmds_clock = db[7] * 5000;
>  
> +     /*
> +      * Try to infer whether the sink supports HDMI infoframes.
> +      *
> +      * HDMI infoframe support was first added in HDMI 1.4. Assume the sink
> +      * supports infoframes if HDMI_Video_present is set.
> +      */
> +     if (len >= 8 && db[8] & BIT(5))
> +             info->has_hdmi_infoframe = true;
> +
>       drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] HDMI: DVI dual %d, max 
> TMDS clock %d kHz\n",
>                   connector->base.id, connector->name,
>                   info->dvi_dual, info->max_tmds_clock);
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel

Reply via email to