[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871q2k7vf5.fsf@intel.com>
Date: Mon, 19 Aug 2024 11:45:34 +0300
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Thomas Weißschuh <linux@...ssschuh.net>, Harry Wentland
<harry.wentland@....com>, Leo Li <sunpeng.li@....com>, Rodrigo Siqueira
<Rodrigo.Siqueira@....com>, Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>, Xinhui Pan
<Xinhui.Pan@....com>, David Airlie <airlied@...il.com>, Daniel Vetter
<daniel@...ll.ch>, jinzh <jinzh@...hub.amd.com>, Aric Cyr
<Aric.Cyr@....com>, Alan Liu <HaoPing.Liu@....com>, Tony Cheng
<Tony.Cheng@....com>, Andrey Grodzovsky <Andrey.Grodzovsky@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
<mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Harry Wentland <Harry.Wentland@....com>,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: Re: [PATCH 10/12] drm/edid: add a helper to compare two EDIDs
On Sun, 18 Aug 2024, Thomas Weißschuh <linux@...ssschuh.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@...ssschuh.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
Powered by blists - more mailing lists