[PATCH 4/8] drm/mtk: Use __drm_atomic_helper_crtc_reset

Chun-Kuang Hu chunkuang.hu at kernel.org
Tue Jun 23 12:01:58 EDT 2020


Hi, Daniel:

Daniel Vetter <daniel.vetter at ffwll.ch> 於 2020年6月13日 週六 上午12:01寫道:
>
> Now also comes with the added benefit of doing a drm_crtc_vblank_off(),
> which means vblank state isn't ill-defined and fail-y at driver load
> before the first modeset on each crtc.
>

Acked-by: Chun-Kuang Hu <chunkuang.hu at kernel.org>

> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> Cc: Chun-Kuang Hu <chunkuang.hu at kernel.org>
> Cc: Philipp Zabel <p.zabel at pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg at gmail.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-mediatek at lists.infradead.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index a7dba4ced902..d654c7d514bd 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -112,19 +112,15 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)
>  {
>         struct mtk_crtc_state *state;
>
> -       if (crtc->state) {
> +       if (crtc->state)
>                 __drm_atomic_helper_crtc_destroy_state(crtc->state);
>
> -               state = to_mtk_crtc_state(crtc->state);
> -               memset(state, 0, sizeof(*state));
> -       } else {
> -               state = kzalloc(sizeof(*state), GFP_KERNEL);
> -               if (!state)
> -                       return;
> -               crtc->state = &state->base;
> -       }
> +       kfree(to_mtk_crtc_state(crtc->state));
> +       crtc->state = NULL;
>
> -       state->base.crtc = crtc;
> +       state = kzalloc(sizeof(*state), GFP_KERNEL);
> +       if (state)
> +               __drm_atomic_helper_crtc_reset(crtc, &state->base);
>  }
>
>  static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc)
> --
> 2.26.2
>



More information about the linux-arm-kernel mailing list