diff options
| author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-05-08 18:27:13 -0400 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-06-02 03:57:02 -0400 |
| commit | d980278bd8fc5b4054d4a7593620ad3ec6e1104a (patch) | |
| tree | 3545fe86fadcb01bb005df13bf7d2beeb235aaae /drivers/gpu/drm/omapdrm/omap_plane.c | |
| parent | ba527c13644fdeacdb4756fc9dd9aa598a40bce3 (diff) | |
drm: omapdrm: Remove custom plane state
The custom plane state only encapsulates the standard plane state with
adding any custom field. Remove it and use the atomic plane helpers
directly.
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 | 58 |
1 files changed, 6 insertions, 52 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 9c2477c7b65b..334ee431c981 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
| @@ -39,16 +39,6 @@ struct omap_plane { | |||
| 39 | uint32_t formats[32]; | 39 | uint32_t formats[32]; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | struct omap_plane_state { | ||
| 43 | struct drm_plane_state base; | ||
| 44 | }; | ||
| 45 | |||
| 46 | static inline struct omap_plane_state * | ||
| 47 | to_omap_plane_state(struct drm_plane_state *state) | ||
| 48 | { | ||
| 49 | return container_of(state, struct omap_plane_state, base); | ||
| 50 | } | ||
| 51 | |||
| 52 | static int omap_plane_prepare_fb(struct drm_plane *plane, | 42 | static int omap_plane_prepare_fb(struct drm_plane *plane, |
| 53 | struct drm_plane_state *new_state) | 43 | struct drm_plane_state *new_state) |
| 54 | { | 44 | { |
| @@ -223,56 +213,20 @@ void omap_plane_install_properties(struct drm_plane *plane, | |||
| 223 | drm_object_attach_property(obj, priv->zorder_prop, 0); | 213 | drm_object_attach_property(obj, priv->zorder_prop, 0); |
| 224 | } | 214 | } |
| 225 | 215 | ||
| 226 | static struct drm_plane_state * | ||
| 227 | omap_plane_atomic_duplicate_state(struct drm_plane *plane) | ||
| 228 | { | ||
| 229 | struct omap_plane_state *state; | ||
| 230 | struct omap_plane_state *copy; | ||
| 231 | |||
| 232 | if (WARN_ON(!plane->state)) | ||
| 233 | return NULL; | ||
| 234 | |||
| 235 | state = to_omap_plane_state(plane->state); | ||
| 236 | copy = kmemdup(state, sizeof(*state), GFP_KERNEL); | ||
| 237 | if (copy == NULL) | ||
| 238 | return NULL; | ||
| 239 | |||
| 240 | __drm_atomic_helper_plane_duplicate_state(plane, ©->base); | ||
| 241 | |||
| 242 | return ©->base; | ||
| 243 | } | ||
| 244 | |||
| 245 | static void omap_plane_atomic_destroy_state(struct drm_plane *plane, | ||
| 246 | struct drm_plane_state *state) | ||
| 247 | { | ||
| 248 | __drm_atomic_helper_plane_destroy_state(state); | ||
| 249 | kfree(to_omap_plane_state(state)); | ||
| 250 | } | ||
| 251 | |||
| 252 | static void omap_plane_reset(struct drm_plane *plane) | 216 | static void omap_plane_reset(struct drm_plane *plane) |
| 253 | { | 217 | { |
| 254 | struct omap_plane *omap_plane = to_omap_plane(plane); | 218 | struct omap_plane *omap_plane = to_omap_plane(plane); |
| 255 | struct omap_plane_state *omap_state; | ||
| 256 | 219 | ||
| 257 | if (plane->state) { | 220 | drm_atomic_helper_plane_reset(plane); |
| 258 | omap_plane_atomic_destroy_state(plane, plane->state); | 221 | if (!plane->state) |
| 259 | plane->state = NULL; | ||
| 260 | } | ||
| 261 | |||
| 262 | omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL); | ||
| 263 | if (omap_state == NULL) | ||
| 264 | return; | 222 | return; |
| 265 | 223 | ||
| 266 | /* | 224 | /* |
| 267 | * Set the zpos default depending on whether we are a primary or overlay | 225 | * Set the zpos default depending on whether we are a primary or overlay |
| 268 | * plane. | 226 | * plane. |
| 269 | */ | 227 | */ |
| 270 | omap_state->base.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY | 228 | plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY |
| 271 | ? 0 : omap_plane->id; | 229 | ? 0 : omap_plane->id; |
| 272 | omap_state->base.rotation = DRM_MODE_ROTATE_0; | ||
| 273 | |||
| 274 | plane->state = &omap_state->base; | ||
| 275 | plane->state->plane = plane; | ||
| 276 | } | 230 | } |
| 277 | 231 | ||
| 278 | static int omap_plane_atomic_set_property(struct drm_plane *plane, | 232 | static int omap_plane_atomic_set_property(struct drm_plane *plane, |
| @@ -311,8 +265,8 @@ static const struct drm_plane_funcs omap_plane_funcs = { | |||
| 311 | .reset = omap_plane_reset, | 265 | .reset = omap_plane_reset, |
| 312 | .destroy = omap_plane_destroy, | 266 | .destroy = omap_plane_destroy, |
| 313 | .set_property = drm_atomic_helper_plane_set_property, | 267 | .set_property = drm_atomic_helper_plane_set_property, |
| 314 | .atomic_duplicate_state = omap_plane_atomic_duplicate_state, | 268 | .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, |
| 315 | .atomic_destroy_state = omap_plane_atomic_destroy_state, | 269 | .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, |
| 316 | .atomic_set_property = omap_plane_atomic_set_property, | 270 | .atomic_set_property = omap_plane_atomic_set_property, |
| 317 | .atomic_get_property = omap_plane_atomic_get_property, | 271 | .atomic_get_property = omap_plane_atomic_get_property, |
| 318 | }; | 272 | }; |
