[PATCH 3/3] drm: Use the state pointer directly in atomic_check
Maxime Ripard
maxime at cerno.tech
Mon Nov 2 13:38:34 UTC 2020
Now that atomic_check takes the global atomic state as a parameter, we
don't need to go through the pointer in the CRTC state.
This was done using the following coccinelle script:
@ crtc_atomic_func @
identifier helpers;
identifier func;
@@
static struct drm_crtc_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
@@
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);
... when != crtc_state
- crtc_state->state
+ state
...
}
@@
struct drm_crtc_state *crtc_state;
identifier crtc_atomic_func.func;
identifier crtc, state;
@@
func(struct drm_crtc *crtc, struct drm_atomic_state *state) {
...
- crtc_state->state
+ state
...
}
Suggested-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Maxime Ripard <maxime at cerno.tech>
---
drivers/gpu/drm/drm_simple_kms_helper.c | 2 +-
drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 +-
drivers/gpu/drm/omapdrm/omap_crtc.c | 2 +-
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 +++---
drivers/gpu/drm/vc4/vc4_crtc.c | 2 +-
drivers/gpu/drm/xlnx/zynqmp_disp.c | 4 +---
6 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 4b46689634dd..743e57c1b44f 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -97,7 +97,7 @@ static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
if (has_primary != crtc_state->enable)
return -EINVAL;
- return drm_atomic_add_affected_planes(crtc_state->state, crtc);
+ return drm_atomic_add_affected_planes(state, crtc);
}
static void drm_simple_kms_crtc_enable(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index eb0e2b08329b..9040835289a8 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -281,7 +281,7 @@ static int mxsfb_crtc_atomic_check(struct drm_crtc *crtc,
return -EINVAL;
/* TODO: Is this needed ? */
- return drm_atomic_add_affected_planes(crtc_state->state, crtc);
+ return drm_atomic_add_affected_planes(state, crtc);
}
static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index d7442aa55f89..49621b2e1ab5 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -583,7 +583,7 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc,
return -EINVAL;
}
- pri_state = drm_atomic_get_new_plane_state(crtc_state->state,
+ pri_state = drm_atomic_get_new_plane_state(state,
crtc->primary);
if (pri_state) {
struct omap_crtc_state *omap_crtc_state =
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 40c59f4bd962..30213708fc99 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -665,9 +665,9 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
if (!crtc_state->active)
return 0;
- if (crtc_state->state->planes[0].ptr != crtc->primary ||
- crtc_state->state->planes[0].state == NULL ||
- crtc_state->state->planes[0].state->crtc != crtc) {
+ if (state->planes[0].ptr != crtc->primary ||
+ state->planes[0].state == NULL ||
+ state->planes[0].state->crtc != crtc) {
dev_dbg(crtc->dev->dev, "CRTC primary plane must be present");
return -EINVAL;
}
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 06088854c647..ea710beb8e00 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -597,7 +597,7 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
if (ret)
return ret;
- for_each_new_connector_in_state(crtc_state->state, conn, conn_state,
+ for_each_new_connector_in_state(state, conn, conn_state,
i) {
if (conn_state->crtc != crtc)
continue;
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 444865af9e36..c685d94409b0 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1506,9 +1506,7 @@ zynqmp_disp_crtc_atomic_disable(struct drm_crtc *crtc,
static int zynqmp_disp_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_atomic_state *state)
{
- struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
- crtc);
- return drm_atomic_add_affected_planes(crtc_state->state, crtc);
+ return drm_atomic_add_affected_planes(state, crtc);
}
static void
--
2.28.0
More information about the dri-devel
mailing list