From ce09d7667dd225564df1e20b8185d4ce7be886cc Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 6 Apr 2017 13:19:03 +0200 Subject: drm/atomic: Add connector atomic_check function, v2. The atomic_check function is useful for implementing properties, but it can be used for other connector modeset related checks as well. Similar to plane check functions, on a modeset atomic_check() is always called. Changes since v1: - Make sure atomic_check() is called on any modeset. Signed-off-by: Maarten Lankhorst Reviewed-by: Dhinakaran Pandiyan Reviewed-by: Daniel Vetter Signed-off-by: Sean Paul Link: http://patchwork.freedesktop.org/patch/msgid/1491477543-31257-5-git-send-email-maarten.lankhorst@linux.intel.com --- include/drm/drm_modeset_helper_vtables.h | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'include/drm') diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index 7847babd893c..c01c328f6cc8 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -872,6 +872,40 @@ struct drm_connector_helper_funcs { */ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector, struct drm_connector_state *connector_state); + + /** + * @atomic_check: + * + * This hook is used to validate connector state. This function is + * called from &drm_atomic_helper_check_modeset, and is called when + * a connector property is set, or a modeset on the crtc is forced. + * + * Because &drm_atomic_helper_check_modeset may be called multiple times, + * this function should handle being called multiple times as well. + * + * This function is also allowed to inspect any other object's state and + * can add more state objects to the atomic commit if needed. Care must + * be taken though to ensure that state check and compute functions for + * these added states are all called, and derived state in other objects + * all updated. Again the recommendation is to just call check helpers + * until a maximal configuration is reached. + * + * NOTE: + * + * This function is called in the check phase of an atomic update. The + * driver is not allowed to change anything outside of the free-standing + * state objects passed-in or assembled in the overall &drm_atomic_state + * update tracking structure. + * + * RETURNS: + * + * 0 on success, -EINVAL if the state or the transition can't be + * supported, -ENOMEM on memory allocation failure and -EDEADLK if an + * attempt to obtain another state object ran into a &drm_modeset_lock + * deadlock. + */ + int (*atomic_check)(struct drm_connector *connector, + struct drm_connector_state *state); }; /** -- cgit v1.2.3