aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2018-07-09 04:40:02 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2018-07-13 12:40:27 -0400
commit3479fc248bf383549ff629c607df0486813e14fd (patch)
tree5f8e2c8079036135c7fd023e40e7b5169cc57a7c
parentce6058039bca7f1f11f1723549eec1bc069dcb28 (diff)
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 <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180709084016.23750-2-daniel.vetter@ffwll.ch
-rw-r--r--include/drm/drmP.h19
-rw-r--r--include/drm/drm_drv.h29
2 files changed, 29 insertions, 19 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c5dfbdb7271d..f7a19c2a7a80 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -102,25 +102,6 @@ struct pci_controller;
102#define DRM_SWITCH_POWER_CHANGING 2 102#define DRM_SWITCH_POWER_CHANGING 2
103#define DRM_SWITCH_POWER_DYNAMIC_OFF 3 103#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
104 104
105static inline bool drm_core_check_feature(struct drm_device *dev, int feature)
106{
107 return dev->driver->driver_features & feature;
108}
109
110/**
111 * drm_drv_uses_atomic_modeset - check if the driver implements
112 * atomic_commit()
113 * @dev: DRM device
114 *
115 * This check is useful if drivers do not have DRIVER_ATOMIC set but
116 * have atomic modesetting internally implemented.
117 */
118static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
119{
120 return drm_core_check_feature(dev, DRIVER_ATOMIC) ||
121 dev->mode_config.funcs->atomic_commit != NULL;
122}
123
124/* returns true if currently okay to sleep */ 105/* returns true if currently okay to sleep */
125static inline bool drm_can_sleep(void) 106static inline bool drm_can_sleep(void)
126{ 107{
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 7e545f5f94d3..46a8009784df 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -649,6 +649,35 @@ static inline bool drm_dev_is_unplugged(struct drm_device *dev)
649 return true; 649 return true;
650} 650}
651 651
652/**
653 * drm_core_check_feature - check driver feature flags
654 * @dev: DRM device to check
655 * @feature: feature flag
656 *
657 * This checks @dev for driver features, see &drm_driver.driver_features and the
658 * various DRIVER_\* flags.
659 *
660 * Returns true if the @feature is supported, false otherwise.
661 */
662static inline bool drm_core_check_feature(struct drm_device *dev, int feature)
663{
664 return dev->driver->driver_features & feature;
665}
666
667/**
668 * drm_drv_uses_atomic_modeset - check if the driver implements
669 * atomic_commit()
670 * @dev: DRM device
671 *
672 * This check is useful if drivers do not have DRIVER_ATOMIC set but
673 * have atomic modesetting internally implemented.
674 */
675static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
676{
677 return drm_core_check_feature(dev, DRIVER_ATOMIC) ||
678 dev->mode_config.funcs->atomic_commit != NULL;
679}
680
652 681
653int drm_dev_set_unique(struct drm_device *dev, const char *name); 682int drm_dev_set_unique(struct drm_device *dev, const char *name);
654 683