[PATCH 61/70] drm/rockchip: vop: Convert to atomic_create_state
Maxime Ripard
mripard at kernel.org
Fri Aug 21 07:39:37 PDT 2026
The rockchip vop crtc implementation provides a custom reset hook.
However, this hook only allocates the state, initializes it with
__drm_atomic_helper_crtc_reset(), and frees the previous state. It
does not perform any hardware reset.
Since this is exactly what the atomic_create_state hook is meant to
do, minus the old state cleanup which the caller handles, convert the
implementation to use atomic_create_state with
__drm_atomic_helper_crtc_state_init() instead.
Signed-off-by: Maxime Ripard <mripard at kernel.org>
---
Cc: "Heiko Stübner" <heiko at sntech.de>
Cc: Andy Yan <andy.yan at rock-chips.com>
Cc: Sandy Huang <hjc at rock-chips.com>
Cc: linux-rockchip at lists.infradead.org
---
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 0090d8ff0c79..bd02597dc2d7 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1654,21 +1654,21 @@ static void vop_crtc_destroy_state(struct drm_crtc *crtc,
__drm_atomic_helper_crtc_destroy_state(&s->base);
kfree(s);
}
-static void vop_crtc_reset(struct drm_crtc *crtc)
+static struct drm_crtc_state *vop_crtc_create_state(struct drm_crtc *crtc)
{
- struct rockchip_crtc_state *crtc_state = kzalloc_obj(*crtc_state);
+ struct rockchip_crtc_state *crtc_state;
- if (crtc->state)
- vop_crtc_destroy_state(crtc, crtc->state);
+ crtc_state = kzalloc_obj(*crtc_state);
+ if (!crtc_state)
+ return ERR_PTR(-ENOMEM);
- if (crtc_state)
- __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base);
- else
- __drm_atomic_helper_crtc_reset(crtc, NULL);
+ __drm_atomic_helper_crtc_state_init(&crtc_state->base, crtc);
+
+ return &crtc_state->base;
}
#ifdef CONFIG_DRM_ANALOGIX_DP
static struct drm_connector *vop_get_edp_connector(struct vop *vop)
{
@@ -1736,11 +1736,11 @@ vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
static const struct drm_crtc_funcs vop_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.page_flip = drm_atomic_helper_page_flip,
.destroy = drm_crtc_cleanup,
- .reset = vop_crtc_reset,
+ .atomic_create_state = vop_crtc_create_state,
.atomic_duplicate_state = vop_crtc_duplicate_state,
.atomic_destroy_state = vop_crtc_destroy_state,
.enable_vblank = vop_crtc_enable_vblank,
.disable_vblank = vop_crtc_disable_vblank,
.set_crc_source = vop_crtc_set_crc_source,
--
2.55.0
More information about the Linux-rockchip
mailing list