Move rotation property to drm core mode_config. This allows us to ditch
the driver-private lastclose logic.

Cc: Rob Clark <robdclark at gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
---
 drivers/gpu/drm/omapdrm/omap_crtc.c  |  4 ++--
 drivers/gpu/drm/omapdrm/omap_drv.c   | 20 --------------------
 drivers/gpu/drm/omapdrm/omap_drv.h   |  1 -
 drivers/gpu/drm/omapdrm/omap_plane.c |  7 ++++---
 4 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 2d28dc337cfb..1240fa61b397 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -385,9 +385,9 @@ static int omap_crtc_set_property(struct drm_crtc *crtc,
                struct drm_property *property, uint64_t val)
 {
        struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-       struct omap_drm_private *priv = crtc->dev->dev_private;
+       struct drm_device *dev = crtc->dev;

-       if (property == priv->rotation_prop) {
+       if (property == dev->mode_config.rotation_property) {
                crtc->invert_dimensions =
                                !!(val & ((1LL << DRM_ROTATE_90) | (1LL << 
DRM_ROTATE_270)));
        }
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 862ba03c236c..282f5ec4f1a2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -560,8 +560,6 @@ static int dev_open(struct drm_device *dev, struct drm_file 
*file)
  */
 static void dev_lastclose(struct drm_device *dev)
 {
-       int i;
-
        /* we don't support vga-switcheroo.. so just make sure the fbdev
         * mode is active
         */
@@ -570,24 +568,6 @@ static void dev_lastclose(struct drm_device *dev)

        DBG("lastclose: dev=%p", dev);

-       if (priv->rotation_prop) {
-               /* need to restore default rotation state.. not sure
-                * if there is a cleaner way to restore properties to
-                * default state?  Maybe a flag that properties should
-                * automatically be restored to default state on
-                * lastclose?
-                */
-               for (i = 0; i < priv->num_crtcs; i++) {
-                       drm_object_property_set_value(&priv->crtcs[i]->base,
-                                       priv->rotation_prop, 0);
-               }
-
-               for (i = 0; i < priv->num_planes; i++) {
-                       drm_object_property_set_value(&priv->planes[i]->base,
-                                       priv->rotation_prop, 0);
-               }
-       }
-
        ret = drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
        if (ret)
                DBG("failed to restore crtc mode");
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 60e47b33c801..aa596504e662 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -111,7 +111,6 @@ struct omap_drm_private {
        bool has_dmm;

        /* properties: */
-       struct drm_property *rotation_prop;
        struct drm_property *zorder_prop;

        /* irq handling: */
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c 
b/drivers/gpu/drm/omapdrm/omap_plane.c
index 891a4dc608af..3b5fad2a359c 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -306,7 +306,7 @@ void omap_plane_install_properties(struct drm_plane *plane,
        struct drm_property *prop;

        if (priv->has_dmm) {
-               prop = priv->rotation_prop;
+               prop = dev->mode_config.rotation_property;
                if (!prop) {
                        prop = drm_mode_create_rotation_property(dev,
                                                                 
BIT(DRM_ROTATE_0) |
@@ -317,7 +317,7 @@ void omap_plane_install_properties(struct drm_plane *plane,
                                                                 
BIT(DRM_REFLECT_Y));
                        if (prop == NULL)
                                return;
-                       priv->rotation_prop = prop;
+                       dev->mode_config.rotation_property = prop;
                }
                drm_object_attach_property(obj, prop, 0);
        }
@@ -337,9 +337,10 @@ int omap_plane_set_property(struct drm_plane *plane,
 {
        struct omap_plane *omap_plane = to_omap_plane(plane);
        struct omap_drm_private *priv = plane->dev->dev_private;
+       struct drm_device *dev = omap_plane->base.dev;
        int ret = -EINVAL;

-       if (property == priv->rotation_prop) {
+       if (property == dev->mode_config.rotation_property) {
                DBG("%s: rotation: %02x", omap_plane->name, (uint32_t)val);
                omap_plane->win.rotation = val;
                ret = apply(plane);
-- 
2.1.1



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140930/39410959/attachment-0001.sig>

Reply via email to