All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Melissa Wen <mwen@igalia.com>,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch
Cc: amd-gfx@lists.freedesktop.org, Alex Hung <alex.hung@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Rodrigo Siqueira <siqueira@igalia.com>,
	Michel Daenzer <michel.daenzer@mailbox.org>,
	dri-devel@lists.freedesktop.org, kernel-dev@igalia.com
Subject: Re: [PATCH v2 12/14] drm/edid: introduce a helper that compares edid data from two drm_edid
Date: Thu, 08 May 2025 14:47:47 +0300	[thread overview]
Message-ID: <87msbntjbw.fsf@intel.com> (raw)
In-Reply-To: <20250507001712.120215-13-mwen@igalia.com>

On Tue, 06 May 2025, Melissa Wen <mwen@igalia.com> wrote:
> AMD driver has a function used to compare if two edid are the same; this
> is useful to some of the link detection algorithms implemented by
> amdgpu. Since the amdgpu function can be helpful for other drivers, this
         ^

Theres's a non-breaking space in there I think.

> commit abstracts the AMD function to make it available at the DRM level
> by wrapping existent drm_edid_eq().
>
> v2:
> - rename drm_edid_eq to drm_edid_eq_buf (jani)
> - add NULL checks (jani)
>
> Co-developed-by: Rodrigo Siqueira <siqueira@igalia.com>
> Signed-off-by: Rodrigo Siqueira <siqueira@igalia.com>
> Signed-off-by: Melissa Wen <mwen@igalia.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 24 +++++++++++++++++++++---
>  include/drm/drm_edid.h     |  2 ++
>  2 files changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 6e4cffd467f1..079042ccbc41 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1820,8 +1820,8 @@ static bool edid_block_is_zero(const void *edid)
>  	return mem_is_zero(edid, EDID_LENGTH);
>  }
>  
> -static bool drm_edid_eq(const struct drm_edid *drm_edid,
> -			const void *raw_edid, size_t raw_edid_size)
> +static bool drm_edid_eq_buf(const struct drm_edid *drm_edid,
> +			    const void *raw_edid, size_t raw_edid_size)
>  {
>  	bool edid1_present = drm_edid && drm_edid->edid && drm_edid->size;
>  	bool edid2_present = raw_edid && raw_edid_size;
> @@ -6918,7 +6918,7 @@ static int _drm_edid_connector_property_update(struct drm_connector *connector,
>  		const void *old_edid = connector->edid_blob_ptr->data;
>  		size_t old_edid_size = connector->edid_blob_ptr->length;
>  
> -		if (old_edid && !drm_edid_eq(drm_edid, old_edid, old_edid_size)) {
> +		if (old_edid && !drm_edid_eq_buf(drm_edid, old_edid, old_edid_size)) {
>  			connector->epoch_counter++;
>  			drm_dbg_kms(dev, "[CONNECTOR:%d:%s] EDID changed, epoch counter %llu\n",
>  				    connector->base.id, connector->name,
> @@ -7523,3 +7523,21 @@ bool drm_edid_is_digital(const struct drm_edid *drm_edid)
>  		drm_edid->edid->input & DRM_EDID_INPUT_DIGITAL;
>  }
>  EXPORT_SYMBOL(drm_edid_is_digital);
> +
> +/**
> + * drm_edid_edid_eq - Check if EDIDs are equal
> + *
> + * @drm_edid_old: old drm_edid to compare edid
> + * @drm_edid_new: new drm_edid to compare edid

Comments still refer to old/new, please run kernel-doc.

> + *
> + * Return true if EDIDs are equal.
> + */
> +bool drm_edid_eq(const struct drm_edid *drm_edid_1,
> +		 const struct drm_edid *drm_edid_2)
> +{
> +	const void *edid_1 = drm_edid_1 ? drm_edid_1->edid : NULL;
> +	size_t edid_1_size = drm_edid_1 ? drm_edid_1->size : 0;
> +
> +	return drm_edid_eq_buf(drm_edid_2, edid_1, edid_1_size);
> +}
> +EXPORT_SYMBOL(drm_edid_eq);
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index ceb522c4f4c2..c0e49c4a32e9 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -472,6 +472,8 @@ int drm_edid_connector_update(struct drm_connector *connector,
>  			      const struct drm_edid *edid);
>  int drm_edid_connector_add_modes(struct drm_connector *connector);
>  bool drm_edid_is_digital(const struct drm_edid *drm_edid);
> +bool drm_edid_eq(const struct drm_edid *drm_edid_first,
> +			 const struct drm_edid *drm_edid_second);

Nitpick, parameter names in the declaration differ from the ones in the
definition.

With the above fixed,

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


>  void drm_edid_get_product_id(const struct drm_edid *drm_edid,
>  			     struct drm_edid_product_id *id);
>  void drm_edid_print_product_id(struct drm_printer *p,

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-05-08 11:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07  0:03 [PATCH v2 00/14] drm/amd/display: more drm_edid to AMD display driver Melissa Wen
2025-05-07  0:03 ` [PATCH v2 01/14] drm/amd/display: make sure drm_edid stored in aconnector doesn't leak Melissa Wen
2025-05-07  0:03 ` [PATCH v2 02/14] drm/amd/display: start using drm_edid helpers to parse EDID caps Melissa Wen
2025-05-07  0:03 ` [PATCH v2 03/14] drm/amd/display: use drm_edid_product_id for parsing EDID product info Melissa Wen
2025-05-07  0:03 ` [PATCH v2 04/14] drm/edid: introduce a helper that gets monitor name from drm_edid Melissa Wen
2025-05-08 11:39   ` Jani Nikula
2025-05-13 21:42     ` Melissa Wen
2025-05-07  0:03 ` [PATCH v2 05/14] drm/amd/display: get panel id with drm_edid helper Melissa Wen
2025-05-07  0:04 ` [PATCH v2 06/14] drm/amd/display: get SAD from drm_eld when parsing EDID caps Melissa Wen
2025-05-07  0:04 ` [PATCH v2 07/14] drm/amd/display: get SADB " Melissa Wen
2025-05-07  0:04 ` [PATCH v2 08/14] drm/amd/display: simplify dm_helpers_parse_edid_caps signature Melissa Wen
2025-05-07  0:04 ` [PATCH v2 09/14] drm/amd/display: change DC functions to accept private types for edid Melissa Wen
2025-05-07  0:04 ` [PATCH v2 10/14] drm/amd/display: add a mid-layer file to handle EDID in DC Melissa Wen
2025-05-07  0:04 ` [PATCH v2 11/14] drm/amd/display: create a function to fill dc_sink with edid data Melissa Wen
2025-05-08 11:41   ` Jani Nikula
2025-05-07  0:04 ` [PATCH v2 12/14] drm/edid: introduce a helper that compares edid data from two drm_edid Melissa Wen
2025-05-08 11:47   ` Jani Nikula [this message]
2025-05-13 21:45     ` Melissa Wen
2025-05-07  0:04 ` [PATCH v2 13/14] drm/amd/display: add drm_edid to dc_sink Melissa Wen
2025-05-08 11:50   ` Jani Nikula
2025-05-07  0:04 ` [PATCH v2 14/14] drm/amd/display: move dc_sink from dc_edid to drm_edid Melissa Wen

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=87msbntjbw.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.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.