diff options
author | Rob Clark <robdclark@gmail.com> | 2014-11-12 11:37:12 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2014-11-16 14:27:27 -0500 |
commit | a8cecf33249b80d8a3c2ca5df1c45eb3b5231b28 (patch) | |
tree | b20cf3c0847d750b4c60e40cdf8b8fd1be348c92 | |
parent | bb6c018d3556dd683e3f16d24f2e9d60bcaed1b2 (diff) |
drm/msm/mdp5: drop attached planes table
Simplify things a bit for atomic, gets rid of some bookkeeping, and
makes the code cleaner.
Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c index 12414472d55a..b7b32c47fd71 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | |||
@@ -25,7 +25,6 @@ | |||
25 | struct mdp5_crtc { | 25 | struct mdp5_crtc { |
26 | struct drm_crtc base; | 26 | struct drm_crtc base; |
27 | char name[8]; | 27 | char name[8]; |
28 | struct drm_plane *planes[8]; | ||
29 | int id; | 28 | int id; |
30 | bool enabled; | 29 | bool enabled; |
31 | 30 | ||
@@ -77,15 +76,14 @@ static void crtc_flush(struct drm_crtc *crtc) | |||
77 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); | 76 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); |
78 | struct mdp5_kms *mdp5_kms = get_kms(crtc); | 77 | struct mdp5_kms *mdp5_kms = get_kms(crtc); |
79 | int id = mdp5_crtc->id; | 78 | int id = mdp5_crtc->id; |
80 | uint32_t i, flush = 0; | 79 | struct drm_plane *plane; |
80 | uint32_t flush = 0; | ||
81 | 81 | ||
82 | for (i = 0; i < ARRAY_SIZE(mdp5_crtc->planes); i++) { | 82 | for_each_plane_on_crtc(crtc, plane) { |
83 | struct drm_plane *plane = mdp5_crtc->planes[i]; | 83 | enum mdp5_pipe pipe = mdp5_plane_pipe(plane); |
84 | if (plane) { | 84 | flush |= pipe2flush(pipe); |
85 | enum mdp5_pipe pipe = mdp5_plane_pipe(plane); | ||
86 | flush |= pipe2flush(pipe); | ||
87 | } | ||
88 | } | 85 | } |
86 | |||
89 | flush |= mixer2flush(mdp5_crtc->id); | 87 | flush |= mixer2flush(mdp5_crtc->id); |
90 | flush |= MDP5_CTL_FLUSH_CTL; | 88 | flush |= MDP5_CTL_FLUSH_CTL; |
91 | 89 | ||
@@ -141,7 +139,8 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) | |||
141 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); | 139 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); |
142 | struct drm_device *dev = crtc->dev; | 140 | struct drm_device *dev = crtc->dev; |
143 | struct drm_pending_vblank_event *event; | 141 | struct drm_pending_vblank_event *event; |
144 | unsigned long flags, i; | 142 | struct drm_plane *plane; |
143 | unsigned long flags; | ||
145 | 144 | ||
146 | spin_lock_irqsave(&dev->event_lock, flags); | 145 | spin_lock_irqsave(&dev->event_lock, flags); |
147 | event = mdp5_crtc->event; | 146 | event = mdp5_crtc->event; |
@@ -157,11 +156,8 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) | |||
157 | } | 156 | } |
158 | spin_unlock_irqrestore(&dev->event_lock, flags); | 157 | spin_unlock_irqrestore(&dev->event_lock, flags); |
159 | 158 | ||
160 | for (i = 0; i < ARRAY_SIZE(mdp5_crtc->planes); i++) { | 159 | for_each_plane_on_crtc(crtc, plane) |
161 | struct drm_plane *plane = mdp5_crtc->planes[i]; | 160 | mdp5_plane_complete_flip(plane); |
162 | if (plane) | ||
163 | mdp5_plane_complete_flip(plane); | ||
164 | } | ||
165 | } | 161 | } |
166 | 162 | ||
167 | static void pageflip_cb(struct msm_fence_cb *cb) | 163 | static void pageflip_cb(struct msm_fence_cb *cb) |
@@ -502,12 +498,6 @@ static void set_attach(struct drm_crtc *crtc, enum mdp5_pipe pipe_id, | |||
502 | { | 498 | { |
503 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); | 499 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); |
504 | 500 | ||
505 | BUG_ON(pipe_id >= ARRAY_SIZE(mdp5_crtc->planes)); | ||
506 | |||
507 | if (mdp5_crtc->planes[pipe_id] == plane) | ||
508 | return; | ||
509 | |||
510 | mdp5_crtc->planes[pipe_id] = plane; | ||
511 | blend_setup(crtc); | 501 | blend_setup(crtc); |
512 | if (mdp5_crtc->enabled && (plane != crtc->primary)) | 502 | if (mdp5_crtc->enabled && (plane != crtc->primary)) |
513 | crtc_flush(crtc); | 503 | crtc_flush(crtc); |
@@ -554,6 +544,7 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, | |||
554 | 544 | ||
555 | drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp5_crtc_funcs); | 545 | drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp5_crtc_funcs); |
556 | drm_crtc_helper_add(crtc, &mdp5_crtc_helper_funcs); | 546 | drm_crtc_helper_add(crtc, &mdp5_crtc_helper_funcs); |
547 | plane->crtc = crtc; | ||
557 | 548 | ||
558 | mdp5_plane_install_properties(plane, &crtc->base); | 549 | mdp5_plane_install_properties(plane, &crtc->base); |
559 | 550 | ||