On Thu, Nov 05, 2020 at 08:07:57PM +0100, Thomas Zimmermann wrote: > Hi > > Am 05.11.20 um 17:45 schrieb Maxime Ripard: > > Many drivers reference the crtc->pointer in order to get the current CRTC > > state in their atomic_begin or atomic_flush hooks, which would be the new > > CRTC state in the global atomic state since _swap_state happened when those > > hooks are run. > > > > Use the drm_atomic_get_new_crtc_state helper to get that state to make it > > more obvious. > > > > This was made using the coccinelle script below: > > > > @ crtc_atomic_func @ > > identifier helpers; > > identifier func; > > @@ > > > > ( > > static struct drm_crtc_helper_funcs helpers = { > > ..., > > .atomic_begin = func, > > ..., > > }; > > | > > static struct drm_crtc_helper_funcs helpers = { > > ..., > > .atomic_flush = func, > > ..., > > }; > > ) > > > > @@ > > identifier crtc_atomic_func.func; > > identifier crtc, state; > > symbol crtc_state; > > expression e; > > @@ > > > > func(struct drm_crtc *crtc, struct drm_atomic_state *state) { > > ... > > - struct tegra_dc_state *crtc_state = e; > > + struct tegra_dc_state *dc_state = e; > > <+... > > - crtc_state > > + dc_state > > ...+> > > } > > > > @@ > > identifier crtc_atomic_func.func; > > identifier crtc, state; > > symbol crtc_state; > > expression e; > > @@ > > > > func(struct drm_crtc *crtc, struct drm_atomic_state *state) { > > ... > > - struct mtk_crtc_state *crtc_state = e; > > + struct mtk_crtc_state *mtk_crtc_state = e; > > <+... > > - crtc_state > > + mtk_crtc_state > > ...+> > > } > > > > @ replaces_new_state @ > > identifier crtc_atomic_func.func; > > identifier crtc, state, crtc_state; > > @@ > > > > func(struct drm_crtc *crtc, struct drm_atomic_state *state) { > > ... > > - struct drm_crtc_state *crtc_state = crtc->state; > > + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, > > crtc); > > ... > > } > > > > @@ > > identifier crtc_atomic_func.func; > > identifier crtc, state, crtc_state; > > @@ > > > > func(struct drm_crtc *crtc, struct drm_atomic_state *state) { > > struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, > > crtc); > > ... > > - crtc->state > > + crtc_state > > ... > > } > > > > @ adds_new_state @ > > identifier crtc_atomic_func.func; > > identifier crtc, state; > > @@ > > > > func(struct drm_crtc *crtc, struct drm_atomic_state *state) { > > + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, > > crtc); > > ... > > - crtc->state > > + crtc_state > > ... > > } > > > > @ include depends on adds_new_state || replaces_new_state @ > > @@ > > > > #include <drm/drm_atomic.h> > > > > @ no_include depends on !include && (adds_new_state || replaces_new_state) @ > > @@ > > > > + #include <drm/drm_atomic.h> > > #include <drm/...> > > > > Cc: "James (Qian) Wang" <james.qian.w...@arm.com> > > Cc: Liviu Dudau <liviu.du...@arm.com> > > Cc: Mihail Atanassov <mihail.atanas...@arm.com> > > Cc: Brian Starkey <brian.star...@arm.com> > > Cc: Russell King <li...@armlinux.org.uk> > > Cc: Paul Cercueil <p...@crapouillou.net> > > Cc: Chun-Kuang Hu <chunkuang...@kernel.org> > > Cc: Philipp Zabel <p.za...@pengutronix.de> > > Cc: Sandy Huang <h...@rock-chips.com> > > Cc: "Heiko Stübner" <he...@sntech.de> > > Cc: Thierry Reding <thierry.red...@gmail.com> > > Cc: Gerd Hoffmann <kra...@redhat.com> > > Reviewed-by: Ville Syrjälä <ville.syrj...@linux.intel.com> > > Suggested-by: Ville Syrjälä <ville.syrj...@linux.intel.com> > > Signed-off-by: Maxime Ripard <max...@cerno.tech> > Acked-by: Thomas Zimmermann <tzimmerm...@suse.de>
Applied, thanks! Maxime
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel