From patchwork Sun Jul 17 17:58:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920619 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7188FC433EF for ; Sun, 17 Jul 2022 17:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Q5AK+4NypIlk8rRS3I711RmXejfY0OnnESySL2cldlE=; b=rxYFEaxqqCsg3sYseVEWgdWDs8 qRi0niXUYT+ovodd4Nqf0ljMqBkv1GBnQpE7pFUqQm028Lfbk2ozgaAvycEEVpoMqgVb0NroMb9sQ QKn6Ps0Cq/RDn/o3tLct0mmALruyvdAH9POUYjtB4UpMYMhym5hzACFmPjsq1dVO5j60Wh/Y45nEb 7Q5xZCFMFBO5J8PwYaCku7X/3FjyL6+1oQ2/uSxHi6RY3s//gB6wp+BPsnrZyvDf0A/WPL6p0G85w Xti7K5MfX0meXOo7BcIEIqCAauLJkICTHWop4X9WJ2r7Ws5RU3eTIrKso3Tjb2CYJatp0ppl0vt6D FrvQAfjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oD8Xo-007y6N-Lx; Sun, 17 Jul 2022 17:59:04 +0000 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com ([46.30.210.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oD8X8-007xmR-60 for linux-mediatek@lists.infradead.org; Sun, 17 Jul 2022 17:58:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Q5AK+4NypIlk8rRS3I711RmXejfY0OnnESySL2cldlE=; b=h+bfBHFSeG2CbL7laYU1YY2xRf6vZMMRMk5qvEAomwTsvBfDLqtntGSkQ9DVsG5VCzhE/TlCDpbRS neJVUzwik7sUmhoAVmFTXOJbY8kXjBNIIs1i5+3fZ3LZnsGMSqKX+UVW+SANGh7k2nmfI/SB5yj86d paP/zrB7Rn7Q30OjeHsEIPW3J0lYufB9/6t78mO3XPlgjFEyjfDhOlcTlayHPhErDiKzuDnRknKbj9 /ietNxnf15VZVa7EvobBvv9v0idp2Oq1KKLek7bFj+83PZA4AjxNqS0qWmbk4b6qWOiE0EPVSLAWLj F2gBFwxUkXOyRGDYStplHVVE6fn+QtA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Q5AK+4NypIlk8rRS3I711RmXejfY0OnnESySL2cldlE=; b=bQm2AFkfu8hxjpuiE8TTBMzELBXKR/wSzafBmVuen8WRQNu21XRea3D9JUrytgKpVLGuhsbs8Jt2e 2sP1etwAA== X-HalOne-Cookie: 24d84fb73bff50a580c06332d25b99da2f041561 X-HalOne-ID: 0a676264-05fa-11ed-be7f-d0431ea8bb03 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 0a676264-05fa-11ed-be7f-d0431ea8bb03; Sun, 17 Jul 2022 17:58:19 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 11/12] drm/bridge: Drop drm_bridge_funcs.mode_fixup Date: Sun, 17 Jul 2022 19:58:00 +0200 Message-Id: <20220717175801.78668-4-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717175801.78668-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> <20220717175801.78668-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220717_105822_491935_97E4A619 X-CRM114-Status: GOOD ( 23.83 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org All users are converted over to drm_bridge_funcs.atomic_check() so it is safe to drop the mode_fixup support. Update the comment for atomic_check with relevant parts from mode_fixup. Signed-off-by: Sam Ravnborg Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/drm_bridge.c | 7 +---- include/drm/drm_bridge.h | 60 ++++++++++-------------------------- 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index b6f56d8f3547..3f5acb19957c 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -685,10 +685,6 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, crtc_state, conn_state); if (ret) return ret; - } else if (bridge->funcs->mode_fixup) { - if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, - &crtc_state->adjusted_mode)) - return -EINVAL; } return 0; @@ -934,8 +930,7 @@ drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge, * @conn_state: new connector state * * First trigger a bus format negotiation before calling - * &drm_bridge_funcs.atomic_check() (falls back on - * &drm_bridge_funcs.mode_fixup()) op for all the bridges in the encoder chain, + * &drm_bridge_funcs.atomic_check() op for all the bridges in the encoder chain, * starting from the last bridge to the first. These are called before calling * &drm_encoder_helper_funcs.atomic_check() * diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 7496f41535b1..8c93369bcc74 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -106,7 +106,7 @@ struct drm_bridge_funcs { * to look at anything else but the passed-in mode, and validate it * against configuration-invariant hardward constraints. Any further * limits which depend upon the configuration can only be checked in - * @mode_fixup. + * @atomic_check. * * RETURNS: * @@ -116,46 +116,6 @@ struct drm_bridge_funcs { const struct drm_display_info *info, const struct drm_display_mode *mode); - /** - * @mode_fixup: - * - * This callback is used to validate and adjust a mode. The parameter - * mode is the display mode that should be fed to the next element in - * the display chain, either the final &drm_connector or the next - * &drm_bridge. The parameter adjusted_mode is the input mode the bridge - * requires. It can be modified by this callback and does not need to - * match mode. See also &drm_crtc_state.adjusted_mode for more details. - * - * This is the only hook that allows a bridge to reject a modeset. If - * this function passes all other callbacks must succeed for this - * configuration. - * - * The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup() - * is not called when &drm_bridge_funcs.atomic_check() is implemented, - * so only one of them should be provided. - * - * NOTE: - * - * This function is called in the check phase of atomic modesets, which - * can be aborted for any reason (including on userspace's request to - * just check whether a configuration would be possible). Drivers MUST - * NOT touch any persistent state (hardware or software) or data - * structures except the passed in @state parameter. - * - * Also beware that userspace can request its own custom modes, neither - * core nor helpers filter modes to the list of probe modes reported by - * the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure - * that modes are filtered consistently put any bridge constraints and - * limits checks into @mode_valid. - * - * RETURNS: - * - * True if an acceptable configuration is possible, false if the modeset - * operation should be rejected. - */ - bool (*mode_fixup)(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); /** * @disable: * @@ -466,9 +426,7 @@ struct drm_bridge_funcs { * &drm_bridge_funcs.atomic_check() hooks are called in reverse * order (from the last to the first bridge). * - * This method is optional. &drm_bridge_funcs.mode_fixup() is not - * called when &drm_bridge_funcs.atomic_check() is implemented, so only - * one of them should be provided. + * This method is optional. * * If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or * &drm_bridge_state.output_bus_cfg.flags it should happen in @@ -478,6 +436,20 @@ struct drm_bridge_funcs { * &drm_connector.display_info.bus_flags if the bridge is the last * element in the chain. * + * NOTE: + * + * This function is called in the check phase of atomic modesets, which + * can be aborted for any reason (including on userspace's request to + * just check whether a configuration would be possible). Drivers MUST + * NOT touch any persistent state (hardware or software) or data + * structures except the passed in @state parameter. + * + * Also beware that userspace can request its own custom modes, neither + * core nor helpers filter modes to the list of probe modes reported by + * the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure + * that modes are filtered consistently put any bridge constraints and + * limits checks into @mode_valid. + * * RETURNS: * zero if the check passed, a negative error code otherwise. */