From patchwork Fri Apr 11 20:08:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 14048708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08C93C369AB for ; Fri, 11 Apr 2025 20:14:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C03710EC9A; Fri, 11 Apr 2025 20:14:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="miLXtdIY"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id B43B210EC9D for ; Fri, 11 Apr 2025 20:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NcnBYS+IJuXdkD3TBjtgHB1cOkaBNKkPSrRkXjMW/As=; b=miLXtdIYfe5jR0Bt7Hp1Dg7J8k VSd69YSe6rGd1PjHqRgJ7P3aL1vdwIjfhp9WZi7fvlP3EaG+dVE43jYrJGjLTzY8HtRN+qiqddHZM 1eKY/SkJTQnqOsQA0llh5gdnqOqgzKyrZTYPSlNffk0BrB7fAdKexxRyj7UlMx3mh8ROtrq42SIVj Y6xDTcYCu83LvCTcsRcFdh3QDljrbRc/EyucbP5euvxmIqv0mHtlGNL7+/TAkUWr3p//NYZxejA0x 7q9oBhfneVKSAC4DQHDLtYni9z6YwXXrABpd1zWMkQUVpekSuIeWRORaoTguHl+vrjuOroM06n4n8 tM3yeDHg==; Received: from [189.6.35.67] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1u3Kln-00FIP5-Cl; Fri, 11 Apr 2025 22:14:35 +0200 From: Melissa Wen To: Alex Hung , Mario Limonciello , Rodrigo Siqueira , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch Cc: Jani Nikula , dri-devel@lists.freedesktop.org, kernel-dev@igalia.com Subject: [PATCH 11/13] drm/edid: introduce a helper that compares edid data from two drm_edid Date: Fri, 11 Apr 2025 17:08:41 -0300 Message-ID: <20250411201333.151335-12-mwen@igalia.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250411201333.151335-1-mwen@igalia.com> References: <20250411201333.151335-1-mwen@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 commit abstracts the AMD function to make it available at the DRM level by wrapping existent drm_edid_eq(). Co-developed-by: Rodrigo Siqueira Signed-off-by: Rodrigo Siqueira Signed-off-by: Melissa Wen --- drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ include/drm/drm_edid.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 855beafb76ff..328a25d198e5 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -7502,3 +7502,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_is_edid_eq - Check if it the EDID is equal + * + * @drm_edid_old: old drm_edid to compare edid + * @drm_edid_new: new drm_edid to compare edid + * + * Return true if the EDID is equal + */ +bool drm_edid_is_edid_eq(const struct drm_edid *drm_edid_old, + const struct drm_edid *drm_edid_new) +{ + const void *old_edid = drm_edid_old->edid; + size_t old_edid_size = drm_edid_old->size; + + return drm_edid_eq(drm_edid_new, old_edid, old_edid_size); +} +EXPORT_SYMBOL(drm_edid_is_edid_eq); diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index eaac5e665892..0e062761296c 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -469,6 +469,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_is_edid_eq(const struct drm_edid *drm_edid_first, + const struct drm_edid *drm_edid_second); 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,