From: Melissa Wen <mwen@igalia.com>
To: Alex Hung <alex.hung@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Rodrigo Siqueira <siqueira@igalia.com>,
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 <jani.nikula@linux.intel.com>,
Michel Daenzer <michel.daenzer@mailbox.org>,
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 [thread overview]
Message-ID: <20250613150015.245917-11-mwen@igalia.com> (raw)
In-Reply-To: <20250613150015.245917-1-mwen@igalia.com>
From: Rodrigo Siqueira <siqueira@igalia.com>
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 <siqueira@igalia.com>
Co-developed-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
---
.../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
next prev parent reply other threads:[~2025-06-13 15:01 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 14:58 [PATCH v4 00/14] drm/amd/display: more drm_edid to AMD display driver Melissa Wen
2025-06-13 14:58 ` [PATCH v4 01/14] drm/amd/display: make sure drm_edid stored in aconnector doesn't leak Melissa Wen
2025-06-13 14:58 ` [PATCH v4 02/14] drm/amd/display: start using drm_edid helpers to parse EDID caps Melissa Wen
2025-06-13 14:58 ` [PATCH v4 03/14] drm/amd/display: use drm_edid_product_id for parsing EDID product info Melissa Wen
2025-06-13 18:53 ` Mario Limonciello
2025-06-16 19:29 ` Melissa Wen
2025-06-13 14:58 ` [PATCH v4 04/14] drm/edid: introduce a helper that gets monitor name from drm_edid Melissa Wen
2025-06-13 14:58 ` [PATCH v4 05/14] drm/amd/display: get panel id with drm_edid helper Melissa Wen
2025-06-13 18:51 ` Mario Limonciello
2025-06-13 14:58 ` [PATCH v4 06/14] drm/amd/display: get SAD from drm_eld when parsing EDID caps Melissa Wen
2025-06-13 18:50 ` Mario Limonciello
2025-06-13 14:58 ` [PATCH v4 07/14] drm/amd/display: get SADB " Melissa Wen
2025-06-13 18:50 ` Mario Limonciello
2025-06-13 14:58 ` [PATCH v4 08/14] drm/amd/display: simplify dm_helpers_parse_edid_caps signature Melissa Wen
2025-06-13 14:58 ` [PATCH v4 09/14] drm/amd/display: change DC functions to accept private types for edid Melissa Wen
2025-06-13 14:58 ` Melissa Wen [this message]
2025-06-13 18:48 ` [PATCH v4 10/14] drm/amd/display: add a mid-layer file to handle EDID in DC Mario Limonciello
2025-06-16 19:27 ` Melissa Wen
2025-06-17 18:56 ` Rodrigo Siqueira
2025-06-17 18:58 ` Limonciello, Mario
2025-06-13 14:58 ` [PATCH v4 11/14] drm/amd/display: create a function to fill dc_sink with edid data Melissa Wen
2025-06-13 18:38 ` Mario Limonciello
2025-06-16 19:27 ` Melissa Wen
2025-06-13 14:58 ` [PATCH v4 12/14] drm/edid: introduce a helper that compares edid data from two drm_edid Melissa Wen
2025-06-13 18:35 ` Mario Limonciello
2025-06-16 19:26 ` Melissa Wen
2025-06-13 14:58 ` [PATCH v4 13/14] drm/amd/display: add drm_edid to dc_sink Melissa Wen
2025-06-13 15:58 ` Mario Limonciello
2025-06-13 17:42 ` Melissa Wen
2025-06-13 18:23 ` Mario Limonciello
2025-06-16 19:12 ` Melissa Wen
2025-06-13 14:58 ` [PATCH v4 14/14] drm/amd/display: move dc_sink from dc_edid to drm_edid Melissa Wen
2025-06-13 18:26 ` Mario Limonciello
2025-06-16 19:09 ` 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=20250613150015.245917-11-mwen@igalia.com \
--to=mwen@igalia.com \
--cc=airlied@gmail.com \
--cc=alex.hung@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jani.nikula@linux.intel.com \
--cc=kernel-dev@igalia.com \
--cc=mario.limonciello@amd.com \
--cc=michel.daenzer@mailbox.org \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).