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
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 <stalek@codeaurora.org>
This commit is contained in:
Daniel Vetter 2021-09-14 16:25:11 +05:30 • committed by Gerrit - the friendly Code Review server
commit 00a3efbc7e

View file

@ -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();