<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/22 Stéphane Marchesin <span dir="ltr"><<a href="mailto:stephane.marchesin@gmail.com" target="_blank">stephane.marchesin@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On Tue, May 21, 2013 at 1:08 AM, Inki Dae <<a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a>> wrote:<br>
> This patch fixes the issue that drm_vblank_get() is failed.<br>
><br>
> The issus occurs when next page flip request is tried<br>
> if previous page flip event wasn't completed yet and then<br>
> dpms became off.<br>
><br>
> So this patch make sure that page flip event is completed<br>
> before dpms goes to off.<br>
<br>
</div>Hi,<br>
<br>
This patch is a squash of the two following patches from the Chrome OS<br>
tree with the KDS bits removed and the dpms off bit added:<br>
<br>
<a href="http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel-next.git;a=commitdiff;h=2e77cd4e423967862ca01b1af82aa8b5b7429fc4;hp=aba002da4c6e5efec4d43e1ce33930a79269349a" target="_blank">http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel-next.git;a=commitdiff;h=2e77cd4e423967862ca01b1af82aa8b5b7429fc4;hp=aba002da4c6e5efec4d43e1ce33930a79269349a</a><br>
<a href="http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel-next.git;a=commitdiff;h=b4ec8bfa750ef43a43c2da746c8afdbb51002882;hp=4f28b9a75c928f229443d7c6c3163159ceb6903a" target="_blank">http://git.chromium.org/gitweb/?p=chromiumos/third_party/kernel-next.git;a=commitdiff;h=b4ec8bfa750ef43a43c2da746c8afdbb51002882;hp=4f28b9a75c928f229443d7c6c3163159ceb6903a</a><br>
<br>
Please keep proper attribution.<br>
<div class="im"><br></div></blockquote><div><br></div><div>Those patches are just for Chrome OS. Please post them if you want for those to be considered so that they can be reviewed. That is why we attend open source. One more comment, please do not abuse exynos_drm_crtc_page_flip()<br>
</div><div class="im"> <br>><br>
> Signed-off-by: Inki Dae <<a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a>><br>
> Signed-off-by: Kyungmin Park <<a href="mailto:kyungmin.park@samsung.com">kyungmin.park@samsung.com</a>><br>
> ---<br>
> drivers/gpu/drm/exynos/exynos_drm_crtc.c | 16 ++++++++++++++++<br>
> 1 files changed, 16 insertions(+), 0 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c<br>
> index e8894bc..69a77e9 100644<br>
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c<br>
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c<br>
> @@ -48,6 +48,8 @@ struct exynos_drm_crtc {<br>
> unsigned int pipe;<br>
> unsigned int dpms;<br>
> enum exynos_crtc_mode mode;<br>
> + wait_queue_head_t pending_flip_queue;<br>
> + atomic_t pending_flip;<br>
> };<br>
><br>
> static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)<br>
> @@ -61,6 +63,13 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)<br>
> return;<br>
> }<br>
><br>
> + if (mode > DRM_MODE_DPMS_ON) {<br>
> + /* wait for the completion of page flip. */<br>
> + wait_event(exynos_crtc->pending_flip_queue,<br>
> + atomic_read(&exynos_crtc->pending_flip) == 0);<br>
> + drm_vblank_off(crtc->dev, exynos_crtc->pipe);<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You should be using vblank_put/get.<br>
<span class=""><font color="#888888"><br></font></span></blockquote><div><br></div><div>No, drm_vblank_put should be called by exynos_drm_crtc_finish_pageflip(). And know that this patch makes sure that pended page flip event is completed before dpms goes to off.<br>
</div><div><br></div><div>Thanks,<br></div><div>Inki Dae <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><font color="#888888">
Stéphane<br>
</font></span><div class=""><div class="h5"><br>
> + }<br>
> +<br>
> exynos_drm_fn_encoder(crtc, &mode, exynos_drm_encoder_crtc_dpms);<br>
> exynos_crtc->dpms = mode;<br>
> }<br>
> @@ -225,6 +234,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,<br>
> spin_lock_irq(&dev->event_lock);<br>
> list_add_tail(&event->base.link,<br>
> &dev_priv->pageflip_event_list);<br>
> + atomic_set(&exynos_crtc->pending_flip, 1);<br>
> spin_unlock_irq(&dev->event_lock);<br>
><br>
> crtc->fb = fb;<br>
> @@ -344,6 +354,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)<br>
><br>
> exynos_crtc->pipe = nr;<br>
> exynos_crtc->dpms = DRM_MODE_DPMS_OFF;<br>
> + init_waitqueue_head(&exynos_crtc->pending_flip_queue);<br>
> + atomic_set(&exynos_crtc->pending_flip, 0);<br>
> exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true);<br>
> if (!exynos_crtc->plane) {<br>
> kfree(exynos_crtc);<br>
> @@ -398,6 +410,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc)<br>
> {<br>
> struct exynos_drm_private *dev_priv = dev->dev_private;<br>
> struct drm_pending_vblank_event *e, *t;<br>
> + struct drm_crtc *drm_crtc = dev_priv->crtc[crtc];<br>
> + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(drm_crtc);<br>
> struct timeval now;<br>
> unsigned long flags;<br>
><br>
> @@ -419,6 +433,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc)<br>
> list_move_tail(&e->base.link, &e->base.file_priv->event_list);<br>
> wake_up_interruptible(&e->base.file_priv->event_wait);<br>
> drm_vblank_put(dev, crtc);<br>
> + atomic_set(&exynos_crtc->pending_flip, 0);<br>
> + wake_up(&exynos_crtc->pending_flip_queue);<br>
> }<br>
><br>
> spin_unlock_irqrestore(&dev->event_lock, flags);<br>
> --<br>
> 1.7.5.4<br>
><br>
> _______________________________________________<br>
> dri-devel mailing list<br>
> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</div></div></blockquote></div><br></div></div>