Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [RFC 19/19] drm/edid: sunset drm_find_cea_extension()
Date: Wed, 23 Mar 2022 18:36:33 +0200	[thread overview]
Message-ID: <YjtMkddPzskdi3oJ@intel.com> (raw)
In-Reply-To: <091dcecb74a14b2cb618f2fc494fd0b52bf535b2.1647985054.git.jani.nikula@intel.com>

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@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

  reply	other threads:[~2022-03-23 16:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 21:40 [Intel-gfx] [RFC 00/19] drm/edid: overhaul CEA data block iteration Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 01/19] drm/edid: add drm_edid_extension_block_count() and drm_edid_size() Jani Nikula
2022-03-23 15:21   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 02/19] drm: use " Jani Nikula
2022-03-23 15:24   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 03/19] drm/edid: clean up CEA data block tag definitions Jani Nikula
2022-03-23 15:33   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 04/19] drm/edid: add iterator for EDID base and extension blocks Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 05/19] drm/edid: add iterator for CEA data blocks Jani Nikula
2022-03-23 16:05   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 06/19] drm/edid: clean up cea_db_is_*() functions Jani Nikula
2022-03-23 15:43   ` Ville Syrjälä
2022-03-23 17:26     ` Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 07/19] drm/edid: convert add_cea_modes() to use cea db iter Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 08/19] drm/edid: convert drm_edid_to_speaker_allocation() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 09/19] drm/edid: convert drm_edid_to_sad() " Jani Nikula
2022-03-23 16:18   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 10/19] drm/edid: convert drm_detect_hdmi_monitor() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 11/19] drm/edid: convert drm_detect_monitor_audio() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 12/19] drm/edid: convert drm_parse_cea_ext() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 13/19] drm/edid: convert drm_edid_to_eld() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 14/19] drm/edid: sunset the old unused cea data block iterators Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 15/19] drm/edid: restore some type safety to cea_db_*() functions Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 16/19] drm/edid: detect basic audio only on CEA extension Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 17/19] drm/edid: detect color formats and CEA revision " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 18/19] drm/edid: skip CEA extension scan in drm_edid_to_eld() just for CEA rev Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 19/19] drm/edid: sunset drm_find_cea_extension() Jani Nikula
2022-03-23 16:36   ` Ville Syrjälä [this message]
2022-03-22 22:07 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: overhaul CEA data block iteration Patchwork
2022-03-22 22:09 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-03-22 22:13 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-22 22:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-23  7:06 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-03-23 16:38 ` [Intel-gfx] [RFC 00/19] " Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YjtMkddPzskdi3oJ@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox