From mboxrd@z Thu Jan 1 00:00:00 1970 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 C5856C71148 for ; Fri, 13 Jun 2025 15:01:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 39D9F10EA0C; Fri, 13 Jun 2025 15:01:32 +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="gg3L1+2z"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF24010EA0C; Fri, 13 Jun 2025 15:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=2yAFi+l9ynW62zO8E/lQO/NE5XGBeLznyzpdW4AFv8Q=; b=gg3L1+2z++oSSdfUymL8LV94N8 3JfD1BcxJnejGhBrfw44GK0ivoYmMaA5O6gZ9J348UsIyPCpkVBCvbiVhBK9BoB958lqfF1WJBm0s sq3NARxMKT/KzYD2S73oLj4X7S5d+T2dc5hIDPZDOpb+uh6euLua2rV3U97sMdKed1nVbBWH+ngqW b4u6xR0y2xPVaQvDJGQAmL7AC//dSVOEe/l1//eV7PY/yxbqfLMN1u0lr53my3SE+y6sU8aw1IhQC VHTb8cA8TxMAC+A1GgDL8iQa2wyajxPj64XbqAQsFGmk7c3noxV06zdW1vtEPzJBxrJL1M+EUrdaI ubECTesg==; Received: from [189.6.13.79] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uQ5uD-00342T-T5; Fri, 13 Jun 2025 17:01:22 +0200 From: Melissa Wen To: Alex Hung , Mario Limonciello , Rodrigo Siqueira , harry.wentland@amd.com, sunpeng.li@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, airlied@gmail.com, simona@ffwll.ch Cc: Jani Nikula , Michel Daenzer , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kernel-dev@igalia.com Subject: [PATCH v4 10/14] drm/amd/display: add a mid-layer file to handle EDID in DC Date: Fri, 13 Jun 2025 11:58:12 -0300 Message-ID: <20250613150015.245917-11-mwen@igalia.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250613150015.245917-1-mwen@igalia.com> References: <20250613150015.245917-1-mwen@igalia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" From: Rodrigo Siqueira Since DC is a shared code, this commit introduces a new file to work as a mid-layer in DC for the edid manipulation. v3: - rebase on top of asdn Signed-off-by: Rodrigo Siqueira Co-developed-by: Melissa Wen Signed-off-by: Melissa Wen --- .../gpu/drm/amd/display/amdgpu_dm/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 19 +++++++++++++++++++ .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 11 +++++++++++ .../drm/amd/display/dc/link/link_detection.c | 17 +++-------------- 4 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile b/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile index 7329b8cc2576..09cb94d8e0e4 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile @@ -39,6 +39,7 @@ AMDGPUDM = \ amdgpu_dm_psr.o \ amdgpu_dm_replay.o \ amdgpu_dm_quirks.o \ + dc_edid.o \ amdgpu_dm_wb.o ifdef CONFIG_DRM_AMD_DC_FP diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file mode 100644 index 000000000000..fab873b091f5 --- /dev/null +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +#include "amdgpu_dm/dc_edid.h" +#include "dc.h" + +bool dc_edid_is_same_edid(struct dc_sink *prev_sink, + struct dc_sink *current_sink) +{ + struct dc_edid *old_edid = &prev_sink->dc_edid; + struct dc_edid *new_edid = ¤t_sink->dc_edid; + + if (old_edid->length != new_edid->length) + return false; + + if (new_edid->length == 0) + return false; + + return (memcmp(old_edid->raw_edid, + new_edid->raw_edid, new_edid->length) == 0); +} diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h new file mode 100644 index 000000000000..7e3b1177bc8a --- /dev/null +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef __DC_EDID_H__ +#define __DC_EDID_H__ + +#include "dc.h" + +bool dc_edid_is_same_edid(struct dc_sink *prev_sink, + struct dc_sink *current_sink); + +#endif /* __DC_EDID_H__ */ diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.c b/drivers/gpu/drm/amd/display/dc/link/link_detection.c index 863c24fe1117..344356e26f8b 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c @@ -48,6 +48,8 @@ #include "dm_helpers.h" #include "clk_mgr.h" +#include "dc_edid.h" + // Offset DPCD 050Eh == 0x5A #define MST_HUB_ID_0x5A 0x5A @@ -617,18 +619,6 @@ static bool detect_dp(struct dc_link *link, return true; } -static bool is_same_edid(struct dc_edid *old_edid, struct dc_edid *new_edid) -{ - if (old_edid->length != new_edid->length) - return false; - - if (new_edid->length == 0) - return false; - - return (memcmp(old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) == 0); -} - static bool wait_for_entering_dp_alt_mode(struct dc_link *link) { @@ -1105,8 +1095,7 @@ static bool detect_link_and_local_sink(struct dc_link *link, // Check if edid is the same if ((prev_sink) && (edid_status == EDID_THE_SAME || edid_status == EDID_OK)) - same_edid = is_same_edid(&prev_sink->dc_edid, - &sink->dc_edid); + same_edid = dc_edid_is_same_edid(prev_sink, sink); if (sink->edid_caps.panel_patch.skip_scdc_overwrite) link->ctx->dc->debug.hdmi20_disable = true; -- 2.47.2