From 00a3efbc7e4acdbaf760d49cd029996c2e085f80 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 14 Sep 2021 16:25:11 +0530 Subject: [PATCH] drm: move drv test macros out of drmP.h Last bit the prevented us from starting to delete the drmP.h monster includes from source files! Also add kernel-doc while moving them. A nice consistent drm_dev_ prefix would be cute for these, but since they're used everywhere I've figured I'll leave this bikeshed aside for now. Reviewed-by: Sean Paul Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-2-daniel.vetter@ffwll.ch Patch-mainline: 20180709084016.23750-2-daniel.vetter@ffwll.ch @ 09/07/18, 08:40 a.m. [stalek@codeaurora.org: drop change for drm_core_check_feature definition]. Change-Id: I8029c20f6d6f2ffdd9e23e7aee112f883e656949 Signed-off-by: Shubham Talekar --- include/drm/drmP.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c023d14490df..c56176c4b670 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -922,12 +922,36 @@ struct drm_device { #define DRM_SWITCH_POWER_CHANGING 2 #define DRM_SWITCH_POWER_DYNAMIC_OFF 3 +/** + * drm_core_check_feature - check driver feature flags + * @dev: DRM device to check + * @feature: feature flag + * + * This checks @dev for driver features, see &drm_driver.driver_features and the + * various DRIVER_\* flags. + * + * Returns true if the @feature is supported, false otherwise. + */ static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) { return ((dev->driver->driver_features & feature) ? 1 : 0); } +/** + * 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__ int drm_drv_uses_atomic_modeset(struct drm_device *dev) +{ + return drm_core_check_feature(dev, DRIVER_ATOMIC) || + dev->mode_config.funcs->atomic_commit != NULL; +} + static inline void drm_device_set_unplugged(struct drm_device *dev) { smp_wmb();