From: Laurent Pinchart Date: Mon, 8 May 2017 22:27:13 +0000 (+0300) Subject: drm: omapdrm: Remove custom plane state X-Git-Tag: v4.14-rc1~484^2~30^2~59 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d980278bd8fc5b4054d4a7593620ad3ec6e1104a;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Tomi Valkeinen --- diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 9c2477c..334ee43 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -39,16 +39,6 @@ struct omap_plane { uint32_t formats[32]; }; -struct omap_plane_state { - struct drm_plane_state base; -}; - -static inline struct omap_plane_state * -to_omap_plane_state(struct drm_plane_state *state) -{ - return container_of(state, struct omap_plane_state, base); -} - static int omap_plane_prepare_fb(struct drm_plane *plane, struct drm_plane_state *new_state) { @@ -223,56 +213,20 @@ void omap_plane_install_properties(struct drm_plane *plane, drm_object_attach_property(obj, priv->zorder_prop, 0); } -static struct drm_plane_state * -omap_plane_atomic_duplicate_state(struct drm_plane *plane) -{ - struct omap_plane_state *state; - struct omap_plane_state *copy; - - if (WARN_ON(!plane->state)) - return NULL; - - state = to_omap_plane_state(plane->state); - copy = kmemdup(state, sizeof(*state), GFP_KERNEL); - if (copy == NULL) - return NULL; - - __drm_atomic_helper_plane_duplicate_state(plane, ©->base); - - return ©->base; -} - -static void omap_plane_atomic_destroy_state(struct drm_plane *plane, - struct drm_plane_state *state) -{ - __drm_atomic_helper_plane_destroy_state(state); - kfree(to_omap_plane_state(state)); -} - static void omap_plane_reset(struct drm_plane *plane) { struct omap_plane *omap_plane = to_omap_plane(plane); - struct omap_plane_state *omap_state; - if (plane->state) { - omap_plane_atomic_destroy_state(plane, plane->state); - plane->state = NULL; - } - - omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL); - if (omap_state == NULL) + drm_atomic_helper_plane_reset(plane); + if (!plane->state) return; /* * Set the zpos default depending on whether we are a primary or overlay * plane. */ - omap_state->base.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY - ? 0 : omap_plane->id; - omap_state->base.rotation = DRM_MODE_ROTATE_0; - - plane->state = &omap_state->base; - plane->state->plane = plane; + plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY + ? 0 : omap_plane->id; } static int omap_plane_atomic_set_property(struct drm_plane *plane, @@ -311,8 +265,8 @@ static const struct drm_plane_funcs omap_plane_funcs = { .reset = omap_plane_reset, .destroy = omap_plane_destroy, .set_property = drm_atomic_helper_plane_set_property, - .atomic_duplicate_state = omap_plane_atomic_duplicate_state, - .atomic_destroy_state = omap_plane_atomic_destroy_state, + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .atomic_set_property = omap_plane_atomic_set_property, .atomic_get_property = omap_plane_atomic_get_property, };