From patchwork Mon Apr 8 08:56:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620816 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 C11A2CD128A for ; Mon, 8 Apr 2024 08:56:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54F3F1122F2; Mon, 8 Apr 2024 08:56:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="XET8nNNt"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3237F1122EE; Mon, 8 Apr 2024 08:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566581; x=1744102581; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IKGqrQphR5b79ERXXYPDjXSyxAGvreM0eJOLhXwviRs=; b=XET8nNNtcL06A/j3ekTfUKINj3IDd3OsG87e3O4TTZ7beVl1Lz0S9wZW 9NQS6NiM1mZ0AI6ehvhokWNG83J38knJJlw5j6RVVWXvGFO9bM/YRAUzP hZIL1aIjDbEd8xTLuDs6H11jncbXsw4CFaG/KN4MTCXg9NvKmIFRKmNbX /FvAKZI9Yj3F9UxXsZv33VbjQc5oCR8iQZB5g3EBAexwkURM8ZhRfwz+u rm1rF1JEk4DXg0Lxar32tQ3lo5DRH/JIeEkEzfh2yWXTYxSMHsmnsHK6+ IadjLuegoWKTk9a5UZmGniDooIVCVYsSjxo5CLIDZ2VT6SKn14dTqfoo4 g==; X-CSE-ConnectionGUID: Vb9HQh7+QXmbdS1Xhf+Dlw== X-CSE-MsgGUID: FiIaFokIRcCGoXovRoFb0w== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="25279152" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="25279152" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:19 -0700 X-CSE-ConnectionGUID: KsIdcYRLQWKNu+TzsjiKKg== X-CSE-MsgGUID: 7oxY/cvCT9m+7twwtg3mbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="19732871" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:17 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 1/7] drm/displayid: move drm_displayid.h to drm_displayd_internal.h Date: Mon, 8 Apr 2024 11:56:02 +0300 Message-Id: <17ca529d89e63934e6694c49d95f54a9c4df9ff6.1712565984.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" There are no exported symbols for displayid, and it's all internal interfaces. Move the header to drivers/gpu/drm/drm_displayd_internal.h. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_displayid.c | 3 ++- .../gpu/drm/drm_displayid_internal.h | 5 +++-- drivers/gpu/drm/drm_edid.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) rename include/drm/drm_displayid.h => drivers/gpu/drm/drm_displayid_internal.h (98%) diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c index 9edc111be7ee..f72a893c7deb 100644 --- a/drivers/gpu/drm/drm_displayid.c +++ b/drivers/gpu/drm/drm_displayid.c @@ -3,10 +3,11 @@ * Copyright © 2021 Intel Corporation */ -#include #include #include +#include "drm_displayid_internal.h" + static const struct displayid_header * displayid_get_header(const u8 *displayid, int length, int index) { diff --git a/include/drm/drm_displayid.h b/drivers/gpu/drm/drm_displayid_internal.h similarity index 98% rename from include/drm/drm_displayid.h rename to drivers/gpu/drm/drm_displayid_internal.h index 566497eeb3b8..5ca3db6d788f 100644 --- a/include/drm/drm_displayid.h +++ b/drivers/gpu/drm/drm_displayid_internal.h @@ -19,8 +19,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef DRM_DISPLAYID_H -#define DRM_DISPLAYID_H + +#ifndef DRM_DISPLAYID_INTERNAL_H +#define DRM_DISPLAYID_INTERNAL_H #include #include diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ea77577a3786..07752cd37b57 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -46,6 +45,7 @@ #include #include "drm_crtc_internal.h" +#include "drm_displayid_internal.h" #include "drm_internal.h" static int oui(u8 first, u8 second, u8 third) From patchwork Mon Apr 8 08:56:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620817 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 DF083C67861 for ; Mon, 8 Apr 2024 08:56:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BA2B1122F7; Mon, 8 Apr 2024 08:56:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="larGtFsQ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 600CB112303; Mon, 8 Apr 2024 08:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566584; x=1744102584; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=12zjj2/En7RptkNkfL85EdZZ8p/Xi8cCRzRJe7hvj4I=; b=larGtFsQySTAKHhi+cxk0IRT4bjhf4JWn/EE/tfMgnNXPSENE0tvQWFs NT2tyNdvW0RWszfHPBqr8DchmUe1Zm9BTCcaEfZVzQi377ujI74Tt7R33 twt4Yq3LdBc2yqALjMfNxZno9nqxhDGQBWrdTD+5SFd5TiIXW/gU64HW3 UpmwiJbjZH1MgGSxNZPW1w4BIIF0HFDid6pTkIEkFn7WRn2AEGnIbwyyI GUbHfwaFqU+CVyaPgNwU3x+5cBxA345UC6C9HeT2HM6eLhgAD8TTzKgVT Yx8pSp2oSRYYgjh5QEhp+atuUUJLCIGpB2abeFeqpl78BHZWOQ0qVkiUk g==; X-CSE-ConnectionGUID: SZ5iUlQKQqWbXd2AKI5QnA== X-CSE-MsgGUID: m63YkiZSTm2KaJm5eJ17Ag== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="25279165" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="25279165" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:24 -0700 X-CSE-ConnectionGUID: AjCocfsRSwKHp+NTzlVPNw== X-CSE-MsgGUID: /jRX+WS0Rky88uTAqAJVCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="19732884" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:22 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 2/7] drm/edid: move all internal declarations to drm_crtc_internal.h Date: Mon, 8 Apr 2024 11:56:03 +0300 Message-Id: <34f4686f306e8bde1f168a5f3127c1d280dce2dc.1712565984.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The declarations for internal EDID functions are a bit scattered. Put them all in drm_crtc_internal.h. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_crtc_internal.h | 6 ++++++ drivers/gpu/drm/drm_displayid.c | 1 + drivers/gpu/drm/drm_eld.c | 4 +++- drivers/gpu/drm/drm_internal.h | 5 ----- include/drm/drm_edid.h | 3 --- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index 0c693229a1c9..2256893d7d67 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -43,12 +43,14 @@ enum drm_color_range; enum drm_connector_force; enum drm_mode_status; +struct cea_sad; struct drm_atomic_state; struct drm_bridge; struct drm_connector; struct drm_crtc; struct drm_device; struct drm_display_mode; +struct drm_edid; struct drm_file; struct drm_framebuffer; struct drm_mode_create_dumb; @@ -297,6 +299,10 @@ void drm_mode_fixup_1366x768(struct drm_display_mode *mode); int drm_edid_override_show(struct drm_connector *connector, struct seq_file *m); int drm_edid_override_set(struct drm_connector *connector, const void *edid, size_t size); int drm_edid_override_reset(struct drm_connector *connector); +const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid, + int ext_id, int *ext_index); +void drm_edid_cta_sad_get(const struct cea_sad *cta_sad, u8 *sad); +void drm_edid_cta_sad_set(struct cea_sad *cta_sad, const u8 *sad); /* drm_edid_load.c */ #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c index f72a893c7deb..f800dc0906d5 100644 --- a/drivers/gpu/drm/drm_displayid.c +++ b/drivers/gpu/drm/drm_displayid.c @@ -6,6 +6,7 @@ #include #include +#include "drm_crtc_internal.h" #include "drm_displayid_internal.h" static const struct displayid_header * diff --git a/drivers/gpu/drm/drm_eld.c b/drivers/gpu/drm/drm_eld.c index 5177991aa272..c0428d07de53 100644 --- a/drivers/gpu/drm/drm_eld.c +++ b/drivers/gpu/drm/drm_eld.c @@ -3,10 +3,12 @@ * Copyright © 2023 Intel Corporation */ +#include + #include #include -#include "drm_internal.h" +#include "drm_crtc_internal.h" /** * drm_eld_sad_get - get SAD from ELD to struct cea_sad diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 2215baef9a3e..690505a1f7a5 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -35,7 +35,6 @@ #define DRM_IF_VERSION(maj, min) (maj << 16 | min) -struct cea_sad; struct dentry; struct dma_buf; struct iosys_map; @@ -278,8 +277,4 @@ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, const struct drm_framebuffer *fb); void drm_framebuffer_debugfs_init(struct drm_device *dev); -/* drm_edid.c */ -void drm_edid_cta_sad_get(const struct cea_sad *cta_sad, u8 *sad); -void drm_edid_cta_sad_set(struct cea_sad *cta_sad, const u8 *sad); - #endif /* __DRM_INTERNAL_H__ */ diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 6f65bbf655a1..6eadc4f12c07 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -467,7 +467,4 @@ int drm_edid_connector_update(struct drm_connector *connector, int drm_edid_connector_add_modes(struct drm_connector *connector); bool drm_edid_is_digital(const struct drm_edid *drm_edid); -const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid, - int ext_id, int *ext_index); - #endif /* __DRM_EDID_H__ */ From patchwork Mon Apr 8 08:56:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620818 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 1A328C67861 for ; Mon, 8 Apr 2024 08:56:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE6201122F3; Mon, 8 Apr 2024 08:56:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cOLTkl3w"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id C41EA1122FB; Mon, 8 Apr 2024 08:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566590; x=1744102590; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BnavicqBEYhBzwyTj6BAbml9agI26PcL36kEbvLlQBk=; b=cOLTkl3wRZWKjefKlpvK/CrDgsKDiJuF4m6x8fyGzzkSo3edVlrDqTxu vO9JHRr5Z02WvVYJ3p9ZCJ8K3E9XPwmZjQXoEBriP6mZjSwcRUczG08AC fUiKJhnHWlJYP88oqXbIE9v2KyxoInRQWYBYen19HO/8Nbg1aNSpAikET t8Z0hcyP9IRyXwZMeqt3834oBihI+CWNdI3h9YCP6QYvWoZPOECIEsngB U/7FjHehfiyCcdbKfZ1hsn7f0NuVhVvzM8hHOYEn8FRmO0O/jWWES3WmG 4MG2IqC+1Y3CiSYyOp5Wj2f8dVFk57NFha43KCMwx37gk+n+EGDeD9WO8 Q==; X-CSE-ConnectionGUID: FGs6oYL5RyO+8R6QNlxZ0A== X-CSE-MsgGUID: /2xQnC4URPeLQtEP6MwmYg== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="7997457" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="7997457" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:29 -0700 X-CSE-ConnectionGUID: tfOlfydsR+SGFLb6dfKvTA== X-CSE-MsgGUID: BRSxGKmARym/YDq/OxCvVQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24294339" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:27 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 3/7] drm/edid: group struct drm_edid based declarations together Date: Mon, 8 Apr 2024 11:56:04 +0300 Message-Id: <57ced070ad4f3a91af66661dcfb6f19687aae3cf.1712565984.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Keep the declarations for struct drm_edid based functions together. Signed-off-by: Jani Nikula --- include/drm/drm_edid.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 6eadc4f12c07..19814bb1103c 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -417,10 +417,6 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, void *data); struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); -const struct drm_edid *drm_edid_read_base_block(struct i2c_adapter *adapter); -u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid); -bool drm_edid_match(const struct drm_edid *drm_edid, - const struct drm_edid_ident *ident); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); @@ -460,11 +456,15 @@ const struct drm_edid *drm_edid_read_ddc(struct drm_connector *connector, const struct drm_edid *drm_edid_read_custom(struct drm_connector *connector, int (*read_block)(void *context, u8 *buf, unsigned int block, size_t len), void *context); +const struct drm_edid *drm_edid_read_base_block(struct i2c_adapter *adapter); const struct drm_edid *drm_edid_read_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); 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); +u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid); +bool drm_edid_match(const struct drm_edid *drm_edid, + const struct drm_edid_ident *ident); #endif /* __DRM_EDID_H__ */ From patchwork Mon Apr 8 08:56:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620819 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 311F5C67861 for ; Mon, 8 Apr 2024 08:56:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B5E21122F4; Mon, 8 Apr 2024 08:56:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TcQeqYl5"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BE451122F9; Mon, 8 Apr 2024 08:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566595; x=1744102595; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/YMHve7Vm+pG1sTLwYhoFnmAsoRlZZQYuv2KhffbZTM=; b=TcQeqYl5pVjIi5EFsU+J/oKaeBVasX+cck6h0AodA5LyNM1pmPOcXspz cMSLI1D49rWAGmyHN5Hvr4oc0ZDfwCyJSuJTYPN1IfvqzWL5hSKbHMQhd +BQFTOu006HjLBERQlsYFNnv0wRj1JKkYoDIgFJpmbSy+nNo+Q0XneRDj HVSmibIvSHy8+TFMmZm99FOq16M+U0jeoPPazYn+FF5lBlRUx/RWxpWKq IONuFplzut8qKZLifo160VGwxvt5Z7AIsuIgl4MkZAjVEDtyGnBUOgIos OPdbqw4dVrL7BAOT+S8bV32+IXnO+Nx+Yb6XYFEcMxoZkFVxC4UTyBKjB g==; X-CSE-ConnectionGUID: M3D3GsAFSnqenME1uDwUUQ== X-CSE-MsgGUID: YdFLNErYRR2Axlj2XBNtsg== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="7997462" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="7997462" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:34 -0700 X-CSE-ConnectionGUID: bzfaV5tiQpOj83z1b+KEWg== X-CSE-MsgGUID: 7uuwiDnZQQCBuv8Ra3xFBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24294350" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:32 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 4/7] drm/edid: rename drm_find_edid_extension() to drm_edid_find_extension() Date: Mon, 8 Apr 2024 11:56:05 +0300 Message-Id: <693b938b57f6c5a757e90c5e488d676d430ed665.1712565984.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Follow the drm_edid_ naming convention. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_crtc_internal.h | 2 +- drivers/gpu/drm/drm_displayid.c | 3 ++- drivers/gpu/drm/drm_edid.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index 2256893d7d67..25aaae937ceb 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -299,7 +299,7 @@ void drm_mode_fixup_1366x768(struct drm_display_mode *mode); int drm_edid_override_show(struct drm_connector *connector, struct seq_file *m); int drm_edid_override_set(struct drm_connector *connector, const void *edid, size_t size); int drm_edid_override_reset(struct drm_connector *connector); -const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid, +const u8 *drm_edid_find_extension(const struct drm_edid *drm_edid, int ext_id, int *ext_index); void drm_edid_cta_sad_get(const struct cea_sad *cta_sad, u8 *sad); void drm_edid_cta_sad_set(struct cea_sad *cta_sad, const u8 *sad); diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c index f800dc0906d5..9d01d762801f 100644 --- a/drivers/gpu/drm/drm_displayid.c +++ b/drivers/gpu/drm/drm_displayid.c @@ -55,9 +55,10 @@ static const u8 *drm_find_displayid_extension(const struct drm_edid *drm_edid, int *length, int *idx, int *ext_index) { - const u8 *displayid = drm_find_edid_extension(drm_edid, DISPLAYID_EXT, ext_index); const struct displayid_header *base; + const u8 *displayid; + displayid = drm_edid_find_extension(drm_edid, DISPLAYID_EXT, ext_index); if (!displayid) return NULL; diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 07752cd37b57..6a31a3af20dd 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4141,7 +4141,7 @@ static int add_detailed_modes(struct drm_connector *connector, * * FIXME: Prefer not returning pointers to raw EDID data. */ -const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid, +const u8 *drm_edid_find_extension(const struct drm_edid *drm_edid, int ext_id, int *ext_index) { const u8 *edid_ext = NULL; @@ -4175,7 +4175,7 @@ static bool drm_edid_has_cta_extension(const struct drm_edid *drm_edid) bool found = false; /* Look for a top level CEA extension block */ - if (drm_find_edid_extension(drm_edid, CEA_EXT, &ext_index)) + if (drm_edid_find_extension(drm_edid, CEA_EXT, &ext_index)) return true; /* CEA blocks can also be found embedded in a DisplayID block */ From patchwork Mon Apr 8 08:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620820 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 A1A49CD128A for ; Mon, 8 Apr 2024 08:56:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE3FF112302; Mon, 8 Apr 2024 08:56:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="PNtbReBM"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3257A112311; Mon, 8 Apr 2024 08:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566599; x=1744102599; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sJRZIiU19JMnnFm9x55z6Ue1qfuAjgndR3khh1cMlPo=; b=PNtbReBMBIOnMnXZPJZCYMvoVA5oCgeusNsxiSIzXEySxX32gu3duWeR oAIDo0GMDDIN98CJaVFQxnC+IE5vIixE9snrSf0s2HSqeetzUBfFOI+wX eyM+S0pFbwTJOuqKfwHEIgCsoGeiyPoP7N37wCq9eJiyl4EI5TV/4dtjh oJZPMrOHWgF03Kg3M6DftGsZL3iBQzv0/O4PLnxrFRVtNrtYX38KH+r20 NAjuuOQVQftimHaXW3JEsDfZFpRwMnDxpWSNWbf67QPFnxkCYMWq9pmEd aZHedzBRRAes2Z6wyL3ylOGHbi5w7fg2s+ADi/osZ29yJUOp4qkjTnFmP w==; X-CSE-ConnectionGUID: KyE84EpUSJ2eQ+hAk5yM2w== X-CSE-MsgGUID: 7eQmyknqQzeC7mo15eoHgg== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="7997466" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="7997466" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:39 -0700 X-CSE-ConnectionGUID: Ij8m79oNRv61teiIvC4kAA== X-CSE-MsgGUID: 42kvke/xSKuHajanwz/l2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24294356" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:37 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 5/7] drm/edid: avoid drm_edid_find_extension() internally Date: Mon, 8 Apr 2024 11:56:06 +0300 Message-Id: <1d5009116442d72b710897c2c389afb24e01a02f.1712565984.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Prefer the EDID iterators over drm_edid_find_extension() in drm_edid_has_cta_extension(), even if this leads to more code. The key is to use the same patterns as much as possible. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_edid.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 6a31a3af20dd..02f0a5fd819a 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -4171,11 +4171,21 @@ static bool drm_edid_has_cta_extension(const struct drm_edid *drm_edid) { const struct displayid_block *block; struct displayid_iter iter; - int ext_index = 0; + struct drm_edid_iter edid_iter; + const u8 *ext; bool found = false; /* Look for a top level CEA extension block */ - if (drm_edid_find_extension(drm_edid, CEA_EXT, &ext_index)) + drm_edid_iter_begin(drm_edid, &edid_iter); + drm_edid_iter_for_each(ext, &edid_iter) { + if (ext[0] == CEA_EXT) { + found = true; + break; + } + } + drm_edid_iter_end(&edid_iter); + + if (found) return true; /* CEA blocks can also be found embedded in a DisplayID block */ From patchwork Mon Apr 8 08:56:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620821 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 31C66CD128A for ; Mon, 8 Apr 2024 08:56:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53F541122EE; Mon, 8 Apr 2024 08:56:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ZYBqNHiQ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF8B21122FD; Mon, 8 Apr 2024 08:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566604; x=1744102604; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U2WIs5Pwzax7T4ezt0fiwOFzrrmUe8x0LWlKpWSp6ww=; b=ZYBqNHiQRKSniG5TTuX2Q3dm/gEDv9/TpMe4ie7O+4w/gh0DPFdT7Tqu 42Ql0uAAx1eObLA7C1TZQZfuABcO6aFYGVaXaRxizEgZkfVv/VnjnTczS xTgSh0J+Nf6AGQHM2GOW+YKz7r2UJO9Xqk4+yzDBK4ByR84kEFo82jjGh 4/WHM8LpMg7vUsgrAY3B4OUgYLx0aLtF4OBiLnuTMc5WOcIcTzuo7jLtQ +Xn9Iqn1x/wLawFm2MsseTvXLpfC4x6JG2mm74SmqEdMEm5qEjPX/nSVo dA2ylu1Js8C18NpEl0b6LHmUrJKtuvRkHGeCseYi4BJOWP6A23ELNqee2 A==; X-CSE-ConnectionGUID: YFnHDytrSSKbqPUjzlpCnQ== X-CSE-MsgGUID: 3WmRrBG0Rda7iPP8yodU4w== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="25279199" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="25279199" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:44 -0700 X-CSE-ConnectionGUID: YcC7hEAdT8ajLmqCGDSwUA== X-CSE-MsgGUID: 3GhYCWwERgCDboT0Znucnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="19732926" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:42 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 6/7] drm/edid: make drm_edid_are_equal() static Date: Mon, 8 Apr 2024 11:56:07 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" drm_edid_are_equal() is only used within drm_edid.c. Make it static. Do not encourage more uses of struct edid. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_edid.c | 3 +-- include/drm/drm_edid.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 02f0a5fd819a..c11421d43b4b 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1825,7 +1825,7 @@ static bool edid_block_is_zero(const void *edid) * This helper can be used during probing to determine if * edid had changed. */ -bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) +static bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) { int edid1_len, edid2_len; bool edid1_present = edid1 != NULL; @@ -1847,7 +1847,6 @@ bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) return true; } -EXPORT_SYMBOL(drm_edid_are_equal); enum edid_block_status { EDID_BLOCK_OK = 0, diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 19814bb1103c..b5ee893001da 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -334,8 +334,6 @@ int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb); int drm_av_sync_delay(struct drm_connector *connector, const struct drm_display_mode *mode); -bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); - int drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, const struct drm_connector *connector, From patchwork Mon Apr 8 08:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13620822 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 4E249CD1296 for ; Mon, 8 Apr 2024 08:56:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72E7E1122F6; Mon, 8 Apr 2024 08:56:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="nCMu5e0Z"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id C12E5112304; Mon, 8 Apr 2024 08:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712566609; x=1744102609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lXBq1nfGZPGeUC6reR+4rVR0wMMhreGWv4waRh0Cjz8=; b=nCMu5e0ZjXCmMvmI2AZoEG6KbCxdIv9gugbg3vxcHY3R2P/CrnF2vp+h 11MRLIVdHMdfJmsBBWt42uyg8x1XvdbnPu4n4vCWlzyCopKqphgBu2qns m8L8LreN0UWlDFqf68ch8mdVIOWS8PBY32vabjIfWqO3+7lsx+m2d87b2 dDLeXPL8kFSqMuS/eVBj5gyEXQ0DAp5K3eLcZEoRVx3XhXFHEZhm9jVlS osfq9bK+lteu1W6791kizmedsfXIVOt0DGP8IpaJygBiyFk2ZrvprRDuC vpJegpqlybht9kusqsmP2/aX+Y1AfQx4ORqGlu6x1RMwDehypoJfJpeZm w==; X-CSE-ConnectionGUID: lC/djkOQRS6hV59jwkP1Yw== X-CSE-MsgGUID: gpTP/v77QK+Wezea8YaL9g== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="25279207" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="25279207" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:49 -0700 X-CSE-ConnectionGUID: SgP0SDUqRT+rAhzhkX49kw== X-CSE-MsgGUID: 6LTNVQSVQxOIgsuDp71I7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="19732939" Received: from bauinger-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.42.71]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 01:56:47 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 7/7] drm/edid: make drm_edid_are_equal() more convenient for its single user Date: Mon, 8 Apr 2024 11:56:08 +0300 Message-Id: <9d12c1aa3fafe19c48b36da863702d8cd7b3668b.1712565984.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Repurpose drm_edid_are_equal() to be more helpful for its single user, and rename drm_edid_eq(). Functionally deduce the length from the blob size, not the blob data, making it more robust against any errors. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_edid.c | 41 ++++++++++++++------------------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c11421d43b4b..1d715634a988 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1818,30 +1818,20 @@ static bool edid_block_is_zero(const void *edid) return !memchr_inv(edid, 0, EDID_LENGTH); } -/** - * drm_edid_are_equal - compare two edid blobs. - * @edid1: pointer to first blob - * @edid2: pointer to second blob - * This helper can be used during probing to determine if - * edid had changed. - */ -static bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) +static bool drm_edid_eq(const struct drm_edid *drm_edid, + const void *raw_edid, size_t raw_edid_size) { - int edid1_len, edid2_len; - bool edid1_present = edid1 != NULL; - bool edid2_present = edid2 != NULL; + bool edid1_present = drm_edid && drm_edid->edid && drm_edid->size; + bool edid2_present = raw_edid && raw_edid_size; if (edid1_present != edid2_present) return false; - if (edid1) { - edid1_len = edid_size(edid1); - edid2_len = edid_size(edid2); - - if (edid1_len != edid2_len) + if (edid1_present) { + if (drm_edid->size != raw_edid_size) return false; - if (memcmp(edid1, edid2, edid1_len)) + if (memcmp(drm_edid->edid, raw_edid, drm_edid->size)) return false; } @@ -6877,15 +6867,14 @@ static int _drm_edid_connector_property_update(struct drm_connector *connector, int ret; if (connector->edid_blob_ptr) { - const struct edid *old_edid = connector->edid_blob_ptr->data; - - if (old_edid) { - if (!drm_edid_are_equal(drm_edid ? drm_edid->edid : NULL, old_edid)) { - connector->epoch_counter++; - drm_dbg_kms(dev, "[CONNECTOR:%d:%s] EDID changed, epoch counter %llu\n", - connector->base.id, connector->name, - connector->epoch_counter); - } + 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)) { + connector->epoch_counter++; + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] EDID changed, epoch counter %llu\n", + connector->base.id, connector->name, + connector->epoch_counter); } }