sti_hqvdp_atomic_check() boots the XP70 coprocessor, which loads its
firmware, then enables the main pixel clock and registers a VTG vsync
notifier.
.atomic_check() must not touch the hardware. A commit with
DRM_MODE_ATOMIC_TEST_ONLY only runs the check hooks, so a client asking
whether a configuration is possible ends up loading firmware and
enabling a clock.
Both are one-shot, guarded by hqvdp->xp70_initialized and
hqvdp->vtg_registered, so nothing leaks, but they belong in the commit
phase. Move them to .atomic_update(). As with the GDP, the failure
paths now log and return instead of rejecting the commit.
Fixes: dd86dc2f9ae1 ("drm/sti: implement atomic_check for the planes")
Signed-off-by: Minseo Park <[email protected]>
---
drivers/gpu/drm/sti/sti_hqvdp.c | 43 ++++++++++++++++-----------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 360d213f2094..66abbe4de864 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1081,28 +1081,6 @@ static int sti_hqvdp_atomic_check(struct drm_plane
*drm_plane,
return -EINVAL;
}
- if (!hqvdp->xp70_initialized)
- /* Start HQVDP XP70 coprocessor */
- sti_hqvdp_start_xp70(hqvdp);
-
- if (!hqvdp->vtg_registered) {
- /* Prevent VTG shutdown */
- if (clk_prepare_enable(hqvdp->clk_pix_main)) {
- DRM_ERROR("Failed to prepare/enable pix main clk\n");
- return -EINVAL;
- }
-
- /* Register VTG Vsync callback to handle bottom fields */
- if (sti_vtg_register_client(hqvdp->vtg,
- &hqvdp->vtg_nb,
- crtc)) {
- DRM_ERROR("Cannot register VTG notifier\n");
- clk_disable_unprepare(hqvdp->clk_pix_main);
- return -EINVAL;
- }
- hqvdp->vtg_registered = true;
- }
-
DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)),
drm_plane->base.id, sti_plane_to_str(plane));
@@ -1152,6 +1130,27 @@ static void sti_hqvdp_atomic_update(struct drm_plane
*drm_plane,
}
mode = &crtc->mode;
+
+ if (!hqvdp->xp70_initialized)
+ /* Start HQVDP XP70 coprocessor */
+ sti_hqvdp_start_xp70(hqvdp);
+
+ if (!hqvdp->vtg_registered) {
+ /* Prevent VTG shutdown */
+ if (clk_prepare_enable(hqvdp->clk_pix_main)) {
+ DRM_ERROR("Failed to prepare/enable pix main clk\n");
+ return;
+ }
+
+ /* Register VTG Vsync callback to handle bottom fields */
+ if (sti_vtg_register_client(hqvdp->vtg, &hqvdp->vtg_nb, crtc)) {
+ DRM_ERROR("Cannot register VTG notifier\n");
+ clk_disable_unprepare(hqvdp->clk_pix_main);
+ return;
+ }
+ hqvdp->vtg_registered = true;
+ }
+
dst_x = newstate->crtc_x;
dst_y = newstate->crtc_y;
dst_w = clamp_val(newstate->crtc_w, 0, mode->hdisplay - dst_x);
--
2.43.0