[PATCH 09/11] drm/imx: page flip fixes

Dave Airlie airlied at gmail.com
Tue May 21 16:18:26 PDT 2013


Hi Sascha,

please review and apply if still applicable, I've already applied the
imx use drm_send_vblank_event to my drm-fixes tree.

Dave.

On Tue, Oct 9, 2012 at 5:50 AM, Rob Clark <rob.clark at linaro.org> wrote:
> From: Rob Clark <rob at ti.com>
>
> The 'event' could be null, so don't list_del(&event->base.link)..  and
> in fact even if it wasn't null there is no reason to do this.
>
> Also, this looks racy with the irq handler, so throw in a spinlock for
> good measure.
>
> Signed-off-by: Rob Clark <rob at ti.com>
> ---
>  drivers/staging/imx-drm/ipuv3-crtc.c |   11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
> index 8fa0f4d..6745766 100644
> --- a/drivers/staging/imx-drm/ipuv3-crtc.c
> +++ b/drivers/staging/imx-drm/ipuv3-crtc.c
> @@ -135,23 +135,26 @@ static int ipu_page_flip(struct drm_crtc *crtc,
>                 struct drm_pending_vblank_event *event)
>  {
>         struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
> +       struct drm_device *drm = ipu_crtc->base.dev;
> +       unsigned long flags;
>         int ret;
>
>         if (ipu_crtc->newfb)
>                 return -EBUSY;
>
> +       spin_lock_irqsave(&drm->event_lock, flags);
>         ret = imx_drm_crtc_vblank_get(ipu_crtc->imx_crtc);
>         if (ret) {
>                 dev_dbg(ipu_crtc->dev, "failed to acquire vblank counter\n");
> -               list_del(&event->base.link);
> -
> -               return ret;
> +               goto out;
>         }
>
>         ipu_crtc->newfb = fb;
>         ipu_crtc->page_flip_event = event;
>
> -       return 0;
> +out:
> +       spin_unlock_irqrestore(&drm->event_lock, flags);
> +       return ret;
>  }
>
>  static const struct drm_crtc_funcs ipu_crtc_funcs = {
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list