Message ID | 1416965387-7042-4-git-send-email-robdclark@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Tue, Nov 25, 2014 at 08:29:47PM -0500, Rob Clark wrote: > Signed-off-by: Rob Clark <robdclark@gmail.com> Merged this and the iterator patch (I've had the planemask one already) into my fixup pile. Thanks, Daniel > --- > drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 +++--- > drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 9 +++++---- > drivers/gpu/drm/msm/msm_kms.h | 23 ----------------------- > 3 files changed, 8 insertions(+), 30 deletions(-) > > diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c > index 6781aa9..a7672e1 100644 > --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c > +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c > @@ -84,7 +84,7 @@ static void crtc_flush(struct drm_crtc *crtc) > struct drm_plane *plane; > uint32_t flush = 0; > > - for_each_plane_on_crtc(crtc, plane) { > + drm_atomic_crtc_for_each_plane(plane, crtc) { > enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); > flush |= pipe2flush(pipe_id); > } > @@ -197,7 +197,7 @@ static void setup_mixer(struct mdp4_kms *mdp4_kms) > struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); > struct drm_plane *plane; > > - for_each_plane_on_crtc(crtc, plane) { > + drm_atomic_crtc_for_each_plane(plane, crtc) { > enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); > int idx = idxs[pipe_id]; > mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer, > @@ -221,7 +221,7 @@ static void blend_setup(struct drm_crtc *crtc) > mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0); > mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0); > > - for_each_plane_on_crtc(crtc, plane) { > + drm_atomic_crtc_for_each_plane(plane, crtc) { > enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); > int idx = idxs[pipe_id]; > if (idx > 0) { > diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c > index 0598bde..0e9a2e3 100644 > --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c > +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c > @@ -91,7 +91,7 @@ static void crtc_flush_all(struct drm_crtc *crtc) > if (!mdp5_crtc->ctl) > return; > > - for_each_plane_on_crtc(crtc, plane) { > + drm_atomic_crtc_for_each_plane(plane, crtc) { > flush_mask |= mdp5_plane_get_flush(plane); > } > flush_mask |= mdp5_ctl_get_flush(mdp5_crtc->ctl); > @@ -124,8 +124,9 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) > } > spin_unlock_irqrestore(&dev->event_lock, flags); > > - for_each_plane_on_crtc(crtc, plane) > + drm_atomic_crtc_for_each_plane(plane, crtc) { > mdp5_plane_complete_flip(plane); > + } > } > > static void mdp5_crtc_destroy(struct drm_crtc *crtc) > @@ -195,7 +196,7 @@ static void blend_setup(struct drm_crtc *crtc) > if (!mdp5_crtc->ctl) > goto out; > > - for_each_plane_on_crtc(crtc, plane) { > + drm_atomic_crtc_for_each_plane(plane, crtc) { > enum mdp_mixer_stage_id stage = > to_mdp5_plane_state(plane->state)->stage; > > @@ -317,7 +318,7 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, > /* verify that there are not too many planes attached to crtc > * and that we don't have conflicting mixer stages: > */ > - for_each_pending_plane_on_crtc(state->state, crtc, plane) { > + drm_atomic_crtc_state_for_each_plane(plane, state) { > struct drm_plane_state *pstate; > > if (cnt >= ARRAY_SIZE(pstates)) { > diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h > index 7fb4876..0643774 100644 > --- a/drivers/gpu/drm/msm/msm_kms.h > +++ b/drivers/gpu/drm/msm/msm_kms.h > @@ -65,27 +65,4 @@ static inline void msm_kms_init(struct msm_kms *kms, > struct msm_kms *mdp4_kms_init(struct drm_device *dev); > struct msm_kms *mdp5_kms_init(struct drm_device *dev); > > -/* TODO move these helper iterator macro somewhere common: */ > -#define for_each_plane_on_crtc(_crtc, _plane) \ > - list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ > - if ((_plane)->state->crtc == (_crtc)) > - > -static inline bool > -__plane_will_be_attached_to_crtc(struct drm_atomic_state *state, > - struct drm_plane *plane, struct drm_crtc *crtc) > -{ > - int idx = drm_plane_index(plane); > - > - /* if plane is modified in incoming state, use the new state: */ > - if (state->plane_states[idx]) > - return state->plane_states[idx]->crtc == crtc; > - > - /* otherwise, current state: */ > - return plane->state->crtc == crtc; > -} > - > -#define for_each_pending_plane_on_crtc(_state, _crtc, _plane) \ > - list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ > - if (__plane_will_be_attached_to_crtc((_state), (_plane), (_crtc))) > - > #endif /* __MSM_KMS_H__ */ > -- > 1.9.3 >
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c index 6781aa9..a7672e1 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c @@ -84,7 +84,7 @@ static void crtc_flush(struct drm_crtc *crtc) struct drm_plane *plane; uint32_t flush = 0; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); flush |= pipe2flush(pipe_id); } @@ -197,7 +197,7 @@ static void setup_mixer(struct mdp4_kms *mdp4_kms) struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); struct drm_plane *plane; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); int idx = idxs[pipe_id]; mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer, @@ -221,7 +221,7 @@ static void blend_setup(struct drm_crtc *crtc) mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0); mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0); - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); int idx = idxs[pipe_id]; if (idx > 0) { diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c index 0598bde..0e9a2e3 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c @@ -91,7 +91,7 @@ static void crtc_flush_all(struct drm_crtc *crtc) if (!mdp5_crtc->ctl) return; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { flush_mask |= mdp5_plane_get_flush(plane); } flush_mask |= mdp5_ctl_get_flush(mdp5_crtc->ctl); @@ -124,8 +124,9 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) } spin_unlock_irqrestore(&dev->event_lock, flags); - for_each_plane_on_crtc(crtc, plane) + drm_atomic_crtc_for_each_plane(plane, crtc) { mdp5_plane_complete_flip(plane); + } } static void mdp5_crtc_destroy(struct drm_crtc *crtc) @@ -195,7 +196,7 @@ static void blend_setup(struct drm_crtc *crtc) if (!mdp5_crtc->ctl) goto out; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp_mixer_stage_id stage = to_mdp5_plane_state(plane->state)->stage; @@ -317,7 +318,7 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, /* verify that there are not too many planes attached to crtc * and that we don't have conflicting mixer stages: */ - for_each_pending_plane_on_crtc(state->state, crtc, plane) { + drm_atomic_crtc_state_for_each_plane(plane, state) { struct drm_plane_state *pstate; if (cnt >= ARRAY_SIZE(pstates)) { diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 7fb4876..0643774 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -65,27 +65,4 @@ static inline void msm_kms_init(struct msm_kms *kms, struct msm_kms *mdp4_kms_init(struct drm_device *dev); struct msm_kms *mdp5_kms_init(struct drm_device *dev); -/* TODO move these helper iterator macro somewhere common: */ -#define for_each_plane_on_crtc(_crtc, _plane) \ - list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ - if ((_plane)->state->crtc == (_crtc)) - -static inline bool -__plane_will_be_attached_to_crtc(struct drm_atomic_state *state, - struct drm_plane *plane, struct drm_crtc *crtc) -{ - int idx = drm_plane_index(plane); - - /* if plane is modified in incoming state, use the new state: */ - if (state->plane_states[idx]) - return state->plane_states[idx]->crtc == crtc; - - /* otherwise, current state: */ - return plane->state->crtc == crtc; -} - -#define for_each_pending_plane_on_crtc(_state, _crtc, _plane) \ - list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ - if (__plane_will_be_attached_to_crtc((_state), (_plane), (_crtc))) - #endif /* __MSM_KMS_H__ */
Signed-off-by: Rob Clark <robdclark@gmail.com> --- drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 +++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 9 +++++---- drivers/gpu/drm/msm/msm_kms.h | 23 ----------------------- 3 files changed, 8 insertions(+), 30 deletions(-)