[Intel-gfx] [RFC 19/19] drm/edid: sunset drm_find_cea_extension()

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Mar 23 16:36:33 UTC 2022


On Tue, Mar 22, 2022 at 11:40:48PM +0200, Jani Nikula wrote:
> Convert drm_find_cea_extension() to a predicate function to check if the
> EDID has a CEA extension or a DisplayID CTA data block. This is mainly
> to avoid adding new users that only find the first CEA extension.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index dfaa21f00941..84314b65b75b 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3422,30 +3422,29 @@ const u8 *drm_find_edid_extension(const struct edid *edid,
>  	return edid_ext;
>  }
>  
> -static const u8 *drm_find_cea_extension(const struct edid *edid)
> +/* Return true if the EDID has a CEA extension or a DisplayID CTA data block */
> +static bool drm_edid_has_cea_extension(const struct edid *edid)
>  {
>  	const struct displayid_block *block;
>  	struct displayid_iter iter;
> -	const u8 *cea;
>  	int ext_index = 0;
> +	bool found = false;
>  
>  	/* Look for a top level CEA extension block */
> -	/* FIXME: make callers iterate through multiple CEA ext blocks? */
> -	cea = drm_find_edid_extension(edid, CEA_EXT, &ext_index);
> -	if (cea)
> -		return cea;
> +	if (drm_find_edid_extension(edid, CEA_EXT, &ext_index))
> +		return true;
>  
>  	/* CEA blocks can also be found embedded in a DisplayID block */
>  	displayid_iter_edid_begin(edid, &iter);
>  	displayid_iter_for_each(block, &iter) {
>  		if (block->tag == DATA_BLOCK_CTA) {
> -			cea = (const u8 *)block;
> +			found = true;
>  			break;
>  		}
>  	}
>  	displayid_iter_end(&iter);
>  
> -	return cea;
> +	return found;
>  }
>  
>  static __always_inline const struct drm_display_mode *cea_mode_for_vic(u8 vic)
> @@ -3715,7 +3714,7 @@ add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid)
>  	int modes = 0;
>  
>  	/* Don't add CEA modes if the CEA extension block is missing */
> -	if (!drm_find_cea_extension(edid))
> +	if (!drm_edid_has_cea_extension(edid))

I'm thinking we could just do
if (modes)
	modes += add_alternate_cea_modes(...);
at the end of add_cea_modes().

Or perhaps
if (found)
	modes += add_alternate_cea_modes(...);
if we think that adding the alternate modes would be apporpriate
even when add_cea_modes() didn't add anything. Not sure.

Yes, that would still introduce a sligth change in behaviour
in case we have a CEA ext block/DisplayID CTA block without
any of the video/hdmi/y420vdb blocks, but that edge case
doesn't feel like a deal-breaker to me.

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list