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" <[email protected]>
> > Cc: Liviu Dudau <[email protected]>
> > Cc: Mihail Atanassov <[email protected]>
> > Cc: Brian Starkey <[email protected]>
> > Cc: Russell King <[email protected]>
> > Cc: Paul Cercueil <[email protected]>
> > Cc: Chun-Kuang Hu <[email protected]>
> > Cc: Philipp Zabel <[email protected]>
> > Cc: Sandy Huang <[email protected]>
> > Cc: "Heiko Stübner" <[email protected]>
> > Cc: Thierry Reding <[email protected]>
> > Cc: Gerd Hoffmann <[email protected]>
> > Reviewed-by: Ville Syrjälä <[email protected]>
> > Suggested-by: Ville Syrjälä <[email protected]>
> > Signed-off-by: Maxime Ripard <[email protected]>
> Acked-by: Thomas Zimmermann <[email protected]>Applied, thanks! Maxime
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
