Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	Jani Nikula <jani.nikula@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	open list <linux-kernel@vger.kernel.org>,
	Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>,
	David Airlie <airlied@linux.ie>, Fangzhi Zuo <Jerry.Zuo@amd.com>,
	Daniel Vetter <daniel@ffwll.ch>, Wayne Lin <Wayne.Lin@amd.com>
Subject: [Intel-gfx] [RFC v2 10/18] drm/display/dp_mst: Fix modeset tracking in drm_dp_atomic_release_vcpi_slots()
Date: Mon,  8 Aug 2022 19:51:55 -0400	[thread overview]
Message-ID: <20220808235203.123892-11-lyude@redhat.com> (raw)
In-Reply-To: <20220808235203.123892-1-lyude@redhat.com>

Currently with the MST helpers we avoid releasing payloads _and_ avoid
pulling in the MST state if there aren't any actual payload changes. While
we want to keep the first step, we need to now make sure that we're always
pulling in the MST state on all modesets that can modify payloads - even if
the resulting payloads in the atomic state are identical to the previous
ones.

This is mainly to make it so that if a CRTC is still assigned to a
connector but is set to DPMS off, the CRTC still holds it's payload
allocation in the atomic state and still appropriately pulls in the MST
state for commit tracking. Otherwise, we'll occasionally forget to update
MST payloads from changes caused by non-atomic DPMS changes. Doing this
also allows us to track bandwidth limitations in a state correctly even
between DPMS changes, so that there's no chance of a simple ->active change
being rejected by the atomic check.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Wayne Lin <Wayne.Lin@amd.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <sean@poorly.run>
Acked-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/display/drm_dp_mst_topology.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
index aa6dcd9ff6a5..2f7c43f88d74 100644
--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
@@ -4474,6 +4474,7 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,
 	struct drm_dp_mst_topology_state *topology_state;
 	struct drm_dp_mst_atomic_payload *payload;
 	struct drm_connector_state *old_conn_state, *new_conn_state;
+	bool update_payload = true;
 
 	old_conn_state = drm_atomic_get_old_connector_state(state, port->connector);
 	if (!old_conn_state->crtc)
@@ -4485,10 +4486,12 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,
 		struct drm_crtc_state *crtc_state =
 			drm_atomic_get_new_crtc_state(state, new_conn_state->crtc);
 
-		if (!crtc_state ||
-		    !drm_atomic_crtc_needs_modeset(crtc_state) ||
-		    crtc_state->enable)
+		/* No modeset means no payload changes, so it's safe to not pull in the MST state */
+		if (!crtc_state || !drm_atomic_crtc_needs_modeset(crtc_state))
 			return 0;
+
+		if (!crtc_state->mode_changed && !crtc_state->connectors_changed)
+			update_payload = false;
 	}
 
 	topology_state = drm_atomic_get_mst_topology_state(state, mgr);
@@ -4496,6 +4499,8 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,
 		return PTR_ERR(topology_state);
 
 	topology_state->pending_crtc_mask |= drm_crtc_mask(old_conn_state->crtc);
+	if (!update_payload)
+		return 0;
 
 	payload = drm_atomic_get_mst_payload_state(topology_state, port);
 	if (WARN_ON(!payload)) {
-- 
2.37.1


  parent reply	other threads:[~2022-08-08 23:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 23:51 [Intel-gfx] [RFC v2 00/18] drm/display/dp_mst: Drop Radeon MST support, make MST atomic-only Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 01/18] drm/amdgpu/dc/mst: Rename dp_mst_stream_allocation(_table) Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 02/18] drm/amdgpu/dm/mst: Rename get_payload_table() Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 03/18] drm/display/dp_mst: Rename drm_dp_mst_vcpi_allocation Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 04/18] drm/display/dp_mst: Call them time slots, not VCPI slots Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 05/18] drm/display/dp_mst: Fix confusing docs for drm_dp_atomic_release_time_slots() Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 06/18] drm/display/dp_mst: Add some missing kdocs for atomic MST structs Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 07/18] drm/display/dp_mst: Add helper for finding payloads in atomic MST state Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 08/18] drm/display/dp_mst: Add nonblocking helpers for DP MST Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 09/18] drm/display/dp_mst: Don't open code modeset checks for releasing time slots Lyude Paul
2022-08-08 23:51 ` Lyude Paul [this message]
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 11/18] drm/nouveau/kms: Cache DP encoders in nouveau_connector Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 12/18] drm/nouveau/kms: Pull mst state in for all modesets Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 13/18] drm/display/dp_mst: Add helpers for serializing SST <-> MST transitions Lyude Paul
2022-08-09 23:42   ` [Intel-gfx] [RFC v3] " Lyude Paul
2022-08-08 23:51 ` [Intel-gfx] [RFC v2 14/18] drm/display/dp_mst: Drop all ports from topology on CSNs before queueing link address work Lyude Paul
2022-08-08 23:52 ` [Intel-gfx] [RFC v2 15/18] drm/display/dp_mst: Skip releasing payloads if last connected port isn't connected Lyude Paul
2022-08-08 23:52 ` [Intel-gfx] [RFC v2 16/18] drm/display/dp_mst: Maintain time slot allocations when deleting payloads Lyude Paul
2022-08-08 23:52 ` [Intel-gfx] [RFC v2 17/18] drm/radeon: Drop legacy MST support Lyude Paul
2022-08-08 23:52 ` [Intel-gfx] [RFC v2 18/18] drm/display/dp_mst: Move all payload info into the atomic state Lyude Paul
2022-08-09  0:21 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/display/dp_mst: Drop Radeon MST support, make MST atomic-only Patchwork
2022-08-09  0:43 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-08-10  0:25 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/display/dp_mst: Drop Radeon MST support, make MST atomic-only (rev2) Patchwork
2022-08-10  3:08 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-08-10 20:35 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/display/dp_mst: Drop Radeon MST support, make MST atomic-only (rev3) Patchwork
2022-08-11  9:46 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220808235203.123892-11-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=Wayne.Lin@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox