From a743d7582db9aba0e7078d6386bdad2756309dba Mon Sep 17 00:00:00 2001 From: Dhinakaran Pandiyan Date: Thu, 22 Dec 2016 00:50:42 -0800 Subject: drm: Wrap the check for atomic_commit implementation This check is useful for drivers that do not have DRIVER_ATOMIC set but have atomic modesetting internally implemented. Wrap the check into a function since this is used in many places and as a bonus, the function name helps to document what the check is for. v2: Change return type to bool (Ville) Move the function drm_atomic.h (Daniel) Fixed comment marker for documentation Suggested-by: Daniel Vetter Cc: Daniel Vetter Cc: Ben Skeggs Signed-off-by: Dhinakaran Pandiyan [danvet: Move back to drmP.h because include hell.] Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/1482396643-32456-1-git-send-email-dhinakaran.pandiyan@intel.com --- include/drm/drmP.h | 13 +++++++++++++ include/drm/drm_atomic.h | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/drm/drmP.h b/include/drm/drmP.h index a9cfd33..8671ddd 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -634,6 +634,19 @@ struct drm_device { int switch_power_state; }; +/** + * drm_drv_uses_atomic_modeset - check if the driver implements + * atomic_commit() + * @dev: DRM device + * + * This check is useful if drivers do not have DRIVER_ATOMIC set but + * have atomic modesetting internally implemented. + */ +static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev) +{ + return dev->mode_config.funcs->atomic_commit != NULL; +} + #include #define DRM_SWITCH_POWER_ON 0 diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 8cc7ca2..b0ebe0f 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -419,5 +419,4 @@ drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) state->connectors_changed; } - #endif /* DRM_ATOMIC_H_ */ -- cgit v1.1