sti_hqvdp_atomic_check() boots the XP70 coprocessor on the first commit
that uses the plane, which means it requests the HQVDP firmware and
writes it into the coprocessor's memories from the check hook.
.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.
The boot does not depend on anything a commit provides, and
sti_hqvdp_bind() already says it creates the plane "once xp70 is
initialized", so start it there. sti_hqvdp_start_xp70() keeps its own
xp70_initialized guard, so the caller no longer needs one.
This moves the firmware request from the first modeset to device init.
The lazy call retried on every check until it succeeded; this one runs
once, so for a built-in driver whose firmware lives in the root
filesystem the plane can now stay unusable where it used to recover on a
later modeset.
Fixes: dd86dc2f9ae1 ("drm/sti: implement atomic_check for the planes")
Signed-off-by: Minseo Park <[email protected]>
---
drivers/gpu/drm/sti/sti_hqvdp.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 360d213f2094..c6b6ed54b899 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1081,10 +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)) {
@@ -1333,6 +1329,9 @@ static int sti_hqvdp_bind(struct device *dev, struct
device *master, void *data)
hqvdp->drm_dev = drm_dev;
+ /* Start HQVDP XP70 coprocessor */
+ sti_hqvdp_start_xp70(hqvdp);
+
/* Create HQVDP plane once xp70 is initialized */
plane = sti_hqvdp_create(drm_dev, hqvdp->dev, STI_HQVDP_0);
if (!plane)
--
2.43.0