From patchwork Tue Nov 12 18:34:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872824 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 D1E2DD32D81 for ; Tue, 12 Nov 2024 18:34:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FCF410E623; Tue, 12 Nov 2024 18:34:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="RDGPOH3d"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2478010E624; Tue, 12 Nov 2024 18:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436454; bh=ny7+lW1QmUhgPG79p69Qw+n9y/fGzw7D/iIT7aahRTg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RDGPOH3d7vcDKwgeYK2zkr8uPra5EsGDEpTxI9MqTfgAruNJ/p65p+DUUZBmhUOa9 c+oTa1j++EnYxPQTKbE/vJqqSbHG7EtU3AnjQ2bNPAAS3XngD2mNmy5UkhRCi33rYg 631EDRfWSdt1UR3QWZd7yLsLj6tiJAYMQ/rlRto4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:10 +0100 Subject: [PATCH v2 1/7] drm/amd/display: Remove spurious declaration of dm_helpers_get_sbios_edid() MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-1-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=1175; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=ny7+lW1QmUhgPG79p69Qw+n9y/fGzw7D/iIT7aahRTg=; b=3ar7M6gLBobRg5ww5czn+dI7lh1If/niMN9gX0UCr2oUTL0FjYA/4uZApdSJmiawvXuIOk5eV dBVAsiCboDaCX80Ebm5yTo3QSF/ZFuYzu8yjj8l11+9ghjYQowgzBJn X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" The prototype is the whole content of commit 575d0df6dae4 ("drm/amd/display: refine the EDID override"). Apparently the definition was never added. Fixes: 575d0df6dae4 ("drm/amd/display: refine the EDID override") Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dm_helpers.h b/drivers/gpu/drm/amd/display/dc/dm_helpers.h index 2e4a46f1b499d1dc990ef92a00fddf50287f3e05..483d8c29261814a608895abe1a195225514f78e6 100644 --- a/drivers/gpu/drm/amd/display/dc/dm_helpers.h +++ b/drivers/gpu/drm/amd/display/dc/dm_helpers.h @@ -208,8 +208,6 @@ int dm_helpers_dmub_set_config_sync(struct dc_context *ctx, enum set_config_status *operation_result); enum adaptive_sync_type dm_get_adaptive_sync_support_type(struct dc_link *link); -enum dc_edid_status dm_helpers_get_sbios_edid(struct dc_link *link, struct dc_edid *edid); - bool dm_helpers_is_fullscreen(struct dc_context *ctx, struct dc_stream_state *stream); bool dm_helpers_is_hdr_on(struct dc_context *ctx, struct dc_stream_state *stream); From patchwork Tue Nov 12 18:34:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872825 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 1FAB2D32D93 for ; Tue, 12 Nov 2024 18:34:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A999D10E624; Tue, 12 Nov 2024 18:34:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="J4NUoEcA"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 341F510E619; Tue, 12 Nov 2024 18:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436454; bh=ggkrDQamEbfGikQ2/25kOxpC8sUxK9EY9OaS4uOE/dU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=J4NUoEcAdZeAt8taC6/Lj1BcPHirHx/vAyF+tQwxuxR2HVhovJCxuSTBf5LGKKeOI YkwP+NF7fwQag0eTVkXLFPzVMyOtwd8DTGrvh5/0cd4UrIVELnnlSMdjWS09Wz+DBe rplLcGr2bF1JQPA4HsrbOWrFJJ9wrjqU22rBwwqo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:11 +0100 Subject: [PATCH v2 2/7] drm/amd/display: Remove EDID members of ddc_service MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-2-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=862; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=ggkrDQamEbfGikQ2/25kOxpC8sUxK9EY9OaS4uOE/dU=; b=/iJkJN3erXCyOgDcpF8uIbF9tLE+ktHmsPCK/iB3Y2eVFH5wLWvMP7/bamfB90mvNxmRMI4a6 3wdqYs8fAeLBAdEX62rQBxUAeen+hM2wqhEKK+L3mic5taogpoo2+9W X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" All usages of these fields have been removed. Fixes: 7c7f5b15be65 ("drm/amd/display: Refactor edid read.") Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h index 428e3a9ab65afb2fd146253b7db08e0571a12983..7dd1cfb9ab763c1e37d1cf6e27bbe4790a732f5b 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h @@ -189,10 +189,6 @@ struct ddc_service { enum display_dongle_type dongle_type; struct dc_context *ctx; struct dc_link *link; - - uint32_t address; - uint32_t edid_buf_len; - uint8_t edid_buf[DC_MAX_EDID_BUFFER_SIZE]; }; #endif /* DC_DDC_TYPES_H_ */ From patchwork Tue Nov 12 18:34:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872822 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 1A222D32D81 for ; Tue, 12 Nov 2024 18:34:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CDD810E61D; Tue, 12 Nov 2024 18:34:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="UxhbOJvi"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 864E110E626; Tue, 12 Nov 2024 18:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436454; bh=D8AJIQ5upY8eIDK7kgKoJ9mXt4n5iLxc9GyefKFO1as=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UxhbOJvinHsBreT0MEYShJ55mYn+jd99g2DRDSjfb6fxmT8DfkrFhLpH73JdvrCMA AbaoNK9KVj499S4vpkSsqXYqTVlRnK+mFsbTRqHSULd/lvD7sKYI5d6yGciPAzybB/ pKvTf7X3/5i666nKw8/lT/KDdpLT6N3Xcu7Gypmo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:12 +0100 Subject: [PATCH v2 3/7] drm/amd/display: Use struct edid in dc_link_add_remote_sink() MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-3-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=6543; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=D8AJIQ5upY8eIDK7kgKoJ9mXt4n5iLxc9GyefKFO1as=; b=p/EST7Fq9ZNgbLgF5pH1TNbVBowHlwlxeYHEDfTxcPgmBxwqUgl0Na1cQWg9vWVvm48ykZBgN /OKKLuJm1IDC4osAHQs6VcDWZZsn0sV+nsMS2COUquCMA+8BURaUx6U X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" The callers of dc_link_add_remote_sink() are using 'struct edid' which they all need to cast to uint8_t *. Allow the direct passing of 'struct edid' to avoid these cast and also move the length calculation so it does not need to be duplicated everywhere. Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 4 +--- drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c | 5 ++--- drivers/gpu/drm/amd/display/dc/dc.h | 6 ++---- drivers/gpu/drm/amd/display/dc/inc/link.h | 3 +-- drivers/gpu/drm/amd/display/dc/link/link_detection.c | 6 ++++-- drivers/gpu/drm/amd/display/dc/link/link_detection.h | 3 +-- 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index f0a6816709ca7dad6415d16f9806f18065026cf7..4a093aff4499add545f7beb654ace477036b46fb 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7242,8 +7242,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw() aconnector->dc_em_sink = dc_link_add_remote_sink( aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions + 1) * EDID_LENGTH, + edid, &init_params); if (aconnector->base.force == DRM_FORCE_ON) { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 6e43594906130c1cbea3e510e87d2013903b1bb5..554cc7a7216858ff10e138bf71ab826aa635afe8 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -327,7 +327,6 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) dc_sink = dc_link_add_remote_sink( aconnector->dc_link, NULL, - 0, &init_params); if (!dc_sink) { @@ -367,8 +366,7 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) edid = drm_edid_raw(aconnector->drm_edid); // FIXME: Get rid of drm_edid_raw() dc_sink = dc_link_add_remote_sink( aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions + 1) * EDID_LENGTH, + edid, &init_params); if (!dc_sink) { diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c index 457d60eeb486c228fde050b206fbe1c9043cdd33..be55165a16df65c623092906582ba7e81a141464 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c @@ -266,11 +266,10 @@ unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link) struct dc_sink *dc_link_add_remote_sink( struct dc_link *link, - const uint8_t *edid, - int len, + const struct edid *edid, struct dc_sink_init_data *init_data) { - return link->dc->link_srv->add_remote_sink(link, edid, len, init_data); + return link->dc->link_srv->add_remote_sink(link, edid, init_data); } void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink) diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index e143fab00a861c4f578167702c648d2b4b043945..7d5c790cab50987f361e1b4228562483a0f908f9 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -1846,14 +1846,12 @@ struct dc_sink_init_data; * called. * * @dc_link - link the remote sink will be added to. - * @edid - byte array of EDID raw data. - * @len - size of the edid in byte + * @edid - EDID data. * @init_data - */ struct dc_sink *dc_link_add_remote_sink( struct dc_link *dc_link, - const uint8_t *edid, - int len, + const struct edid *edid, struct dc_sink_init_data *init_data); /* Remove remote sink from a link with dc_connection_mst_branch connection type. diff --git a/drivers/gpu/drm/amd/display/dc/inc/link.h b/drivers/gpu/drm/amd/display/dc/inc/link.h index f04292086c08a081fce8e780c584a0ce66668f12..76bac2e773b0f5036b82942ed90b9c43c6558d4c 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/link.h +++ b/drivers/gpu/drm/amd/display/dc/inc/link.h @@ -109,8 +109,7 @@ struct link_service { enum dc_connection_type *type); struct dc_sink *(*add_remote_sink)( struct dc_link *link, - const uint8_t *edid, - int len, + const struct edid *edid, struct dc_sink_init_data *init_data); void (*remove_remote_sink)(struct dc_link *link, struct dc_sink *sink); bool (*get_hpd_state)(struct dc_link *link); 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 e026c728042a5f47decbc3e7c80583c0d31fa700..05adaf8248b1b11675aa9e86a24fa24a2a811e01 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 + // Offset DPCD 050Eh == 0x5A #define MST_HUB_ID_0x5A 0x5A @@ -1390,10 +1392,10 @@ static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink struct dc_sink *link_add_remote_sink( struct dc_link *link, - const uint8_t *edid, - int len, + const struct edid *edid, struct dc_sink_init_data *init_data) { + int len = edid ? (edid->extensions + 1) * EDID_LENGTH : 0; struct dc_sink *dc_sink; enum dc_edid_status edid_status; diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.h b/drivers/gpu/drm/amd/display/dc/link/link_detection.h index 7da05078721ef4d9a2e10c52da4eb30510d9c160..dec5001411be2c008c8684f474b020bf78278442 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_detection.h +++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.h @@ -31,8 +31,7 @@ bool link_detect_connection_type(struct dc_link *link, enum dc_connection_type *type); struct dc_sink *link_add_remote_sink( struct dc_link *link, - const uint8_t *edid, - int len, + const struct edid *edid, struct dc_sink_init_data *init_data); void link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink); bool link_reset_cur_dp_mst_topology(struct dc_link *link); From patchwork Tue Nov 12 18:34:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872828 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 07D9AD32D81 for ; Tue, 12 Nov 2024 18:34:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14D5F10E626; Tue, 12 Nov 2024 18:34:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="DLcfL/Dm"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF18210E628; Tue, 12 Nov 2024 18:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436455; bh=vfFChF/mpp6Y+jDrgJ5oMCTjoYQYj2LykqmDiJ4JUdM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DLcfL/Dm2Wdt/G0Rm1Orx9BPNsGUFNEpvhFSkvw4FkMXYYxSf+j4YOmR3WuNw0w0z kL/1pxIFrqo+MWrqoifeCpOxLAtf6yRLGCKf8FLoY7VjAP5zLDudN/v8O4M51SoJpG y2gLSSuWo8FlaWN0GBaGxWyyj3WYIa1OwqrPVAdk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:13 +0100 Subject: [PATCH v2 4/7] drm/amdgpu: Switch amdgpu_connector to struct drm_edid MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-4-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=12081; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=vfFChF/mpp6Y+jDrgJ5oMCTjoYQYj2LykqmDiJ4JUdM=; b=dcV7EfOiqydNPq1zRiKd6HRHf2cgRV9aBENDSY/UjbpcVttE9spvVaSQmDOz59csrxyOGQq6g meeoVQVJENVBujWx0YHR6PFoPvECnPaXLmbTLJrLIhmmeZVl4/om0MD X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" "struct drm_edid" is the safe and recommended alternative to "struct edid". Rename the member to make sure that no usage sites are missed, as "struct drm_edid" has some restrictions, for example it can not be used with kfree(). Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 55 +++++++++++++------------- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 3 +- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 4 +- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 344e0a9ee08a99a7e874e4ed31c28901b7ea25b0..436f9ae0959f650102ac0ea372195da5d22c7ec9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -246,10 +246,10 @@ amdgpu_connector_find_encoder(struct drm_connector *connector, return NULL; } -static struct edid * +static const struct drm_edid * amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev) { - return drm_edid_duplicate(drm_edid_raw(adev->mode_info.bios_hardcoded_edid)); + return drm_edid_dup(adev->mode_info.bios_hardcoded_edid); } static void amdgpu_connector_get_edid(struct drm_connector *connector) @@ -258,7 +258,7 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector) struct amdgpu_device *adev = drm_to_adev(dev); struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); - if (amdgpu_connector->edid) + if (amdgpu_connector->drm_edid) return; /* on hw with routers, select right port */ @@ -268,8 +268,8 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector) if ((amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) != ENCODER_OBJECT_ID_NONE) && amdgpu_connector->ddc_bus->has_aux) { - amdgpu_connector->edid = drm_get_edid(connector, - &amdgpu_connector->ddc_bus->aux.ddc); + amdgpu_connector->drm_edid = drm_edid_read_ddc( + connector, &amdgpu_connector->ddc_bus->aux.ddc); } else if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) || (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { struct amdgpu_connector_atom_dig *dig = amdgpu_connector->con_priv; @@ -277,32 +277,33 @@ static void amdgpu_connector_get_edid(struct drm_connector *connector) if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && amdgpu_connector->ddc_bus->has_aux) - amdgpu_connector->edid = drm_get_edid(connector, - &amdgpu_connector->ddc_bus->aux.ddc); + amdgpu_connector->drm_edid = drm_edid_read_ddc( + connector, &amdgpu_connector->ddc_bus->aux.ddc); else if (amdgpu_connector->ddc_bus) - amdgpu_connector->edid = drm_get_edid(connector, - &amdgpu_connector->ddc_bus->adapter); + amdgpu_connector->drm_edid = drm_edid_read_ddc( + connector, &amdgpu_connector->ddc_bus->adapter); } else if (amdgpu_connector->ddc_bus) { - amdgpu_connector->edid = drm_get_edid(connector, - &amdgpu_connector->ddc_bus->adapter); + amdgpu_connector->drm_edid = drm_edid_read_ddc( + connector, &amdgpu_connector->ddc_bus->adapter); } - if (!amdgpu_connector->edid) { + if (!amdgpu_connector->drm_edid) { /* some laptops provide a hardcoded edid in rom for LCDs */ if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) || (connector->connector_type == DRM_MODE_CONNECTOR_eDP))) { - amdgpu_connector->edid = amdgpu_connector_get_hardcoded_edid(adev); - drm_connector_update_edid_property(connector, amdgpu_connector->edid); + amdgpu_connector->drm_edid = amdgpu_connector_get_hardcoded_edid(adev); } } + + drm_edid_connector_update(connector, amdgpu_connector->drm_edid); } static void amdgpu_connector_free_edid(struct drm_connector *connector) { struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); - kfree(amdgpu_connector->edid); - amdgpu_connector->edid = NULL; + drm_edid_free(amdgpu_connector->drm_edid); + amdgpu_connector->drm_edid = NULL; } static int amdgpu_connector_ddc_get_modes(struct drm_connector *connector) @@ -310,12 +311,12 @@ static int amdgpu_connector_ddc_get_modes(struct drm_connector *connector) struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); int ret; - if (amdgpu_connector->edid) { - drm_connector_update_edid_property(connector, amdgpu_connector->edid); - ret = drm_add_edid_modes(connector, amdgpu_connector->edid); + if (amdgpu_connector->drm_edid) { + drm_edid_connector_update(connector, amdgpu_connector->drm_edid); + ret = drm_edid_connector_add_modes(connector); return ret; } - drm_connector_update_edid_property(connector, NULL); + drm_edid_connector_update(connector, NULL); return 0; } @@ -731,7 +732,7 @@ amdgpu_connector_lvds_detect(struct drm_connector *connector, bool force) /* check for edid as well */ amdgpu_connector_get_edid(connector); - if (amdgpu_connector->edid) + if (amdgpu_connector->drm_edid) ret = connector_status_connected; /* check acpi lid status ??? */ @@ -881,13 +882,13 @@ amdgpu_connector_vga_detect(struct drm_connector *connector, bool force) amdgpu_connector_free_edid(connector); amdgpu_connector_get_edid(connector); - if (!amdgpu_connector->edid) { + if (!amdgpu_connector->drm_edid) { DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", connector->name); ret = connector_status_connected; } else { - amdgpu_connector->use_digital = - !!(amdgpu_connector->edid->input & DRM_EDID_INPUT_DIGITAL); + amdgpu_connector->use_digital = drm_edid_is_digital( + amdgpu_connector->drm_edid); /* some oems have boards with separate digital and analog connectors * with a shared ddc line (often vga + hdmi) @@ -1062,14 +1063,14 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force) amdgpu_connector_free_edid(connector); amdgpu_connector_get_edid(connector); - if (!amdgpu_connector->edid) { + if (!amdgpu_connector->drm_edid) { DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", connector->name); ret = connector_status_connected; broken_edid = true; /* defer use_digital to later */ } else { - amdgpu_connector->use_digital = - !!(amdgpu_connector->edid->input & DRM_EDID_INPUT_DIGITAL); + amdgpu_connector->use_digital = drm_edid_is_digital( + amdgpu_connector->drm_edid); /* some oems have boards with separate digital and analog connectors * with a shared ddc line (often vga + hdmi) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 5e3faefc5510914e8865147b9788e7093517eeb7..e584997c77776c1128f2aa431c9aec7477daf48a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h @@ -50,7 +50,6 @@ struct amdgpu_device; struct amdgpu_encoder; struct amdgpu_router; struct amdgpu_hpd; -struct edid; struct drm_edid; #define to_amdgpu_crtc(x) container_of(x, struct amdgpu_crtc, base) @@ -623,7 +622,7 @@ struct amdgpu_connector { bool use_digital; /* we need to mind the EDID between detect and get modes due to analog/digital/tvencoder */ - struct edid *edid; + const struct drm_edid *drm_edid; void *con_priv; bool dac_load_detect; bool detected_by_load; /* if the connection status was determined by load */ diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 5098c50d54c85a147cc582ab42840c3868edf8b5..8c3e1c0d86cf273a5e4b7f30088368d61d8d5881 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -1299,7 +1299,7 @@ static void dce_v10_0_audio_write_speaker_allocation(struct drm_encoder *encoder return; } - sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb); + sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->drm_edid), &sadb); if (sad_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); sad_count = 0; @@ -1369,7 +1369,7 @@ static void dce_v10_0_audio_write_sad_regs(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads); + sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->drm_edid), &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index c5680ff4ab9fd8f2127c55f83e6d1562b3430e5d..a3b6436d08b0ef4274adfed16b0cde4f3971e3b9 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -1331,7 +1331,7 @@ static void dce_v11_0_audio_write_speaker_allocation(struct drm_encoder *encoder return; } - sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb); + sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->drm_edid), &sadb); if (sad_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); sad_count = 0; @@ -1401,7 +1401,7 @@ static void dce_v11_0_audio_write_sad_regs(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads); + sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->drm_edid), &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index eb7de9122d99f7208e3ca5b1c86ecd10766be5b1..482879b7e4464de0b7f2c9eaa1c16370dc7e28d8 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -1217,7 +1217,7 @@ static void dce_v6_0_audio_write_speaker_allocation(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb); + sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->drm_edid), &sadb); if (sad_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); sad_count = 0; @@ -1292,7 +1292,7 @@ static void dce_v6_0_audio_write_sad_regs(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads); + sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->drm_edid), &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index 04b79ff87f756c75dba16fa34ef115bea74cf805..9ec004101a115e70f4dff9e40b4f67c898153f42 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -1272,7 +1272,7 @@ static void dce_v8_0_audio_write_speaker_allocation(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb); + sad_count = drm_edid_to_speaker_allocation(drm_edid_raw(amdgpu_connector->drm_edid), &sadb); if (sad_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); sad_count = 0; @@ -1340,7 +1340,7 @@ static void dce_v8_0_audio_write_sad_regs(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads); + sad_count = drm_edid_to_sad(drm_edid_raw(amdgpu_connector->drm_edid), &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) From patchwork Tue Nov 12 18:34:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872829 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 BFB3DD42BBF for ; Tue, 12 Nov 2024 18:34:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B59810E627; Tue, 12 Nov 2024 18:34:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="K5C/EeWl"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0410F10E626; Tue, 12 Nov 2024 18:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436455; bh=qCgxSe+6OiA7qFuTKE7GRpdlVfifdiH0Ryq6gKTEzEE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=K5C/EeWle3iIZPHCNHmBNVNBtj2GXAHlywd8e0zeV7oCkMMlyes5GdOWBLrRrimT4 5Hlbmb7etz0V/USXl7QVi4WqoVFAEEk1t/QFq4/7VQBF7wqNJ7ehvcTaFxLSgcL3jq KXXa3hFnPgoD/sLiIAYg4WJlgKIMNajQ1/Gp/5mg= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:14 +0100 Subject: [PATCH v2 5/7] drm/amd/display: Switch dc_sink to struct drm_edid MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-5-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=12701; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=qCgxSe+6OiA7qFuTKE7GRpdlVfifdiH0Ryq6gKTEzEE=; b=JJ1lDa5Po+Q08N1NaTjpiwDbGSFVL1muYt4aSsmnVvRSAvGXyreWmc+jf4Ab5AhPqpQ40vqP4 ul/WiGW0nW5D/8TYQhzzs0SOWxnHnNS4swN80DcsZofr3cI+klWYVOi X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" The custom "struct dc_edid" can be replaced by the standard "struct drm_edid. Rename the member to make sure that no usage sites are missed, as "struct drm_edid" has some restrictions, for example it can not be used with kfree(). Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++------ .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 27 ++++++------- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 3 -- drivers/gpu/drm/amd/display/dc/dc_types.h | 5 --- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 2 +- .../gpu/drm/amd/display/dc/link/link_detection.c | 44 ++++++++++++---------- 7 files changed, 43 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 4a093aff4499add545f7beb654ace477036b46fb..b09e13aed570756655b94647d4346c722a02e34a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3594,15 +3594,13 @@ void amdgpu_dm_update_connector_after_detect( aconnector->dc_sink = sink; dc_sink_retain(aconnector->dc_sink); - if (sink->dc_edid.length == 0) { + if (!sink->drm_edid) { aconnector->drm_edid = NULL; if (aconnector->dc_link->aux_mode) { drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux); } } else { - const struct edid *edid = (const struct edid *)sink->dc_edid.raw_edid; - - aconnector->drm_edid = drm_edid_alloc(edid, sink->dc_edid.length); + aconnector->drm_edid = drm_edid_dup(sink->drm_edid); drm_edid_connector_update(connector, aconnector->drm_edid); if (aconnector->dc_link->aux_mode) @@ -7185,15 +7183,10 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector) aconnector->drm_edid = drm_edid; /* Update emulated (virtual) sink's EDID */ if (dc_em_sink && dc_link) { - // FIXME: Get rid of drm_edid_raw() - const struct edid *edid = drm_edid_raw(drm_edid); - - memset(&dc_em_sink->edid_caps, 0, sizeof(struct dc_edid_caps)); - memmove(dc_em_sink->dc_edid.raw_edid, edid, - (edid->extensions + 1) * EDID_LENGTH); + dc_em_sink->drm_edid = drm_edid_dup(drm_edid); dm_helpers_parse_edid_caps( dc_link, - &dc_em_sink->dc_edid, + dc_em_sink->drm_edid, &dc_em_sink->edid_caps); } } diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index b0fea0856866d68b2e78a9f141effe2777ea26ee..57b4a58eb9c8bfcb7b76622cf303ba01450e30ba 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -48,14 +48,14 @@ #include "ddc_service_types.h" #include "clk_mgr.h" -static u32 edid_extract_panel_id(struct edid *edid) +static u32 edid_extract_panel_id(const struct edid *edid) { return (u32)edid->mfg_id[0] << 24 | (u32)edid->mfg_id[1] << 16 | (u32)EDID_PRODUCT_ID(edid); } -static void apply_edid_quirks(struct edid *edid, struct dc_edid_caps *edid_caps) +static void apply_edid_quirks(const struct edid *edid, struct dc_edid_caps *edid_caps) { uint32_t panel_id = edid_extract_panel_id(edid); @@ -89,19 +89,19 @@ static void apply_edid_quirks(struct edid *edid, struct dc_edid_caps *edid_caps) * dm_helpers_parse_edid_caps() - Parse edid caps * * @link: current detected link - * @edid: [in] pointer to edid + * @drm_edid: [in] pointer to edid * @edid_caps: [in] pointer to edid caps * * Return: void */ enum dc_edid_status dm_helpers_parse_edid_caps( struct dc_link *link, - const struct dc_edid *edid, + const struct drm_edid *drm_edid, struct dc_edid_caps *edid_caps) { struct amdgpu_dm_connector *aconnector = link->priv; struct drm_connector *connector = &aconnector->base; - struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL; + const struct edid *edid_buf = drm_edid_raw(drm_edid); struct cea_sad *sads; int sad_count = -1; int sadb_count = -1; @@ -110,10 +110,10 @@ enum dc_edid_status dm_helpers_parse_edid_caps( enum dc_edid_status result = EDID_OK; - if (!edid_caps || !edid) + if (!edid_caps || !drm_edid) return EDID_BAD_INPUT; - if (!drm_edid_is_valid(edid_buf)) + if (!drm_edid_valid(drm_edid)) result = EDID_BAD_CHECKSUM; edid_caps->manufacturer_id = (uint16_t) edid_buf->mfg_id[0] | @@ -132,7 +132,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( apply_edid_quirks(edid_buf, edid_caps); - sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); + sad_count = drm_edid_to_sad(edid_buf, &sads); if (sad_count <= 0) return result; @@ -146,7 +146,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->audio_modes[i].sample_size = sad->byte2; } - sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb); + sadb_count = drm_edid_to_speaker_allocation(edid_buf, &sadb); if (sadb_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sadb_count); @@ -966,7 +966,6 @@ enum dc_edid_status dm_helpers_read_local_edid( int retry = 3; enum dc_edid_status edid_status; const struct drm_edid *drm_edid; - const struct edid *edid; if (link->aux_mode) ddc = &aconnector->dm_dp_aux.aux.ddc; @@ -996,16 +995,14 @@ enum dc_edid_status dm_helpers_read_local_edid( if (!drm_edid) return EDID_NO_RESPONSE; - edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw() - sink->dc_edid.length = EDID_LENGTH * (edid->extensions + 1); - memmove(sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); + sink->drm_edid = drm_edid_dup(drm_edid); /* We don't need the original edid anymore */ drm_edid_free(drm_edid); edid_status = dm_helpers_parse_edid_caps( link, - &sink->dc_edid, + sink->drm_edid, &sink->edid_caps); } while (edid_status == EDID_BAD_CHECKSUM && --retry > 0); @@ -1032,7 +1029,7 @@ enum dc_edid_status dm_helpers_read_local_edid( dm_helpers_dp_write_dpcd(ctx, link, DP_TEST_EDID_CHECKSUM, - &sink->dc_edid.raw_edid[sink->dc_edid.length-1], + &drm_edid_raw(sink->drm_edid)->checksum, 1); dm_helpers_dp_write_dpcd(ctx, diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 7d5c790cab50987f361e1b4228562483a0f908f9..60f535fd39620b5657c1bc34b7f2e1509f62a5f3 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -2389,7 +2389,7 @@ struct scdc_caps { */ struct dc_sink { enum signal_type sink_signal; - struct dc_edid dc_edid; /* raw edid */ + const struct drm_edid *drm_edid; /* raw edid */ struct dc_edid_caps edid_caps; /* parse display caps */ struct dc_container_id *dc_container_id; uint32_t dongle_max_pix_clk; diff --git a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h index 7dd1cfb9ab763c1e37d1cf6e27bbe4790a732f5b..6e0a457b7551dcec06614bab0aedbbf5f9ec3ff0 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h @@ -178,9 +178,6 @@ enum display_dongle_type { DISPLAY_DONGLE_DP_HDMI_MISMATCHED_DONGLE, }; -#define DC_MAX_EDID_BUFFER_SIZE 2048 -#define DC_EDID_BLOCK_SIZE 128 - struct ddc_service { struct ddc *ddc_pin; struct ddc_flags flags; diff --git a/drivers/gpu/drm/amd/display/dc/dc_types.h b/drivers/gpu/drm/amd/display/dc/dc_types.h index edf4df1d03b58ca97a23bfe97f7bd9651b21517b..d16be380d3eda73adfeee63eabca6836d3a36df0 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_types.h @@ -149,11 +149,6 @@ struct dc_cea_audio_mode { }; }; -struct dc_edid { - uint32_t length; - uint8_t raw_edid[DC_MAX_EDID_BUFFER_SIZE]; -}; - /* When speaker location data block is not available, DEFAULT_SPEAKER_LOCATION * is used. In this case we assume speaker location are: front left, front * right and front center. */ diff --git a/drivers/gpu/drm/amd/display/dc/dm_helpers.h b/drivers/gpu/drm/amd/display/dc/dm_helpers.h index 483d8c29261814a608895abe1a195225514f78e6..5a3d4bf7c370f08babc052f259d26a1a291d4c72 100644 --- a/drivers/gpu/drm/amd/display/dc/dm_helpers.h +++ b/drivers/gpu/drm/amd/display/dc/dm_helpers.h @@ -61,7 +61,7 @@ void dm_helpers_free_gpu_mem( enum dc_edid_status dm_helpers_parse_edid_caps( struct dc_link *link, - const struct dc_edid *edid, + const struct drm_edid *drm_edid, struct dc_edid_caps *edid_caps); 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 05adaf8248b1b11675aa9e86a24fa24a2a811e01..f13b4e8929d5b217495b5fd29c4da7248a01a8e6 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c @@ -618,16 +618,25 @@ 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) +static bool is_same_edid(const struct drm_edid *old_drm_edid, + const struct drm_edid *new_drm_edid) { - if (old_edid->length != new_edid->length) + const struct edid *old_edid, *new_edid; + size_t old_edid_length, new_edid_length; + + old_edid = drm_edid_raw(old_drm_edid); + new_edid = drm_edid_raw(new_drm_edid); + + if (!old_edid || !new_edid) return false; - if (new_edid->length == 0) + old_edid_length = (old_edid->extensions + 1) * EDID_LENGTH; + new_edid_length = (new_edid->extensions + 1) * EDID_LENGTH; + + if (old_edid_length != new_edid_length) return false; - return (memcmp(old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) == 0); + return memcmp(old_edid, new_edid, old_edid_length) == 0; } static bool wait_for_entering_dp_alt_mode(struct dc_link *link) @@ -878,6 +887,7 @@ static bool detect_link_and_local_sink(struct dc_link *link, struct dpcd_caps prev_dpcd_caps; enum dc_connection_type new_connection_type = dc_connection_none; const uint32_t post_oui_delay = 30; // 30ms + const struct edid *edid; DC_LOGGER_INIT(link->ctx->logger); @@ -1112,8 +1122,8 @@ 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 = is_same_edid(prev_sink->drm_edid, + sink->drm_edid); if (sink->edid_caps.panel_patch.skip_scdc_overwrite) link->ctx->dc->debug.hdmi20_disable = true; @@ -1150,11 +1160,12 @@ static bool detect_link_and_local_sink(struct dc_link *link, if (link->local_sink && dc_is_dp_signal(sink_caps.signal)) dp_trace_init(link); + edid = drm_edid_raw(sink->drm_edid); /* Connectivity log: detection */ - for (i = 0; i < sink->dc_edid.length / DC_EDID_BLOCK_SIZE; i++) { + for (i = 0; i < edid->extensions + 1; i++) { CONN_DATA_DETECT(link, - &sink->dc_edid.raw_edid[i * DC_EDID_BLOCK_SIZE], - DC_EDID_BLOCK_SIZE, + edid + i, + EDID_LENGTH, "%s: [Block %d] ", sink->edid_caps.display_name, i); } @@ -1399,11 +1410,6 @@ struct dc_sink *link_add_remote_sink( struct dc_sink *dc_sink; enum dc_edid_status edid_status; - if (len > DC_MAX_EDID_BUFFER_SIZE) { - dm_error("Max EDID buffer size breached!\n"); - return NULL; - } - if (!init_data) { BREAK_TO_DEBUGGER(); return NULL; @@ -1419,8 +1425,7 @@ struct dc_sink *link_add_remote_sink( if (!dc_sink) return NULL; - memmove(dc_sink->dc_edid.raw_edid, edid, len); - dc_sink->dc_edid.length = len; + dc_sink->drm_edid = drm_edid_alloc(edid, len); if (!link_add_remote_sink_helper( link, @@ -1429,7 +1434,7 @@ struct dc_sink *link_add_remote_sink( edid_status = dm_helpers_parse_edid_caps( link, - &dc_sink->dc_edid, + dc_sink->drm_edid, &dc_sink->edid_caps); /* @@ -1437,7 +1442,8 @@ struct dc_sink *link_add_remote_sink( * parsing fails */ if (edid_status != EDID_OK && edid_status != EDID_PARTIAL_VALID) { - dc_sink->dc_edid.length = 0; + drm_edid_free(dc_sink->drm_edid); + dc_sink->drm_edid = NULL; dm_error("Bad EDID, status%d!\n", edid_status); } From patchwork Tue Nov 12 18:34:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872826 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 398A6D42BBF for ; Tue, 12 Nov 2024 18:34:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9873510E61B; Tue, 12 Nov 2024 18:34:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="trWuKTH6"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3963310E62E; Tue, 12 Nov 2024 18:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436455; bh=GQbAFEDWc3+fqXey0UCnib602pu/hNtipXn2veTOQnE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=trWuKTH6f5Cm+jMlyBaJwqdnRcGUxNEXY17GJ5McYfCxpCUrl7YaM54ykLW2nIDX4 88mFmPzX8Ggw46/R98XaMq4Y7tJrTNAgxwmfk4NL9sSszRBZith+B09bpTDJeFCWS+ ZrLaODco5BWN790kX2SflQCvlCQ333t6+i0Ganqs= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:15 +0100 Subject: [PATCH v2 6/7] drm/amd/display: Drop opencoded edid panel id extraction MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-6-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=1611; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=GQbAFEDWc3+fqXey0UCnib602pu/hNtipXn2veTOQnE=; b=BV0quP0krDQKRm6g1QR1UItqHJe3GadXKHvPM5oEacRP9OTIyVhR+ESaBNNakuCVBBg9ZIVQI N224eyv7XrvC5BhtHt+rG9GsUcBq1ZjK689gN/i8Sh2PjB5hxkG8+bM X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" Now that a struct drm_edid is available make use of the standard drm_edid_get_panel_id(). Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index 57b4a58eb9c8bfcb7b76622cf303ba01450e30ba..6f51395bf02cd6fd647de5c1a63822853deb23c9 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -48,16 +48,9 @@ #include "ddc_service_types.h" #include "clk_mgr.h" -static u32 edid_extract_panel_id(const struct edid *edid) +static void apply_edid_quirks(const struct drm_edid *edid, struct dc_edid_caps *edid_caps) { - return (u32)edid->mfg_id[0] << 24 | - (u32)edid->mfg_id[1] << 16 | - (u32)EDID_PRODUCT_ID(edid); -} - -static void apply_edid_quirks(const struct edid *edid, struct dc_edid_caps *edid_caps) -{ - uint32_t panel_id = edid_extract_panel_id(edid); + u32 panel_id = drm_edid_get_panel_id(edid); switch (panel_id) { /* Workaround for some monitors which does not work well with FAMS */ @@ -130,7 +123,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->edid_hdmi = connector->display_info.is_hdmi; - apply_edid_quirks(edid_buf, edid_caps); + apply_edid_quirks(drm_edid, edid_caps); sad_count = drm_edid_to_sad(edid_buf, &sads); if (sad_count <= 0) From patchwork Tue Nov 12 18:34:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13872827 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 3035ED32D93 for ; Tue, 12 Nov 2024 18:34:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3CD810E61E; Tue, 12 Nov 2024 18:34:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=weissschuh.net header.i=@weissschuh.net header.b="rMalO9Ta"; dkim-atps=neutral Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by gabe.freedesktop.org (Postfix) with ESMTPS id 130C410E62D; Tue, 12 Nov 2024 18:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1731436455; bh=OCMki1vQqbDliRkOMezACkpm1Q36q6wLOkTgwor2sVw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rMalO9TaEUVfeVBWfJC8vJPCeZyaLbaD3ioHhJ2otPSxCRAZzRd3nPeXNEYucB5H9 W6ncVnx7bpKq7Mb3eFqODFpvcH6DvaLfOZz7cpnrkf8N74g98IBITim9N6mJ1gBA46 x/r6DycF3Ubt4KaYLI18UbdPcXM3mClAE9OyaXLU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Nov 2024 19:34:16 +0100 Subject: [PATCH v2 7/7] drm/amd/display: Switch dc_link_add_remote_sink() to struct drm_edid MIME-Version: 1.0 Message-Id: <20241112-amdgpu-drm_edid-v2-7-1399dc0f0469@weissschuh.net> References: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> In-Reply-To: <20241112-amdgpu-drm_edid-v2-0-1399dc0f0469@weissschuh.net> To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , jinzh , Aric Cyr , Alan Liu , Tony Cheng , Andrey Grodzovsky , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Melissa Wen , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1731436454; l=6539; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=OCMki1vQqbDliRkOMezACkpm1Q36q6wLOkTgwor2sVw=; b=ivWuWrGWBTBrHZtGZ8K6EFZ4S0boWjcegIJwbAhytLAqAYLmxQnpjj5yol6OlTrlX/w3mHYvQ MNeJgFiZ5GEAZGjhTpMZ6kKzVtivWazGXTH+sJRlyDxt87rFx9IRHkH X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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" "struct drm_edid" is the safe and recommended alternative to "struct edid". Now that all callers of dc_link_add_remote_sink() have access to a validate struct drm_edid, pass it around directly. Signed-off-by: Thomas Weißschuh --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 4 +--- drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c | 4 ++-- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/link.h | 2 +- drivers/gpu/drm/amd/display/dc/link/link_detection.c | 5 ++--- drivers/gpu/drm/amd/display/dc/link/link_detection.h | 2 +- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index b09e13aed570756655b94647d4346c722a02e34a..a555809f2691001b26fc2cbcd3dff41484521365 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7218,7 +7218,6 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) .sink_signal = SIGNAL_TYPE_VIRTUAL }; const struct drm_edid *drm_edid; - const struct edid *edid; drm_edid = drm_edid_read(connector); drm_edid_connector_update(connector, drm_edid); @@ -7232,10 +7231,9 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) aconnector->drm_edid = drm_edid; - edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw() aconnector->dc_em_sink = dc_link_add_remote_sink( aconnector->dc_link, - edid, + drm_edid, &init_params); if (aconnector->base.force == DRM_FORCE_ON) { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 554cc7a7216858ff10e138bf71ab826aa635afe8..df70f6bc92a3fa247aa9389ab29d8e249bb683ab 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -361,12 +361,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST }; - const struct edid *edid; - edid = drm_edid_raw(aconnector->drm_edid); // FIXME: Get rid of drm_edid_raw() dc_sink = dc_link_add_remote_sink( aconnector->dc_link, - edid, + aconnector->drm_edid, &init_params); if (!dc_sink) { diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c index be55165a16df65c623092906582ba7e81a141464..26c975ec7861848d458d13190cb173c6e1003cef 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c @@ -266,10 +266,10 @@ unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link) struct dc_sink *dc_link_add_remote_sink( struct dc_link *link, - const struct edid *edid, + const struct drm_edid *drm_edid, struct dc_sink_init_data *init_data) { - return link->dc->link_srv->add_remote_sink(link, edid, init_data); + return link->dc->link_srv->add_remote_sink(link, drm_edid, init_data); } void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink) diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 60f535fd39620b5657c1bc34b7f2e1509f62a5f3..b12f95ba7dcd29f2722d0e9d498295c34de40b2a 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -1851,7 +1851,7 @@ struct dc_sink_init_data; */ struct dc_sink *dc_link_add_remote_sink( struct dc_link *dc_link, - const struct edid *edid, + const struct drm_edid *drm_edid, struct dc_sink_init_data *init_data); /* Remove remote sink from a link with dc_connection_mst_branch connection type. diff --git a/drivers/gpu/drm/amd/display/dc/inc/link.h b/drivers/gpu/drm/amd/display/dc/inc/link.h index 76bac2e773b0f5036b82942ed90b9c43c6558d4c..12a452315b0ee84412b36c66b231658837186537 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/link.h +++ b/drivers/gpu/drm/amd/display/dc/inc/link.h @@ -109,7 +109,7 @@ struct link_service { enum dc_connection_type *type); struct dc_sink *(*add_remote_sink)( struct dc_link *link, - const struct edid *edid, + const struct drm_edid *drm_edid, struct dc_sink_init_data *init_data); void (*remove_remote_sink)(struct dc_link *link, struct dc_sink *sink); bool (*get_hpd_state)(struct dc_link *link); 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 f13b4e8929d5b217495b5fd29c4da7248a01a8e6..387117863c9e8af6298b07d2040a4372f94c8c88 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c @@ -1403,10 +1403,9 @@ static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink struct dc_sink *link_add_remote_sink( struct dc_link *link, - const struct edid *edid, + const struct drm_edid *drm_edid, struct dc_sink_init_data *init_data) { - int len = edid ? (edid->extensions + 1) * EDID_LENGTH : 0; struct dc_sink *dc_sink; enum dc_edid_status edid_status; @@ -1425,7 +1424,7 @@ struct dc_sink *link_add_remote_sink( if (!dc_sink) return NULL; - dc_sink->drm_edid = drm_edid_alloc(edid, len); + dc_sink->drm_edid = drm_edid_dup(drm_edid); if (!link_add_remote_sink_helper( link, diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.h b/drivers/gpu/drm/amd/display/dc/link/link_detection.h index dec5001411be2c008c8684f474b020bf78278442..c35b4f5304c6e8bcbb6f998962d089b43104db89 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_detection.h +++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.h @@ -31,7 +31,7 @@ bool link_detect_connection_type(struct dc_link *link, enum dc_connection_type *type); struct dc_sink *link_add_remote_sink( struct dc_link *link, - const struct edid *edid, + const struct drm_edid *drm_edid, struct dc_sink_init_data *init_data); void link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink); bool link_reset_cur_dp_mst_topology(struct dc_link *link);