On 2014년 12월 18일 22:58, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
> 
> The atomic helper to disable planes also uses exynos_update_plane() to
> disable plane so we had to adapt it to both commit and disable planes.
> 
> A check for NULL CRTC was added to exynos_plane_mode_set() since planes
> to be disabled have plane_state->crtc set to NULL.
> 
> Also win_disable() callback uses plane->crtc as arg for the same reason.
> 
> exynos_drm_fb_get_buf_cnt() needs a fb check too to avoid a null pointer.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c    |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 24 ++++++++++++++++++------
>  2 files changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> index d346d1e..470456d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> @@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct 
> drm_framebuffer *fb)
>  
>       exynos_fb = to_exynos_fb(fb);
>  
> -     return exynos_fb->buf_cnt;
> +     return exynos_fb ? exynos_fb->buf_cnt : 0;

This change isn't related with this patch.

>  }
>  
>  struct drm_framebuffer *
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
> b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index 1c67fbc..dfca218 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -98,6 +98,9 @@ static void exynos_plane_mode_set(struct drm_plane *plane, 
> struct drm_crtc *crtc
>       unsigned int actual_w;
>       unsigned int actual_h;
>  
> +     if (!crtc)
> +             return;

Ditto.

> +
>       actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
>       actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->mode.vdisplay);
>  
> @@ -140,8 +143,6 @@ static void exynos_plane_mode_set(struct drm_plane 
> *plane, struct drm_crtc *crtc
>                       exynos_plane->crtc_x, exynos_plane->crtc_y,
>                       exynos_plane->crtc_width, exynos_plane->crtc_height);
>  
> -     plane->crtc = crtc;
> -
>       if (exynos_crtc->ops->win_mode_set)
>               exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane);
>  }
> @@ -179,15 +180,26 @@ exynos_update_plane(struct drm_plane *plane, struct 
> drm_crtc *crtc,
>                    uint32_t src_x, uint32_t src_y,
>                    uint32_t src_w, uint32_t src_h)
>  {
> -     struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
>       struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
> +     struct exynos_drm_crtc *exynos_crtc;
>  
>       exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
>                             crtc_w, crtc_h, src_x >> 16, src_y >> 16,
>                             src_w >> 16, src_h >> 16);
>  
> -     if (exynos_crtc->ops->win_commit)
> -             exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
> +     if (fb) {
> +             exynos_crtc = to_exynos_crtc(crtc);
> +             if (exynos_crtc->ops->win_commit)
> +                     exynos_crtc->ops->win_commit(exynos_crtc,
> +                                                  exynos_plane->zpos);
> +     } else {
> +             exynos_crtc = to_exynos_crtc(plane->crtc);
> +             if (exynos_crtc->ops->win_disable)
> +                     exynos_crtc->ops->win_disable(exynos_crtc,
> +                                                   exynos_plane->zpos);
> +     }
> +
> +     plane->crtc = crtc;
>  }
>  
>  static int exynos_disable_plane(struct drm_plane *plane)
> @@ -224,7 +236,7 @@ static int exynos_plane_set_property(struct drm_plane 
> *plane,
>  
>  static struct drm_plane_funcs exynos_plane_funcs = {
>       .update_plane   = drm_plane_helper_update,
> -     .disable_plane  = exynos_disable_plane,
> +     .disable_plane  = drm_plane_helper_disable,
>       .destroy        = exynos_plane_destroy,
>       .set_property   = exynos_plane_set_property,
>  };
> 

Reply via email to