Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 61/70] drm/rockchip: vop: Convert to atomic_create_state
       [not found] <20260821-drm-no-more-crtc-reset-v1-0-fb793475c05a@kernel.org>
@ 2026-08-21 14:39 ` Maxime Ripard
  2026-08-27 13:32   ` Heiko Stuebner
  2026-08-21 14:39 ` [PATCH 62/70] drm/rockchip: vop2: " Maxime Ripard
  1 sibling, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2026-08-21 14:39 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: dri-devel, Maxime Ripard, Heiko Stübner, Andy Yan,
	Sandy Huang, linux-rockchip

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@kernel.org>
---
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: linux-rockchip@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


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 62/70] drm/rockchip: vop2: Convert to atomic_create_state
       [not found] <20260821-drm-no-more-crtc-reset-v1-0-fb793475c05a@kernel.org>
  2026-08-21 14:39 ` [PATCH 61/70] drm/rockchip: vop: Convert to atomic_create_state Maxime Ripard
@ 2026-08-21 14:39 ` Maxime Ripard
  2026-08-27 13:32   ` Heiko Stuebner
  1 sibling, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2026-08-21 14:39 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: dri-devel, Maxime Ripard, Heiko Stübner, Andy Yan,
	Sandy Huang, linux-rockchip

The rockchip vop2 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@kernel.org>
---
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: linux-rockchip@lists.infradead.org
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 4cce3e336f5b..b2f3a579bbe5 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -2298,28 +2298,28 @@ static void vop2_crtc_destroy_state(struct drm_crtc *crtc,
 
 	__drm_atomic_helper_crtc_destroy_state(&vcstate->base);
 	kfree(vcstate);
 }
 
-static void vop2_crtc_reset(struct drm_crtc *crtc)
+static struct drm_crtc_state *vop2_crtc_create_state(struct drm_crtc *crtc)
 {
-	struct rockchip_crtc_state *vcstate = kzalloc_obj(*vcstate);
+	struct rockchip_crtc_state *vcstate;
 
-	if (crtc->state)
-		vop2_crtc_destroy_state(crtc, crtc->state);
+	vcstate = kzalloc_obj(*vcstate);
+	if (!vcstate)
+		return ERR_PTR(-ENOMEM);
 
-	if (vcstate)
-		__drm_atomic_helper_crtc_reset(crtc, &vcstate->base);
-	else
-		__drm_atomic_helper_crtc_reset(crtc, NULL);
+	__drm_atomic_helper_crtc_state_init(&vcstate->base, crtc);
+
+	return &vcstate->base;
 }
 
 static const struct drm_crtc_funcs vop2_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
 	.destroy = drm_crtc_cleanup,
-	.reset = vop2_crtc_reset,
+	.atomic_create_state = vop2_crtc_create_state,
 	.atomic_duplicate_state = vop2_crtc_duplicate_state,
 	.atomic_destroy_state = vop2_crtc_destroy_state,
 	.enable_vblank = vop2_crtc_enable_vblank,
 	.disable_vblank = vop2_crtc_disable_vblank,
 	.late_register = vop2_crtc_late_register,

-- 
2.55.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 62/70] drm/rockchip: vop2: Convert to atomic_create_state
  2026-08-21 14:39 ` [PATCH 62/70] drm/rockchip: vop2: " Maxime Ripard
@ 2026-08-27 13:32   ` Heiko Stuebner
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Stuebner @ 2026-08-27 13:32 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Maxime Ripard
  Cc: dri-devel, Maxime Ripard, Andy Yan, Sandy Huang, linux-rockchip

Am Freitag, 21. August 2026, 16:39:38 Mitteleuropäische Sommerzeit schrieb Maxime Ripard:
> The rockchip vop2 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@kernel.org>


Reviewed-by: Heiko Stuebner <heiko@sntech.de>



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 61/70] drm/rockchip: vop: Convert to atomic_create_state
  2026-08-21 14:39 ` [PATCH 61/70] drm/rockchip: vop: Convert to atomic_create_state Maxime Ripard
@ 2026-08-27 13:32   ` Heiko Stuebner
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Stuebner @ 2026-08-27 13:32 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
	Maxime Ripard
  Cc: dri-devel, Maxime Ripard, Andy Yan, Sandy Huang, linux-rockchip

Am Freitag, 21. August 2026, 16:39:37 Mitteleuropäische Sommerzeit schrieb Maxime Ripard:
> 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@kernel.org>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-27 13:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260821-drm-no-more-crtc-reset-v1-0-fb793475c05a@kernel.org>
2026-08-21 14:39 ` [PATCH 61/70] drm/rockchip: vop: Convert to atomic_create_state Maxime Ripard
2026-08-27 13:32   ` Heiko Stuebner
2026-08-21 14:39 ` [PATCH 62/70] drm/rockchip: vop2: " Maxime Ripard
2026-08-27 13:32   ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox