Message ID | 1416587033-16207-1-git-send-email-thierry.reding@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Nov 21, 2014 at 05:23:49PM +0100, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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. > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > Note that I based this patch on a local tree which has Daniel's Exynos > prototype conversion, so the Exynos specific parts may not apply to > anything else. I can respin if that's a problem. > > drivers/gpu/drm/drm_atomic_helper.c | 4 +++- > drivers/gpu/drm/drm_plane_helper.c | 2 +- > drivers/gpu/drm/exynos/exynos_drm_plane.c | 3 ++- > drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 3 ++- > include/drm/drm_plane_helper.h | 3 ++- > 5 files changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 690360038dc1..d55f4d0ce990 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1011,6 +1011,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 *state = old_state->plane_states[i]; > > if (!plane) > continue; > @@ -1020,7 +1021,8 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, > if (!funcs || !funcs->atomic_update) > continue; > > - funcs->atomic_update(plane); > + /* NOTE: state is the old state here. */ Call the variable old_plane_state and remove the comment imo. Otherwise Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > + funcs->atomic_update(plane, state); > } > > for (i = 0; i < ncrtcs; i++) { > diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c > index 2dd30518f9a2..aa399db5d36d 100644 > --- a/drivers/gpu/drm/drm_plane_helper.c > +++ b/drivers/gpu/drm/drm_plane_helper.c > @@ -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) > diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c > index c218f7f5a5e5..b903937204a3 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c > @@ -311,7 +311,8 @@ static int exynos_plane_atomic_check(struct drm_plane *plane, > return 0; > } > > -static void exynos_plane_atomic_update(struct drm_plane *plane) > +static void exynos_plane_atomic_update(struct drm_plane *plane, > + struct drm_plane_state *old_state) > { > struct exynos_plane *exynos_plane = to_exynos_plane(plane); > int ret; > diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c > index 76d0a40c7138..1e5ebe83647d 100644 > --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c > +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c > @@ -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; > diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h > index 00ad3b3c5324..d3122cd0609b 100644 > --- a/include/drm/drm_plane_helper.h > +++ b/include/drm/drm_plane_helper.h > @@ -59,7 +59,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, > -- > 2.1.3 >
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 690360038dc1..d55f4d0ce990 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1011,6 +1011,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 *state = old_state->plane_states[i]; if (!plane) continue; @@ -1020,7 +1021,8 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs || !funcs->atomic_update) continue; - funcs->atomic_update(plane); + /* NOTE: state is the old state here. */ + funcs->atomic_update(plane, state); } for (i = 0; i < ncrtcs; i++) { diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 2dd30518f9a2..aa399db5d36d 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -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) diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index c218f7f5a5e5..b903937204a3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -311,7 +311,8 @@ static int exynos_plane_atomic_check(struct drm_plane *plane, return 0; } -static void exynos_plane_atomic_update(struct drm_plane *plane) +static void exynos_plane_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) { struct exynos_plane *exynos_plane = to_exynos_plane(plane); int ret; diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c index 76d0a40c7138..1e5ebe83647d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c @@ -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; diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index 00ad3b3c5324..d3122cd0609b 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h @@ -59,7 +59,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,