diff options
author | Jyri Sarha <jsarha@ti.com> | 2016-06-13 09:53:36 +0300 |
---|---|---|
committer | Jyri Sarha <jsarha@ti.com> | 2016-08-08 23:04:59 +0300 |
commit | 0a1fe1b7c589a635a40d6d9b525dd99634581ea2 (patch) | |
tree | b564f2b4881db957baaadcb370baed676e312849 /drivers/gpu/drm/tilcdc | |
parent | 8c65abb9140e26d66968e6e357a00ad704705154 (diff) | |
download | op-kernel-dev-0a1fe1b7c589a635a40d6d9b525dd99634581ea2.zip op-kernel-dev-0a1fe1b7c589a635a40d6d9b525dd99634581ea2.tar.gz |
drm/tilcdc: Make tilcdc_crtc_page_flip() work if crtc is not yet on
Make tilcdc_crtc_page_flip() work if crtc is not yet on. The plane
commit sometimes comes before crtc is turned on. The new framebuffer
should be set to scanout also in that case, so that it is there when
crtc is turned on at the end of the commit phase.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 52845c8..d9d2a6c 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -174,8 +174,6 @@ int tilcdc_crtc_page_flip(struct drm_crtc *crtc, struct drm_device *dev = crtc->dev; int r; unsigned long flags; - s64 tdiff; - ktime_t next_vblank; r = tilcdc_verify_fb(crtc, fb); if (r) @@ -194,15 +192,21 @@ int tilcdc_crtc_page_flip(struct drm_crtc *crtc, spin_lock_irqsave(&tilcdc_crtc->irq_lock, flags); - next_vblank = ktime_add_us(tilcdc_crtc->last_vblank, - 1000000 / crtc->hwmode.vrefresh); + if (crtc->hwmode.vrefresh && ktime_to_ns(tilcdc_crtc->last_vblank)) { + ktime_t next_vblank; + s64 tdiff; - tdiff = ktime_to_us(ktime_sub(next_vblank, ktime_get())); + next_vblank = ktime_add_us(tilcdc_crtc->last_vblank, + 1000000 / crtc->hwmode.vrefresh); - if (tdiff >= TILCDC_VBLANK_SAFETY_THRESHOLD_US) + tdiff = ktime_to_us(ktime_sub(next_vblank, ktime_get())); + + if (tdiff < TILCDC_VBLANK_SAFETY_THRESHOLD_US) + tilcdc_crtc->next_fb = fb; + } + + if (tilcdc_crtc->next_fb != fb) set_scanout(crtc, fb); - else - tilcdc_crtc->next_fb = fb; tilcdc_crtc->event = event; @@ -248,6 +252,7 @@ void tilcdc_crtc_dpms(struct drm_crtc *crtc, int mode) } drm_flip_work_commit(&tilcdc_crtc->unref_work, priv->wq); + tilcdc_crtc->last_vblank = ktime_set(0, 0); } } |