aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-08-15 04:52:50 -0400
committerDave Airlie <airlied@redhat.com>2017-08-15 22:06:02 -0400
commitefa479352fc780b305fa186cafb5f416fdf2b2cb (patch)
tree746fb290dd453b53cd881cdd9c38f72db67049c7
parent0c697fafc66830ca7d5dc19123a1d0641deaa1f6 (diff)
drm/nouveau: Fix merge commit
The most recent merge commit in airlied/drm-next has problems with confusing old_crtc_state and new_crtc_state. Use the for_each_oldnew_crtc_in_state macros to clean up the confusion, and explicitly look at the correct state instead of looking at asyh->state. With these fixes it becomes more obvious what the code is trying to do, which will hopefully prevent future confusion. Cc: Dave Airlie <airlied@redhat.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 2efcfb18024d..f7b4326a4641 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -3897,7 +3897,7 @@ static void
3897nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) 3897nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
3898{ 3898{
3899 struct drm_device *dev = state->dev; 3899 struct drm_device *dev = state->dev;
3900 struct drm_crtc_state *new_crtc_state; 3900 struct drm_crtc_state *new_crtc_state, *old_crtc_state;
3901 struct drm_crtc *crtc; 3901 struct drm_crtc *crtc;
3902 struct drm_plane_state *new_plane_state; 3902 struct drm_plane_state *new_plane_state;
3903 struct drm_plane *plane; 3903 struct drm_plane *plane;
@@ -3918,13 +3918,13 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
3918 mutex_lock(&disp->mutex); 3918 mutex_lock(&disp->mutex);
3919 3919
3920 /* Disable head(s). */ 3920 /* Disable head(s). */
3921 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 3921 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
3922 struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state); 3922 struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
3923 struct nv50_head *head = nv50_head(crtc); 3923 struct nv50_head *head = nv50_head(crtc);
3924 3924
3925 NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name, 3925 NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
3926 asyh->clr.mask, asyh->set.mask); 3926 asyh->clr.mask, asyh->set.mask);
3927 if (new_crtc_state->active && !asyh->state.active) 3927 if (old_crtc_state->active && !new_crtc_state->active)
3928 drm_crtc_vblank_off(crtc); 3928 drm_crtc_vblank_off(crtc);
3929 3929
3930 if (asyh->clr.mask) { 3930 if (asyh->clr.mask) {
@@ -4000,7 +4000,7 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
4000 } 4000 }
4001 4001
4002 /* Update head(s). */ 4002 /* Update head(s). */
4003 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 4003 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
4004 struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state); 4004 struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state);
4005 struct nv50_head *head = nv50_head(crtc); 4005 struct nv50_head *head = nv50_head(crtc);
4006 4006
@@ -4012,10 +4012,10 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
4012 interlock_core = 1; 4012 interlock_core = 1;
4013 } 4013 }
4014 4014
4015 if (asyh->state.active) { 4015 if (new_crtc_state->active) {
4016 if (!new_crtc_state->active) 4016 if (!old_crtc_state->active)
4017 drm_crtc_vblank_on(crtc); 4017 drm_crtc_vblank_on(crtc);
4018 if (asyh->state.event) 4018 if (new_crtc_state->event)
4019 drm_crtc_vblank_get(crtc); 4019 drm_crtc_vblank_get(crtc);
4020 } 4020 }
4021 } 4021 }
@@ -4064,13 +4064,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
4064 if (new_crtc_state->event) { 4064 if (new_crtc_state->event) {
4065 unsigned long flags; 4065 unsigned long flags;
4066 /* Get correct count/ts if racing with vblank irq */ 4066 /* Get correct count/ts if racing with vblank irq */
4067 if (crtc->state->active) 4067 if (new_crtc_state->active)
4068 drm_crtc_accurate_vblank_count(crtc); 4068 drm_crtc_accurate_vblank_count(crtc);
4069 spin_lock_irqsave(&crtc->dev->event_lock, flags); 4069 spin_lock_irqsave(&crtc->dev->event_lock, flags);
4070 drm_crtc_send_vblank_event(crtc, new_crtc_state->event); 4070 drm_crtc_send_vblank_event(crtc, new_crtc_state->event);
4071 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 4071 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
4072
4072 new_crtc_state->event = NULL; 4073 new_crtc_state->event = NULL;
4073 if (crtc->state->active) 4074 if (new_crtc_state->active)
4074 drm_crtc_vblank_put(crtc); 4075 drm_crtc_vblank_put(crtc);
4075 } 4076 }
4076 } 4077 }