@@ -3342,44 +3342,46 @@ EXPORT_SYMBOL(drm_dp_add_payload_part1);
33423342 * drm_dp_remove_payload() - Remove an MST payload
33433343 * @mgr: Manager to use.
33443344 * @mst_state: The MST atomic state
3345- * @payload: The payload to write
3345+ * @old_payload: The payload with its old state
3346+ * @new_payload: The payload to write
33463347 *
33473348 * Removes a payload from an MST topology if it was successfully assigned a start slot. Also updates
33483349 * the starting time slots of all other payloads which would have been shifted towards the start of
33493350 * the VC table as a result. After calling this, the driver should generate ACT and payload packets.
33503351 */
33513352void drm_dp_remove_payload (struct drm_dp_mst_topology_mgr * mgr ,
33523353 struct drm_dp_mst_topology_state * mst_state ,
3353- struct drm_dp_mst_atomic_payload * payload )
3354+ const struct drm_dp_mst_atomic_payload * old_payload ,
3355+ struct drm_dp_mst_atomic_payload * new_payload )
33543356{
33553357 struct drm_dp_mst_atomic_payload * pos ;
33563358 bool send_remove = false;
33573359
33583360 /* We failed to make the payload, so nothing to do */
3359- if (payload -> vc_start_slot == -1 )
3361+ if (new_payload -> vc_start_slot == -1 )
33603362 return ;
33613363
33623364 mutex_lock (& mgr -> lock );
3363- send_remove = drm_dp_mst_port_downstream_of_branch (payload -> port , mgr -> mst_primary );
3365+ send_remove = drm_dp_mst_port_downstream_of_branch (new_payload -> port , mgr -> mst_primary );
33643366 mutex_unlock (& mgr -> lock );
33653367
33663368 if (send_remove )
3367- drm_dp_destroy_payload_step1 (mgr , mst_state , payload );
3369+ drm_dp_destroy_payload_step1 (mgr , mst_state , new_payload );
33683370 else
33693371 drm_dbg_kms (mgr -> dev , "Payload for VCPI %d not in topology, not sending remove\n" ,
3370- payload -> vcpi );
3372+ new_payload -> vcpi );
33713373
33723374 list_for_each_entry (pos , & mst_state -> payloads , next ) {
3373- if (pos != payload && pos -> vc_start_slot > payload -> vc_start_slot )
3374- pos -> vc_start_slot -= payload -> time_slots ;
3375+ if (pos != new_payload && pos -> vc_start_slot > new_payload -> vc_start_slot )
3376+ pos -> vc_start_slot -= old_payload -> time_slots ;
33753377 }
3376- payload -> vc_start_slot = -1 ;
3378+ new_payload -> vc_start_slot = -1 ;
33773379
33783380 mgr -> payload_count -- ;
3379- mgr -> next_start_slot -= payload -> time_slots ;
3381+ mgr -> next_start_slot -= old_payload -> time_slots ;
33803382
3381- if (payload -> delete )
3382- drm_dp_mst_put_port_malloc (payload -> port );
3383+ if (new_payload -> delete )
3384+ drm_dp_mst_put_port_malloc (new_payload -> port );
33833385}
33843386EXPORT_SYMBOL (drm_dp_remove_payload );
33853387
@@ -5362,28 +5364,53 @@ struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_a
53625364}
53635365EXPORT_SYMBOL (drm_atomic_get_mst_topology_state );
53645366
5367+ /**
5368+ * drm_atomic_get_old_mst_topology_state: get old MST topology state in atomic state, if any
5369+ * @state: global atomic state
5370+ * @mgr: MST topology manager, also the private object in this case
5371+ *
5372+ * This function wraps drm_atomic_get_old_private_obj_state() passing in the MST atomic
5373+ * state vtable so that the private object state returned is that of a MST
5374+ * topology object.
5375+ *
5376+ * Returns:
5377+ *
5378+ * The old MST topology state, or NULL if there's no topology state for this MST mgr
5379+ * in the global atomic state
5380+ */
5381+ struct drm_dp_mst_topology_state *
5382+ drm_atomic_get_old_mst_topology_state (struct drm_atomic_state * state ,
5383+ struct drm_dp_mst_topology_mgr * mgr )
5384+ {
5385+ struct drm_private_state * old_priv_state =
5386+ drm_atomic_get_old_private_obj_state (state , & mgr -> base );
5387+
5388+ return old_priv_state ? to_dp_mst_topology_state (old_priv_state ) : NULL ;
5389+ }
5390+ EXPORT_SYMBOL (drm_atomic_get_old_mst_topology_state );
5391+
53655392/**
53665393 * drm_atomic_get_new_mst_topology_state: get new MST topology state in atomic state, if any
53675394 * @state: global atomic state
53685395 * @mgr: MST topology manager, also the private object in this case
53695396 *
5370- * This function wraps drm_atomic_get_priv_obj_state () passing in the MST atomic
5397+ * This function wraps drm_atomic_get_new_private_obj_state () passing in the MST atomic
53715398 * state vtable so that the private object state returned is that of a MST
53725399 * topology object.
53735400 *
53745401 * Returns:
53755402 *
5376- * The MST topology state, or NULL if there's no topology state for this MST mgr
5403+ * The new MST topology state, or NULL if there's no topology state for this MST mgr
53775404 * in the global atomic state
53785405 */
53795406struct drm_dp_mst_topology_state *
53805407drm_atomic_get_new_mst_topology_state (struct drm_atomic_state * state ,
53815408 struct drm_dp_mst_topology_mgr * mgr )
53825409{
5383- struct drm_private_state * priv_state =
5410+ struct drm_private_state * new_priv_state =
53845411 drm_atomic_get_new_private_obj_state (state , & mgr -> base );
53855412
5386- return priv_state ? to_dp_mst_topology_state (priv_state ) : NULL ;
5413+ return new_priv_state ? to_dp_mst_topology_state (new_priv_state ) : NULL ;
53875414}
53885415EXPORT_SYMBOL (drm_atomic_get_new_mst_topology_state );
53895416
0 commit comments