aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTomasz Figa <tfiga@chromium.org>2016-09-14 08:55:00 -0400
committerSean Paul <seanpaul@chromium.org>2016-09-21 09:55:52 -0400
commit41ee436700f41260663d0b201585551745b623d0 (patch)
tree790e102db23da0171181666d314c63a3ad846f07 /drivers/gpu
parent646ec68718067a3e6b029b72a9a2919178f0f201 (diff)
drm/rockchip: Always signal event in next vblank after cfg_done
This patch makes the driver send the pending vblank event in next vblank following the commit, relying on vblank signalling improvements done in previous patches. This gives us vblank events that always represent the real moment of changes hitting on the screen (which was the case only for complete FB changes before) and lets us remove the manual window update check. Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_vop.c54
1 files changed, 10 insertions, 44 deletions
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index d3237f84cbdb..1d8c942b5ce9 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -105,10 +105,6 @@ struct vop_win {
105 struct drm_plane base; 105 struct drm_plane base;
106 const struct vop_win_data *data; 106 const struct vop_win_data *data;
107 struct vop *vop; 107 struct vop *vop;
108
109 /* protected by dev->event_lock */
110 bool enable;
111 dma_addr_t yrgb_mst;
112}; 108};
113 109
114struct vop { 110struct vop {
@@ -712,11 +708,6 @@ static void vop_plane_atomic_disable(struct drm_plane *plane,
712 if (!old_state->crtc) 708 if (!old_state->crtc)
713 return; 709 return;
714 710
715 spin_lock_irq(&plane->dev->event_lock);
716 vop_win->enable = false;
717 vop_win->yrgb_mst = 0;
718 spin_unlock_irq(&plane->dev->event_lock);
719
720 spin_lock(&vop->reg_lock); 711 spin_lock(&vop->reg_lock);
721 712
722 VOP_WIN_SET(vop, win, enable, 0); 713 VOP_WIN_SET(vop, win, enable, 0);
@@ -780,11 +771,6 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
780 offset += (src->y1 >> 16) * fb->pitches[0]; 771 offset += (src->y1 >> 16) * fb->pitches[0];
781 vop_plane_state->yrgb_mst = rk_obj->dma_addr + offset + fb->offsets[0]; 772 vop_plane_state->yrgb_mst = rk_obj->dma_addr + offset + fb->offsets[0];
782 773
783 spin_lock_irq(&plane->dev->event_lock);
784 vop_win->enable = true;
785 vop_win->yrgb_mst = vop_plane_state->yrgb_mst;
786 spin_unlock_irq(&plane->dev->event_lock);
787
788 spin_lock(&vop->reg_lock); 774 spin_lock(&vop->reg_lock);
789 775
790 VOP_WIN_SET(vop, win, format, vop_plane_state->format); 776 VOP_WIN_SET(vop, win, format, vop_plane_state->format);
@@ -1108,6 +1094,16 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
1108 */ 1094 */
1109 vop_wait_for_irq_handler(vop); 1095 vop_wait_for_irq_handler(vop);
1110 1096
1097 spin_lock_irq(&crtc->dev->event_lock);
1098 if (crtc->state->event) {
1099 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
1100 WARN_ON(vop->event);
1101
1102 vop->event = crtc->state->event;
1103 crtc->state->event = NULL;
1104 }
1105 spin_unlock_irq(&crtc->dev->event_lock);
1106
1111 for_each_plane_in_state(old_state, plane, old_plane_state, i) { 1107 for_each_plane_in_state(old_state, plane, old_plane_state, i) {
1112 if (!old_plane_state->fb) 1108 if (!old_plane_state->fb)
1113 continue; 1109 continue;
@@ -1125,19 +1121,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
1125static void vop_crtc_atomic_begin(struct drm_crtc *crtc, 1121static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
1126 struct drm_crtc_state *old_crtc_state) 1122 struct drm_crtc_state *old_crtc_state)
1127{ 1123{
1128 struct vop *vop = to_vop(crtc);
1129
1130 rockchip_drm_psr_flush(crtc); 1124 rockchip_drm_psr_flush(crtc);
1131
1132 spin_lock_irq(&crtc->dev->event_lock);
1133 if (crtc->state->event) {
1134 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
1135 WARN_ON(vop->event);
1136
1137 vop->event = crtc->state->event;
1138 crtc->state->event = NULL;
1139 }
1140 spin_unlock_irq(&crtc->dev->event_lock);
1141} 1125}
1142 1126
1143static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs = { 1127static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs = {
@@ -1203,29 +1187,11 @@ static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
1203 drm_framebuffer_unreference(fb); 1187 drm_framebuffer_unreference(fb);
1204} 1188}
1205 1189
1206static bool vop_win_pending_is_complete(struct vop_win *vop_win)
1207{
1208 dma_addr_t yrgb_mst;
1209
1210 if (!vop_win->enable)
1211 return VOP_WIN_GET(vop_win->vop, vop_win->data, enable) == 0;
1212
1213 yrgb_mst = VOP_WIN_GET_YRGBADDR(vop_win->vop, vop_win->data);
1214
1215 return yrgb_mst == vop_win->yrgb_mst;
1216}
1217
1218static void vop_handle_vblank(struct vop *vop) 1190static void vop_handle_vblank(struct vop *vop)
1219{ 1191{
1220 struct drm_device *drm = vop->drm_dev; 1192 struct drm_device *drm = vop->drm_dev;
1221 struct drm_crtc *crtc = &vop->crtc; 1193 struct drm_crtc *crtc = &vop->crtc;
1222 unsigned long flags; 1194 unsigned long flags;
1223 int i;
1224
1225 for (i = 0; i < vop->data->win_size; i++) {
1226 if (!vop_win_pending_is_complete(&vop->win[i]))
1227 return;
1228 }
1229 1195
1230 spin_lock_irqsave(&drm->event_lock, flags); 1196 spin_lock_irqsave(&drm->event_lock, flags);
1231 if (vop->event) { 1197 if (vop->event) {