diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-09-26 12:30:52 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-10-21 12:25:47 -0400 |
commit | 0da88db14034e8b309f1c4188123ca1a02f4b354 (patch) | |
tree | 51a5237359da11038d16f735f60da1f6218aecdd | |
parent | 18391ec0bb4a1ea1ba2b485b8b29ac536d52fa5b (diff) |
drm/omap: Use per-plane rotation property
The global mode_config.rotation_property is going away, switch over to
per-plane rotation_property.
Not sure I got the annoying crtc rotation_property handling right.
Might work, or migth not.
v2: Drop the BIT()
Don't create rotation property twice for each primary plane
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
[danvet: Add comment per discussion between Tomi&Ville.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1474907460-10717-8-git-send-email-ville.syrjala@linux.intel.com
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 52 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 14 |
3 files changed, 41 insertions, 38 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 180f644e861e..16c691dbc372 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -438,13 +438,14 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, | |||
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | static bool omap_crtc_is_plane_prop(struct drm_device *dev, | 441 | static bool omap_crtc_is_plane_prop(struct drm_crtc *crtc, |
442 | struct drm_property *property) | 442 | struct drm_property *property) |
443 | { | 443 | { |
444 | struct drm_device *dev = crtc->dev; | ||
444 | struct omap_drm_private *priv = dev->dev_private; | 445 | struct omap_drm_private *priv = dev->dev_private; |
445 | 446 | ||
446 | return property == priv->zorder_prop || | 447 | return property == priv->zorder_prop || |
447 | property == dev->mode_config.rotation_property; | 448 | property == crtc->primary->rotation_property; |
448 | } | 449 | } |
449 | 450 | ||
450 | static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, | 451 | static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, |
@@ -452,9 +453,7 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, | |||
452 | struct drm_property *property, | 453 | struct drm_property *property, |
453 | uint64_t val) | 454 | uint64_t val) |
454 | { | 455 | { |
455 | struct drm_device *dev = crtc->dev; | 456 | if (omap_crtc_is_plane_prop(crtc, property)) { |
456 | |||
457 | if (omap_crtc_is_plane_prop(dev, property)) { | ||
458 | struct drm_plane_state *plane_state; | 457 | struct drm_plane_state *plane_state; |
459 | struct drm_plane *plane = crtc->primary; | 458 | struct drm_plane *plane = crtc->primary; |
460 | 459 | ||
@@ -479,9 +478,7 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, | |||
479 | struct drm_property *property, | 478 | struct drm_property *property, |
480 | uint64_t *val) | 479 | uint64_t *val) |
481 | { | 480 | { |
482 | struct drm_device *dev = crtc->dev; | 481 | if (omap_crtc_is_plane_prop(crtc, property)) { |
483 | |||
484 | if (omap_crtc_is_plane_prop(dev, property)) { | ||
485 | /* | 482 | /* |
486 | * Delegate property get to the primary plane. The | 483 | * Delegate property get to the primary plane. The |
487 | * drm_atomic_plane_get_property() function isn't exported, but | 484 | * drm_atomic_plane_get_property() function isn't exported, but |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 31ec5d0a9576..39c5312b466c 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -293,16 +293,6 @@ static int omap_modeset_init_properties(struct drm_device *dev) | |||
293 | { | 293 | { |
294 | struct omap_drm_private *priv = dev->dev_private; | 294 | struct omap_drm_private *priv = dev->dev_private; |
295 | 295 | ||
296 | if (priv->has_dmm) { | ||
297 | dev->mode_config.rotation_property = | ||
298 | drm_mode_create_rotation_property(dev, | ||
299 | DRM_ROTATE_0 | DRM_ROTATE_90 | | ||
300 | DRM_ROTATE_180 | DRM_ROTATE_270 | | ||
301 | DRM_REFLECT_X | DRM_REFLECT_Y); | ||
302 | if (!dev->mode_config.rotation_property) | ||
303 | return -ENOMEM; | ||
304 | } | ||
305 | |||
306 | priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3); | 296 | priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3); |
307 | if (!priv->zorder_prop) | 297 | if (!priv->zorder_prop) |
308 | return -ENOMEM; | 298 | return -ENOMEM; |
@@ -753,24 +743,32 @@ static void dev_lastclose(struct drm_device *dev) | |||
753 | 743 | ||
754 | DBG("lastclose: dev=%p", dev); | 744 | DBG("lastclose: dev=%p", dev); |
755 | 745 | ||
756 | if (dev->mode_config.rotation_property) { | 746 | /* need to restore default rotation state.. not sure |
757 | /* need to restore default rotation state.. not sure | 747 | * if there is a cleaner way to restore properties to |
758 | * if there is a cleaner way to restore properties to | 748 | * default state? Maybe a flag that properties should |
759 | * default state? Maybe a flag that properties should | 749 | * automatically be restored to default state on |
760 | * automatically be restored to default state on | 750 | * lastclose? |
761 | * lastclose? | 751 | */ |
762 | */ | 752 | for (i = 0; i < priv->num_crtcs; i++) { |
763 | for (i = 0; i < priv->num_crtcs; i++) { | 753 | struct drm_crtc *crtc = priv->crtcs[i]; |
764 | drm_object_property_set_value(&priv->crtcs[i]->base, | ||
765 | dev->mode_config.rotation_property, | ||
766 | DRM_ROTATE_0); | ||
767 | } | ||
768 | 754 | ||
769 | for (i = 0; i < priv->num_planes; i++) { | 755 | if (!crtc->primary->rotation_property) |
770 | drm_object_property_set_value(&priv->planes[i]->base, | 756 | continue; |
771 | dev->mode_config.rotation_property, | 757 | |
772 | DRM_ROTATE_0); | 758 | drm_object_property_set_value(&crtc->base, |
773 | } | 759 | crtc->primary->rotation_property, |
760 | DRM_ROTATE_0); | ||
761 | } | ||
762 | |||
763 | for (i = 0; i < priv->num_planes; i++) { | ||
764 | struct drm_plane *plane = priv->planes[i]; | ||
765 | |||
766 | if (!plane->rotation_property) | ||
767 | continue; | ||
768 | |||
769 | drm_object_property_set_value(&plane->base, | ||
770 | plane->rotation_property, | ||
771 | DRM_ROTATE_0); | ||
774 | } | 772 | } |
775 | 773 | ||
776 | if (priv->fbdev) { | 774 | if (priv->fbdev) { |
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 6ddaa5ea4b6b..0ffd5b930ec0 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -211,9 +211,17 @@ void omap_plane_install_properties(struct drm_plane *plane, | |||
211 | struct omap_drm_private *priv = dev->dev_private; | 211 | struct omap_drm_private *priv = dev->dev_private; |
212 | 212 | ||
213 | if (priv->has_dmm) { | 213 | if (priv->has_dmm) { |
214 | struct drm_property *prop = dev->mode_config.rotation_property; | 214 | if (!plane->rotation_property) |
215 | 215 | drm_plane_create_rotation_property(plane, | |
216 | drm_object_attach_property(obj, prop, DRM_ROTATE_0); | 216 | DRM_ROTATE_0, |
217 | DRM_ROTATE_0 | DRM_ROTATE_90 | | ||
218 | DRM_ROTATE_180 | DRM_ROTATE_270 | | ||
219 | DRM_REFLECT_X | DRM_REFLECT_Y); | ||
220 | |||
221 | /* Attach the rotation property also to the crtc object */ | ||
222 | if (plane->rotation_property && obj != &plane->base) | ||
223 | drm_object_attach_property(obj, plane->rotation_property, | ||
224 | DRM_ROTATE_0); | ||
217 | } | 225 | } |
218 | 226 | ||
219 | drm_object_attach_property(obj, priv->zorder_prop, 0); | 227 | drm_object_attach_property(obj, priv->zorder_prop, 0); |