From patchwork Wed Jan 15 21:05:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940937 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 3540FC02180 for ; Wed, 15 Jan 2025 21:05:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1261A10E107; Wed, 15 Jan 2025 21:05:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="X7oDNsbM"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2CAC10E107 for ; Wed, 15 Jan 2025 21:05:45 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D8F5EA42503; Wed, 15 Jan 2025 21:03:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40E4FC4CEE1; Wed, 15 Jan 2025 21:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975144; bh=6ckx9CZvlTSjCbDIC22eA0KmGebnaJfAaI11J96XgL8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X7oDNsbMUqOZ2nxr1qXnWSQw7tTXhewLgar4NWvbIae+PH/3Z7FpRpijNxQac1RRQ MNr1OBnYuCfwVDcuOuyf+KZKAuZ4IR6K8qDF2nvyqH7raxb66LI7UkYXUVrvCCV70Y NPSqVXylaN+c3OotEuvR0BdiPA0kbRNdTuGXzKEoevH5CdN/6Eqmqcl3WUrcbcswNf QPVENMDuUp9WmBixya1VTl2Nw/Fn3ZXBMd7NFA0MVcBKBGaEat/uGbC3TWjFv8VL7r eIScfZ0UBoczeaLhFl2MaKGWUYlTLt25lP0N7mh/fbLsaJMCfzhgBv9qPgp9wk+q3m oIdFYm2ddEPPg== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:08 +0100 Subject: [PATCH 01/29] drm/atomic-helper: Fix commit_tail state variable name MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-1-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3025; i=mripard@kernel.org; h=from:subject:message-id; bh=6ckx9CZvlTSjCbDIC22eA0KmGebnaJfAaI11J96XgL8=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyqLs60OP2j15q3Fr1oPYCRf+OW0omv2BP+lSok9Ia 6SZ+APOjqksDMKcDLJiiixPZMJOL29fXOVgv/IHzBxWJpAhDFycAjARy1DG+uKC563zLOaW/z4m f0jCJne567pv3DP+phy1CEsQOmQmePJwmNW6KyznLr//oGH0jdfiAWM1u3LH6bpiEd+/C7fNiJR ecP35R7uY8jPzp7T/CtzR3Zf1PtC6kfuW4NUPJxwFWl6JulsCAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" Even though the commit_tail () drm_atomic_state parameter is called old_state, it's actually the state being committed which is confusing. It's even more confusing since the atomic_commit_tail hook being called by commit_tail() parameter is called state. Let's rename the variable from old_state to state to make it less confusing. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 40e4e1b6c9110677c1c4981eeb15dc93966f4cf6..913d94d664d885323ad7e41a6424633c28c787e1 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1818,13 +1818,13 @@ void drm_atomic_helper_commit_tail_rpm(struct drm_atomic_state *old_state) drm_atomic_helper_cleanup_planes(dev, old_state); } EXPORT_SYMBOL(drm_atomic_helper_commit_tail_rpm); -static void commit_tail(struct drm_atomic_state *old_state) +static void commit_tail(struct drm_atomic_state *state) { - struct drm_device *dev = old_state->dev; + struct drm_device *dev = state->dev; const struct drm_mode_config_helper_funcs *funcs; struct drm_crtc_state *new_crtc_state; struct drm_crtc *crtc; ktime_t start; s64 commit_time_ms; @@ -1842,37 +1842,37 @@ static void commit_tail(struct drm_atomic_state *old_state) * These times will be averaged out in the self refresh helpers to avoid * overreacting over one outlier frame */ start = ktime_get(); - drm_atomic_helper_wait_for_fences(dev, old_state, false); + drm_atomic_helper_wait_for_fences(dev, state, false); - drm_atomic_helper_wait_for_dependencies(old_state); + drm_atomic_helper_wait_for_dependencies(state); /* * We cannot safely access new_crtc_state after * drm_atomic_helper_commit_hw_done() so figure out which crtc's have * self-refresh active beforehand: */ - for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) if (new_crtc_state->self_refresh_active) new_self_refresh_mask |= BIT(i); if (funcs && funcs->atomic_commit_tail) - funcs->atomic_commit_tail(old_state); + funcs->atomic_commit_tail(state); else - drm_atomic_helper_commit_tail(old_state); + drm_atomic_helper_commit_tail(state); commit_time_ms = ktime_ms_delta(ktime_get(), start); if (commit_time_ms > 0) - drm_self_refresh_helper_update_avg_times(old_state, + drm_self_refresh_helper_update_avg_times(state, (unsigned long)commit_time_ms, new_self_refresh_mask); - drm_atomic_helper_commit_cleanup_done(old_state); + drm_atomic_helper_commit_cleanup_done(state); - drm_atomic_state_put(old_state); + drm_atomic_state_put(state); } static void commit_work(struct work_struct *work) { struct drm_atomic_state *state = container_of(work, From patchwork Wed Jan 15 21:05:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940938 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 12CA7C02183 for ; Wed, 15 Jan 2025 21:05:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F6DE10E526; Wed, 15 Jan 2025 21:05:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="aKX+A3AG"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4E9C10E16B for ; Wed, 15 Jan 2025 21:05:48 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 07CE0A42525; Wed, 15 Jan 2025 21:04:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50401C4CED1; Wed, 15 Jan 2025 21:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975147; bh=lDrhwzfJy+p4W4zYRuAxMW9M3nsbsVn6uvOzLIguERE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aKX+A3AGg5oHBre5NbGiLMjDTTFoEaI5QY9jK2veVlWF7KTxmCsJ2mXMx/PfMq5y+ rzyY/DpqZJKL/iGCOKhjgrDst/9HDeaUyMsG1U7taN1hPvEpYuilQDHda0JajQHA1e CoeC5DvydV7bPKk2vrqRiPu8l2a3pCfz/aAOG0AuGeimPyExGqQYwIsEPGHFIwIRLs L1/0L6IJ73Zj2y0Ohr5ySM/6PHWvPLLY6zqZpR/rzO4sAFBZp+j8GA4FNWX0OI0JGZ xC9K9q7/JZqcoI+SIfPAWzbQyPXaaiS3WJP3txWENChLrPuRYmaGU5IKlbYUHhwJF+ bUJp0vkuheOUQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:09 +0100 Subject: [PATCH 02/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_dependencies() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-2-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3009; i=mripard@kernel.org; h=from:subject:message-id; bh=lDrhwzfJy+p4W4zYRuAxMW9M3nsbsVn6uvOzLIguERE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyqI58k+6vEpf/GTeOJuv9yKDcNJpf/4Jza0bFhsc1 4lgr/rRMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACYy4wxjrWh9854/7BJz924p 7ywICreVWifKel7Qg/Gqlsij//ye77+ExjdtOq5ayBw/ec1SbaeHjHWKgc3CM19VxjctPl0/9VN mt0Sopw3ffPayLQEFW7z//XmwN5shT63dRVDggO1Pj9iqnQA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_wait_for_dependencies() waits for all the dependencies a commit has before going forward with it. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 913d94d664d885323ad7e41a6424633c28c787e1..48dc4f18e757549b67940cc5ca4d76812ef13985 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2411,48 +2411,48 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, } EXPORT_SYMBOL(drm_atomic_helper_setup_commit); /** * drm_atomic_helper_wait_for_dependencies - wait for required preceding commits - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function waits for all preceding commits that touch the same CRTC as - * @old_state to both be committed to the hardware (as signalled by + * @state to both be committed to the hardware (as signalled by * drm_atomic_helper_commit_hw_done()) and executed by the hardware (as signalled * by calling drm_crtc_send_vblank_event() on the &drm_crtc_state.event). * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state) +void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state; struct drm_plane *plane; struct drm_plane_state *old_plane_state; struct drm_connector *conn; struct drm_connector_state *old_conn_state; int i; long ret; - for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { + for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { ret = drm_crtc_commit_wait(old_crtc_state->commit); if (ret) drm_err(crtc->dev, "[CRTC:%d:%s] commit wait timed out\n", crtc->base.id, crtc->name); } - for_each_old_connector_in_state(old_state, conn, old_conn_state, i) { + for_each_old_connector_in_state(state, conn, old_conn_state, i) { ret = drm_crtc_commit_wait(old_conn_state->commit); if (ret) drm_err(conn->dev, "[CONNECTOR:%d:%s] commit wait timed out\n", conn->base.id, conn->name); } - for_each_old_plane_in_state(old_state, plane, old_plane_state, i) { + for_each_old_plane_in_state(state, plane, old_plane_state, i) { ret = drm_crtc_commit_wait(old_plane_state->commit); if (ret) drm_err(plane->dev, "[PLANE:%d:%s] commit wait timed out\n", plane->base.id, plane->name); From patchwork Wed Jan 15 21:05:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940939 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 99361C02183 for ; Wed, 15 Jan 2025 21:05:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2170210E7E4; Wed, 15 Jan 2025 21:05:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="HuyL8X67"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AAF810E7E3 for ; Wed, 15 Jan 2025 21:05:51 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 81BB4A42523; Wed, 15 Jan 2025 21:04:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E28C1C4CED1; Wed, 15 Jan 2025 21:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975150; bh=LYEhfKiFb3CUu2Y0XG8MQHtGxB63YAoqR4SNayCeLEw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HuyL8X67lHaMg3QzkZ+S2IcqG5bq7H6ZKlVTLrZ2pDfegot/+DeezP7oNXPiiEmXv AQwYJtEALWWaNZ/Z7ne2Cto5rZP6o8GZsiHzA61EqMALYOiPKZMWyqV7ApkQS/SD6k jIk/Z/NaGNwZj/SHUkH0zkMkLy0Jaub6X9y6GZ/EUzCGiaAxyx5JOfzRrWCOXXxNlG a1+MlkwpADg0lcX+5ZaWxbP+GlS+SrYboqT31cmeoLPvQygua3My9aL6pRn9ag/Ef3 ejTfCpQ5/5zNErda0dbwLMrRnpm+AcHS8ODyuzDWT/K4eo7jsVw6r9SUNdVUe3W8wX zC/z6jrT77atA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:10 +0100 Subject: [PATCH 03/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-3-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2624; i=mripard@kernel.org; h=from:subject:message-id; bh=LYEhfKiFb3CUu2Y0XG8MQHtGxB63YAoqR4SNayCeLEw=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdymIq/Z+2dFso7rYXb7iv/MPiT1rNg3QpxWve2nz3j s09J9bVMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACYiN4Ox3mvd4a18fBNvhVnt dwtncuRJCYmWtA2ROfFH+XDmp4J/7zKfWj81+iDC6NbvkDCl42wYY8OzLMlIRuUDkw5vX1q0Psp ++7aoQzbuUjPLl+nwMyWw8lu4SUfwCKct9A/ikuSMC5+pAQA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_commit_tail() is the final part of an atomic commit, and is given a parameter with the drm_atomic_state being committed. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 48dc4f18e757549b67940cc5ca4d76812ef13985..c80d2ee0247a5316dd103d6178c7fa96eb366c9a 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1756,38 +1756,38 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, } EXPORT_SYMBOL(drm_atomic_helper_wait_for_flip_done); /** * drm_atomic_helper_commit_tail - commit atomic update to hardware - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This is the default implementation for the * &drm_mode_config_helper_funcs.atomic_commit_tail hook, for drivers * that do not support runtime_pm or do not need the CRTC to be * enabled to perform a commit. Otherwise, see * drm_atomic_helper_commit_tail_rpm(). * * Note that the default ordering of how the various stages are called is to * match the legacy modeset helper library closest. */ -void drm_atomic_helper_commit_tail(struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_tail(struct drm_atomic_state *state) { - struct drm_device *dev = old_state->dev; + struct drm_device *dev = state->dev; - drm_atomic_helper_commit_modeset_disables(dev, old_state); + drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, old_state, 0); + drm_atomic_helper_commit_planes(dev, state, 0); - drm_atomic_helper_commit_modeset_enables(dev, old_state); + drm_atomic_helper_commit_modeset_enables(dev, state); - drm_atomic_helper_fake_vblank(old_state); + drm_atomic_helper_fake_vblank(state); - drm_atomic_helper_commit_hw_done(old_state); + drm_atomic_helper_commit_hw_done(state); - drm_atomic_helper_wait_for_vblanks(dev, old_state); + drm_atomic_helper_wait_for_vblanks(dev, state); - drm_atomic_helper_cleanup_planes(dev, old_state); + drm_atomic_helper_cleanup_planes(dev, state); } EXPORT_SYMBOL(drm_atomic_helper_commit_tail); /** * drm_atomic_helper_commit_tail_rpm - commit atomic update to hardware From patchwork Wed Jan 15 21:05:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940940 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 B691EC02185 for ; Wed, 15 Jan 2025 21:05:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 26C5610E16B; Wed, 15 Jan 2025 21:05:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="m85B3tyl"; 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 1369510E7E5 for ; Wed, 15 Jan 2025 21:05:54 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B38685C5E90; Wed, 15 Jan 2025 21:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF187C4CED1; Wed, 15 Jan 2025 21:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975153; bh=hY2WCPBkfNB6VAzQ2TTD6t4BV2WNicqT+QdY1QJWur4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=m85B3tylrsmUrTt9Q+grjfyjBKZiDI5crZCB/0LyGTxWQSdZpYr046DTHseq5gn1o gVgFFFvZ9Dt/xm63FqwmU8V8WMnjvln6LDt/29iJRB5GxM+vB/NEjXkQ3WwApO6HcV IhqVXMkI/44EkDRYuGMeoePAbRyfLtcCfiD9kCbqPrHsPUX7PNttyZztY3xUp03jJ7 +ys6dXFYfIDfpcnu7LMblOhg+tpzEW8g6Y4/YyiVkLR1FzAWxrCzK2KXC2OPWV/Yqs 55o4yyefitljh2El2KvqB1LBJ5Jk3zDJz4SUKGol6IVSgZOKkYyWu8f3wTI09iVQci rB/7pKEP6zaiw== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:11 +0100 Subject: [PATCH 04/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail_rpm() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-4-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2531; i=mripard@kernel.org; h=from:subject:message-id; bh=hY2WCPBkfNB6VAzQ2TTD6t4BV2WNicqT+QdY1QJWur4=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdymKfuc3FBQ6s7YmQc3cLqrCcs3a9EyPb2pKzOVwf/ zZ+DFjQMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACaywp2xTr0mlntmmTdb1MwW cb2Da/Ku3o8Kubtq/u4FOfHCkzIeWR6ZUXTGwO2WWJzh0ohHoXrvGOtTfDa3c/RcTQzxetNZaCr TOyNe9v0mJb+wV9td4ltKxA+nnAs6PTF+AQvrVrMrpfuU9gIA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_commit_tail_rpm() is the final part of an atomic commit, and is given the state being committed as a parameter. However, that parameter is named old_state, but documented as the "new modeset state" which is all super confusing. Let's rename that parameter to state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index c80d2ee0247a5316dd103d6178c7fa96eb366c9a..cb08fda752c65d6d0c4388bb4bf7054e74a053a8 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1789,36 +1789,36 @@ void drm_atomic_helper_commit_tail(struct drm_atomic_state *state) } EXPORT_SYMBOL(drm_atomic_helper_commit_tail); /** * drm_atomic_helper_commit_tail_rpm - commit atomic update to hardware - * @old_state: new modeset state to be committed + * @state: new modeset state to be committed * * This is an alternative implementation for the * &drm_mode_config_helper_funcs.atomic_commit_tail hook, for drivers * that support runtime_pm or need the CRTC to be enabled to perform a * commit. Otherwise, one should use the default implementation * drm_atomic_helper_commit_tail(). */ -void drm_atomic_helper_commit_tail_rpm(struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_tail_rpm(struct drm_atomic_state *state) { - struct drm_device *dev = old_state->dev; + struct drm_device *dev = state->dev; - drm_atomic_helper_commit_modeset_disables(dev, old_state); + drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_modeset_enables(dev, old_state); + drm_atomic_helper_commit_modeset_enables(dev, state); - drm_atomic_helper_commit_planes(dev, old_state, + drm_atomic_helper_commit_planes(dev, state, DRM_PLANE_COMMIT_ACTIVE_ONLY); - drm_atomic_helper_fake_vblank(old_state); + drm_atomic_helper_fake_vblank(state); - drm_atomic_helper_commit_hw_done(old_state); + drm_atomic_helper_commit_hw_done(state); - drm_atomic_helper_wait_for_vblanks(dev, old_state); + drm_atomic_helper_wait_for_vblanks(dev, state); - drm_atomic_helper_cleanup_planes(dev, old_state); + drm_atomic_helper_cleanup_planes(dev, state); } EXPORT_SYMBOL(drm_atomic_helper_commit_tail_rpm); static void commit_tail(struct drm_atomic_state *state) { From patchwork Wed Jan 15 21:05:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940941 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 79FC2C02183 for ; Wed, 15 Jan 2025 21:05:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 038C110E7E3; Wed, 15 Jan 2025 21:05:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="dho65txb"; 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 EF3BC10E7E3 for ; Wed, 15 Jan 2025 21:05:56 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A9D5D5C5E98; Wed, 15 Jan 2025 21:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF1E6C4CED1; Wed, 15 Jan 2025 21:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975156; bh=CISyuLYjgS5U6UJVRsrpY706ypFUXAyfrCeZtDNy+ro=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dho65txb30mOBY+FLFNqdz4tizHDyRM/2pCJyDPZTqCxXmR2tjXifulG5lJfrdBGm +B+blaj1S/JU5oWgiplprXOd0wr7B1FRo42bedNcd20FOPvOCNrfbBp+ZZb96PnOQo TUP3hPGMU17UPWvEsPH/Cpa0iEafqHvE0k/snTGGPa6pv+bjIJe+9C3Bu93t1Yk3X/ +FLL6P6WRH+S98/GBOCC+O1Xrebf0oQhzn+2m/ybOrYXJjnODT3ExD2WG8hLzdO8IC a28wohOV/7/8b81ZcIMR594mZg8a5YwG1YyZZiVqoZWMj8gN/APMH3ztwZpJEB7qiH Rwyr3Y7NQzq7Q== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:12 +0100 Subject: [PATCH 05/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_modeset_disables() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-5-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2377; i=mripard@kernel.org; h=from:subject:message-id; bh=CISyuLYjgS5U6UJVRsrpY706ypFUXAyfrCeZtDNy+ro=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyuJb+LfHB1yo0FxvdMe7p9dGdYE486blYhUhO7gWK T7tSzvRMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACZiKcZYKzc39rLWNHvBksUd VfHx06U3l9p9XG1c5h3zIbt6446eCXfcDuTX3CnsXbSiYIuqotosxobrJl9/XbDw7bjZpCug43D wc7jVwfB1H/olWgwWqzFO/SnAe/bQCTONfBapvXI7vEJ4tgMA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_modeset_disables() disables all the outputs affected by a commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index cb08fda752c65d6d0c4388bb4bf7054e74a053a8..d5129de2278d5f62c136f8b6c831f903d9e53927 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1427,11 +1427,11 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) } /** * drm_atomic_helper_commit_modeset_disables - modeset commit to disable outputs * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function shuts down all the outputs that need to be shut down and * prepares them (if required) with the new mode. * * For compatibility with legacy CRTC helpers this should be called before @@ -1439,18 +1439,18 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) * does. But drivers with different needs can group the modeset commits together * and do the plane commits at the end. This is useful for drivers doing runtime * PM since planes updates then only happen when the CRTC is actually enabled. */ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { - disable_outputs(dev, old_state); + disable_outputs(dev, state); - drm_atomic_helper_update_legacy_modeset_state(dev, old_state); - drm_atomic_helper_calc_timestamping_constants(old_state); + drm_atomic_helper_update_legacy_modeset_state(dev, state); + drm_atomic_helper_calc_timestamping_constants(state); - crtc_set_mode(dev, old_state); + crtc_set_mode(dev, state); } EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_disables); static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, struct drm_atomic_state *old_state) From patchwork Wed Jan 15 21:05:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940942 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 AB580C02183 for ; Wed, 15 Jan 2025 21:06:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 304AC10E7E5; Wed, 15 Jan 2025 21:06:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="CtJJQf+q"; 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 AC28B10E7E7 for ; Wed, 15 Jan 2025 21:05:59 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 634045C5E90; Wed, 15 Jan 2025 21:05:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8503EC4CEE2; Wed, 15 Jan 2025 21:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975158; bh=jrW4OZul1IIHd+cW8sCFwOefiIlmodcDT+REyvjTBCU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CtJJQf+qSBrfDDMoIKGI3QTIV/BLFgIyacJHlD6jJ2TTZsVoDbm4laxEv8lQPYxHV /4FnlZfcvJfiBnLsDf/Nk+9olC4AcHpDO0aTrlAw4EvY17+oZjDhLaqhw47wgwequA nOJom8DRvkgaD15+Fp18/HPnm4a5bUlJR3GqW7acFjRQmwlbkkgRfvYq+irRf9p5Va q7lhdFIDuznrVwB+IhiPpks+Kava/xWCS89+1SzJyHeyg3e6ItkKlI6pqWC7uJ4iNg RRankKOmsbVDBcdTvBeq7X/nFsn+BzLvweZEw9daQ00VEsnqrsF/Qh2+FGb35OkFgU 0ScIoF9DP1mRw== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:13 +0100 Subject: [PATCH 06/29] drm/atomic-helper: Change parameter name of disable_outputs() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-6-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4016; i=mripard@kernel.org; h=from:subject:message-id; bh=jrW4OZul1IIHd+cW8sCFwOefiIlmodcDT+REyvjTBCU=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyuJntDsv71tsPNVzuZTzislR2z8dDP3Uctt7aVh00 /0FpRvNO6ayMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBENpcyNszwzNoUWPo6MsRW T9j24wbPWVwCvAeCmiT5VI36A/9fTMvSjn73VXGD0NdvU3c0SKcYMtY7meSv0Z744Hzow/6NR98 k3N14RUmq0F7vrXbs0wPsazfN/lrreujJHP/vl69O9DKv3LYaAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" disable_outputs() disables all connectors and CRTCs affected by a commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d5129de2278d5f62c136f8b6c831f903d9e53927..0d561b5c249a79a723e047f061d4103ef7742e87 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1148,19 +1148,19 @@ crtc_needs_disable(struct drm_crtc_state *old_state, (old_state->self_refresh_active && !new_state->active) || new_state->self_refresh_active; } static void -disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) +disable_outputs(struct drm_device *dev, struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *old_conn_state, *new_conn_state; struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; int i; - for_each_oldnew_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { + for_each_oldnew_connector_in_state(state, connector, old_conn_state, new_conn_state, i) { const struct drm_encoder_helper_funcs *funcs; struct drm_encoder *encoder; struct drm_bridge *bridge; /* @@ -1168,15 +1168,15 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) * still on. So need to check the old, saved state. */ if (!old_conn_state->crtc) continue; - old_crtc_state = drm_atomic_get_old_crtc_state(old_state, old_conn_state->crtc); + old_crtc_state = drm_atomic_get_old_crtc_state(state, old_conn_state->crtc); if (new_conn_state->crtc) new_crtc_state = drm_atomic_get_new_crtc_state( - old_state, + state, new_conn_state->crtc); else new_crtc_state = NULL; if (!crtc_needs_disable(old_crtc_state, new_crtc_state) || @@ -1199,28 +1199,28 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) /* * Each encoder has at most one connector (since we always steal * it away), so we won't call disable hooks twice. */ bridge = drm_bridge_chain_get_first_bridge(encoder); - drm_atomic_bridge_chain_disable(bridge, old_state); + drm_atomic_bridge_chain_disable(bridge, state); /* Right function depends upon target state. */ if (funcs) { if (funcs->atomic_disable) - funcs->atomic_disable(encoder, old_state); + funcs->atomic_disable(encoder, state); else if (new_conn_state->crtc && funcs->prepare) funcs->prepare(encoder); else if (funcs->disable) funcs->disable(encoder); else if (funcs->dpms) funcs->dpms(encoder, DRM_MODE_DPMS_OFF); } - drm_atomic_bridge_chain_post_disable(bridge, old_state); + drm_atomic_bridge_chain_post_disable(bridge, state); } - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; int ret; /* Shut down everything that needs a full modeset. */ if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) @@ -1237,11 +1237,11 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) /* Right function depends upon target state. */ if (new_crtc_state->enable && funcs->prepare) funcs->prepare(crtc); else if (funcs->atomic_disable) - funcs->atomic_disable(crtc, old_state); + funcs->atomic_disable(crtc, state); else if (funcs->disable) funcs->disable(crtc); else if (funcs->dpms) funcs->dpms(crtc, DRM_MODE_DPMS_OFF); From patchwork Wed Jan 15 21:05:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940943 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 DAE31C02180 for ; Wed, 15 Jan 2025 21:06:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 408D810E7E7; Wed, 15 Jan 2025 21:06:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ac213T0J"; 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 74E1210E7E7 for ; Wed, 15 Jan 2025 21:06:02 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2E36A5C5E99; Wed, 15 Jan 2025 21:05:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D439C4CEE1; Wed, 15 Jan 2025 21:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975161; bh=rqGqdTzqbd19HgjsQNxbk7hOL1MYm+2z8Ug5KClR57A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ac213T0JrLVZh8R28ZEvt475+SFdBPPJLzznlMNKBXlBTHfeLfYR5EeoUY578lt2R kt+dlHRmwEOxI4USFetJ5bI5K+jJ9MAp6zMrmlbj0NnRvQYeFQ5eO/uxJsSMxtCmGk d8PluXR5+v9vMSrNm0STPOp/kNM5+aNg8wlYSg4sDbuPhDZ3kQyN0iBQ9SJFYrVQ4S 8K9vMwARSyaxdDBGl1amw6BMTqbjEqMzySKTjGtsVKCeITRP64mUW0sr8icI8ZNay2 B5zn5GsOlNKi2WixeaEqrA8ghtsPMCITBKGb0qQTa9YRTmTOrqFIdbIrxIQb0x4zuL 7wI8sQqiCZVAg== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:14 +0100 Subject: [PATCH 07/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_disable() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-7-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2110; i=mripard@kernel.org; h=from:subject:message-id; bh=rqGqdTzqbd19HgjsQNxbk7hOL1MYm+2z8Ug5KClR57A=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyhLn5l9nztTluX7rpt+sZ58MPH9dk1sax5VxjOHAZ RE/1e+LO6ayMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBE7kQx1nv9WLo1JUS06pp1 /tI/HesVjKrK2+5N+/Wt13CRfY3Gk/BrLe+04q98Li+85Rrztun2B8aGjR+8rb3imawCRUpmtez gL5nM4Fmx6ZnPFH1/z3c5tzhWLHNeJVKp+GiP0fWvkcrVDx8AAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_bridge_chain_disable() disables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_bridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index c6af46dd02bfa9e15b59e4c460debdd7fd84be44..e714c8ddd9d564473a41c465e437a6022dfd031c 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -544,21 +544,21 @@ void drm_bridge_chain_mode_set(struct drm_bridge *bridge, EXPORT_SYMBOL(drm_bridge_chain_mode_set); /** * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain * @bridge: bridge control structure - * @old_state: old atomic state + * @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_disable (falls back on * &drm_bridge_funcs.disable) 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_disable * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_encoder *encoder; struct drm_bridge *iter; if (!bridge) @@ -568,11 +568,11 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { if (iter->funcs->atomic_disable) { struct drm_bridge_state *old_bridge_state; old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, + drm_atomic_get_old_bridge_state(state, iter); if (WARN_ON(!old_bridge_state)) return; iter->funcs->atomic_disable(iter, old_bridge_state); From patchwork Wed Jan 15 21:05:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940944 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 D65ADC02183 for ; Wed, 15 Jan 2025 21:06:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BB3C10E7E9; Wed, 15 Jan 2025 21:06:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="nloJwC9W"; 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 4528410E528 for ; Wed, 15 Jan 2025 21:06:05 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F415B5C5CD8; Wed, 15 Jan 2025 21:05:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23714C4CED1; Wed, 15 Jan 2025 21:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975164; bh=JvQm1aj5Sq1V7cJors4GdJigIzlzbMu3j8ZB3Yo5M+k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nloJwC9WV1gQEWq5qxvZ7lnFAuQ5tiAAjA9PTT5nfEMGjxgOYiAKvh83gmG6/iV2O J9bSl/z33vyHpaOUAiR1whtfdLYsOCK5U1cqlBK07sj0tiBLRHMJn/fKwAYr9zhqgD IOFtEbSGFnZx/JiQbtRBfLc8SBYbc9NeUpJmVssLKZbmUmyJ0npeB6EnV+6mjpYsrY 7KbUsFcy265mGOSRXAK5rsY00BzBkywiWDgNy5QZZaWjqXz4/ynS6ZAszu67vW9YfW a12lOfaMqf8N3AYH6kRUVC6pw6gwoa8leztfCCotjSOoChqRqiJ0rc+H1JEjLqgKaD 5QTaqyt8kMXnw== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:15 +0100 Subject: [PATCH 08/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-8-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3022; i=mripard@kernel.org; h=from:subject:message-id; bh=JvQm1aj5Sq1V7cJors4GdJigIzlzbMu3j8ZB3Yo5M+k=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyhLSzVwS5vdXHHsxdW7wA5XenXL7PWoyn7+TVF018 fTa0z59HVNZGIQ5GWTFFFmeyISdXt6+uMrBfuUPmDmsTCBDGLg4BWAioQ6MNVwLd/U2rbs/h1El Q2z7zX2HC3mOXLK+4WLS6RNTxmeS0PbXWdHk77Wcw0/uPfylwrX7AWN98Uy+nfYTC4oOvtx7sK1 owT3LSuPIF6lT/3frTix1XfRGNi45X/RWycmL7ycrbyzoM70NAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_bridge_chain_post_disable() disables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_bridge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index e714c8ddd9d564473a41c465e437a6022dfd031c..9755761d0d0f2659cf8d71e1734aee9772cc8c0f 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -585,17 +585,17 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, } } EXPORT_SYMBOL(drm_atomic_bridge_chain_disable); static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { - if (old_state && bridge->funcs->atomic_post_disable) { + if (state && bridge->funcs->atomic_post_disable) { struct drm_bridge_state *old_bridge_state; old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, + drm_atomic_get_old_bridge_state(state, bridge); if (WARN_ON(!old_bridge_state)) return; bridge->funcs->atomic_post_disable(bridge, @@ -607,11 +607,11 @@ static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge, /** * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges * in the encoder chain * @bridge: bridge control structure - * @old_state: old atomic state + * @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_post_disable (falls back on * &drm_bridge_funcs.post_disable) op for all the bridges in the encoder chain, * starting from the first bridge to the last. These are called after completing * &drm_encoder_helper_funcs.atomic_disable @@ -628,11 +628,11 @@ static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge, * Bridge B, Bridge A, Bridge E, Bridge D, Bridge C. * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_encoder *encoder; struct drm_bridge *next, *limit; if (!bridge) @@ -675,16 +675,16 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, chain_node) { if (next == bridge) break; drm_atomic_bridge_call_post_disable(next, - old_state); + state); } } } - drm_atomic_bridge_call_post_disable(bridge, old_state); + drm_atomic_bridge_call_post_disable(bridge, state); if (limit) /* Jump all bridges that we have already post_disabled */ bridge = limit; } From patchwork Wed Jan 15 21:05:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940945 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 3BBDBC02183 for ; Wed, 15 Jan 2025 21:06:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD21E10E7EB; Wed, 15 Jan 2025 21:06:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="o2JALqug"; 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 3C0A010E528 for ; Wed, 15 Jan 2025 21:06:08 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EB6AD5C5E2A; Wed, 15 Jan 2025 21:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A301C4CEE4; Wed, 15 Jan 2025 21:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975167; bh=mj6NM+PSrLMPxTlgg9EIkBu+YOWNcjioXwNh4JUXpAI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=o2JALquglnx8RnLtBofCg2ih33H4tu3g/093vrzsERl6elnUwiCINKbntNqbMtE98 lsX8knGLNlQbOy3OjjwNmjKaAORxJcAHUJqG+ovaumh2w7Pp6SFLEgq6GfWdLRMG1/ YuphMK8kEo8BdIgd7CfeHZymzPXv/CsU/kjSZl6f4LY301IUZ8k99/pVg5EVQqnu6M E5Xjxp2joX+H9oSEwXA599h/eZ4oLWb1Bw3gdv203UkbV5moLKIgC184qrzyB66nP8 D6eRcAFy7i8zzjo07cpteWS75U74BTUYB00iKVLSFf2uS/3KPjm3CNzK0ZLdbAXZCk pTCLAMwa+W7tA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:16 +0100 Subject: [PATCH 09/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_update_legacy_modeset_state() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-9-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3609; i=mripard@kernel.org; h=from:subject:message-id; bh=mj6NM+PSrLMPxTlgg9EIkBu+YOWNcjioXwNh4JUXpAI=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdypKexe13XohvfJBs3ybZ9Oryps17L7he1PsqmCY+e +O18NDEjqksDMKcDLJiiixPZMJOL29fXOVgv/IHzBxWJpAhDFycAjCRfFvGhvNGxhsO7GuVuvD8 V/P+gwuWuXvXW2frlC8LK5512ExwlcGBXsEXXKbPNOJEbP7ZbeDMY6zPifq9KqNqd1P/8pQrm+d 4TN5Q58uhPzc/NTxEpO6JrX3mhgD2SYXvPjff0sk/mnwufg4A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_update_legacy_modeset_state() updates all the legacy modeset pointers a connector, encoder or CRTC might have with the ones being setup by a given commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 0d561b5c249a79a723e047f061d4103ef7742e87..50b3fdb033eaae8e852a4fd298d2e958be1201f3 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1265,11 +1265,11 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *state) } /** * drm_atomic_helper_update_legacy_modeset_state - update legacy modeset state * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function updates all the various legacy modeset state pointers in * connectors, encoders and CRTCs. * * Drivers can use this for building their own atomic commit if they don't have @@ -1281,20 +1281,20 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *state) * the legacy state pointers are only really useful for transitioning an * existing driver to the atomic world. */ void drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *old_conn_state, *new_conn_state; struct drm_crtc *crtc; struct drm_crtc_state *new_crtc_state; int i; /* clear out existing links and update dpms */ - for_each_oldnew_connector_in_state(old_state, connector, old_conn_state, new_conn_state, i) { + for_each_oldnew_connector_in_state(state, connector, old_conn_state, new_conn_state, i) { if (connector->encoder) { WARN_ON(!connector->encoder->crtc); connector->encoder->crtc = NULL; connector->encoder = NULL; @@ -1311,11 +1311,11 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, connector->dpms = mode; } } /* set new links */ - for_each_new_connector_in_state(old_state, connector, new_conn_state, i) { + for_each_new_connector_in_state(state, connector, new_conn_state, i) { if (!new_conn_state->crtc) continue; if (WARN_ON(!new_conn_state->best_encoder)) continue; @@ -1323,19 +1323,19 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, connector->encoder = new_conn_state->best_encoder; connector->encoder->crtc = new_conn_state->crtc; } /* set legacy state in the crtc structure */ - for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { struct drm_plane *primary = crtc->primary; struct drm_plane_state *new_plane_state; crtc->mode = new_crtc_state->mode; crtc->enabled = new_crtc_state->enable; new_plane_state = - drm_atomic_get_new_plane_state(old_state, primary); + drm_atomic_get_new_plane_state(state, primary); if (new_plane_state && new_plane_state->crtc == crtc) { crtc->x = new_plane_state->src_x >> 16; crtc->y = new_plane_state->src_y >> 16; } From patchwork Wed Jan 15 21:05:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940946 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 CA420C02180 for ; Wed, 15 Jan 2025 21:06:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AB8E10E528; Wed, 15 Jan 2025 21:06:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="aDnLrefF"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F59F10E7EC for ; Wed, 15 Jan 2025 21:06:11 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 8D968A4252C; Wed, 15 Jan 2025 21:04:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B09C4CED1; Wed, 15 Jan 2025 21:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975170; bh=3U25VSbp7zOKRnxUgWW8z3EJnwEdMNg7JGTzkjvUMOg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aDnLrefFjZcXQkJsio+Cp6itcjqalKBxXBIDJ19kFSt2IKh65aCfbgqKKKqCUULYT 2kjY9Moaut5YFpSRMdnUEsoW3XEfN+xrg43JzgqiZeNIgV0czCdYNeeSsi+UCVtXZm dRyAW3UCMkz3CCKaVwkHR0gn6vEXBYkOhXHmnR/OUed+/A+XwKPx2EnDNxaWWq4eef nzCoQEdOSTHDgqBLF44QZTeyV39m619DRuVeQ0pOhmpg54svT/3Udexb7WoA08ooEg wdDCkmdrHi9OhMQu7yqwbCZC/AiLo8yFj16s5x9kvj35D66bdeAXrVfUYqaXUYYsdX napBMQ5Ql/BYw== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:17 +0100 Subject: [PATCH 10/29] drm/atomic-helper: Change parameter name of crtc_set_mode() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-10-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1984; i=mripard@kernel.org; h=from:subject:message-id; bh=3U25VSbp7zOKRnxUgWW8z3EJnwEdMNg7JGTzkjvUMOg=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdypI6e9/EOxcfO12npXo/Mf7drOYdayT12hKyog5UT mNgDovpmMrCIMzJICumyPJEJuz08vbFVQ72K3/AzGFlAhnCwMUpABMRe85YZ1bzgoO1I0pAR+zg +pdLP/N+X6dloWm4Q/WuwBbz/cY/lx++ymPEPf+c//tzc6cn9y6rZ2yY/Wbm0wsbI5Kl1hcXfjl UtaxEr8bi9I2bbQytPNqpm/fFHuZwr1h+6PZ9WU9TXoEWjq0A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" crtc_set_mode() deals with calling the modeset related hooks for CRTC, connectors and bridges if and when a new commit changes them. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 50b3fdb033eaae8e852a4fd298d2e958be1201f3..55c91f2821d550c8af52b71d8f452e0fdee997e4 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1363,19 +1363,19 @@ void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *stat } } EXPORT_SYMBOL(drm_atomic_helper_calc_timestamping_constants); static void -crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) +crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *new_crtc_state; struct drm_connector *connector; struct drm_connector_state *new_conn_state; int i; - for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; if (!new_crtc_state->mode_changed) continue; @@ -1387,11 +1387,11 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) funcs->mode_set_nofb(crtc); } } - for_each_new_connector_in_state(old_state, connector, new_conn_state, i) { + for_each_new_connector_in_state(state, connector, new_conn_state, i) { const struct drm_encoder_helper_funcs *funcs; struct drm_encoder *encoder; struct drm_display_mode *mode, *adjusted_mode; struct drm_bridge *bridge; From patchwork Wed Jan 15 21:05:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940947 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 3270EC02183 for ; Wed, 15 Jan 2025 21:06:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE8FB10E7EE; Wed, 15 Jan 2025 21:06:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="NZQWVLg4"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE4C110E7EC for ; Wed, 15 Jan 2025 21:06:13 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 2F672A42534; Wed, 15 Jan 2025 21:04:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FAB6C4CED1; Wed, 15 Jan 2025 21:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975172; bh=4FufsHC9m2G2exxSOBIj1GnRZlr7++zve5XtvmcgBsg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NZQWVLg4ejKsVeASyciS13xA10GQE/TyNQoD8sL5QESmxw9PVY9wHZoLGJmnIavAy qQ+nqpZs4jvqGdcCRnnVUfBs6IUbI3kXmeZ9VhVVQizG+wmxE0KH+Hz8xgPpQMyV6x 994BFmv9QSGzZYEsXk9uey9aqm+61Atglj9rGvfkfXdx6J05WhvP4AzqLGWA3Frc2H JNb8AQMFaGI8WolSgzZpSlvmTEVFW3iT2m1Zo35X5U2nwEV4dPcMRrYiug8ZbfVPar /oQGP1GQvLNfwgcYSfcNvOdRA1wyLkz++CKxqkLjzfl98TGG58t/s2sTJPd9asZA1w m0OEj6if2eSIA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:18 +0100 Subject: [PATCH 11/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-11-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4891; i=mripard@kernel.org; h=from:subject:message-id; bh=4FufsHC9m2G2exxSOBIj1GnRZlr7++zve5XtvmcgBsg=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdylJlG+z+FTcrm3x9sokv7/pnzzf8/g9OZBiqywrOC tjsUP+pYyoLgzAng6yYIssTmbDTy9sXVznYr/wBM4eVCWQIAxenAExklg1jrfRvVX6ds9ZzTss5 2MdL/jxWciH7feLyu2v4l8jfjNe5qHuIV+HUj7O6Gpwptn3GH7cJMjY8CS0Krvlh0/a8t1M9y+9 YYuhsgVLtxbzbJ9te8a0MddeeMveO7MTH7ss4Ok8mnfl1rx4A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_commit_planes() updates all planes affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 55c91f2821d550c8af52b71d8f452e0fdee997e4..9f3cf5df0dd810e3725bf44a02a9574f676f17de 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2719,19 +2719,19 @@ static bool plane_crtc_active(const struct drm_plane_state *state) } /** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * @flags: flags for committing plane state * * This function commits the new plane state using the plane and atomic helper * functions for planes and CRTCs. It assumes that the atomic state has already * been pushed into the relevant object state pointers, since this step can no * longer fail. * - * It still requires the global state object @old_state to know which planes and + * It still requires the global state object @state to know which planes and * crtcs need to be updated though. * * Note that this function does all plane updates across all CRTCs in one step. * If the hardware can't support this approach look at * drm_atomic_helper_commit_planes_on_crtc() instead. @@ -2758,36 +2758,36 @@ static bool plane_crtc_active(const struct drm_plane_state *state) * The drm_atomic_helper_commit() default implementation doesn't set the * ACTIVE_ONLY flag to most closely match the behaviour of the legacy helpers. * This should not be copied blindly by drivers. */ void drm_atomic_helper_commit_planes(struct drm_device *dev, - struct drm_atomic_state *old_state, + struct drm_atomic_state *state, uint32_t flags) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; struct drm_plane *plane; struct drm_plane_state *old_plane_state, *new_plane_state; int i; bool active_only = flags & DRM_PLANE_COMMIT_ACTIVE_ONLY; bool no_disable = flags & DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private; if (!funcs || !funcs->atomic_begin) continue; if (active_only && !new_crtc_state->active) continue; - funcs->atomic_begin(crtc, old_state); + funcs->atomic_begin(crtc, state); } - for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, new_plane_state, i) { + for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { const struct drm_plane_helper_funcs *funcs; bool disabling; funcs = plane->helper_private; @@ -2821,40 +2821,40 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (drm_atomic_crtc_needs_modeset(crtc_state) && no_disable) continue; - funcs->atomic_disable(plane, old_state); + funcs->atomic_disable(plane, state); } else if (new_plane_state->crtc || disabling) { - funcs->atomic_update(plane, old_state); + funcs->atomic_update(plane, state); if (!disabling && funcs->atomic_enable) { if (drm_atomic_plane_enabling(old_plane_state, new_plane_state)) - funcs->atomic_enable(plane, old_state); + funcs->atomic_enable(plane, state); } } } - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private; if (!funcs || !funcs->atomic_flush) continue; if (active_only && !new_crtc_state->active) continue; - funcs->atomic_flush(crtc, old_state); + funcs->atomic_flush(crtc, state); } /* * Signal end of framebuffer access here before hw_done. After hw_done, * a later commit might have already released the plane state. */ - for_each_old_plane_in_state(old_state, plane, old_plane_state, i) { + for_each_old_plane_in_state(state, plane, old_plane_state, i) { const struct drm_plane_helper_funcs *funcs = plane->helper_private; if (funcs->end_fb_access) funcs->end_fb_access(plane, old_plane_state); } From patchwork Wed Jan 15 21:05:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940948 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 C9100C02183 for ; Wed, 15 Jan 2025 21:06:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5808810E7EF; Wed, 15 Jan 2025 21:06:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="YCAZyEub"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E66710E7EF for ; Wed, 15 Jan 2025 21:06:16 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EC7265C5C06; Wed, 15 Jan 2025 21:05:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34CE9C4CEE1; Wed, 15 Jan 2025 21:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975175; bh=2hnCkwftdq+vOkBj7qH7PV9IG+JRCfhlib275mgFgpA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YCAZyEubYjM70re2iYK1CWe3RV7IM9RSum00f+4fc0SsDAqoBAIANRc9GZDJY77zl On+x5cwDy5kngGHYEYWyAe/wo1ihwemv2dqlO/mGchr9rq95yoFtqN5pcHXx1Xyrxe Rki5itIZQsny8BULkelksE52VnwvDPjQF6KXBfu+cxOYB8Uw1F5A60W5XzC3n2K3fo JjF+H8tI4PtYw3H72yazEr6+nLKDCT3SuMRIaHZiYjL5pa0ntBCVd7+crJvAVnZE/4 j/njeGUohKfq2G+o8IHCfEgn4vYqmCNhW0v+B5WB45gdxxNuTBsT1p3kOYJsUJwYcT RwDsO184H/zSQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:19 +0100 Subject: [PATCH 12/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-12-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4126; i=mripard@kernel.org; h=from:subject:message-id; bh=2hnCkwftdq+vOkBj7qH7PV9IG+JRCfhlib275mgFgpA=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdylKnPl4T3LFo7a1T6z0WqaV+sEuM4D4gJPbhjGVZz VrfDVUiHVNZGIQ5GWTFFFmeyISdXt6+uMrBfuUPmDmsTCBDGLg4BWAir5oZ6z03B5qv053QdGY1 g27DfjbpRYePhHanHN59TGhBUbvzqTazWXu4Y7LufH4g+sXtUezbFYz1/h0TDq3t2cNz0VWy4+v XE387XQNaOcM9XqjJNV9WfvPjcPj7yhcbDL79XG3G4DJ7vlMYAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_commit_modeset_enables() enables all outputs affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 9f3cf5df0dd810e3725bf44a02a9574f676f17de..b95e30dee1b4e2ba8991affd1e280a7a36171afd 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1474,11 +1474,11 @@ static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, } /** * drm_atomic_helper_commit_modeset_enables - modeset commit to enable outputs * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function enables all the outputs with the new configuration which had to * be turned off for the update. * * For compatibility with legacy CRTC helpers this should be called after @@ -1486,20 +1486,20 @@ static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, * does. But drivers with different needs can group the modeset commits together * and do the plane commits at the end. This is useful for drivers doing runtime * PM since planes updates then only happen when the CRTC is actually enabled. */ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state; struct drm_crtc_state *new_crtc_state; struct drm_connector *connector; struct drm_connector_state *new_conn_state; int i; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { const struct drm_crtc_helper_funcs *funcs; /* Need to filter out CRTCs where only planes change. */ if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) continue; @@ -1511,17 +1511,17 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, if (new_crtc_state->enable) { drm_dbg_atomic(dev, "enabling [CRTC:%d:%s]\n", crtc->base.id, crtc->name); if (funcs->atomic_enable) - funcs->atomic_enable(crtc, old_state); + funcs->atomic_enable(crtc, state); else if (funcs->commit) funcs->commit(crtc); } } - for_each_new_connector_in_state(old_state, connector, new_conn_state, i) { + for_each_new_connector_in_state(state, connector, new_conn_state, i) { const struct drm_encoder_helper_funcs *funcs; struct drm_encoder *encoder; struct drm_bridge *bridge; if (!new_conn_state->best_encoder) @@ -1540,25 +1540,25 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, /* * Each encoder has at most one connector (since we always steal * it away), so we won't call enable hooks twice. */ bridge = drm_bridge_chain_get_first_bridge(encoder); - drm_atomic_bridge_chain_pre_enable(bridge, old_state); + drm_atomic_bridge_chain_pre_enable(bridge, state); if (funcs) { if (funcs->atomic_enable) - funcs->atomic_enable(encoder, old_state); + funcs->atomic_enable(encoder, state); else if (funcs->enable) funcs->enable(encoder); else if (funcs->commit) funcs->commit(encoder); } - drm_atomic_bridge_chain_enable(bridge, old_state); + drm_atomic_bridge_chain_enable(bridge, state); } - drm_atomic_helper_commit_writebacks(dev, old_state); + drm_atomic_helper_commit_writebacks(dev, state); } EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables); /* * For atomic updates which touch just a single CRTC, calculate the time of the From patchwork Wed Jan 15 21:05:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940949 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 3DC00C02183 for ; Wed, 15 Jan 2025 21:06:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4AA610E7E8; Wed, 15 Jan 2025 21:06:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="qQLSWi0W"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A03E10E7E8 for ; Wed, 15 Jan 2025 21:06:19 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id AEFB7A42519; Wed, 15 Jan 2025 21:04:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0FD3C4CEE1; Wed, 15 Jan 2025 21:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975178; bh=LOKttQ8nGaUtTC20bGo7CfKeiLgqBv/SSB8f+7ogkeA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qQLSWi0Wy7jm989bOccZHJbJRQzGEDS2JOOC0l52alRQhxalxtNBxwQ1J5Fue7jFa RcVHXeYBUXPePXk24x06k65VgK1RbaJRRhhAOImPfOaeAMuwRLsL1wrgQdZXm+/5Hz 5SVKIF0gnTLH1jNTZ6I5oQw1BmvUEPlJ+pX6mHRNwjYn+FoZUoShlc+dgnBwqITRwh UUmYDKt3rlnylt8t26A/ZtkgRul6Ui220CFptN/WQFki+Gr53TjNpbp4eEjnd7+mbz vnB5VXgSHUkJRgIK6rTjMFw/q1aqx3gQrzIFykt8ccb3DxZ4wHLfe/msNvGx8turol glzprQdZqV5ZA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:20 +0100 Subject: [PATCH 13/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-13-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3079; i=mripard@kernel.org; h=from:subject:message-id; bh=LOKttQ8nGaUtTC20bGo7CfKeiLgqBv/SSB8f+7ogkeA=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdylLMnntkeCT/e0pwuH+9ybve5JqEgvt1nuVrGZ10v 368E6TRMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTAC4Sx1hfnHqnYqffqeMm5xX8 ly1asfzEfNOi9+2qStz9K7K0RQ679F63nTrhxaw3LWc3P/K49zuSsb5Uvf/e/8daujopG6SEAna sZrNXjpgQKieRuXHSVA53cY7qM57WPgpPVFK1ss9YmKXuAAA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_bridge_chain_pre_enable() enables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_bridge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 9755761d0d0f2659cf8d71e1734aee9772cc8c0f..b060b699e059f0d4bd47dcc4aba49399ce45b332 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -690,17 +690,17 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, } } EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); static void drm_atomic_bridge_call_pre_enable(struct drm_bridge *bridge, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { - if (old_state && bridge->funcs->atomic_pre_enable) { + if (state && bridge->funcs->atomic_pre_enable) { struct drm_bridge_state *old_bridge_state; old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, + drm_atomic_get_old_bridge_state(state, bridge); if (WARN_ON(!old_bridge_state)) return; bridge->funcs->atomic_pre_enable(bridge, old_bridge_state); @@ -711,11 +711,11 @@ static void drm_atomic_bridge_call_pre_enable(struct drm_bridge *bridge, /** * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in * the encoder chain * @bridge: bridge control structure - * @old_state: old atomic state + * @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_pre_enable (falls back on * &drm_bridge_funcs.pre_enable) 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_enable @@ -731,11 +731,11 @@ static void drm_atomic_bridge_call_pre_enable(struct drm_bridge *bridge, * Bridge C, Bridge D, Bridge E, Bridge A, Bridge B. * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_encoder *encoder; struct drm_bridge *iter, *next, *limit; if (!bridge) @@ -770,15 +770,15 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, /* At the first bridge to request prev * bridges called first. */ break; - drm_atomic_bridge_call_pre_enable(next, old_state); + drm_atomic_bridge_call_pre_enable(next, state); } } - drm_atomic_bridge_call_pre_enable(iter, old_state); + drm_atomic_bridge_call_pre_enable(iter, state); if (iter->pre_enable_prev_first) /* Jump all bridges that we have already pre_enabled */ iter = limit; From patchwork Wed Jan 15 21:05:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940950 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 6B767C02183 for ; Wed, 15 Jan 2025 21:06:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1D3710E7EC; Wed, 15 Jan 2025 21:06:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="DuRZAKj3"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id D666110E7F0 for ; Wed, 15 Jan 2025 21:06:21 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 90E635C5CD8; Wed, 15 Jan 2025 21:05:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B25BDC4CED1; Wed, 15 Jan 2025 21:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975181; bh=W7E34uIDD6EPQfuiAssvLwh6q5tyCyKBTh2H3DKKzSE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DuRZAKj3zoUmxhCLSVuc8SguFHLiq/qCJyUgM30Hqo9T/JAByjNZYoUQhLNBVZika I/UXNATHTWccD89AtkgrC1JTHg7x9w7dT8oRAom2bPMhm8XgZ9WizHJKP5D8moKHhd b2jrV+MPHHpN7j4CHFAw+HwiF+3mq41KRItcUlM1QPIWNxrBLVNuI0QbG2hXoZ2bIn s76+fnA38CmQ8C9Ar395TR6s/Yq133bFQgWp7qpaf7BrE5vlDlMjo2w4zEDc25PHso 7a0opgQ9wXUNkXkPUHRYJjpN24LHXVYI05grot1KNgfQ0Fj3j8VfRxIwakCRJLQWEE y7J/mksnSwF7g== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:21 +0100 Subject: [PATCH 14/29] drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-14-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2108; i=mripard@kernel.org; h=from:subject:message-id; bh=W7E34uIDD6EPQfuiAssvLwh6q5tyCyKBTh2H3DKKzSE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdytJvqlwT5vA8NXxRdtDhfGzy8mWp1VNtBAIPVVvG+ 1yZHRfdMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACZyZgtjw7rGZbsX75oolyjc k79qy+Xi8x6suU53pdnvHhTVe7b5hH+ksHLcvBtZPHJpdo6vvoTGMjZskfgz+8Mf9jmP9sX45W0 86Ln1WoDNMsmaTSuKH4d7sybw7dRZuaTl2RTWz/fe1G9oWW8IAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_bridge_chain_enable() enables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_bridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index b060b699e059f0d4bd47dcc4aba49399ce45b332..c937980d6591fd98e33e37d799ebf84e7e6c5529 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -789,21 +789,21 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, EXPORT_SYMBOL(drm_atomic_bridge_chain_pre_enable); /** * drm_atomic_bridge_chain_enable - enables all bridges in the encoder chain * @bridge: bridge control structure - * @old_state: old atomic state + * @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_enable (falls back on * &drm_bridge_funcs.enable) op for all the bridges in the encoder chain, * starting from the first bridge to the last. These are called after completing * &drm_encoder_helper_funcs.atomic_enable * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_encoder *encoder; if (!bridge) return; @@ -812,11 +812,11 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { if (bridge->funcs->atomic_enable) { struct drm_bridge_state *old_bridge_state; old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, + drm_atomic_get_old_bridge_state(state, bridge); if (WARN_ON(!old_bridge_state)) return; bridge->funcs->atomic_enable(bridge, old_bridge_state); From patchwork Wed Jan 15 21:05:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940951 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 74549C02183 for ; Wed, 15 Jan 2025 21:06:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECDCB10E7F0; Wed, 15 Jan 2025 21:06:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="gLCPylpm"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id E70B810E7F0 for ; Wed, 15 Jan 2025 21:06:24 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id EE412A4157C; Wed, 15 Jan 2025 21:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 580E1C4CED1; Wed, 15 Jan 2025 21:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975183; bh=imbzOlHPI3T2/bhE2uZ8m8ju5T+B94wxhjoKisesxXk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gLCPylpmuzF/4T5+QWVCSPTQowEqlUMYBjtqfW9CUkzgGLxWGtSdg6uht/QizeDpg bRWaEorB6HNWH3SkJxQ7gqIm0bb+8lyqZAgT/mb2CjmfMNypRMrhPA2GzlpE9I1vp6 7O7sECBjz1IeU+clbL3jNQBhvnpsNDZOCHGuqceQkLLvxYcWCeUnHDn+36ncLU0kax LZi3Qa6YqsHZExJEbQwBKLp4Q97tqsyMM1tx0sFfDx2Npx/h03hYzpSUw2ifNa4Tey ukjmBcUWk4RZRSSJzI+MaV+YTjh/oho25WZCEM/IGrpIUKeRLVN5qd1OnhZLvUgEg5 DVeYY+r3rXnLg== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:22 +0100 Subject: [PATCH 15/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-15-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1760; i=mripard@kernel.org; h=from:subject:message-id; bh=imbzOlHPI3T2/bhE2uZ8m8ju5T+B94wxhjoKisesxXk=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdytIzYvzudB9me6oRN6v4rl30R8U/slyHHZf9FrnzI pElJW1Dx1QWBmFOBlkxRZYnMmGnl7cvrnKwX/kDZg4rE8gQBi5OAZjIjgeMDRcPfipX+jgj7c/5 8NSb69MLIoq21qya/HjKi+orhXUv21jm7pA+EOm7aOsa9mD7y/qzAhjr7DTa6gtW2ES8Xedve0r nnX4xS4vuQoffFkWbXxXGMag4cu2QDS+WXH9gZ+Dp1bemvT8FAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_commit_writebacks() updates all writeback connectors affected by a new commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index b95e30dee1b4e2ba8991affd1e280a7a36171afd..cf859fa0110ad1154021e970dc262387cf3eb0c8 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1451,26 +1451,26 @@ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev, crtc_set_mode(dev, state); } EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_disables); static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_connector *connector; struct drm_connector_state *new_conn_state; int i; - for_each_new_connector_in_state(old_state, connector, new_conn_state, i) { + for_each_new_connector_in_state(state, connector, new_conn_state, i) { const struct drm_connector_helper_funcs *funcs; funcs = connector->helper_private; if (!funcs->atomic_commit) continue; if (new_conn_state->writeback_job && new_conn_state->writeback_job->fb) { WARN_ON(connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK); - funcs->atomic_commit(connector, old_state); + funcs->atomic_commit(connector, state); } } } /** From patchwork Wed Jan 15 21:05:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940952 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 428ADC02180 for ; Wed, 15 Jan 2025 21:06:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C0DCF10E7F5; Wed, 15 Jan 2025 21:06:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ais8f+py"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2612C10E7F5 for ; Wed, 15 Jan 2025 21:06:27 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D1EED5C035F; Wed, 15 Jan 2025 21:05:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00BE6C4CED1; Wed, 15 Jan 2025 21:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975186; bh=gSa5hgJmZNyZLS4aT9fuejsL92OjyuPuv7yfGUgFx0M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ais8f+pyjMV1cqoEwfuy6hHcdir3L9+cg7J1yuwR0ZZGCPF+7D4b6bcb8EMb5aFhU GQeKxzXSBWX5heX5oaFl6L3JSnbQsmIZnbini1QXOlRNbOskosNxeOt50XtYhEG6qB s0U8qnKxDkNaIWQ20aJSr2Ln3CLp14o7v4hvgEw4l/5NxvuxAvTWyD+bb3WAU2Y/0E XEHy5VsYgBJtV1fPBjKjOHVNXDHqlASNx+jfa2y2ohqM4lzTyTQcGGgL9i8me4SYpM evhCY9m/HrsU/JOuwZeCuVu1NFTqDZgEFNWdj6EnGYilGdp/LcmLfwXDYT4zewShXg 2LuGqljdsk/CQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:23 +0100 Subject: [PATCH 16/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-16-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2558; i=mripard@kernel.org; h=from:subject:message-id; bh=gSa5hgJmZNyZLS4aT9fuejsL92OjyuPuv7yfGUgFx0M=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyjLCBpJ3BTpPKTN51UU/+XH2oFagyOyJgcw7Z909v VC/U52vYyoLgzAng6yYIssTmbDTy9sXVznYr/wBM4eVCWQIAxenAEwkMZexYVFT1p7pbdfr4m/5 hZ7jv/FINFU9ZcLBRpUc9bU8po1skz91F7344p8W+SE0XlbbctlTxnqHNWu1rDlYxeqN3mb1MTX MOFj2s1YlOPjZtaUyEV2fzNkO3ahzz5WKTVueuGl+7n3fjwA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_fake_vblank() fake a vblank event if needed when a new commit is being applied. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index cf859fa0110ad1154021e970dc262387cf3eb0c8..78bc540158b7c64129eb728d8f8d67a6797bd0b3 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2460,11 +2460,11 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state) } EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies); /** * drm_atomic_helper_fake_vblank - fake VBLANK events if needed - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function walks all CRTCs and fakes VBLANK events on those with * &drm_crtc_state.no_vblank set to true and &drm_crtc_state.event != NULL. * The primary use of this function is writeback connectors working in oneshot * mode and faking VBLANK events. In this case they only fake the VBLANK event @@ -2476,29 +2476,29 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies); * VBLANK interrupt. * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_fake_vblank(struct drm_atomic_state *old_state) +void drm_atomic_helper_fake_vblank(struct drm_atomic_state *state) { struct drm_crtc_state *new_crtc_state; struct drm_crtc *crtc; int i; - for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { unsigned long flags; if (!new_crtc_state->no_vblank) continue; - spin_lock_irqsave(&old_state->dev->event_lock, flags); + spin_lock_irqsave(&state->dev->event_lock, flags); if (new_crtc_state->event) { drm_crtc_send_vblank_event(crtc, new_crtc_state->event); new_crtc_state->event = NULL; } - spin_unlock_irqrestore(&old_state->dev->event_lock, flags); + spin_unlock_irqrestore(&state->dev->event_lock, flags); } } EXPORT_SYMBOL(drm_atomic_helper_fake_vblank); /** From patchwork Wed Jan 15 21:05:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940953 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 50B6FC02185 for ; Wed, 15 Jan 2025 21:06:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4E1010E7FB; Wed, 15 Jan 2025 21:06:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="V7LKk2IR"; 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 BE1A610E7FB for ; Wed, 15 Jan 2025 21:06:29 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 794285C5E88; Wed, 15 Jan 2025 21:05:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BB2AC4CED1; Wed, 15 Jan 2025 21:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975189; bh=zx3u1Khvkx4qTNs/PbrVy6WCbYbSdR514iklgqEorIU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=V7LKk2IRdH5CRt/RnvQYtbiSUuw0J2CgtuxjPfkt/tG2xoWUiQoPwO2PMBkL6QRkH lKj5tGw5etcUfkVbJKMhL47KMbPvsyABHU8hirdfraB0bgrP4BMHB19MSRD6Da2CxO GnqWO6I6J3jVg7Z6GRcNUkk7a8dFW3vRfnu49ljKIkw7hi63UFGiptLgdPj/sHeB+z KWssFN9XQ9rupzA1Zvf3PvuKAGfjvoOLrCqTkh20iBvR+BFxWBP2t9DasRbHt/h8nL SDx99zspEMHMe2MbdMaLo9t01x1eaS56QEZe5g+PJ8mP1tDK+cwnyV6O52B8DcMC82 dCZ2pMOoc+mEA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:24 +0100 Subject: [PATCH 17/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-17-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2136; i=mripard@kernel.org; h=from:subject:message-id; bh=zx3u1Khvkx4qTNs/PbrVy6WCbYbSdR514iklgqEorIU=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyjIVcV3HS19nbuRVq3jPNF18h7p5yvVd5T9L17y7V Pk8V3ZPx1QWBmFOBlkxRZYnMmGnl7cvrnKwX/kDZg4rE8gQBi5OAZhIw1TGet8Paqp5oQvEV+Za FnfN+ZnKbih+Xu8BY7Uowyv+e7mK5T/cF81e5xHXZexuv+28++k4xobvEl+dHU1cOResOzTtT86 VdXflN2zXeJZ5vCe86tbPpVVt661n3j4Q6iat3r74K8+dX88B X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_commit_hw_done() signals hardware completion of a given commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 78bc540158b7c64129eb728d8f8d67a6797bd0b3..d642bbc074bd364256409c91649f8d8aa10f5023 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2501,11 +2501,11 @@ void drm_atomic_helper_fake_vblank(struct drm_atomic_state *state) } EXPORT_SYMBOL(drm_atomic_helper_fake_vblank); /** * drm_atomic_helper_commit_hw_done - setup possible nonblocking commit - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function is used to signal completion of the hardware commit step. After * this step the driver is not allowed to read or change any permanent software * or hardware modeset state. The only exception is state protected by other * means than &drm_modeset_lock locks. @@ -2514,18 +2514,18 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank); * this function is called. * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; struct drm_crtc_commit *commit; int i; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { commit = new_crtc_state->commit; if (!commit) continue; /* From patchwork Wed Jan 15 21:05:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940954 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 AF2B4C02183 for ; Wed, 15 Jan 2025 21:06:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F65D10E7FD; Wed, 15 Jan 2025 21:06:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="EXrpd3Z5"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F05910E7FF for ; Wed, 15 Jan 2025 21:06:32 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 30EF15C5EA4; Wed, 15 Jan 2025 21:05:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 520ECC4CED1; Wed, 15 Jan 2025 21:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975191; bh=VbD59Rc/xrLvH8j0QsdsdtGobqdBYrbMJL7Oj4VqEQQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EXrpd3Z5fFIp85nnyGaG57zFGSoPO4vagwMRYfcklq0yN8u/JFXUqYL8gVh6xLB0m rMXAwtCrfssRGoOgYiii/FM9ggEqv6LXUytu5sm5Fv495slBA7sEKKJg/h/k+3e8EF JzlvaEUfKn/yAyMo2+/JiVStEYPJ2q4DVu7hdUe3LMVxjE98vX7mOpwPPHbCGgyhG5 AEJrVd4xQD+iN71uJIvAwzHt5lsI6dBiHiWckbJaHzzqc4/rR3nemCrHr+3f8SBMmL ZG6YhcWDRyUnhULl3v0W0Yn70G+fUYpf7PmL0rzr1jdKFwZn7LlT5WOf9QARpuja/X woVczZp1GBUBg== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:25 +0100 Subject: [PATCH 18/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-18-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3197; i=mripard@kernel.org; h=from:subject:message-id; bh=VbD59Rc/xrLvH8j0QsdsdtGobqdBYrbMJL7Oj4VqEQQ=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyrIhlgvn7NmswNwhlsVa80d8Qi1v8b6cdZvlDV/aF VhM27C4YyoLgzAng6yYIssTmbDTy9sXVznYr/wBM4eVCWQIAxenAEzk3zvGhvmmmgIXmwTr6io7 Y9uW2+XNiz8y0/nH5cNzXdYeNv7nmDgv6ddivanZx6q2rY6/r5CpwNhwWCeY1WnlSmZPcYUrn6e 4PhRa80Vs+fkJgQumiDpYfVu58MGV/jtyb1Qn2KxYckfiXqoSAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_wait_for_vblanks() waits for vblank events on all the CRTCs affected by a commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d642bbc074bd364256409c91649f8d8aa10f5023..581fd0f14ba0aa2a9d0334cad49575de3fb5fb20 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1656,11 +1656,11 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev, EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences); /** * drm_atomic_helper_wait_for_vblanks - wait for vblank on CRTCs * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * Helper to, after atomic commit, wait for vblanks on all affected * CRTCs (ie. before cleaning up old framebuffers using * drm_atomic_helper_cleanup_planes()). It will only wait on CRTCs where the * framebuffers have actually changed to optimize for the legacy cursor and @@ -1670,44 +1670,44 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences); * drm_atomic_helper_setup_commit() should look at * drm_atomic_helper_wait_for_flip_done() as an alternative. */ void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state, *new_crtc_state; int i, ret; unsigned int crtc_mask = 0; /* * Legacy cursor ioctls are completely unsynced, and userspace * relies on that (by doing tons of cursor updates). */ - if (old_state->legacy_cursor_update) + if (state->legacy_cursor_update) return; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { if (!new_crtc_state->active) continue; ret = drm_crtc_vblank_get(crtc); if (ret != 0) continue; crtc_mask |= drm_crtc_mask(crtc); - old_state->crtcs[i].last_vblank_count = drm_crtc_vblank_count(crtc); + state->crtcs[i].last_vblank_count = drm_crtc_vblank_count(crtc); } - for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { + for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { if (!(crtc_mask & drm_crtc_mask(crtc))) continue; ret = wait_event_timeout(dev->vblank[i].queue, - old_state->crtcs[i].last_vblank_count != - drm_crtc_vblank_count(crtc), - msecs_to_jiffies(100)); + state->crtcs[i].last_vblank_count != + drm_crtc_vblank_count(crtc), + msecs_to_jiffies(100)); WARN(!ret, "[CRTC:%d:%s] vblank wait timed out\n", crtc->base.id, crtc->name); drm_crtc_vblank_put(crtc); From patchwork Wed Jan 15 21:05:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940955 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 6A3B6C02183 for ; Wed, 15 Jan 2025 21:06:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB60210E7FF; Wed, 15 Jan 2025 21:06:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="q1IRDe/v"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 271D110E7FF for ; Wed, 15 Jan 2025 21:06:35 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D58445C5E8E; Wed, 15 Jan 2025 21:05:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 030E7C4CED1; Wed, 15 Jan 2025 21:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975194; bh=dDSrEJOy32MEMpzmIKaY91KJje1WwYUjtbVILeIG9mQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=q1IRDe/v+pmW+pZXDd1ChzHoQlFfqFzBX+jnhylRdmKxV5nAZrdh3kyHT8bf24JKn YJzv8BU5kJ3QpKsIjIecl2y7A9hActVpAiV8VJtIg68sInyC8t7x+YkCwFYWxj4hJv DMyS4THV4k52tbY8xIv/p3gX5KwcA9vBgIjU5aLqKilZeM5+keUh7UK8MwtDfUfsrP rHwIIgEKFt2F84nri5MUwzuWwh0V8BxuCDLHXf50zqACMiHA1KQEmI8TOUjMRAwXwx rXCHkOvieBAz9Y4O1FPLqW4kq6hdq0LzrFdzJAoLJOJl2AP6nPemeRkajm/5YKj9Na 9CWE/QuZdTSYw== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:26 +0100 Subject: [PATCH 19/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-19-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2219; i=mripard@kernel.org; h=from:subject:message-id; bh=dDSrEJOy32MEMpzmIKaY91KJje1WwYUjtbVILeIG9mQ=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyrK3rs5eUNQwgUnq/qO7N/KOrwwNjjkS/atdd5WM+ uvbT57ndExlYRDmZJAVU2R5IhN2enn74ioH+5U/YOawMoEMYeDiFICJtD9hrOE+KfCqwv1fo61p k/t7p4/+fLq98xJLGS0y/eUmLen/yXDwOu+MbMaOnSoTKpe/dzu3mLFOc/GBQ0pHn/I1mcxmy7/ 84EP/W18+29NRfvubhYymOl2ocGksYPz9IvLliqtvGILszXcAAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_cleanup_planes() is one of the final part of a commit, and will free up all plane resources used in the previous commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 581fd0f14ba0aa2a9d0334cad49575de3fb5fb20..000ae2d4ded286458ee386e34336d650907a8073 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2977,28 +2977,28 @@ drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state, EXPORT_SYMBOL(drm_atomic_helper_disable_planes_on_crtc); /** * drm_atomic_helper_cleanup_planes - cleanup plane resources after commit * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * This function cleans up plane state, specifically framebuffers, from the old - * configuration. Hence the old configuration must be perserved in @old_state to + * configuration. Hence the old configuration must be perserved in @state to * be able to call this function. * * This function may not be called on the new state when the atomic update * fails at any point after calling drm_atomic_helper_prepare_planes(). Use * drm_atomic_helper_unprepare_planes() in this case. */ void drm_atomic_helper_cleanup_planes(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_plane *plane; struct drm_plane_state *old_plane_state; int i; - for_each_old_plane_in_state(old_state, plane, old_plane_state, i) { + for_each_old_plane_in_state(state, plane, old_plane_state, i) { const struct drm_plane_helper_funcs *funcs = plane->helper_private; if (funcs->cleanup_fb) funcs->cleanup_fb(plane, old_plane_state); } From patchwork Wed Jan 15 21:05:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940956 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 D3109C02180 for ; Wed, 15 Jan 2025 21:06:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F97410E7FC; Wed, 15 Jan 2025 21:06:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Ac+Eoaqa"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCA2A10E800 for ; Wed, 15 Jan 2025 21:06:37 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 76E225C5E9C; Wed, 15 Jan 2025 21:05:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AF5FC4CED1; Wed, 15 Jan 2025 21:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975197; bh=JlNpKq0AqEF+LIgcS78N6Jf/PshBRGdHw/rz3bhUe7g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ac+EoaqaOcamWhz3k5jOYDPP8RGEt1ahxxAZXzaEC5MCl8qlehQSzx+pI27svQUKn p0VxKC6QzR3qRrm5xXVzHh2s57pG7rNmrRsQJ28a4WNdXDFbK4of0iP59YwazSwTQ3 l9C5k9QZ+qhDyW0VAE+RqS/nY+BU/2THunDNZYqd9SKXxFR4mINPYUHyz44/fD23+q T4LNg3YGDs0vFqsKf07vnC1I2CLZCBgjud0O7S2P4Q+1RiYbeXbXKkL008INsDyJyc KejMN9bDQGM1zh44VaXuBSmSyV66GX6HVwcqDuVKxv+HP9dNJ18nmYxOnBl3eAHCUv Bue2KcnpS42sA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:27 +0100 Subject: [PATCH 20/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-20-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3045; i=mripard@kernel.org; h=from:subject:message-id; bh=JlNpKq0AqEF+LIgcS78N6Jf/PshBRGdHw/rz3bhUe7g=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdynLW95u89EVuNYV/fJybfo1PYRXnrRPxa5MVdm472 HovKJ6xYyoLgzAng6yYIssTmbDTy9sXVznYr/wBM4eVCWQIAxenAEzk33LGOt3mGNFvpUW8yQEf fpyTsLU+Ff1j75nwq1ukxc7d33SqMD2L/azLm8/1DAoxfy2DXv97wdgwceoepyJnhV5Rl8v/dOb KioiJbLz+a91MhZ3M/7wzJZ+FbnXxi/QQeWTLvFH3pXvu3eUA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_wait_for_dependencies() is the final part of a commit and signals it completion. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 000ae2d4ded286458ee386e34336d650907a8073..baa32b10c4a08252b736927fedd36c3fccbe6020 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2541,36 +2541,36 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state) /* backend must have consumed any event by now */ WARN_ON(new_crtc_state->event); complete_all(&commit->hw_done); } - if (old_state->fake_commit) { - complete_all(&old_state->fake_commit->hw_done); - complete_all(&old_state->fake_commit->flip_done); + if (state->fake_commit) { + complete_all(&state->fake_commit->hw_done); + complete_all(&state->fake_commit->flip_done); } } EXPORT_SYMBOL(drm_atomic_helper_commit_hw_done); /** * drm_atomic_helper_commit_cleanup_done - signal completion of commit - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * - * This signals completion of the atomic update @old_state, including any + * This signals completion of the atomic update @state, including any * cleanup work. If used, it must be called right before calling * drm_atomic_state_put(). * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state; struct drm_crtc_commit *commit; int i; - for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { + for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { commit = old_crtc_state->commit; if (WARN_ON(!commit)) continue; complete_all(&commit->cleanup_done); @@ -2579,13 +2579,13 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state) spin_lock(&crtc->commit_lock); list_del(&commit->commit_entry); spin_unlock(&crtc->commit_lock); } - if (old_state->fake_commit) { - complete_all(&old_state->fake_commit->cleanup_done); - WARN_ON(!try_wait_for_completion(&old_state->fake_commit->hw_done)); + if (state->fake_commit) { + complete_all(&state->fake_commit->cleanup_done); + WARN_ON(!try_wait_for_completion(&state->fake_commit->hw_done)); } } EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done); /** From patchwork Wed Jan 15 21:05:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940957 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 B5E54C02180 for ; Wed, 15 Jan 2025 21:06:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42D2A10E800; Wed, 15 Jan 2025 21:06:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="aQRGmgoX"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F22410E800 for ; Wed, 15 Jan 2025 21:06:40 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D5C3EA41377; Wed, 15 Jan 2025 21:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C751C4CEE3; Wed, 15 Jan 2025 21:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975199; bh=sDDX/oiMtlwEuDb5DiMZpd8llHRvToc5ZvV7Y0vSefE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aQRGmgoXtOob3SAB5VN3V4zbRNadt2qCPZFhp9Y9t0KNtX16gTitwhGAHiryeK+Mt hObV5WVLr6DOfOqzVlrQ2PKL3Jo3sal+LATk8eTRCzo9dijQCKwy+FQNWJlplEIABu b2fpcwB6Yu2+vAGlklz5POgvUTZzwfOK5x7YFpdmlYtgpfTiEb3K0Bmclcw+pYffVP zES3xkVZXaTGDk6TDZkar4E3C3YAJ5fIE99pMRHGD556BXo/c1/cGA6ahQ1si+rfW4 ue2YqgKUzc5BbEAiqNPcW0L36GaW0g2f5AAvKWfyr7pw1s+v5NuGH+NsQczdGqU832 O+iOehWHyFKfQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:28 +0100 Subject: [PATCH 21/29] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done() MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-21-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2600; i=mripard@kernel.org; h=from:subject:message-id; bh=sDDX/oiMtlwEuDb5DiMZpd8llHRvToc5ZvV7Y0vSefE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdynL+RmJma9lFoo90X639eFjE4HVdy/W8lI0fgh2fH Pv/7nR/x1QWBmFOBlkxRZYnMmGnl7cvrnKwX/kDZg4rE8gQBi5OAZgI90/GhsU71zG3XrlomjNT fLu9e/HhB2d8U0N1G7yeT53E3ne38un/vyVBWnx3uy9O2MObfjWPjbGG1zBxtVXD7rJegV7tm5J pl37u4nRs2zLnX8vm/uNLdxi3mkuEvNkS2ySz88Nrx0/9BfMA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" drm_atomic_helper_wait_for_flip_done() will wait for pages flips on all CRTCs affected by a given commit. It takes the drm_atomic_state being committed as a parameter. However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index baa32b10c4a08252b736927fedd36c3fccbe6020..cb24e590a39f80c0cc5feb8b6a9a4fd41a651211 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1716,11 +1716,11 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); /** * drm_atomic_helper_wait_for_flip_done - wait for all page flips to be done * @dev: DRM device - * @old_state: atomic state object with old state structures + * @state: atomic state object being committed * * Helper to, after atomic commit, wait for page flips on all affected * crtcs (ie. before cleaning up old framebuffers using * drm_atomic_helper_cleanup_planes()). Compared to * drm_atomic_helper_wait_for_vblanks() this waits for the completion on all @@ -1729,32 +1729,32 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); * * This requires that drivers use the nonblocking commit tracking support * initialized using drm_atomic_helper_setup_commit(). */ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *state) { struct drm_crtc *crtc; int i; for (i = 0; i < dev->mode_config.num_crtc; i++) { - struct drm_crtc_commit *commit = old_state->crtcs[i].commit; + struct drm_crtc_commit *commit = state->crtcs[i].commit; int ret; - crtc = old_state->crtcs[i].ptr; + crtc = state->crtcs[i].ptr; if (!crtc || !commit) continue; ret = wait_for_completion_timeout(&commit->flip_done, 10 * HZ); if (ret == 0) drm_err(dev, "[CRTC:%d:%s] flip_done timed out\n", crtc->base.id, crtc->name); } - if (old_state->fake_commit) - complete_all(&old_state->fake_commit->flip_done); + if (state->fake_commit) + complete_all(&state->fake_commit->flip_done); } EXPORT_SYMBOL(drm_atomic_helper_wait_for_flip_done); /** * drm_atomic_helper_commit_tail - commit atomic update to hardware From patchwork Wed Jan 15 21:05:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940958 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 08E0EC02183 for ; Wed, 15 Jan 2025 21:06:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B60310E803; Wed, 15 Jan 2025 21:06:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="e087VOMQ"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3979A10E801 for ; Wed, 15 Jan 2025 21:06:43 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 6F8B2A42528; Wed, 15 Jan 2025 21:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEE68C4CED1; Wed, 15 Jan 2025 21:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975202; bh=ehJPr/l/FwO7pkSiqq2hk3A9URL1NN3vlOmlGJYM1jY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=e087VOMQBtFNI6g2por7/hTrQj5ETw0OsoWIsjhBaZudNgEYZlDZkECZr+KYUJ34b LLtfWKJy6W0f3yuZRkv3Xa0LlCcsrMfjSS9CJ2q4WHdxRDSRd2/X1r7J1hXlIBjrnm Fv1MpDwx3xc88WOijwYwZJVDcEIBfwBcdDMoSCm2lhUuN69bWC/7K8tlO+TdASn1UM nusyWIYM9xPJ2PJ4U6ImuIhdEf9ium2EFZeU+I//TfM30z9lAKH03uxcQwqrDbBkKZ FzZdWlNysf78OtxWnrNbBrRN6rsJfGMIXGxw+LEElCgKmhgwAxgE5aBFals12hhz96 1Z8AqWfyIpHPQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:29 +0100 Subject: [PATCH 22/29] drm/bridge: Rename atomic hooks parameters to drop old prefix MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-22-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2433; i=mripard@kernel.org; h=from:subject:message-id; bh=ehJPr/l/FwO7pkSiqq2hk3A9URL1NN3vlOmlGJYM1jY=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdynLq2UnGsl3KX8LflGpu/rrzZck8/nV9tz31U15c2 9Ove7moYyoLgzAng6yYIssTmbDTy9sXVznYr/wBM4eVCWQIAxenAEykko+x4ZmO+I3onb3LPr3R rbt91qbCwC7h0o2l73v/q5hxPX5hri/O0XZdyfin/GZ5mRMOemumM9Yn9DaGnVjxYtafVP5ls+/ 9Up7trZdo9iuo8U/E3ItPPzbn9eVtu++9aNan+2rZvunWnJcA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 the bridge atomic hooks were using the old_bridge_state name for their drm_bridge_state parameter. However, this state is the current state being committed for all of them, which ends up being confusing. Let's rename it to bridge_state for all of them. Signed-off-by: Maxime Ripard --- include/drm/drm_bridge.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 4b84faf14e368310dd20aa964e8178ec80aa6fa7..8e18130be8bb85fc2463917dde9bf1d281934184 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -303,11 +303,11 @@ struct drm_bridge_funcs { * there is one) when this callback is called. * * The @atomic_pre_enable callback is optional. */ void (*atomic_pre_enable)(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state); + struct drm_bridge_state *bridge_state); /** * @atomic_enable: * * This callback should enable the bridge. It is called right after @@ -323,11 +323,11 @@ struct drm_bridge_funcs { * chain if there is one. * * The @atomic_enable callback is optional. */ void (*atomic_enable)(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state); + struct drm_bridge_state *bridge_state); /** * @atomic_disable: * * This callback should disable the bridge. It is called right before * the preceding element in the display pipe is disabled. If the @@ -340,11 +340,11 @@ struct drm_bridge_funcs { * signals) feeding it is still running when this callback is called. * * The @atomic_disable callback is optional. */ void (*atomic_disable)(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state); + struct drm_bridge_state *bridge_state); /** * @atomic_post_disable: * * This callback should disable the bridge. It is called right after the @@ -359,11 +359,11 @@ struct drm_bridge_funcs { * called. * * The @atomic_post_disable callback is optional. */ void (*atomic_post_disable)(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state); + struct drm_bridge_state *bridge_state); /** * @atomic_duplicate_state: * * Duplicate the current bridge state object (which is guaranteed to be From patchwork Wed Jan 15 21:05:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940959 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 06C04C02180 for ; Wed, 15 Jan 2025 21:06:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 771CC10E801; Wed, 15 Jan 2025 21:06:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="GIGfyyuF"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9524210E801 for ; Wed, 15 Jan 2025 21:06:45 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 510395C007A; Wed, 15 Jan 2025 21:06:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75023C4CED1; Wed, 15 Jan 2025 21:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975204; bh=9T4ReeimU/AWX2mhfPxcnSlL9IFfjkRULA/cewF8mHQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GIGfyyuF+0E+BM33vaISLl+XVtOHjDezKxt5Hfbff+4WRS9uEi4VK/hjxK8fe0WBU jIS3TitzqGof5+zg/olNLxeChpg1sKQznxdH6ISHoywmF6nJ1kbuxp+BpA7iPBxI67 BtVFXO+QU/gG6u3eGIMEw5feCvA8SrCFabEKy/gD/bL5vk/7jMwJGmGC9X3AA23GUA pyKP4NN+UQ7mzWo/41uw+wb0fy2zmj9xpe+tSsm5DK4DZkSKbx3f2JYsZ9slvIAvTg Ir1EtvboOP8XLD4coKo9Cw2G7ZEIkS3nPa4Ltak4Yi8xClONIJC9+O6ni1Law1ZBop EDwGgmxyZQGgA== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:30 +0100 Subject: [PATCH 23/29] drm/bridge: Provide a helper to retrieve current bridge state MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-23-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1204; i=mripard@kernel.org; h=from:subject:message-id; bh=9T4ReeimU/AWX2mhfPxcnSlL9IFfjkRULA/cewF8mHQ=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyvJz54n9/qZ0dem20yGtusa2pqqvTD9OefyaxSD0y Oe7Tz4wdExlYRDmZJAVU2R5IhN2enn74ioH+5U/YOawMoEMYeDiFICJ/A5ibDjOIOb3p7WmJ3Wm nOp7kdCOf0eFQyYzab9YUxzBJKTQ2ex80DFT0OpEvmSJ7ZPCCt4/jDX8XI2xVm7G5Xy67xILtv6 T1jnLNn9r/5Tm1Mais0xT7z+5fiH6x7JXNT1vbtjvS5js/BQA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 current bridge state is accessible from the drm_bridge structure, but since it's fairly indirect it's not easy to figure out. Provide a helper to retrieve it. Signed-off-by: Maxime Ripard --- include/drm/drm_bridge.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 8e18130be8bb85fc2463917dde9bf1d281934184..95c5037a6335e4c1be511e6c31308202015c7754 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -955,10 +955,27 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np) { return NULL; } #endif +/** + * @drm_bridge_get_current_state() - Get the current bridge state + * @bridge: bridge object + * + * RETURNS: + * + * The current bridge state, or NULL if there is none. + */ +static inline struct drm_bridge_state * +drm_bridge_get_current_state(struct drm_bridge *bridge) +{ + if (!bridge) + return NULL; + + return drm_priv_to_bridge_state(bridge->base.state); +} + /** * drm_bridge_get_next_bridge() - Get the next bridge in the chain * @bridge: bridge object * * RETURNS: From patchwork Wed Jan 15 21:05:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940960 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 21E8FC02185 for ; Wed, 15 Jan 2025 21:06:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9925010E805; Wed, 15 Jan 2025 21:06:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="n6UiRYFZ"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73AE610E808 for ; Wed, 15 Jan 2025 21:06:48 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A77D8A42528; Wed, 15 Jan 2025 21:04:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12BDBC4CED1; Wed, 15 Jan 2025 21:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975207; bh=5zLzfFZPREyjvEuyET+bvMC8ZsqMF5Ry5XDxOdMfXqs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=n6UiRYFZNzvlTfen819iBAVzF6FfZpArJHliz49TPpZZ+aqdEL/sGaVcxWjDziOgC GGLZtfck4gFI1HO/LSSirx0AWYxaxBKbIGai7V8KDdFgrUUpqzH61eZwLwkEFmGa66 krlOePI1jnnj0slUNIyVSMocBRuZKkWl+5bkUicmfvvLVZy5ZkANROS/CIqcom5IRx EYlLC+THZjcni++cEO0kveyp6au+mC3J/U4p8qDuqWicOJgdrtlt4osz7/jCMnRqLe vFTgkvhkRE9vRlb4V3CfLrIWiRLAC458WDfDceW7VEILfyMTsIn1Spe+W1qZUqdikV xaY2IVwWhk72A== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:31 +0100 Subject: [PATCH 24/29] drm/bridge: Provide a helper to get the global state from a bridge state MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-24-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1469; i=mripard@kernel.org; h=from:subject:message-id; bh=5zLzfFZPREyjvEuyET+bvMC8ZsqMF5Ry5XDxOdMfXqs=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyvJ3FL9NcPi4LnNzf0pHU6vd0UtMfOebJFsW8X+xm Xrk9oIFHVNZGIQ5GWTFFFmeyISdXt6+uMrBfuUPmDmsTCBDGLg4BWAiu/UYG9521p24H2B9Qtvv lU33ZPaApBunFh3VOVwkLXlvtfOcRNtXqeelZ2qm+a9RSRU80vx0NWOt2JXtzDE/Hk0IN/55fXr e0c6327aq5ZT6lCgt+y+g/ZVvyY/KO647l5lynlLMzohl2M4CAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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" We have access to the global drm_atomic_state from a drm_bridge_state, but since it's fairly indirect it's not as obvious as it can be for other KMS entities. Provide a helper to make it easier to figure out. Signed-off-by: Maxime Ripard --- include/drm/drm_atomic.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 31ca88deb10d262fb3a3f8e14d2afe24f8410cb1..bd7959ae312c99c0a0034d36378ae44f04f6a374 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -1183,10 +1183,26 @@ static inline struct drm_bridge_state * drm_priv_to_bridge_state(struct drm_private_state *priv) { return container_of(priv, struct drm_bridge_state, base); } +/** + * @drm_bridge_state_get_atomic_state() - Get the atomic state from a bridge state + * @bridge_state: bridge state object + * + * RETURNS: + * The global atomic state @bridge_state is a part of, or NULL if there is none. + */ +static inline struct drm_atomic_state * +drm_bridge_state_get_atomic_state(struct drm_bridge_state *bridge_state) +{ + if (!bridge_state) + return NULL; + + return bridge_state->base.state; +} + struct drm_bridge_state * drm_atomic_get_bridge_state(struct drm_atomic_state *state, struct drm_bridge *bridge); struct drm_bridge_state * drm_atomic_get_old_bridge_state(const struct drm_atomic_state *state, From patchwork Wed Jan 15 21:05:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940961 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 D203CC02180 for ; Wed, 15 Jan 2025 21:06:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BB3E10E806; Wed, 15 Jan 2025 21:06:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="j/Rk0YHW"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25D3710E80C for ; Wed, 15 Jan 2025 21:06:51 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 48BC4A42500; Wed, 15 Jan 2025 21:05:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A709AC4CED1; Wed, 15 Jan 2025 21:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975210; bh=/CiUYb4G3lzcZpS8RuUPgDRCzbVp2kboLer3fHdUhgE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=j/Rk0YHWZaLy3DE+xuHzbNP2g7J39AjVtJsOhPqtEM3RRSv1BwXvPVc5tDMXQO+pU RFHPAqxzHnPyJksqGiooCCwzgTctaJaf8ZpXWePhvTDI4EfUY2uCrDh8MSkLuA0V/V l5I2TdDrAiOSH8QIfmMZADIyzJ4xJd+j1P54eqJaJQY/5v73vbWv2bmzbgG+wGUq5j RJCd0JuybCVBPWWt4+Ue4aw6mngRfsVA8JKGiijP23XA9qyV8uoT640xpiZxHy5f6O wsra8BBf/lDacz6UMEiXPBcdHq3cic1GZFY5IYV3VML4/575aZWVN605Pk2GbL/z9Z W/QQaSaM7GugQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:32 +0100 Subject: [PATCH 25/29] drm/bridge: Provide pointers to the connector and crtc in bridge state MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-25-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3800; i=mripard@kernel.org; h=from:subject:message-id; bh=/CiUYb4G3lzcZpS8RuUPgDRCzbVp2kboLer3fHdUhgE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdygqPv69qEVzpmp9ffqxu0REZw1L2gJuR8TYzeHycW Hamq7J0TGVhEOZkkBVTZHkiE3Z6efviKgf7lT9g5rAygQxh4OIUgIlkJTPWh6izeJjxf9RKKX+r J5j/bt+qW4+kmJuU+i7PEJZx5FlTGllpNXd65b5VLkmZvzfy7GZhbDh6XTtabPO0YIuXVzniA9Q 023/u7w2fl3ntSsBL7XN/b3YaTd61cYP8fdPFMjeqwx12zAMA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 connectors are no longer necessarily created by the bridges drivers themselves but might be created by drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to. Indeed, the only way to retrieve the CRTC is to follow the drm_bridge encoder field, and then the drm_encoder crtc field, both of them being deprecated. And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it. Let's provide both pointers in the drm_bridge_state structure so we don't have to follow deprecated, non-atomic, pointers, and be more consistent with the other KMS entities. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++ drivers/gpu/drm/drm_bridge.c | 21 +++++++++++++-------- include/drm/drm_atomic.h | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 519228eb109533d2596e899a57b571fa0995824f..66661dca077215b78dffca7bc1712f56d35e3918 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state); * that don't subclass the bridge state. */ void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge, struct drm_bridge_state *state) { + if (state->connector) { + drm_connector_put(state->connector); + state->connector = NULL; + } + kfree(state); } EXPORT_SYMBOL(drm_atomic_helper_bridge_destroy_state); /** diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index c937980d6591fd98e33e37d799ebf84e7e6c5529..069c105aa59636c64caffbefcf482133b0db97d9 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -829,19 +829,24 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_enable); static int drm_atomic_bridge_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct drm_bridge_state *bridge_state; + int ret; + + bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, + bridge); + if (WARN_ON(!bridge_state)) + return -EINVAL; + + bridge_state->crtc = crtc_state->crtc; + + drm_connector_get(conn_state->connector); + bridge_state->connector = conn_state->connector; + if (bridge->funcs->atomic_check) { - struct drm_bridge_state *bridge_state; - int ret; - - bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, - bridge); - if (WARN_ON(!bridge_state)) - return -EINVAL; - ret = bridge->funcs->atomic_check(bridge, bridge_state, crtc_state, conn_state); if (ret) return ret; } else if (bridge->funcs->mode_fixup) { diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index bd7959ae312c99c0a0034d36378ae44f04f6a374..b2c5868a3a66280ffc7437fa7a8613079402facd 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -1166,10 +1166,24 @@ struct drm_bridge_state { /** * @bridge: the bridge this state refers to */ struct drm_bridge *bridge; + /** + * @crtc: CRTC the bridge is connected to, NULL if disabled. + * + * Do not change this directly. + */ + struct drm_crtc *crtc; + + /** + * @connector: The connector the bridge is connected to, NULL if disabled. + * + * Do not change this directly. + */ + struct drm_connector *connector; + /** * @input_bus_cfg: input bus configuration */ struct drm_bus_cfg input_bus_cfg; From patchwork Wed Jan 15 21:05:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940962 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 8C104C02185 for ; Wed, 15 Jan 2025 21:06:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1217E10E808; Wed, 15 Jan 2025 21:06:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="pV+sqXoD"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86DC410E80C for ; Wed, 15 Jan 2025 21:06:53 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 341FF5C007A; Wed, 15 Jan 2025 21:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 561F0C4CED1; Wed, 15 Jan 2025 21:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975212; bh=4rng1/FXPgrbijYp0baw2dWK17v5rUUL8Bb9KbH4Svs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pV+sqXoDB15iLdZf1llE4DgWAHabsi0WDr/x7Gv34uBpFWBsfikghmoKlI1Vc5fUB 9mV/HynzH7zDB6p5r4a0nAxVmXK1PPr+a9TDzCkcXIcVCajRGPBqeJ0/KVZ50CT+DT 4S8qokCABwQaPUxoFZuH4q5lkNfatPLOOeiIFqHpDPbsUUh2q06TNW+nV9X4uDp01Q 3/qU3lIczX9m8wem6T731zWjyaHkHk1sK+Ju+9Z9PcBQQM37oeBEK8iYk/QgxVHsMr ZHo4j0hxlchqbyBV7RQurcvYYM2Guwq29BOLvlcP4GnVU84S9JPfNBlezj96nSpbI3 Z17RWfS5gx05A== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:33 +0100 Subject: [PATCH 26/29] drm/bridge: cdns-csi: Switch to atomic helpers MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-26-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4145; i=mripard@kernel.org; h=from:subject:message-id; bh=4rng1/FXPgrbijYp0baw2dWK17v5rUUL8Bb9KbH4Svs=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdygpT7SINg+zWPHMwWi9RFtpXU/13R8HkJvNbbXWMm udCz+Z3TGVhEOZkkBVTZHkiE3Z6efviKgf7lT9g5rAygQxh4OIUgInkKjHWp+/Pnt/irL+Nq7tL pG3vDX3HFVIG98qfXYzW5uGcu9gppC6ya2VSGcufBzuTuqUOzH/PWJ8X07pMmoEliSumPuk3w49 UqQuqOs+4L5x5KsNs86j68uKkV0cM4+Y1fZL4diOMITBfFwA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 Cadence DSI driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers. This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index c7a0247e06adf3e532f830363b3422a8058513ef..aab4959a6f80c3502f717e0881eef30a2c7d1f18 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -653,11 +653,12 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, return MODE_BAD; return MODE_OK; } -static void cdns_dsi_bridge_disable(struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); u32 val; @@ -673,11 +674,12 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge) dsi->platform_ops->disable(dsi); pm_runtime_put(dsi->base.dev); } -static void cdns_dsi_bridge_post_disable(struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); pm_runtime_put(dsi->base.dev); @@ -750,11 +752,12 @@ static void cdns_dsi_init_link(struct cdns_dsi *dsi) writel(val, dsi->regs + MCTL_MAIN_EN); dsi->link_initialized = true; } -static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); struct cdns_dsi_output *output = &dsi->output; struct drm_display_mode *mode; @@ -768,11 +771,11 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) return; if (dsi->platform_ops && dsi->platform_ops->enable) dsi->platform_ops->enable(dsi); - mode = &bridge->encoder->crtc->state->adjusted_mode; + mode = &bridge_state->crtc->state->adjusted_mode; nlanes = output->dev->lanes; WARN_ON_ONCE(cdns_dsi_check_conf(dsi, mode, &dsi_cfg, false)); cdns_dsi_hs_init(dsi); @@ -890,11 +893,12 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) tmp = readl(dsi->regs + MCTL_MAIN_EN) | IF_EN(input->id); writel(tmp, dsi->regs + MCTL_MAIN_EN); } -static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge); struct cdns_dsi *dsi = input_to_dsi(input); if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) @@ -905,14 +909,14 @@ static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge) } static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = { .attach = cdns_dsi_bridge_attach, .mode_valid = cdns_dsi_bridge_mode_valid, - .disable = cdns_dsi_bridge_disable, - .pre_enable = cdns_dsi_bridge_pre_enable, - .enable = cdns_dsi_bridge_enable, - .post_disable = cdns_dsi_bridge_post_disable, + .atomic_disable = cdns_dsi_bridge_atomic_disable, + .atomic_pre_enable = cdns_dsi_bridge_atomic_pre_enable, + .atomic_enable = cdns_dsi_bridge_atomic_enable, + .atomic_post_disable = cdns_dsi_bridge_atomic_post_disable, }; static int cdns_dsi_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *dev) { From patchwork Wed Jan 15 21:05:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940963 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 6C372C02183 for ; Wed, 15 Jan 2025 21:06:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB52D10E80C; Wed, 15 Jan 2025 21:06:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ViWP2XFO"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5684810E810 for ; Wed, 15 Jan 2025 21:06:56 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0F65D5C5E72; Wed, 15 Jan 2025 21:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 075AEC4CED1; Wed, 15 Jan 2025 21:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975215; bh=IFyKqYW5kHErE1g3zqtG1lE+48aizUrsrSVZsplb+88=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ViWP2XFOSZIy71cyqnNaXxpksuVvC3WszqizJsdRSwArAyedVNvA/rg9WmtmoSYtm PfsmiWGZx3S1Y2KoTEt13xyJczZyuirxgUkSVI+akQ6SNboZkBxp1F+KDNUhm0t41d K7JLCMVOXvBXOwXs6PMxzk4/1JrQ7Z5TdREleSXOs/YVD9bDl6ylQe1hNLxQ6IN0wP yb3Fkl/k3BRTdjCpdr3JdVj1jjKnsLhngkCjqiV54Ctu4vIulpC+1G6JE7R4VrqI8s P2Gpoha96R3BQtKE80akwHILXs0tAwwT676mMNAlqvix6zNB64YIojakwwjMeEpE0x xqQ8Sn6DsxiiQ== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:34 +0100 Subject: [PATCH 27/29] drm/bridge: tc358775: Switch to atomic commit MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-27-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3798; i=mripard@kernel.org; h=from:subject:message-id; bh=IFyKqYW5kHErE1g3zqtG1lE+48aizUrsrSVZsplb+88=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyoqvkxK+5Gi9s/tu+GTW1nOP34gyX7p1f/qVZLPiW Ym9HwI7OqayMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBEckwZ62yTj19ONXNbNOHd 1KmJi1O7t7xZfCLH9JLBz6yP7+dGPv7DE39z0s91PuYhF14cOP9M7wNjfc2KpAQz56AlYssOHeh fcPjaveu7jl44Uph9MfXoXKPIF7lz1DOn/1z868RJ8btO+tpL3wAA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 tc358775 driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers. This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/tc358775.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c index 0b4efaca6d682320b76ce09ed41824ae7f84ca2d..8f8ed8dc033daf001fc188d919fb38918673bd72 100644 --- a/drivers/gpu/drm/bridge/tc358775.c +++ b/drivers/gpu/drm/bridge/tc358775.c @@ -285,11 +285,12 @@ struct tc_data { static inline struct tc_data *bridge_to_tc(struct drm_bridge *b) { return container_of(b, struct tc_data, bridge); } -static void tc_bridge_pre_enable(struct drm_bridge *bridge) +static void tc_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct tc_data *tc = bridge_to_tc(bridge); struct device *dev = &tc->dsi->dev; int ret; @@ -308,11 +309,12 @@ static void tc_bridge_pre_enable(struct drm_bridge *bridge) gpiod_set_value(tc->reset_gpio, 0); usleep_range(10, 20); } -static void tc_bridge_post_disable(struct drm_bridge *bridge) +static void tc_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct tc_data *tc = bridge_to_tc(bridge); struct device *dev = &tc->dsi->dev; int ret; @@ -367,34 +369,22 @@ static void d2l_write(struct i2c_client *i2c, u16 addr, u32 val) if (ret < 0) dev_err(&i2c->dev, "Error %d writing to subaddress 0x%x\n", ret, addr); } -/* helper function to access bus_formats */ -static struct drm_connector *get_connector(struct drm_encoder *encoder) -{ - struct drm_device *dev = encoder->dev; - struct drm_connector *connector; - - list_for_each_entry(connector, &dev->mode_config.connector_list, head) - if (connector->encoder == encoder) - return connector; - - return NULL; -} - -static void tc_bridge_enable(struct drm_bridge *bridge) +static void tc_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct tc_data *tc = bridge_to_tc(bridge); u32 hback_porch, hsync_len, hfront_porch, hactive, htime1, htime2; u32 vback_porch, vsync_len, vfront_porch, vactive, vtime1, vtime2; u32 val = 0; u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay; struct drm_display_mode *mode; - struct drm_connector *connector = get_connector(bridge->encoder); + struct drm_connector *connector = bridge_state->connector; - mode = &bridge->encoder->crtc->state->adjusted_mode; + mode = &bridge_state->crtc->state->adjusted_mode; hback_porch = mode->htotal - mode->hsync_end; hsync_len = mode->hsync_end - mode->hsync_start; vback_porch = mode->vtotal - mode->vsync_end; vsync_len = mode->vsync_end - mode->vsync_start; @@ -599,14 +589,14 @@ static int tc_bridge_attach(struct drm_bridge *bridge, &tc->bridge, flags); } static const struct drm_bridge_funcs tc_bridge_funcs = { .attach = tc_bridge_attach, - .pre_enable = tc_bridge_pre_enable, - .enable = tc_bridge_enable, + .atomic_pre_enable = tc_bridge_atomic_pre_enable, + .atomic_enable = tc_bridge_atomic_enable, .mode_valid = tc_mode_valid, - .post_disable = tc_bridge_post_disable, + .atomic_post_disable = tc_bridge_atomic_post_disable, }; static int tc_attach_host(struct tc_data *tc) { struct device *dev = &tc->i2c->dev; From patchwork Wed Jan 15 21:05:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940964 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 0AD03C02185 for ; Wed, 15 Jan 2025 21:07:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D40E10E810; Wed, 15 Jan 2025 21:07:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="at8sTwos"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F7EB10E816 for ; Wed, 15 Jan 2025 21:06:59 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 61D86A42559; Wed, 15 Jan 2025 21:05:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1FCCC4CED1; Wed, 15 Jan 2025 21:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975218; bh=Lxn7QYHOtKzIJLhVs8S7FYY1s/WdolpaIS+Erde033U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=at8sTwosJIi2FuSt/sSqa3ATo3RkilEXLx6KpeoQLYocdRqs5eZF9BAs5mtt+JAUr YEKFAk7h8uLOv+ueNYfxbh4oDvk1sIVciQiP88fWwEd2/i6Bt6Pwf+c9lWqFwhFgZH aBqf4A3RoSbzij5rtF8vWpdKrpDC3iyNBxFiNtjmInIC5yRUr2Us/fIDpyBXOwp+zD FaEOp+yWogKK/HqFWbwf/z4uCk1fzQp7SJHdho1Bs5SgIBt3OAcUFHuAHh1l+pCMjf ptj0MCAqBOgStSZEF1ehicGCELLCVoBrA1QzlIHjWiQJvxl0ldEqqo/xTeruTnIYh2 EIPgNIsK/jWTw== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:35 +0100 Subject: [PATCH 28/29] drm/bridge: tc358768: Convert to atomic helpers MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-28-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4131; i=mripard@kernel.org; h=from:subject:message-id; bh=Lxn7QYHOtKzIJLhVs8S7FYY1s/WdolpaIS+Erde033U=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdyor3Vvziqf56auvONbyNL0u6Kx60id+M8/zv5X5iZ Zwn47yTHVNZGIQ5GWTFFFmeyISdXt6+uMrBfuUPmDmsTCBDGLg4BWAiNucY69Tu7A5csWBuxdSF t0qDxVOsdLWnFay9/kdTjau398nlbT8c0kull60org4JO71UurXSj7G+rqdXPqPBSmj3q3k597O 4zObllx9+doKV1yCUrXfPjN2358nO7BU1aFd+yrSH7dlU7wsA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 tc358768 driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers. This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/tc358768.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c index ec79b0dd0e2cd6dfbdd8aee54d6a8d9cf8bfb060..043ecfa5f9bac49c30a2fe9f708b5fba9d235bdc 100644 --- a/drivers/gpu/drm/bridge/tc358768.c +++ b/drivers/gpu/drm/bridge/tc358768.c @@ -600,17 +600,29 @@ static void tc358768_bridge_disable(struct drm_bridge *bridge) ret = tc358768_clear_error(priv); if (ret) dev_warn(priv->dev, "Software disable failed: %d\n", ret); } +static void tc358768_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) +{ + tc358768_bridge_disable(bridge); +} + static void tc358768_bridge_post_disable(struct drm_bridge *bridge) { struct tc358768_priv *priv = bridge_to_tc358768(bridge); tc358768_hw_disable(priv); } +static void tc358768_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) +{ + tc358768_bridge_post_disable(bridge); +} + static int tc358768_setup_pll(struct tc358768_priv *priv, const struct drm_display_mode *mode) { u32 fbd, prd, frs; int ret; @@ -680,11 +692,12 @@ static u32 tc358768_dsi_bytes_to_ns(struct tc358768_priv *priv, u32 val) u64 n = priv->dsiclk / 4 * priv->dsi_lanes; return (u32)div_u64(m, n); } -static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) +static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct tc358768_priv *priv = bridge_to_tc358768(bridge); struct mipi_dsi_device *dsi_dev = priv->output.dev; unsigned long mode_flags = dsi_dev->mode_flags; u32 val, val2, lptxcnt, hact, data_type; @@ -717,11 +730,11 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) dev_err(dev, "Software reset failed: %d\n", ret); tc358768_hw_disable(priv); return; } - mode = &bridge->encoder->crtc->state->adjusted_mode; + mode = &bridge_state->crtc->state->adjusted_mode; ret = tc358768_setup_pll(priv, mode); if (ret) { dev_err(dev, "PLL setup failed: %d\n", ret); tc358768_hw_disable(priv); return; @@ -1081,11 +1094,12 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) tc358768_bridge_disable(bridge); tc358768_bridge_post_disable(bridge); } } -static void tc358768_bridge_enable(struct drm_bridge *bridge) +static void tc358768_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state) { struct tc358768_priv *priv = bridge_to_tc358768(bridge); int ret; if (!priv->enabled) { @@ -1164,14 +1178,14 @@ static bool tc358768_mode_fixup(struct drm_bridge *bridge, static const struct drm_bridge_funcs tc358768_bridge_funcs = { .attach = tc358768_bridge_attach, .mode_valid = tc358768_bridge_mode_valid, .mode_fixup = tc358768_mode_fixup, - .pre_enable = tc358768_bridge_pre_enable, - .enable = tc358768_bridge_enable, - .disable = tc358768_bridge_disable, - .post_disable = tc358768_bridge_post_disable, + .atomic_pre_enable = tc358768_bridge_atomic_pre_enable, + .atomic_enable = tc358768_bridge_atomic_enable, + .atomic_disable = tc358768_bridge_atomic_disable, + .atomic_post_disable = tc358768_bridge_atomic_post_disable, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_get_input_bus_fmts = tc358768_atomic_get_input_bus_fmts, From patchwork Wed Jan 15 21:05:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13940965 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 21AC0C02183 for ; Wed, 15 Jan 2025 21:07:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8ED5E10E814; Wed, 15 Jan 2025 21:07:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="JJzZy4yN"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id D759610E813 for ; Wed, 15 Jan 2025 21:07:01 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 051D5A42524; Wed, 15 Jan 2025 21:05:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B4BC4CED1; Wed, 15 Jan 2025 21:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736975220; bh=XkJDra09QyuAsQxq5bOx2/A8d5UtPsANLqv7dd5sQKE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JJzZy4yNYXzt8uCJu3oRULBJqWrC+5eUUSbYyjngHeXkY4LG/56zBWODFzktQB/sb 12cer6wotSjt+l9PXGbajzHU8QGTY76MMzBtCXBHPqxXqmVxzQa24FEQRjdhEwSQkg mnXQAL859N8RQDi4MNisSMKsuR/MWL1tb3cVioEPD5B0e0WsATicwFOY624EIY4p60 LPww1mEyEGrec9xqGx6UB5yaasyMtJaSz+ofJRxH5ekaQHee3srmP5hsWoHnu/TzEm 9/StOeR5xk8/1j4dXDnvSyuNzs6bTsgT9WXFQojPePFrYoCq+l0xL4rmnB652qBNkv +fsPfv2a0jS5w== From: Maxime Ripard Date: Wed, 15 Jan 2025 22:05:36 +0100 Subject: [PATCH 29/29] drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer MIME-Version: 1.0 Message-Id: <20250115-bridge-connector-v1-29-9a2fecd886a6@kernel.org> References: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> In-Reply-To: <20250115-bridge-connector-v1-0-9a2fecd886a6@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Douglas Anderson Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=8143; i=mripard@kernel.org; h=from:subject:message-id; bh=XkJDra09QyuAsQxq5bOx2/A8d5UtPsANLqv7dd5sQKE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDOkdykovk5wesf2d/9hzrqmMhwvHdbbY7CzJzgtaV+Zuy FkbdmF5x1QWBmFOBlkxRZYnMmGnl7cvrnKwX/kDZg4rE8gQBi5OAZiIbzFjnRn/qdkLLu1/8PDl rYUa8Xxs6xo3Gz0u1eB52qoya5bb/cnbtW96b1d5xtzZZXqj52dUAmOdudXR9zZWNj2e5e+9Swv +PIy7vcN6xXzvuLaWTy83nt2exPVijbxtHuutuD3T9b4m6ysBAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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 TI sn65dsi86 driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers. This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index b3d617505dda7d22b38c000fb79de46376adf3f1..c17d9486cf5c36d61eb00af2bdf9ba1b6f890ffd 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -242,15 +242,16 @@ static void ti_sn65dsi86_write_u16(struct ti_sn65dsi86 *pdata, u8 buf[2] = { val & 0xff, val >> 8 }; regmap_bulk_write(pdata->regmap, reg, buf, ARRAY_SIZE(buf)); } -static u32 ti_sn_bridge_get_dsi_freq(struct ti_sn65dsi86 *pdata) +static u32 ti_sn_bridge_get_dsi_freq(struct ti_sn65dsi86 *pdata, + struct drm_bridge_state *bridge_state) { u32 bit_rate_khz, clk_freq_khz; struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; + &bridge_state->crtc->state->adjusted_mode; bit_rate_khz = mode->clock * mipi_dsi_pixel_format_to_bpp(pdata->dsi->format); clk_freq_khz = bit_rate_khz / (pdata->dsi->lanes * 2); @@ -273,11 +274,12 @@ static const u32 ti_sn_bridge_dsiclk_lut[] = { 416000000, 486000000, 460800000, }; -static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata) +static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata, + struct drm_bridge_state *bridge_state) { int i; u32 refclk_rate; const u32 *refclk_lut; size_t refclk_lut_size; @@ -286,11 +288,11 @@ static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata) refclk_rate = clk_get_rate(pdata->refclk); refclk_lut = ti_sn_bridge_refclk_lut; refclk_lut_size = ARRAY_SIZE(ti_sn_bridge_refclk_lut); clk_prepare_enable(pdata->refclk); } else { - refclk_rate = ti_sn_bridge_get_dsi_freq(pdata) * 1000; + refclk_rate = ti_sn_bridge_get_dsi_freq(pdata, bridge_state) * 1000; refclk_lut = ti_sn_bridge_dsiclk_lut; refclk_lut_size = ARRAY_SIZE(ti_sn_bridge_dsiclk_lut); } /* for i equals to refclk_lut_size means default frequency */ @@ -310,16 +312,17 @@ static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata) * regardless of its actual sourcing. */ pdata->pwm_refclk_freq = ti_sn_bridge_refclk_lut[i]; } -static void ti_sn65dsi86_enable_comms(struct ti_sn65dsi86 *pdata) +static void ti_sn65dsi86_enable_comms(struct ti_sn65dsi86 *pdata, + struct drm_bridge_state *bridge_state) { mutex_lock(&pdata->comms_mutex); /* configure bridge ref_clk */ - ti_sn_bridge_set_refclk_freq(pdata); + ti_sn_bridge_set_refclk_freq(pdata, bridge_state); /* * HPD on this bridge chip is a bit useless. This is an eDP bridge * so the HPD is an internal signal that's only there to signal that * the panel is done powering up. ...but the bridge chip debounces @@ -375,11 +378,11 @@ static int __maybe_unused ti_sn65dsi86_resume(struct device *dev) * so we can do it in resume which lets us read the EDID before * pre_enable(). Without a reference clock we need the MIPI reference * clock so reading early doesn't work. */ if (pdata->refclk) - ti_sn65dsi86_enable_comms(pdata); + ti_sn65dsi86_enable_comms(pdata, drm_bridge_get_current_state(&pdata->bridge)); return ret; } static int __maybe_unused ti_sn65dsi86_suspend(struct device *dev) @@ -820,16 +823,17 @@ static void ti_sn_bridge_atomic_disable(struct drm_bridge *bridge, /* disable video stream */ regmap_update_bits(pdata->regmap, SN_ENH_FRAME_REG, VSTREAM_ENABLE, 0); } -static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) +static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata, + struct drm_bridge_state *bridge_state) { unsigned int bit_rate_mhz, clk_freq_mhz; unsigned int val; struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; + &bridge_state->crtc->state->adjusted_mode; /* set DSIA clk frequency */ bit_rate_mhz = (mode->clock / 1000) * mipi_dsi_pixel_format_to_bpp(pdata->dsi->format); clk_freq_mhz = bit_rate_mhz / (pdata->dsi->lanes * 2); @@ -855,16 +859,18 @@ static unsigned int ti_sn_bridge_get_bpp(struct drm_connector *connector) */ static const unsigned int ti_sn_bridge_dp_rate_lut[] = { 0, 1620, 2160, 2430, 2700, 3240, 4320, 5400 }; -static int ti_sn_bridge_calc_min_dp_rate_idx(struct ti_sn65dsi86 *pdata, unsigned int bpp) +static int ti_sn_bridge_calc_min_dp_rate_idx(struct ti_sn65dsi86 *pdata, + struct drm_bridge_state *bridge_state, + unsigned int bpp) { unsigned int bit_rate_khz, dp_rate_mhz; unsigned int i; struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; + &bridge_state->crtc->state->adjusted_mode; /* Calculate minimum bit rate based on our pixel clock. */ bit_rate_khz = mode->clock * bpp; /* Calculate minimum DP data rate, taking 80% as per DP spec */ @@ -959,14 +965,15 @@ static unsigned int ti_sn_bridge_read_valid_rates(struct ti_sn65dsi86 *pdata) } return valid_rates; } -static void ti_sn_bridge_set_video_timings(struct ti_sn65dsi86 *pdata) +static void ti_sn_bridge_set_video_timings(struct ti_sn65dsi86 *pdata, + struct drm_bridge_state *bridge_state) { struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; + &bridge_state->crtc->state->adjusted_mode; u8 hsync_polarity = 0, vsync_polarity = 0; if (mode->flags & DRM_MODE_FLAG_NHSYNC) hsync_polarity = CHA_HSYNC_POLARITY; if (mode->flags & DRM_MODE_FLAG_NVSYNC) @@ -1104,11 +1111,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge, regmap_write(pdata->regmap, SN_LN_ASSIGN_REG, pdata->ln_assign); regmap_update_bits(pdata->regmap, SN_ENH_FRAME_REG, LN_POLRS_MASK, pdata->ln_polrs << LN_POLRS_OFFSET); /* set dsi clk frequency value */ - ti_sn_bridge_set_dsi_rate(pdata); + ti_sn_bridge_set_dsi_rate(pdata, old_bridge_state); /* * The SN65DSI86 only supports ASSR Display Authentication method and * this method is enabled for eDP panels. An eDP panel must support this * authentication method. We need to enable this method in the eDP panel @@ -1139,11 +1146,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge, val); valid_rates = ti_sn_bridge_read_valid_rates(pdata); /* Train until we run out of rates */ - for (dp_rate_idx = ti_sn_bridge_calc_min_dp_rate_idx(pdata, bpp); + for (dp_rate_idx = ti_sn_bridge_calc_min_dp_rate_idx(pdata, old_bridge_state, bpp); dp_rate_idx < ARRAY_SIZE(ti_sn_bridge_dp_rate_lut); dp_rate_idx++) { if (!(valid_rates & BIT(dp_rate_idx))) continue; @@ -1155,11 +1162,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge, DRM_DEV_ERROR(pdata->dev, "%s (%d)\n", last_err_str, ret); return; } /* config video parameters */ - ti_sn_bridge_set_video_timings(pdata); + ti_sn_bridge_set_video_timings(pdata, old_bridge_state); /* enable video stream */ regmap_update_bits(pdata->regmap, SN_ENH_FRAME_REG, VSTREAM_ENABLE, VSTREAM_ENABLE); } @@ -1170,11 +1177,11 @@ static void ti_sn_bridge_atomic_pre_enable(struct drm_bridge *bridge, struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); pm_runtime_get_sync(pdata->dev); if (!pdata->refclk) - ti_sn65dsi86_enable_comms(pdata); + ti_sn65dsi86_enable_comms(pdata, old_bridge_state); /* td7: min 100 us after enable before DSI data */ usleep_range(100, 110); }