diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-03-06 17:16:43 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-06-12 22:52:44 +0300 |
commit | e2cd09b202c5d32804f72bc28a9ed5a7d8a34452 (patch) | |
tree | 6294741b5af173bf15e9d708644dbb07a6be113e /drivers/gpu/drm/omapdrm/omap_drv.c | |
parent | 5c70c464787febc67c40b13f2fedccc378b0fa8e (diff) | |
download | talos-op-linux-e2cd09b202c5d32804f72bc28a9ed5a7d8a34452.tar.gz talos-op-linux-e2cd09b202c5d32804f72bc28a9ed5a7d8a34452.zip |
drm: omapdrm: Store the rotation property in dev->mode_config
Rotation is a standard property, store it in
dev->mode_config.rotation_property. While at it, extract the properties
initialization code to a separate function instead of running it for
every plane.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_drv.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 94920d47e3b6..ce6a255d277a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -151,6 +151,27 @@ static int omap_modeset_create_crtc(struct drm_device *dev, int id, return 0; } +static int omap_modeset_init_properties(struct drm_device *dev) +{ + struct omap_drm_private *priv = dev->dev_private; + + if (priv->has_dmm) { + dev->mode_config.rotation_property = + drm_mode_create_rotation_property(dev, + BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) | + BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) | + BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); + if (!dev->mode_config.rotation_property) + return -ENOMEM; + } + + priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3); + if (!priv->zorder_prop) + return -ENOMEM; + + return 0; +} + static int omap_modeset_init(struct drm_device *dev) { struct omap_drm_private *priv = dev->dev_private; @@ -165,6 +186,10 @@ static int omap_modeset_init(struct drm_device *dev) omap_drm_irq_install(dev); + ret = omap_modeset_init_properties(dev); + if (ret < 0) + return ret; + /* * We usually don't want to create a CRTC for each manager, at least * not until we have a way to expose private planes to userspace. @@ -583,7 +608,7 @@ static void dev_lastclose(struct drm_device *dev) DBG("lastclose: dev=%p", dev); - if (priv->rotation_prop) { + if (dev->mode_config.rotation_property) { /* 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 @@ -592,12 +617,12 @@ static void dev_lastclose(struct drm_device *dev) */ for (i = 0; i < priv->num_crtcs; i++) { drm_object_property_set_value(&priv->crtcs[i]->base, - priv->rotation_prop, 0); + dev->mode_config.rotation_property, 0); } for (i = 0; i < priv->num_planes; i++) { drm_object_property_set_value(&priv->planes[i]->base, - priv->rotation_prop, 0); + dev->mode_config.rotation_property, 0); } } |