diff options
author | Rob Clark <robdclark@gmail.com> | 2014-11-25 20:29:47 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-11-27 09:39:09 -0500 |
commit | 93b02beb41b06b3c43036fa600156448c51c2aaf (patch) | |
tree | 7cca2f8eb08b17617301a5f630c27effd6ea0594 | |
parent | dd275956aa176cf2ff00d5437c45f1552f1f3a11 (diff) |
drm/msm: switch to atomic-helpers iterator macros
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 9 | ||||
-rw-r--r-- | 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 6781aa994613..a7672e100d8b 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) | |||
84 | struct drm_plane *plane; | 84 | struct drm_plane *plane; |
85 | uint32_t flush = 0; | 85 | uint32_t flush = 0; |
86 | 86 | ||
87 | for_each_plane_on_crtc(crtc, plane) { | 87 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
88 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); | 88 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); |
89 | flush |= pipe2flush(pipe_id); | 89 | flush |= pipe2flush(pipe_id); |
90 | } | 90 | } |
@@ -197,7 +197,7 @@ static void setup_mixer(struct mdp4_kms *mdp4_kms) | |||
197 | struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); | 197 | struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); |
198 | struct drm_plane *plane; | 198 | struct drm_plane *plane; |
199 | 199 | ||
200 | for_each_plane_on_crtc(crtc, plane) { | 200 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
201 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); | 201 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); |
202 | int idx = idxs[pipe_id]; | 202 | int idx = idxs[pipe_id]; |
203 | mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer, | 203 | mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer, |
@@ -221,7 +221,7 @@ static void blend_setup(struct drm_crtc *crtc) | |||
221 | mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0); | 221 | mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0); |
222 | mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0); | 222 | mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0); |
223 | 223 | ||
224 | for_each_plane_on_crtc(crtc, plane) { | 224 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
225 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); | 225 | enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); |
226 | int idx = idxs[pipe_id]; | 226 | int idx = idxs[pipe_id]; |
227 | if (idx > 0) { | 227 | 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 0598bdea4ff4..0e9a2e3a82d7 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) | |||
91 | if (!mdp5_crtc->ctl) | 91 | if (!mdp5_crtc->ctl) |
92 | return; | 92 | return; |
93 | 93 | ||
94 | for_each_plane_on_crtc(crtc, plane) { | 94 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
95 | flush_mask |= mdp5_plane_get_flush(plane); | 95 | flush_mask |= mdp5_plane_get_flush(plane); |
96 | } | 96 | } |
97 | flush_mask |= mdp5_ctl_get_flush(mdp5_crtc->ctl); | 97 | 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) | |||
124 | } | 124 | } |
125 | spin_unlock_irqrestore(&dev->event_lock, flags); | 125 | spin_unlock_irqrestore(&dev->event_lock, flags); |
126 | 126 | ||
127 | for_each_plane_on_crtc(crtc, plane) | 127 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
128 | mdp5_plane_complete_flip(plane); | 128 | mdp5_plane_complete_flip(plane); |
129 | } | ||
129 | } | 130 | } |
130 | 131 | ||
131 | static void mdp5_crtc_destroy(struct drm_crtc *crtc) | 132 | static void mdp5_crtc_destroy(struct drm_crtc *crtc) |
@@ -195,7 +196,7 @@ static void blend_setup(struct drm_crtc *crtc) | |||
195 | if (!mdp5_crtc->ctl) | 196 | if (!mdp5_crtc->ctl) |
196 | goto out; | 197 | goto out; |
197 | 198 | ||
198 | for_each_plane_on_crtc(crtc, plane) { | 199 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
199 | enum mdp_mixer_stage_id stage = | 200 | enum mdp_mixer_stage_id stage = |
200 | to_mdp5_plane_state(plane->state)->stage; | 201 | to_mdp5_plane_state(plane->state)->stage; |
201 | 202 | ||
@@ -317,7 +318,7 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, | |||
317 | /* verify that there are not too many planes attached to crtc | 318 | /* verify that there are not too many planes attached to crtc |
318 | * and that we don't have conflicting mixer stages: | 319 | * and that we don't have conflicting mixer stages: |
319 | */ | 320 | */ |
320 | for_each_pending_plane_on_crtc(state->state, crtc, plane) { | 321 | drm_atomic_crtc_state_for_each_plane(plane, state) { |
321 | struct drm_plane_state *pstate; | 322 | struct drm_plane_state *pstate; |
322 | 323 | ||
323 | if (cnt >= ARRAY_SIZE(pstates)) { | 324 | if (cnt >= ARRAY_SIZE(pstates)) { |
diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 7fb4876388e7..06437745bc2c 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, | |||
65 | struct msm_kms *mdp4_kms_init(struct drm_device *dev); | 65 | struct msm_kms *mdp4_kms_init(struct drm_device *dev); |
66 | struct msm_kms *mdp5_kms_init(struct drm_device *dev); | 66 | struct msm_kms *mdp5_kms_init(struct drm_device *dev); |
67 | 67 | ||
68 | /* TODO move these helper iterator macro somewhere common: */ | ||
69 | #define for_each_plane_on_crtc(_crtc, _plane) \ | ||
70 | list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ | ||
71 | if ((_plane)->state->crtc == (_crtc)) | ||
72 | |||
73 | static inline bool | ||
74 | __plane_will_be_attached_to_crtc(struct drm_atomic_state *state, | ||
75 | struct drm_plane *plane, struct drm_crtc *crtc) | ||
76 | { | ||
77 | int idx = drm_plane_index(plane); | ||
78 | |||
79 | /* if plane is modified in incoming state, use the new state: */ | ||
80 | if (state->plane_states[idx]) | ||
81 | return state->plane_states[idx]->crtc == crtc; | ||
82 | |||
83 | /* otherwise, current state: */ | ||
84 | return plane->state->crtc == crtc; | ||
85 | } | ||
86 | |||
87 | #define for_each_pending_plane_on_crtc(_state, _crtc, _plane) \ | ||
88 | list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ | ||
89 | if (__plane_will_be_attached_to_crtc((_state), (_plane), (_crtc))) | ||
90 | |||
91 | #endif /* __MSM_KMS_H__ */ | 68 | #endif /* __MSM_KMS_H__ */ |