All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Xinhui Pan" <Xinhui.Pan@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>, jinzh <jinzh@github.amd.com>,
	"Aric Cyr" <Aric.Cyr@amd.com>, "Alan Liu" <HaoPing.Liu@amd.com>,
	"Tony Cheng" <Tony.Cheng@amd.com>,
	"Andrey Grodzovsky" <Andrey.Grodzovsky@amd.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	"Harry Wentland" <Harry.Wentland@amd.com>,
	"Thomas Weißschuh" <linux@weissschuh.net>
Subject: Re: [PATCH 10/12] drm/edid: add a helper to compare two EDIDs
Date: Mon, 19 Aug 2024 11:45:34 +0300	[thread overview]
Message-ID: <871q2k7vf5.fsf@intel.com> (raw)
In-Reply-To: <20240818-amdgpu-drm_edid-v1-10-aea66c1f7cf4@weissschuh.net>

On Sun, 18 Aug 2024, Thomas Weißschuh <linux@weissschuh.net> wrote:
> As struct drm_edid is opaque, drivers can't directly memcmp() the
> contained data. Add a helper to provide this functionality.

I'm not sure why drivers would need to compare EDIDs.

The only user was added in commit eb815442e840 ("drm/amd/display: don't
create new dc_sink if nothing changed at detection") with absolutely no
explanation why.

Other drivers use connector->epoch_counter to see if the EDID or status
changed.


BR,
Jani.


>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++
>  include/drm/drm_edid.h     |  1 +
>  2 files changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 69fb11741abd..c2493c983a64 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1840,6 +1840,24 @@ static bool drm_edid_eq(const struct drm_edid *drm_edid,
>  	return true;
>  }
>  
> +/**
> + * drm_edid_equal - compare two EDID
> + * @drm_edid_a: First EDID data
> + * @drm_edid_b: Second EDID data
> + *
> + * Compare two EDIDs for equality (including extensions)
> + *
> + * Return: True if the EDIDs are equal, false otherwise.
> + */
> +bool drm_edid_equal(const struct drm_edid *drm_edid_a, const struct drm_edid *drm_edid_b)
> +{
> +	if (!drm_edid_b)
> +		return !drm_edid_a;
> +
> +	return drm_edid_eq(drm_edid_a, drm_edid_b->edid, drm_edid_b->size);
> +}
> +EXPORT_SYMBOL(drm_edid_equal);
> +
>  enum edid_block_status {
>  	EDID_BLOCK_OK = 0,
>  	EDID_BLOCK_READ_FAIL,
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index a5b377c4a342..35b40a9d3350 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -456,6 +456,7 @@ drm_display_mode_from_cea_vic(struct drm_device *dev,
>  const struct drm_edid *drm_edid_alloc(const void *edid, size_t size);
>  const struct drm_edid *drm_edid_dup(const struct drm_edid *drm_edid);
>  void drm_edid_free(const struct drm_edid *drm_edid);
> +bool drm_edid_equal(const struct drm_edid *drm_edid_a, const struct drm_edid *drm_edid_b);
>  bool drm_edid_valid(const struct drm_edid *drm_edid);
>  const struct edid *drm_edid_raw(const struct drm_edid *drm_edid);
>  const struct drm_edid *drm_edid_read(struct drm_connector *connector);

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-08-19  8:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18 10:43 [PATCH 00/12] drm/amd: Switch over to struct drm_edid Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 01/12] drm/amd/display: remove spurious definition for dm_helpers_get_sbios_edid() Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 02/12] drm/amd/display: Remove EDID members of ddc_service Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 03/12] drm/edid: constify argument of drm_edid_is_valid() Thomas Weißschuh
2024-08-19  8:21   ` Jani Nikula
2024-08-19 18:31     ` Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 04/12] drm/amd/display: Simplify raw_edid handling in dm_helpers_parse_edid_caps() Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 05/12] drm/amd/display: Constify " Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 06/12] drm/amd/display: Constify 'struct edid' in parsing functions Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 07/12] drm/amd/display: Use struct edid in dc_link_add_remote_sink() Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 08/12] drm/amdgpu: Switch amdgpu_connector to struct drm_edid Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 09/12] drm/amd/display: Switch amdgpu_dm_connector " Thomas Weißschuh
2024-08-19  8:26   ` Jani Nikula
2024-08-18 10:43 ` [PATCH 10/12] drm/edid: add a helper to compare two EDIDs Thomas Weißschuh
2024-08-19  8:45   ` Jani Nikula [this message]
2024-08-18 10:43 ` [PATCH 11/12] drm/amd/display: Switch dc_sink to struct drm_edid Thomas Weißschuh
2024-08-18 10:43 ` [PATCH 12/12] drm/amd/display: Switch dc_link_add_remote_sink() " Thomas Weißschuh
2024-08-19 14:31 ` [PATCH 00/12] drm/amd: Switch over " Melissa Wen
2024-08-19 18:39   ` Thomas Weißschuh

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=871q2k7vf5.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Andrey.Grodzovsky@amd.com \
    --cc=Aric.Cyr@amd.com \
    --cc=HaoPing.Liu@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Tony.Cheng@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=jinzh@github.amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sunpeng.li@amd.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.