drm/plane: Pass old state to ->atomic_update()
authorThierry Reding <treding@nvidia.com>
Tue, 25 Nov 2014 11:09:44 +0000 (12:09 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 25 Nov 2014 12:27:58 +0000 (13:27 +0100)
In most situations it will be useful to have the old state passed to the
->atomic_update() callback. For example if a plane is being disabled the
new state's .crtc field will be NULL, but some drivers may rely on this
field to program the CRTCs registers.

v2: rename variable to old_plane_state and remove redundant comment as
suggested by Daniel Vetter, remove an Exynos hunk that doesn't apply to
drm-next and add a hunk for pending MSM mdp5 changes

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_plane_helper.c
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
include/drm/drm_plane_helper.h

index d981d07d50cd0f13e8da3843a79b3d71c10a7570..2fa0840694d0df5011a8a5366c2ee58113608194 100644 (file)
@@ -1046,6 +1046,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
        for (i = 0; i < nplanes; i++) {
                struct drm_plane_helper_funcs *funcs;
                struct drm_plane *plane = old_state->planes[i];
+               struct drm_plane_state *old_plane_state;
 
                if (!plane)
                        continue;
@@ -1055,7 +1056,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,
                if (!funcs || !funcs->atomic_update)
                        continue;
 
-               funcs->atomic_update(plane);
+               old_plane_state = old_state->plane_states[i];
+
+               funcs->atomic_update(plane, old_plane_state);
        }
 
        for (i = 0; i < ncrtcs; i++) {
index 93c6533c25daf61c1d2ca3f6067a54c9af5f4bea..18a1ac6ac22f396aa55b34187b7fb89a9392613b 100644 (file)
@@ -443,7 +443,7 @@ int drm_plane_helper_commit(struct drm_plane *plane,
                        crtc_funcs[i]->atomic_begin(crtc[i]);
        }
 
-       plane_funcs->atomic_update(plane);
+       plane_funcs->atomic_update(plane, plane_state);
 
        for (i = 0; i < 2; i++) {
                if (crtc_funcs[i] && crtc_funcs[i]->atomic_flush)
index 76d0a40c71389e0770b770ea2c70158dd32fa6f4..1e5ebe83647d1aa3f86dd2c60024304932c9e11f 100644 (file)
@@ -107,7 +107,8 @@ static int mdp4_plane_atomic_check(struct drm_plane *plane,
        return 0;
 }
 
-static void mdp4_plane_atomic_update(struct drm_plane *plane)
+static void mdp4_plane_atomic_update(struct drm_plane *plane,
+                                    struct drm_plane_state *old_state)
 {
        struct drm_plane_state *state = plane->state;
        int ret;
index 533df7caa31024c97012fa94caa9219b7ba2cdb8..26e5fdea6594c7d23854bc566ffe618453c455dd 100644 (file)
@@ -213,7 +213,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
        return 0;
 }
 
-static void mdp5_plane_atomic_update(struct drm_plane *plane)
+static void mdp5_plane_atomic_update(struct drm_plane *plane,
+                                    struct drm_plane_state *old_state)
 {
        struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
        struct drm_plane_state *state = plane->state;
index c48f14d886902989fe18f5860d4bf10832a0b782..fcfa969523fb31cde022acbdc07be61bc241a817 100644 (file)
@@ -60,7 +60,8 @@ struct drm_plane_helper_funcs {
 
        int (*atomic_check)(struct drm_plane *plane,
                            struct drm_plane_state *state);
-       void (*atomic_update)(struct drm_plane *plane);
+       void (*atomic_update)(struct drm_plane *plane,
+                             struct drm_plane_state *old_state);
 };
 
 static inline void drm_plane_helper_add(struct drm_plane *plane,