diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-05-08 18:27:12 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-06-02 03:55:03 -0400 |
commit | ba527c13644fdeacdb4756fc9dd9aa598a40bce3 (patch) | |
tree | 6b337eecf26c554b31355b6d800a0df83959febb /drivers/gpu/drm/omapdrm/omap_plane.c | |
parent | d6f544f6bf419a5bc65f7f2d070db008d1119097 (diff) |
drm: omapdrm: Store the Z order in the plane state zpos field
The DRM core implements a standard "zpos" property to control planes
ordering. The omapdrm driver implements a similar property named
"zorder". Although we can't switch to DRM core handling of the "zpos"
property for backward compatibility reasons, we can store the zorder
value in the drm_plane_state zpos field, saving us from adding a custom
field to the plane state.
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_plane.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index d3d6818c68f8..9c2477c7b65b 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -41,8 +41,6 @@ struct omap_plane { | |||
41 | 41 | ||
42 | struct omap_plane_state { | 42 | struct omap_plane_state { |
43 | struct drm_plane_state base; | 43 | struct drm_plane_state base; |
44 | |||
45 | unsigned int zorder; | ||
46 | }; | 44 | }; |
47 | 45 | ||
48 | static inline struct omap_plane_state * | 46 | static inline struct omap_plane_state * |
@@ -73,7 +71,6 @@ static void omap_plane_atomic_update(struct drm_plane *plane, | |||
73 | struct omap_drm_private *priv = plane->dev->dev_private; | 71 | struct omap_drm_private *priv = plane->dev->dev_private; |
74 | struct omap_plane *omap_plane = to_omap_plane(plane); | 72 | struct omap_plane *omap_plane = to_omap_plane(plane); |
75 | struct drm_plane_state *state = plane->state; | 73 | struct drm_plane_state *state = plane->state; |
76 | struct omap_plane_state *omap_state = to_omap_plane_state(state); | ||
77 | struct omap_overlay_info info; | 74 | struct omap_overlay_info info; |
78 | struct omap_drm_window win; | 75 | struct omap_drm_window win; |
79 | int ret; | 76 | int ret; |
@@ -85,7 +82,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane, | |||
85 | info.rotation = OMAP_DSS_ROT_0; | 82 | info.rotation = OMAP_DSS_ROT_0; |
86 | info.global_alpha = 0xff; | 83 | info.global_alpha = 0xff; |
87 | info.mirror = 0; | 84 | info.mirror = 0; |
88 | info.zorder = omap_state->zorder; | 85 | info.zorder = state->zpos; |
89 | 86 | ||
90 | memset(&win, 0, sizeof(win)); | 87 | memset(&win, 0, sizeof(win)); |
91 | win.rotation = state->rotation; | 88 | win.rotation = state->rotation; |
@@ -138,11 +135,10 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, | |||
138 | struct drm_plane_state *old_state) | 135 | struct drm_plane_state *old_state) |
139 | { | 136 | { |
140 | struct omap_drm_private *priv = plane->dev->dev_private; | 137 | struct omap_drm_private *priv = plane->dev->dev_private; |
141 | struct omap_plane_state *omap_state = to_omap_plane_state(plane->state); | ||
142 | struct omap_plane *omap_plane = to_omap_plane(plane); | 138 | struct omap_plane *omap_plane = to_omap_plane(plane); |
143 | 139 | ||
144 | plane->state->rotation = DRM_MODE_ROTATE_0; | 140 | plane->state->rotation = DRM_MODE_ROTATE_0; |
145 | omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY | 141 | plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY |
146 | ? 0 : omap_plane->id; | 142 | ? 0 : omap_plane->id; |
147 | 143 | ||
148 | priv->dispc_ops->ovl_enable(omap_plane->id, false); | 144 | priv->dispc_ops->ovl_enable(omap_plane->id, false); |
@@ -268,11 +264,11 @@ static void omap_plane_reset(struct drm_plane *plane) | |||
268 | return; | 264 | return; |
269 | 265 | ||
270 | /* | 266 | /* |
271 | * Set defaults depending on whether we are a primary or overlay | 267 | * Set the zpos default depending on whether we are a primary or overlay |
272 | * plane. | 268 | * plane. |
273 | */ | 269 | */ |
274 | omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY | 270 | omap_state->base.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY |
275 | ? 0 : omap_plane->id; | 271 | ? 0 : omap_plane->id; |
276 | omap_state->base.rotation = DRM_MODE_ROTATE_0; | 272 | omap_state->base.rotation = DRM_MODE_ROTATE_0; |
277 | 273 | ||
278 | plane->state = &omap_state->base; | 274 | plane->state = &omap_state->base; |
@@ -285,10 +281,9 @@ static int omap_plane_atomic_set_property(struct drm_plane *plane, | |||
285 | uint64_t val) | 281 | uint64_t val) |
286 | { | 282 | { |
287 | struct omap_drm_private *priv = plane->dev->dev_private; | 283 | struct omap_drm_private *priv = plane->dev->dev_private; |
288 | struct omap_plane_state *omap_state = to_omap_plane_state(state); | ||
289 | 284 | ||
290 | if (property == priv->zorder_prop) | 285 | if (property == priv->zorder_prop) |
291 | omap_state->zorder = val; | 286 | state->zpos = val; |
292 | else | 287 | else |
293 | return -EINVAL; | 288 | return -EINVAL; |
294 | 289 | ||
@@ -301,11 +296,9 @@ static int omap_plane_atomic_get_property(struct drm_plane *plane, | |||
301 | uint64_t *val) | 296 | uint64_t *val) |
302 | { | 297 | { |
303 | struct omap_drm_private *priv = plane->dev->dev_private; | 298 | struct omap_drm_private *priv = plane->dev->dev_private; |
304 | const struct omap_plane_state *omap_state = | ||
305 | container_of(state, const struct omap_plane_state, base); | ||
306 | 299 | ||
307 | if (property == priv->zorder_prop) | 300 | if (property == priv->zorder_prop) |
308 | *val = omap_state->zorder; | 301 | *val = state->zpos; |
309 | else | 302 | else |
310 | return -EINVAL; | 303 | return -EINVAL; |
311 | 304 | ||