diff options
author | Dave Airlie <airlied@redhat.com> | 2014-08-04 03:57:34 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-08-04 03:57:34 -0400 |
commit | c759606c96dc052373d4c36ea383595da46b04e9 (patch) | |
tree | 583a4234d43c57e03b85315353adf304970645fc /drivers/gpu/drm/drm_crtc.c | |
parent | 2ee39452fa2fff1e8edb954ccb7e0daee9646557 (diff) | |
parent | 4dac3edfe68e5e1b3c2216b84ba160572420fa40 (diff) |
Merge tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel into drm-next
Final feature pull for 3.17.
drm-intel-next-2014-07-25:
- Ditch UMS support (well just the config option for now)
- Prep work for future platforms (Sonika Jindal, Damien)
- runtime pm/soix fixes (Paulo, Jesse)
- psr tracking improvements, locking fixes, now enabled by default!
- rps fixes for chv (Deepak, Ville)
- drm core patches for rotation support (Ville, Sagar Kamble) - the i915 parts
unfortunately didn't make it yet
- userptr fixes (Chris)
- minimum backlight brightness (Jani), acked long ago by Matthew Garret on irc -
I've forgotten about this patch :(
QA is a bit unhappy about the DP MST stuff since it broke hpd testing a
bit, but otherwise looks sane. I've backmerged drm-next to resolve
conflicts with the mst stuff, which means the new tag itself doesn't
contain the overview as usual.
* tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel: (75 commits)
drm/i915/userptr: Keep spin_lock/unlock in the same block
drm/i915: Allow overlapping userptr objects
drm/i915: Ditch UMS config option
drm/i915: respect the VBT minimum backlight brightness
drm/i915: extract backlight minimum brightness from VBT
drm/i915: Replace HAS_PCH_SPLIT which incorrectly lets some platforms in
drm/i915: Returning from increase/decrease of pllclock when invalid
drm/i915: Setting legacy palette correctly for different platforms
drm/i915: Avoid incorrect returning for some platforms
drm/i915: Writing proper check for reading of pipe status reg
drm/i915: Returning the right VGA control reg for platforms
drm/i915: Allowing changing of wm latencies for valid platforms
drm/i915: Adding HAS_GMCH_DISPLAY macro
drm/i915: Fix possible overflow when recording semaphore states.
drm/i915: Do not unmap object unless no other VMAs reference it
drm/i915: remove plane/cursor/pipe assertions from intel_crtc_disable
drm/i915: Reorder ctx unref on ppgtt cleanup
drm/i915/error: Check the potential ctx obj's vm
drm/i915: Fix printing proper min/min/rpe values in debugfs
drm/i915: BDW can also detect unclaimed registers
...
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 98 |
1 files changed, 94 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index c3a5a8f0825b..3c4a62169f28 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -182,6 +182,12 @@ static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = | |||
182 | { DRM_MODE_SCALE_ASPECT, "Full aspect" }, | 182 | { DRM_MODE_SCALE_ASPECT, "Full aspect" }, |
183 | }; | 183 | }; |
184 | 184 | ||
185 | static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { | ||
186 | { DRM_MODE_PICTURE_ASPECT_NONE, "Automatic" }, | ||
187 | { DRM_MODE_PICTURE_ASPECT_4_3, "4:3" }, | ||
188 | { DRM_MODE_PICTURE_ASPECT_16_9, "16:9" }, | ||
189 | }; | ||
190 | |||
185 | /* | 191 | /* |
186 | * Non-global properties, but "required" for certain connectors. | 192 | * Non-global properties, but "required" for certain connectors. |
187 | */ | 193 | */ |
@@ -1463,6 +1469,33 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev) | |||
1463 | EXPORT_SYMBOL(drm_mode_create_scaling_mode_property); | 1469 | EXPORT_SYMBOL(drm_mode_create_scaling_mode_property); |
1464 | 1470 | ||
1465 | /** | 1471 | /** |
1472 | * drm_mode_create_aspect_ratio_property - create aspect ratio property | ||
1473 | * @dev: DRM device | ||
1474 | * | ||
1475 | * Called by a driver the first time it's needed, must be attached to desired | ||
1476 | * connectors. | ||
1477 | * | ||
1478 | * Returns: | ||
1479 | * Zero on success, errno on failure. | ||
1480 | */ | ||
1481 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev) | ||
1482 | { | ||
1483 | if (dev->mode_config.aspect_ratio_property) | ||
1484 | return 0; | ||
1485 | |||
1486 | dev->mode_config.aspect_ratio_property = | ||
1487 | drm_property_create_enum(dev, 0, "aspect ratio", | ||
1488 | drm_aspect_ratio_enum_list, | ||
1489 | ARRAY_SIZE(drm_aspect_ratio_enum_list)); | ||
1490 | |||
1491 | if (dev->mode_config.aspect_ratio_property == NULL) | ||
1492 | return -ENOMEM; | ||
1493 | |||
1494 | return 0; | ||
1495 | } | ||
1496 | EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property); | ||
1497 | |||
1498 | /** | ||
1466 | * drm_mode_create_dirty_property - create dirty property | 1499 | * drm_mode_create_dirty_property - create dirty property |
1467 | * @dev: DRM device | 1500 | * @dev: DRM device |
1468 | * | 1501 | * |
@@ -3476,19 +3509,28 @@ EXPORT_SYMBOL(drm_property_create_enum); | |||
3476 | struct drm_property *drm_property_create_bitmask(struct drm_device *dev, | 3509 | struct drm_property *drm_property_create_bitmask(struct drm_device *dev, |
3477 | int flags, const char *name, | 3510 | int flags, const char *name, |
3478 | const struct drm_prop_enum_list *props, | 3511 | const struct drm_prop_enum_list *props, |
3479 | int num_values) | 3512 | int num_props, |
3513 | uint64_t supported_bits) | ||
3480 | { | 3514 | { |
3481 | struct drm_property *property; | 3515 | struct drm_property *property; |
3482 | int i, ret; | 3516 | int i, ret, index = 0; |
3517 | int num_values = hweight64(supported_bits); | ||
3483 | 3518 | ||
3484 | flags |= DRM_MODE_PROP_BITMASK; | 3519 | flags |= DRM_MODE_PROP_BITMASK; |
3485 | 3520 | ||
3486 | property = drm_property_create(dev, flags, name, num_values); | 3521 | property = drm_property_create(dev, flags, name, num_values); |
3487 | if (!property) | 3522 | if (!property) |
3488 | return NULL; | 3523 | return NULL; |
3524 | for (i = 0; i < num_props; i++) { | ||
3525 | if (!(supported_bits & (1ULL << props[i].type))) | ||
3526 | continue; | ||
3489 | 3527 | ||
3490 | for (i = 0; i < num_values; i++) { | 3528 | if (WARN_ON(index >= num_values)) { |
3491 | ret = drm_property_add_enum(property, i, | 3529 | drm_property_destroy(dev, property); |
3530 | return NULL; | ||
3531 | } | ||
3532 | |||
3533 | ret = drm_property_add_enum(property, index++, | ||
3492 | props[i].type, | 3534 | props[i].type, |
3493 | props[i].name); | 3535 | props[i].name); |
3494 | if (ret) { | 3536 | if (ret) { |
@@ -4937,6 +4979,36 @@ int drm_format_vert_chroma_subsampling(uint32_t format) | |||
4937 | EXPORT_SYMBOL(drm_format_vert_chroma_subsampling); | 4979 | EXPORT_SYMBOL(drm_format_vert_chroma_subsampling); |
4938 | 4980 | ||
4939 | /** | 4981 | /** |
4982 | * drm_rotation_simplify() - Try to simplify the rotation | ||
4983 | * @rotation: Rotation to be simplified | ||
4984 | * @supported_rotations: Supported rotations | ||
4985 | * | ||
4986 | * Attempt to simplify the rotation to a form that is supported. | ||
4987 | * Eg. if the hardware supports everything except DRM_REFLECT_X | ||
4988 | * one could call this function like this: | ||
4989 | * | ||
4990 | * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) | | ||
4991 | * BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) | | ||
4992 | * BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y)); | ||
4993 | * | ||
4994 | * to eliminate the DRM_ROTATE_X flag. Depending on what kind of | ||
4995 | * transforms the hardware supports, this function may not | ||
4996 | * be able to produce a supported transform, so the caller should | ||
4997 | * check the result afterwards. | ||
4998 | */ | ||
4999 | unsigned int drm_rotation_simplify(unsigned int rotation, | ||
5000 | unsigned int supported_rotations) | ||
5001 | { | ||
5002 | if (rotation & ~supported_rotations) { | ||
5003 | rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y); | ||
5004 | rotation = (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 4); | ||
5005 | } | ||
5006 | |||
5007 | return rotation; | ||
5008 | } | ||
5009 | EXPORT_SYMBOL(drm_rotation_simplify); | ||
5010 | |||
5011 | /** | ||
4940 | * drm_mode_config_init - initialize DRM mode_configuration structure | 5012 | * drm_mode_config_init - initialize DRM mode_configuration structure |
4941 | * @dev: DRM device | 5013 | * @dev: DRM device |
4942 | * | 5014 | * |
@@ -5054,3 +5126,21 @@ void drm_mode_config_cleanup(struct drm_device *dev) | |||
5054 | drm_modeset_lock_fini(&dev->mode_config.connection_mutex); | 5126 | drm_modeset_lock_fini(&dev->mode_config.connection_mutex); |
5055 | } | 5127 | } |
5056 | EXPORT_SYMBOL(drm_mode_config_cleanup); | 5128 | EXPORT_SYMBOL(drm_mode_config_cleanup); |
5129 | |||
5130 | struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev, | ||
5131 | unsigned int supported_rotations) | ||
5132 | { | ||
5133 | static const struct drm_prop_enum_list props[] = { | ||
5134 | { DRM_ROTATE_0, "rotate-0" }, | ||
5135 | { DRM_ROTATE_90, "rotate-90" }, | ||
5136 | { DRM_ROTATE_180, "rotate-180" }, | ||
5137 | { DRM_ROTATE_270, "rotate-270" }, | ||
5138 | { DRM_REFLECT_X, "reflect-x" }, | ||
5139 | { DRM_REFLECT_Y, "reflect-y" }, | ||
5140 | }; | ||
5141 | |||
5142 | return drm_property_create_bitmask(dev, 0, "rotation", | ||
5143 | props, ARRAY_SIZE(props), | ||
5144 | supported_rotations); | ||
5145 | } | ||
5146 | EXPORT_SYMBOL(drm_mode_create_rotation_property); | ||