From patchwork Fri May 31 20:37:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 13682144 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 64E0BC25B75 for ; Fri, 31 May 2024 20:38:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1F9D10E35B; Fri, 31 May 2024 20:38:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Wb9ElQb0"; dkim-atps=neutral Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id F20A210E2D9 for ; Fri, 31 May 2024 20:37:49 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 1C140CE1BBF; Fri, 31 May 2024 20:37:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 4B3BCC32786; Fri, 31 May 2024 20:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717187866; bh=8bGM/eiU7NTz6fPCc/iXWib0hQ5x48YiJgZm3kopRQw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Wb9ElQb0U6cg5Zx/iN10na0lbdtBy6xM001hqbPCBI2TB0QH0szKwLsTsbnRKqygJ Ozxz0ROMRXJDydbqseCjYrb2CZEaARALv3Zs24lURJhMwYKj5tCXVZI7hdWRFCn0b6 MsLsYWNvchlSzt+HK658s/eaJIzxPxEQFMdMdOBHq0ToGUAzJscQsGgpSjsjOj30b+ xwGbu/eK+aNW4X+ilIXFttSneKK64hUCn7AaV6lqJQVtQB987xW8CH93yhehXp2Hkc X6QNGegppWh4bcHSB1hye6wCwOo8xo87Dvq21SwQLoyVw4/go4xkF/rI2Bg7kcBYCU awz08vk35Z50Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4108FC27C50; Fri, 31 May 2024 20:37:46 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Fri, 31 May 2024 22:37:45 +0200 Subject: [PATCH 1/2] drm/mediatek: Drop chain_mode_fixup call in mode_valid() MIME-Version: 1.0 Message-Id: <20240531-bridge_chain_mode-v1-1-8b49e36c5dd3@ravnborg.org> References: <20240531-bridge_chain_mode-v1-0-8b49e36c5dd3@ravnborg.org> In-Reply-To: <20240531-bridge_chain_mode-v1-0-8b49e36c5dd3@ravnborg.org> To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Sam Ravnborg , Maxime Ripard , Laurent Pinchart , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , Dafna Hirschfeld , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717187864; l=2519; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=g2zVbjZcqkh2hiGY7iFzlHZfu3znz4lPoZjniC5HZeQ=; b=w1EiPCAd7or7aUVHQp8xtVRJNOSZi3rzqoyygcHYSDL0tXhq+4GnhDrFo1QaJLFVumuIe3eIJ3h4 mLJiwpcJBf0dYmx6OK/rqorlTGUd/cXH7dmKWbVIQxReLwBc+/tZ X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg 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: , Reply-To: sam@ravnborg.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sam Ravnborg The mode_valid implementation had a call to drm_bridge_chain_mode_fixup() which would be wrong as the mode_valid is not allowed to change anything - only to validate the mode. As the next bridge is often/always a connector the call had no effect anyway. So drop it. From the git history I could see this call was included in the original version of the driver so there was no help there to find out why it was added in the first place. But a lot has changed since the initial driver were added and is seems safe to remove the call now. v4: - Link to v3: https://lore.kernel.org/dri-devel/20220717174454.46616-4-sam@ravnborg.org/ - Rebase, and added acks/rb v3: - Link to v2: https://lore.kernel.org/dri-devel/20211020181901.2114645-6-sam@ravnborg.org/ v2: - Link to v1: https://lore.kernel.org/dri-devel/20210722062246.2512666-6-sam@ravnborg.org/ Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Reviewed-by: Laurent Pinchart Acked-by: Chun-Kuang Hu Cc: Chun-Kuang Hu Cc: Philipp Zabel Cc: Matthias Brugger Cc: Dafna Hirschfeld Cc: linux-mediatek@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 6e1cca97a654..0a90fe448d14 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1208,22 +1208,11 @@ mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) { struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge); - struct drm_bridge *next_bridge; dev_dbg(hdmi->dev, "xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), !!(mode->flags & DRM_MODE_FLAG_INTERLACE), mode->clock * 1000); - next_bridge = drm_bridge_get_next_bridge(&hdmi->bridge); - if (next_bridge) { - struct drm_display_mode adjusted_mode; - - drm_mode_init(&adjusted_mode, mode); - if (!drm_bridge_chain_mode_fixup(next_bridge, mode, - &adjusted_mode)) - return MODE_BAD; - } - if (hdmi->conf) { if (hdmi->conf->cea_modes_only && !drm_match_cea_mode(mode)) return MODE_BAD; From patchwork Fri May 31 20:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 13682143 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 7CB7DC25B75 for ; Fri, 31 May 2024 20:38:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC22710E2A1; Fri, 31 May 2024 20:38:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="h9F41wSU"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id F128810E2A1 for ; Fri, 31 May 2024 20:37:47 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E79F360C01; Fri, 31 May 2024 20:37:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 60A01C4AF09; Fri, 31 May 2024 20:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717187866; bh=WY531ZFWnLngKD/+q6EMBQ80fsxU9iBEBmfNN0fASI0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=h9F41wSUTOvzpThewcM4UF1PqEF9QEJ1Sa6H5Yi2OEH/S4eFxd0v6Hd/YbbOQ5zYJ hchmcaUZnP0ak+JWCK4oS7sdrouSK+ThkaT4I7G8WQ4IgfjAvWZ6X6+bYiZXB+QZhP pKEUuVepzPqWGSe7gxc/MpUPuLC0AJRC2oeHQb++2+diZ4tuy5W32fXjAp5Prguish /gcKj+q3vpRfFzagmFXTFi+3VR4S5rMmF2Z337zZNcf+ShDPY3scAyTqi/O447biSI EUaUEuPrgLaiRhZ88ySL+2a+a1zlYM65R3B3YZTBRZSpULbnXAuKhu2Tz4ZmxqREvs a4s8D0OoJzfTg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 554E9C27C51; Fri, 31 May 2024 20:37:46 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Fri, 31 May 2024 22:37:46 +0200 Subject: [PATCH 2/2] drm/bridge: Drop drm_bridge_chain_mode_fixup MIME-Version: 1.0 Message-Id: <20240531-bridge_chain_mode-v1-2-8b49e36c5dd3@ravnborg.org> References: <20240531-bridge_chain_mode-v1-0-8b49e36c5dd3@ravnborg.org> In-Reply-To: <20240531-bridge_chain_mode-v1-0-8b49e36c5dd3@ravnborg.org> To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Sam Ravnborg , Maxime Ripard , Laurent Pinchart , Laurent Pinchart , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717187865; l=2934; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=xm7f++qnfzJgiUWk6f8lnMbUPrsPBwFJAzI7MRE8MMU=; b=CYV+punnp4i5EnYOF7WM7p5Tr4giEsg9rQzS+q54fSTqfQKj23xN+cQ8ABZfaxDnbquEbl+6FoCW 5FR+KJ7MAX4qOtndDEElXMeSxZvkijk2u4hK5hiv1rVSiF1eblpM X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg 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: , Reply-To: sam@ravnborg.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sam Ravnborg There are no users left of drm_bridge_chain_mode_fixup() and we do not want to have this function available, so drop it. Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Reviewed-by: Laurent Pinchart Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter --- drivers/gpu/drm/drm_bridge.c | 37 ------------------------------------- include/drm/drm_bridge.h | 3 --- 2 files changed, 40 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 584d109330ab..d44f055dbe3e 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -467,43 +467,6 @@ void drm_bridge_detach(struct drm_bridge *bridge) * needed, in order to gradually transition to the new model. */ -/** - * drm_bridge_chain_mode_fixup - fixup proposed mode for all bridges in the - * encoder chain - * @bridge: bridge control structure - * @mode: desired mode to be set for the bridge - * @adjusted_mode: updated mode that works for this bridge - * - * Calls &drm_bridge_funcs.mode_fixup for all the bridges in the - * encoder chain, starting from the first bridge to the last. - * - * Note: the bridge passed should be the one closest to the encoder - * - * RETURNS: - * true on success, false on failure - */ -bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct drm_encoder *encoder; - - if (!bridge) - return true; - - encoder = bridge->encoder; - list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { - if (!bridge->funcs->mode_fixup) - continue; - - if (!bridge->funcs->mode_fixup(bridge, mode, adjusted_mode)) - return false; - } - - return true; -} -EXPORT_SYMBOL(drm_bridge_chain_mode_fixup); - /** * drm_bridge_chain_mode_valid - validate the mode against all bridges in the * encoder chain. diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 4baca0d9107b..5cf41f92d1f0 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -855,9 +855,6 @@ drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder) #define drm_for_each_bridge_in_chain(encoder, bridge) \ list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node) -bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); enum drm_mode_status drm_bridge_chain_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info,