Commit 0da88db1 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
[danvet: Add comment per discussion between Tomi&Ville.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1474907460-10717-8-git-send-email-ville.syrjala@linux.intel.com
parent 18391ec0
...@@ -438,13 +438,14 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -438,13 +438,14 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
} }
} }
static bool omap_crtc_is_plane_prop(struct drm_device *dev, static bool omap_crtc_is_plane_prop(struct drm_crtc *crtc,
struct drm_property *property) struct drm_property *property)
{ {
struct drm_device *dev = crtc->dev;
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
return property == priv->zorder_prop || return property == priv->zorder_prop ||
property == dev->mode_config.rotation_property; property == crtc->primary->rotation_property;
} }
static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, 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,9 +453,7 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
struct drm_property *property, struct drm_property *property,
uint64_t val) uint64_t val)
{ {
struct drm_device *dev = crtc->dev; if (omap_crtc_is_plane_prop(crtc, property)) {
if (omap_crtc_is_plane_prop(dev, property)) {
struct drm_plane_state *plane_state; struct drm_plane_state *plane_state;
struct drm_plane *plane = crtc->primary; struct drm_plane *plane = crtc->primary;
...@@ -479,9 +478,7 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, ...@@ -479,9 +478,7 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
struct drm_property *property, struct drm_property *property,
uint64_t *val) uint64_t *val)
{ {
struct drm_device *dev = crtc->dev; if (omap_crtc_is_plane_prop(crtc, property)) {
if (omap_crtc_is_plane_prop(dev, property)) {
/* /*
* Delegate property get to the primary plane. The * Delegate property get to the primary plane. The
* drm_atomic_plane_get_property() function isn't exported, but * drm_atomic_plane_get_property() function isn't exported, but
......
...@@ -293,16 +293,6 @@ static int omap_modeset_init_properties(struct drm_device *dev) ...@@ -293,16 +293,6 @@ static int omap_modeset_init_properties(struct drm_device *dev)
{ {
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
if (priv->has_dmm) {
dev->mode_config.rotation_property =
drm_mode_create_rotation_property(dev,
DRM_ROTATE_0 | DRM_ROTATE_90 |
DRM_ROTATE_180 | DRM_ROTATE_270 |
DRM_REFLECT_X | DRM_REFLECT_Y);
if (!dev->mode_config.rotation_property)
return -ENOMEM;
}
priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3); priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3);
if (!priv->zorder_prop) if (!priv->zorder_prop)
return -ENOMEM; return -ENOMEM;
...@@ -753,24 +743,32 @@ static void dev_lastclose(struct drm_device *dev) ...@@ -753,24 +743,32 @@ static void dev_lastclose(struct drm_device *dev)
DBG("lastclose: dev=%p", dev); DBG("lastclose: dev=%p", dev);
if (dev->mode_config.rotation_property) { /* need to restore default rotation state.. not sure
/* need to restore default rotation state.. not sure * if there is a cleaner way to restore properties to
* if there is a cleaner way to restore properties to * default state? Maybe a flag that properties should
* default state? Maybe a flag that properties should * automatically be restored to default state on
* automatically be restored to default state on * lastclose?
* lastclose? */
*/ for (i = 0; i < priv->num_crtcs; i++) {
for (i = 0; i < priv->num_crtcs; i++) { struct drm_crtc *crtc = priv->crtcs[i];
drm_object_property_set_value(&priv->crtcs[i]->base,
dev->mode_config.rotation_property,
DRM_ROTATE_0);
}
for (i = 0; i < priv->num_planes; i++) { if (!crtc->primary->rotation_property)
drm_object_property_set_value(&priv->planes[i]->base, continue;
dev->mode_config.rotation_property,
DRM_ROTATE_0); drm_object_property_set_value(&crtc->base,
} crtc->primary->rotation_property,
DRM_ROTATE_0);
}
for (i = 0; i < priv->num_planes; i++) {
struct drm_plane *plane = priv->planes[i];
if (!plane->rotation_property)
continue;
drm_object_property_set_value(&plane->base,
plane->rotation_property,
DRM_ROTATE_0);
} }
if (priv->fbdev) { if (priv->fbdev) {
......
...@@ -211,9 +211,17 @@ void omap_plane_install_properties(struct drm_plane *plane, ...@@ -211,9 +211,17 @@ void omap_plane_install_properties(struct drm_plane *plane,
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
if (priv->has_dmm) { if (priv->has_dmm) {
struct drm_property *prop = dev->mode_config.rotation_property; if (!plane->rotation_property)
drm_plane_create_rotation_property(plane,
drm_object_attach_property(obj, prop, DRM_ROTATE_0); DRM_ROTATE_0,
DRM_ROTATE_0 | DRM_ROTATE_90 |
DRM_ROTATE_180 | DRM_ROTATE_270 |
DRM_REFLECT_X | DRM_REFLECT_Y);
/* Attach the rotation property also to the crtc object */
if (plane->rotation_property && obj != &plane->base)
drm_object_attach_property(obj, plane->rotation_property,
DRM_ROTATE_0);
} }
drm_object_attach_property(obj, priv->zorder_prop, 0); drm_object_attach_property(obj, priv->zorder_prop, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment