aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_drv.c3
-rw-r--r--include/drm/drm_device.h10
-rw-r--r--include/drm/drm_drv.h8
3 files changed, 17 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index ea4941da9b27..36e8e9cbec52 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -506,6 +506,9 @@ int drm_dev_init(struct drm_device *dev,
506 dev->dev = parent; 506 dev->dev = parent;
507 dev->driver = driver; 507 dev->driver = driver;
508 508
509 /* no per-device feature limits by default */
510 dev->driver_features = ~0u;
511
509 INIT_LIST_HEAD(&dev->filelist); 512 INIT_LIST_HEAD(&dev->filelist);
510 INIT_LIST_HEAD(&dev->filelist_internal); 513 INIT_LIST_HEAD(&dev->filelist_internal);
511 INIT_LIST_HEAD(&dev->clientlist); 514 INIT_LIST_HEAD(&dev->clientlist);
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index f9c6e0e3aec7..42411b3ea0c8 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -46,6 +46,16 @@ struct drm_device {
46 struct drm_master *master; 46 struct drm_master *master;
47 47
48 /** 48 /**
49 * @driver_features: per-device driver features
50 *
51 * Drivers can clear specific flags here to disallow
52 * certain features on a per-device basis while still
53 * sharing a single &struct drm_driver instance across
54 * all devices.
55 */
56 u32 driver_features;
57
58 /**
49 * @unplugged: 59 * @unplugged:
50 * 60 *
51 * Flag to tell if the device has been unplugged. 61 * Flag to tell if the device has been unplugged.
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 23b9678137a6..8830e3de3a86 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -653,14 +653,14 @@ static inline bool drm_dev_is_unplugged(struct drm_device *dev)
653 * @dev: DRM device to check 653 * @dev: DRM device to check
654 * @feature: feature flag 654 * @feature: feature flag
655 * 655 *
656 * This checks @dev for driver features, see &drm_driver.driver_features and the 656 * This checks @dev for driver features, see &drm_driver.driver_features,
657 * various DRIVER_\* flags. 657 * &drm_device.driver_features, and the various DRIVER_\* flags.
658 * 658 *
659 * Returns true if the @feature is supported, false otherwise. 659 * Returns true if the @feature is supported, false otherwise.
660 */ 660 */
661static inline bool drm_core_check_feature(struct drm_device *dev, int feature) 661static inline bool drm_core_check_feature(struct drm_device *dev, u32 feature)
662{ 662{
663 return dev->driver->driver_features & feature; 663 return dev->driver->driver_features & dev->driver_features & feature;
664} 664}
665 665
666/** 666/**