[PATCH v7 03/15] drm/imx: dc-plane: Disable plane when it is invisible
From: Liu Ying
Date: Mon Oct 26 2026 - 06:35:20 EST
Fetch unit backing plane doesn't support invisible plane because
SOURCEBUFFERDIMENSION and FRAMEDIMENSIONS registers only accept
dimension for visible frame. Disable plane when it is invisible
to avoid wrongly programming the two registers with invisible
frame.
Fixes: 711a3b878366 ("drm/imx: Add i.MX8qxp Display Controller KMS")
Signed-off-by: Liu Ying <victor.liu@xxxxxxx>
--
v7:
- Newly introduced to fix invisible planes. (Sashiko AI bot)
---
drivers/gpu/drm/imx/dc/dc-plane.c | 54 ++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/imx/dc/dc-plane.c b/drivers/gpu/drm/imx/dc/dc-plane.c
index 62dd0576fadc..42c0a46281cb 100644
--- a/drivers/gpu/drm/imx/dc/dc-plane.c
+++ b/drivers/gpu/drm/imx/dc/dc-plane.c
@@ -126,6 +126,33 @@ dc_plane_atomic_check(struct drm_plane *plane, struct drm_atomic_commit *state)
return dc_plane_check_fb(plane_state);
}
+/* A prerequisite is that drm_dev_enter() has been called beforehand. */
+static void __dc_plane_atomic_disable(struct drm_plane *plane)
+{
+ struct dc_plane *dplane = to_dc_plane(plane);
+ const struct dc_fu_ops *fu_ops;
+
+ /* disable fetchunit in shadow */
+ fu_ops = dc_fu_get_ops(dplane->fu);
+ fu_ops->disable_src_buf(dplane->fu, DC_FETCHUNIT_FRAC0);
+
+ /* set ExtDst's source to ConstFrame */
+ dc_ed_pec_src_sel(dplane->ed, dc_cf_get_link_id(dplane->cf));
+}
+
+static void dc_plane_atomic_disable(struct drm_plane *plane,
+ struct drm_atomic_commit *state)
+{
+ int idx;
+
+ if (!drm_dev_enter(plane->dev, &idx))
+ return;
+
+ __dc_plane_atomic_disable(plane);
+
+ drm_dev_exit(idx);
+}
+
static void
dc_plane_atomic_update(struct drm_plane *plane, struct drm_atomic_commit *state)
{
@@ -143,6 +170,11 @@ dc_plane_atomic_update(struct drm_plane *plane, struct drm_atomic_commit *state)
if (!drm_dev_enter(plane->dev, &idx))
return;
+ if (!new_state->visible) {
+ __dc_plane_atomic_disable(plane);
+ goto out;
+ }
+
src_w = drm_rect_width(&new_state->src) >> 16;
src_h = drm_rect_height(&new_state->src) >> 16;
@@ -171,27 +203,7 @@ dc_plane_atomic_update(struct drm_plane *plane, struct drm_atomic_commit *state)
/* set ExtDst's source to LayerBlend */
dc_ed_pec_src_sel(dplane->ed, dc_lb_get_link_id(lb));
-
- drm_dev_exit(idx);
-}
-
-static void dc_plane_atomic_disable(struct drm_plane *plane,
- struct drm_atomic_commit *state)
-{
- struct dc_plane *dplane = to_dc_plane(plane);
- const struct dc_fu_ops *fu_ops;
- int idx;
-
- if (!drm_dev_enter(plane->dev, &idx))
- return;
-
- /* disable fetchunit in shadow */
- fu_ops = dc_fu_get_ops(dplane->fu);
- fu_ops->disable_src_buf(dplane->fu, DC_FETCHUNIT_FRAC0);
-
- /* set ExtDst's source to ConstFrame */
- dc_ed_pec_src_sel(dplane->ed, dc_cf_get_link_id(dplane->cf));
-
+out:
drm_dev_exit(idx);
}
--
2.43.0