aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-01-27 18:34:27 -0500
committerDave Airlie <airlied@redhat.com>2015-01-27 18:34:27 -0500
commit21773f16f2cb3c056051c679da542f0b494252e2 (patch)
tree362e701c962f8a78978775ff3e4093b490ee0cd1 /drivers/gpu/drm/drm_crtc.c
parent2f5b4ef15c60bc5292a3f006c018acb3da53737b (diff)
parent9469244d869623e8b54d9f3d4d00737e377af273 (diff)
Merge tag 'topic/atomic-core-2015-01-27' of git://anongit.freedesktop.org/drm-intel into drm-next
* tag 'topic/atomic-core-2015-01-27' of git://anongit.freedesktop.org/drm-intel: drm/atomic: Fix potential use of state after free drm/atomic-helper: debug output for modesets drm/atomic-helpers: Saner encoder/crtc callbacks drm/atomic-helpers: Recover full cursor plane behaviour drm/atomic-helper: add connector->dpms() implementation drm/atomic: Add drm_crtc_state->active drm: Add standardized boolean props drm/plane-helper: Fix transitional helper kerneldocs drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb Conflicts: include/drm/drm_crtc_helper.h
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c76
1 files changed, 73 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index ad2934ba0bd2..b459888f6310 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -691,6 +691,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
691 if (cursor) 691 if (cursor)
692 cursor->possible_crtcs = 1 << drm_crtc_index(crtc); 692 cursor->possible_crtcs = 1 << drm_crtc_index(crtc);
693 693
694 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
695 drm_object_attach_property(&crtc->base, config->prop_active, 0);
696 }
697
694 return 0; 698 return 0;
695} 699}
696EXPORT_SYMBOL(drm_crtc_init_with_planes); 700EXPORT_SYMBOL(drm_crtc_init_with_planes);
@@ -1481,6 +1485,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
1481 return -ENOMEM; 1485 return -ENOMEM;
1482 dev->mode_config.prop_crtc_id = prop; 1486 dev->mode_config.prop_crtc_id = prop;
1483 1487
1488 prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC,
1489 "ACTIVE");
1490 if (!prop)
1491 return -ENOMEM;
1492 dev->mode_config.prop_active = prop;
1493
1484 return 0; 1494 return 0;
1485} 1495}
1486 1496
@@ -3810,7 +3820,7 @@ static struct drm_property *property_create_range(struct drm_device *dev,
3810} 3820}
3811 3821
3812/** 3822/**
3813 * drm_property_create_range - create a new ranged property type 3823 * drm_property_create_range - create a new unsigned ranged property type
3814 * @dev: drm device 3824 * @dev: drm device
3815 * @flags: flags specifying the property type 3825 * @flags: flags specifying the property type
3816 * @name: name of the property 3826 * @name: name of the property
@@ -3821,8 +3831,8 @@ static struct drm_property *property_create_range(struct drm_device *dev,
3821 * object with drm_object_attach_property. The returned property object must be 3831 * object with drm_object_attach_property. The returned property object must be
3822 * freed with drm_property_destroy. 3832 * freed with drm_property_destroy.
3823 * 3833 *
3824 * Userspace is allowed to set any integer value in the (min, max) range 3834 * Userspace is allowed to set any unsigned integer value in the (min, max)
3825 * inclusive. 3835 * range inclusive.
3826 * 3836 *
3827 * Returns: 3837 * Returns:
3828 * A pointer to the newly created property on success, NULL on failure. 3838 * A pointer to the newly created property on success, NULL on failure.
@@ -3836,6 +3846,24 @@ struct drm_property *drm_property_create_range(struct drm_device *dev, int flags
3836} 3846}
3837EXPORT_SYMBOL(drm_property_create_range); 3847EXPORT_SYMBOL(drm_property_create_range);
3838 3848
3849/**
3850 * drm_property_create_signed_range - create a new signed ranged property type
3851 * @dev: drm device
3852 * @flags: flags specifying the property type
3853 * @name: name of the property
3854 * @min: minimum value of the property
3855 * @max: maximum value of the property
3856 *
3857 * This creates a new generic drm property which can then be attached to a drm
3858 * object with drm_object_attach_property. The returned property object must be
3859 * freed with drm_property_destroy.
3860 *
3861 * Userspace is allowed to set any signed integer value in the (min, max)
3862 * range inclusive.
3863 *
3864 * Returns:
3865 * A pointer to the newly created property on success, NULL on failure.
3866 */
3839struct drm_property *drm_property_create_signed_range(struct drm_device *dev, 3867struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
3840 int flags, const char *name, 3868 int flags, const char *name,
3841 int64_t min, int64_t max) 3869 int64_t min, int64_t max)
@@ -3845,6 +3873,23 @@ struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
3845} 3873}
3846EXPORT_SYMBOL(drm_property_create_signed_range); 3874EXPORT_SYMBOL(drm_property_create_signed_range);
3847 3875
3876/**
3877 * drm_property_create_object - create a new object property type
3878 * @dev: drm device
3879 * @flags: flags specifying the property type
3880 * @name: name of the property
3881 * @type: object type from DRM_MODE_OBJECT_* defines
3882 *
3883 * This creates a new generic drm property which can then be attached to a drm
3884 * object with drm_object_attach_property. The returned property object must be
3885 * freed with drm_property_destroy.
3886 *
3887 * Userspace is only allowed to set this to any property value of the given
3888 * @type. Only useful for atomic properties, which is enforced.
3889 *
3890 * Returns:
3891 * A pointer to the newly created property on success, NULL on failure.
3892 */
3848struct drm_property *drm_property_create_object(struct drm_device *dev, 3893struct drm_property *drm_property_create_object(struct drm_device *dev,
3849 int flags, const char *name, uint32_t type) 3894 int flags, const char *name, uint32_t type)
3850{ 3895{
@@ -3852,6 +3897,9 @@ struct drm_property *drm_property_create_object(struct drm_device *dev,
3852 3897
3853 flags |= DRM_MODE_PROP_OBJECT; 3898 flags |= DRM_MODE_PROP_OBJECT;
3854 3899
3900 if (WARN_ON(!(flags & DRM_MODE_PROP_ATOMIC)))
3901 return NULL;
3902
3855 property = drm_property_create(dev, flags, name, 1); 3903 property = drm_property_create(dev, flags, name, 1);
3856 if (!property) 3904 if (!property)
3857 return NULL; 3905 return NULL;
@@ -3863,6 +3911,28 @@ struct drm_property *drm_property_create_object(struct drm_device *dev,
3863EXPORT_SYMBOL(drm_property_create_object); 3911EXPORT_SYMBOL(drm_property_create_object);
3864 3912
3865/** 3913/**
3914 * drm_property_create_bool - create a new boolean property type
3915 * @dev: drm device
3916 * @flags: flags specifying the property type
3917 * @name: name of the property
3918 *
3919 * This creates a new generic drm property which can then be attached to a drm
3920 * object with drm_object_attach_property. The returned property object must be
3921 * freed with drm_property_destroy.
3922 *
3923 * This is implemented as a ranged property with only {0, 1} as valid values.
3924 *
3925 * Returns:
3926 * A pointer to the newly created property on success, NULL on failure.
3927 */
3928struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags,
3929 const char *name)
3930{
3931 return drm_property_create_range(dev, flags, name, 0, 1);
3932}
3933EXPORT_SYMBOL(drm_property_create_bool);
3934
3935/**
3866 * drm_property_add_enum - add a possible value to an enumeration property 3936 * drm_property_add_enum - add a possible value to an enumeration property
3867 * @property: enumeration property to change 3937 * @property: enumeration property to change
3868 * @index: index of the new enumeration 3938 * @index: index of the new enumeration