Hi, Daniel: Daniel Vetter <daniel.vetter@xxxxxxxx> 於 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@xxxxxxxxxx> > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx> > Cc: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx> > Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> > Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx > Cc: linux-mediatek@xxxxxxxxxxxxxxxxxxx > --- > 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 > _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel