@@ -846,6 +846,75 @@ drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state,
846
846
}
847
847
EXPORT_SYMBOL (drm_atomic_get_new_private_obj_state );
848
848
849
+ /**
850
+ * drm_atomic_get_old_connector_for_encoder - Get old connector for an encoder
851
+ * @state: Atomic state
852
+ * @encoder: The encoder to fetch the connector state for
853
+ *
854
+ * This function finds and returns the connector that was connected to @encoder
855
+ * as specified by the @state.
856
+ *
857
+ * If there is no connector in @state which previously had @encoder connected to
858
+ * it, this function will return NULL. While this may seem like an invalid use
859
+ * case, it is sometimes useful to differentiate commits which had no prior
860
+ * connectors attached to @encoder vs ones that did (and to inspect their
861
+ * state). This is especially true in enable hooks because the pipeline has
862
+ * changed.
863
+ *
864
+ * Returns: The old connector connected to @encoder, or NULL if the encoder is
865
+ * not connected.
866
+ */
867
+ struct drm_connector *
868
+ drm_atomic_get_old_connector_for_encoder (struct drm_atomic_state * state ,
869
+ struct drm_encoder * encoder )
870
+ {
871
+ struct drm_connector_state * conn_state ;
872
+ struct drm_connector * connector ;
873
+ unsigned int i ;
874
+
875
+ for_each_old_connector_in_state (state , connector , conn_state , i ) {
876
+ if (conn_state -> best_encoder == encoder )
877
+ return connector ;
878
+ }
879
+
880
+ return NULL ;
881
+ }
882
+ EXPORT_SYMBOL (drm_atomic_get_old_connector_for_encoder );
883
+
884
+ /**
885
+ * drm_atomic_get_new_connector_for_encoder - Get new connector for an encoder
886
+ * @state: Atomic state
887
+ * @encoder: The encoder to fetch the connector state for
888
+ *
889
+ * This function finds and returns the connector that will be connected to
890
+ * @encoder as specified by the @state.
891
+ *
892
+ * If there is no connector in @state which will have @encoder connected to it,
893
+ * this function will return NULL. While this may seem like an invalid use case,
894
+ * it is sometimes useful to differentiate commits which have no connectors
895
+ * attached to @encoder vs ones that do (and to inspect their state). This is
896
+ * especially true in disable hooks because the pipeline will change.
897
+ *
898
+ * Returns: The new connector connected to @encoder, or NULL if the encoder is
899
+ * not connected.
900
+ */
901
+ struct drm_connector *
902
+ drm_atomic_get_new_connector_for_encoder (struct drm_atomic_state * state ,
903
+ struct drm_encoder * encoder )
904
+ {
905
+ struct drm_connector_state * conn_state ;
906
+ struct drm_connector * connector ;
907
+ unsigned int i ;
908
+
909
+ for_each_new_connector_in_state (state , connector , conn_state , i ) {
910
+ if (conn_state -> best_encoder == encoder )
911
+ return connector ;
912
+ }
913
+
914
+ return NULL ;
915
+ }
916
+ EXPORT_SYMBOL (drm_atomic_get_new_connector_for_encoder );
917
+
849
918
/**
850
919
* drm_atomic_get_connector_state - get connector state
851
920
* @state: global atomic state object
0 commit comments