From mboxrd@z Thu Jan 1 00:00:00 1970 From: Inki Dae Subject: Re: [PATCH] drm/exynos: wait for the completion of pending page flip Date: Wed, 22 May 2013 13:22:05 +0900 Message-ID: References: <1369123698-19503-1-git-send-email-inki.dae@samsung.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2042477413==" Return-path: Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by gabe.freedesktop.org (Postfix) with ESMTP id C9A91E5C64 for ; Tue, 21 May 2013 21:29:31 -0700 (PDT) Received: by mail-wi0-f169.google.com with SMTP id hn14so3702478wib.4 for ; Tue, 21 May 2013 21:29:31 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: =?ISO-8859-1?Q?St=E9phane_Marchesin?= Cc: Kyungmin Park , Seung-Woo Kim , DRI mailing list List-Id: dri-devel@lists.freedesktop.org --===============2042477413== Content-Type: multipart/alternative; boundary=001a11c26ac68e44cf04dd46e8c6 --001a11c26ac68e44cf04dd46e8c6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2013/5/22 St=E9phane Marchesin > On Tue, May 21, 2013 at 1:08 AM, Inki Dae wrote: > > This patch fixes the issue that drm_vblank_get() is failed. > > > > The issus occurs when next page flip request is tried > > if previous page flip event wasn't completed yet and then > > dpms became off. > > > > So this patch make sure that page flip event is completed > > before dpms goes to off. > > Hi, > > This patch is a squash of the two following patches from the Chrome OS > tree with the KDS bits removed and the dpms off bit added: > > > http://git.chromium.org/gitweb/?p=3Dchromiumos/third_party/kernel-next.gi= t;a=3Dcommitdiff;h=3D2e77cd4e423967862ca01b1af82aa8b5b7429fc4;hp=3Daba002da= 4c6e5efec4d43e1ce33930a79269349a > > http://git.chromium.org/gitweb/?p=3Dchromiumos/third_party/kernel-next.gi= t;a=3Dcommitdiff;h=3Db4ec8bfa750ef43a43c2da746c8afdbb51002882;hp=3D4f28b9a7= 5c928f229443d7c6c3163159ceb6903a > > Please keep proper attribution. > > 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() > > Signed-off-by: Inki Dae > Signed-off-by: Kyungmin Park > --- > drivers/gpu/drm/exynos/exynos_drm_crtc.c | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c > index e8894bc..69a77e9 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c > @@ -48,6 +48,8 @@ struct exynos_drm_crtc { > unsigned int pipe; > unsigned int dpms; > enum exynos_crtc_mode mode; > + wait_queue_head_t pending_flip_queue; > + atomic_t pending_flip; > }; > > static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) > @@ -61,6 +63,13 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) > return; > } > > + if (mode > DRM_MODE_DPMS_ON) { > + /* wait for the completion of page flip. */ > + wait_event(exynos_crtc->pending_flip_queue, > + atomic_read(&exynos_crtc->pending_flip) =3D=3D 0); > + drm_vblank_off(crtc->dev, exynos_crtc->pipe); You should be using vblank_put/get. > > 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. Thanks, Inki Dae St=E9phane > > > + } > > + > > exynos_drm_fn_encoder(crtc, &mode, exynos_drm_encoder_crtc_dpms= ); > > exynos_crtc->dpms =3D mode; > > } > > @@ -225,6 +234,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crt= c > *crtc, > > spin_lock_irq(&dev->event_lock); > > list_add_tail(&event->base.link, > > &dev_priv->pageflip_event_list); > > + atomic_set(&exynos_crtc->pending_flip, 1); > > spin_unlock_irq(&dev->event_lock); > > > > crtc->fb =3D fb; > > @@ -344,6 +354,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, > unsigned int nr) > > > > exynos_crtc->pipe =3D nr; > > exynos_crtc->dpms =3D DRM_MODE_DPMS_OFF; > > + init_waitqueue_head(&exynos_crtc->pending_flip_queue); > > + atomic_set(&exynos_crtc->pending_flip, 0); > > exynos_crtc->plane =3D exynos_plane_init(dev, 1 << nr, true); > > if (!exynos_crtc->plane) { > > kfree(exynos_crtc); > > @@ -398,6 +410,8 @@ void exynos_drm_crtc_finish_pageflip(struct > drm_device *dev, int crtc) > > { > > struct exynos_drm_private *dev_priv =3D dev->dev_private; > > struct drm_pending_vblank_event *e, *t; > > + struct drm_crtc *drm_crtc =3D dev_priv->crtc[crtc]; > > + struct exynos_drm_crtc *exynos_crtc =3D to_exynos_crtc(drm_crtc= ); > > struct timeval now; > > unsigned long flags; > > > > @@ -419,6 +433,8 @@ void exynos_drm_crtc_finish_pageflip(struct > drm_device *dev, int crtc) > > list_move_tail(&e->base.link, > &e->base.file_priv->event_list); > > wake_up_interruptible(&e->base.file_priv->event_wait); > > drm_vblank_put(dev, crtc); > > + atomic_set(&exynos_crtc->pending_flip, 0); > > + wake_up(&exynos_crtc->pending_flip_queue); > > } > > > > spin_unlock_irqrestore(&dev->event_lock, flags); > > -- > > 1.7.5.4 > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/dri-devel > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel > --001a11c26ac68e44cf04dd46e8c6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



2013/5/22 St=E9phane Marchesin <stephane.marchesin@gmai= l.com>
On Tue,= May 21, 2013 at 1:08 AM, Inki Dae <inki.dae@samsung.com> wrote:
> This patch fixes the issue that drm_vblank_get() is failed.
>
> The issus occurs when next page flip request is tried
> if previous page flip event wasn't completed yet and then
> dpms became off.
>
> So this patch make sure that page flip event is completed
> before dpms goes to off.

Hi,

This patch is a squash of the two following patches from the Chrome OS
tree with the KDS bits removed and the dpms off bit added:

http://git.c= hromium.org/gitweb/?p=3Dchromiumos/third_party/kernel-next.git;a=3Dcommitdi= ff;h=3D2e77cd4e423967862ca01b1af82aa8b5b7429fc4;hp=3Daba002da4c6e5efec4d43e= 1ce33930a79269349a
http://git.c= hromium.org/gitweb/?p=3Dchromiumos/third_party/kernel-next.git;a=3Dcommitdi= ff;h=3Db4ec8bfa750ef43a43c2da746c8afdbb51002882;hp=3D4f28b9a75c928f229443d7= c6c3163159ceb6903a

Please keep proper attribution.


Those patches = are just for Chrome OS. Please post them if you want for those to be consid= ered so that they can be reviewed. That is why we attend open source. One m= ore comment, please do not abuse exynos_drm_crtc_page_flip()
=A0
>
> Signed-off-by: Inki Dae <in= ki.dae@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> =A0drivers/gpu/drm/exynos/exynos_drm_crtc.c | =A0 16 ++++++++++++++++<= br> > =A01 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/dr= m/exynos/exynos_drm_crtc.c
> index e8894bc..69a77e9 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -48,6 +48,8 @@ struct exynos_drm_crtc {
> =A0 =A0 =A0 =A0 unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pi= pe;
> =A0 =A0 =A0 =A0 unsigned int =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dp= ms;
> =A0 =A0 =A0 =A0 enum exynos_crtc_mode =A0 =A0 =A0 =A0 =A0 mode;
> + =A0 =A0 =A0 wait_queue_head_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 pending_fl= ip_queue;
> + =A0 =A0 =A0 atomic_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= pending_flip;
> =A0};
>
> =A0static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) > @@ -61,6 +63,13 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *c= rtc, int mode)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> =A0 =A0 =A0 =A0 }
>
> + =A0 =A0 =A0 if (mode > DRM_MODE_DPMS_ON) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* wait for the completion of page flip.= */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 wait_event(exynos_crtc->pending_flip_= queue,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 atomic_r= ead(&exynos_crtc->pending_flip) =3D=3D 0);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 drm_vblank_off(crtc->dev, exynos_crtc= ->pipe);

You should be using= vblank_put/get.


No, drm_vblank_put should be called by exynos_drm_crtc_fin= ish_pageflip(). And know that this patch makes sure that pended page flip e= vent is completed before dpms goes to off.

Thanks,
Inki Dae
<= font color=3D"#888888"> St=E9phane

> + =A0 =A0 =A0 }
> +
> =A0 =A0 =A0 =A0 exynos_drm_fn_encoder(crtc, &mode, exynos_drm_enco= der_crtc_dpms);
> =A0 =A0 =A0 =A0 exynos_crtc->dpms =3D mode;
> =A0}
> @@ -225,6 +234,7 @@ static int exynos_drm_crtc_page_flip(struct drm_cr= tc *crtc,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_lock_irq(&dev->event_lock)= ;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 list_add_tail(&event->base.link= ,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &d= ev_priv->pageflip_event_list);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 atomic_set(&exynos_crtc->pending_= flip, 1);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_unlock_irq(&dev->event_loc= k);
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 crtc->fb =3D fb;
> @@ -344,6 +354,8 @@ int exynos_drm_crtc_create(struct drm_device *dev,= unsigned int nr)
>
> =A0 =A0 =A0 =A0 exynos_crtc->pipe =3D nr;
> =A0 =A0 =A0 =A0 exynos_crtc->dpms =3D DRM_MODE_DPMS_OFF;
> + =A0 =A0 =A0 init_waitqueue_head(&exynos_crtc->pending_flip_qu= eue);
> + =A0 =A0 =A0 atomic_set(&exynos_crtc->pending_flip, 0);
> =A0 =A0 =A0 =A0 exynos_crtc->plane =3D exynos_plane_init(dev, 1 <= ;< nr, true);
> =A0 =A0 =A0 =A0 if (!exynos_crtc->plane) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 kfree(exynos_crtc);
> @@ -398,6 +410,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_de= vice *dev, int crtc)
> =A0{
> =A0 =A0 =A0 =A0 struct exynos_drm_private *dev_priv =3D dev->dev_pr= ivate;
> =A0 =A0 =A0 =A0 struct drm_pending_vblank_event *e, *t;
> + =A0 =A0 =A0 struct drm_crtc *drm_crtc =3D dev_priv->crtc[crtc]; > + =A0 =A0 =A0 struct exynos_drm_crtc *exynos_crtc =3D to_exynos_crtc(d= rm_crtc);
> =A0 =A0 =A0 =A0 struct timeval now;
> =A0 =A0 =A0 =A0 unsigned long flags;
>
> @@ -419,6 +433,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_de= vice *dev, int crtc)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 list_move_tail(&e->base.link, &= amp;e->base.file_priv->event_list);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 wake_up_interruptible(&e->base.= file_priv->event_wait);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 drm_vblank_put(dev, crtc);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 atomic_set(&exynos_crtc->pending_= flip, 0);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 wake_up(&exynos_crtc->pending_fli= p_queue);
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 spin_unlock_irqrestore(&dev->event_lock, flags)= ;
> --
> 1.7.5.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.fre= edesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel=
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesk= top.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--001a11c26ac68e44cf04dd46e8c6-- --===============2042477413== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============2042477413==--