Subject: linux-next: manual merge of the amdgpu tree with the drm-next tree

From: Thierry Reding <[email-masked]>
Date: Wed, 06 May 2026 11:55:55 +0200

Hi all,

Today's linux-next merge of the amdgpu tree got a conflict in:

  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

between commit:

  5164f7e7ff8e ("drm: Rename struct drm_atomic_state to drm_atomic_commit")

from the drm-next tree and commit:

  3c108046e1d6 ("drm/amd/display: Add power module on Linux")

from the amdgpu tree.

I fixed it up (see below) and can carry the fix as necessary. It looks
like this is pretty much what's in the amdgpu tree, modulo some
whitespace changes. This is now fixed as far as linux-next is concerned,
but any non trivial conflicts should be mentioned to your upstream
maintainer when your tree is submitted for merging.  You may also want
to consider cooperating with the maintainer of the conflicting tree to
minimise any particularly complex conflicts.

diff --cc drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index cbfdcc65bf5d,246ee40e202a..ad56a409a88e
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@@ -10479,8 -10582,104 +10582,104 @@@ static void dm_clear_writeback(struct a
  	dc_stream_remove_writeback(dm->dc, crtc_state->stream, 0);
  }
  
+ /**
+  * amdgpu_dm_mod_power_update_streams - update mod_power stream state on modeset
+  * @state: the drm atomic state
+  * @dm: the display manager to update mod_power on
+  *
+  * Notify mod_power of stream changes on modeset events, and disable PSR/Replay
+  * in preparation for hardware programming. See also
+  * amdgpu_dm_mod_power_setup_streams() for post-modeset mod_power setup.
+  */
+ static void amdgpu_dm_mod_power_update_streams(struct drm_atomic_state *state,
+ 					       struct amdgpu_display_manager *dm)
+ {
+ 	struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
+ 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
+ 	struct amdgpu_dm_connector *aconnector;
+ 	struct drm_crtc *crtc;
+ 	int i = 0;
+ 
+ 	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+ 		dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
+ 		dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
+ 
+ 		if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
+ 			continue;
+ 
+ 		/*
+ 		 * Update mod_power on modeset event in preparation for hw
+ 		 * programming. Always use the old stream, since it would have
+ 		 * been previously added to mod_power. If old stream is null (on
+ 		 * crtc enable, for example), mod_power will no-op, which is the
+ 		 * desried behavior.
+ 		 */
+ 		if (old_crtc_state->active) {
+ 			scoped_guard(mutex, &dm->dc_lock) {
+ 				amdgpu_dm_psr_set_event(dm, dm_old_crtc_state->stream, true,
+ 					psr_event_hw_programming, true);
+ 				amdgpu_dm_replay_set_event(dm, dm_old_crtc_state->stream, true,
+ 					replay_event_hw_programming, true);
+ 			}
+ 		}
+ 
+ 		if (new_crtc_state->active) {
+ 			aconnector = (struct amdgpu_dm_connector *)
+ 				dm_new_crtc_state->stream->dm_stream_context;
+ 			if (old_crtc_state->active) {
+ 				mod_power_replace_stream(dm->power_module,
+ 					dm_old_crtc_state->stream,
+ 					dm_new_crtc_state->stream,
+ 					&aconnector->psr_caps);
+ 			} else {
+ 				mod_power_add_stream(dm->power_module,
+ 					dm_new_crtc_state->stream,
+ 					&aconnector->psr_caps);
+ 			}
+ 		} else if (old_crtc_state->active) {
+ 			mod_power_remove_stream(dm->power_module,
+ 				dm_old_crtc_state->stream);
+ 		}
+ 	}
+ }
+ 
+ /**
+  * amdgpu_dm_mod_power_setup_streams - setup mod_power stream state post modeset
+  * @state: the drm atomic state
+  * @dm: the display manager to update mod_power on
+  *
+  * Notify mod_power of mode_change. This needs to be done after dc_stream
+  * updates have been committed, and VRR parameters have been updated.
+  */
+ static void amdgpu_dm_mod_power_setup_streams(struct drm_atomic_state *state,
+ 					      struct amdgpu_display_manager *dm)
+ {
+ 	struct dm_crtc_state *dm_new_crtc_state;
+ 	struct drm_crtc_state *new_crtc_state;
+ 	struct amdgpu_crtc *acrtc;
+ 	struct drm_crtc *crtc;
+ 	int i = 0;
+ 
+ 	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
+ 		dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
+ 		acrtc = to_amdgpu_crtc(crtc);
+ 
+ 		if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
+ 			continue;
+ 
+ 		if (new_crtc_state->active) {
+ 			amdgpu_dm_link_setup_replay(dm_new_crtc_state->stream,
+ 					&acrtc->dm_irq_params.vrr_params);
+ 			mod_power_notify_mode_change(dm->power_module,
+ 						dm_new_crtc_state->stream,
+ 						false);
+ 		}
+ 	}
+ 
+ }
+ 
 -static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
 -					struct dc_state *dc_state)
 +static void amdgpu_dm_commit_streams(struct drm_atomic_commit *state,
- 					struct dc_state *dc_state)
++				     struct dc_state *dc_state)
  {
  	struct drm_device *dev = state->dev;
  	struct amdgpu_device *adev = drm_to_adev(dev);