* [PATCH 1/2] drm/imx: ipuv3: account for active PREs in atomic check
@ 2026-07-08 21:53 Osama Abdelkader
0 siblings, 0 replies; only message in thread
From: Osama Abdelkader @ 2026-07-08 21:53 UTC (permalink / raw)
To: Philipp Zabel, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Frank Li,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Lucas Stach,
dri-devel, imx, linux-arm-kernel, linux-kernel
Cc: Osama Abdelkader, stable
ipu_planes_assign_pre() starts each atomic check with the number of
registered PRE blocks, but that value does not account for PREs that are
already used by planes outside the current atomic state.
This can happen when CRTCs are updated independently: the current commit
only adds planes from the affected CRTCs, while PREs used by other active
CRTCs are ignored. As a result, atomic check can approve more PRE users
than the hardware can provide.
Subtract already-active PRE users that are not part of the current atomic
state before assigning PREs to the planes in the commit.
Fixes: 00514e859335 ("drm/imx: use PRG/PRE when possible")
Cc: stable@vger.kernel.org
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c
index 67f2da7f2b65..d6806d1ae6e1 100644
--- a/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c
@@ -822,6 +822,19 @@ int ipu_planes_assign_pre(struct drm_device *dev,
return ret;
}
+ list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
+ if (drm_atomic_get_new_plane_state(state, plane))
+ continue;
+
+ plane_state = plane->state;
+ if (!plane_state || !plane_state->crtc || !plane_state->fb)
+ continue;
+
+ ipu_state = to_ipu_plane_state(plane_state);
+ if (ipu_state->use_pre)
+ available_pres--;
+ }
+
/*
* We are going over the planes in 2 passes: first we assign PREs to
* planes with a tiling modifier, which need the PREs to resolve into
@@ -843,7 +856,7 @@ int ipu_planes_assign_pre(struct drm_device *dev,
plane_state->fb->modifier == DRM_FORMAT_MOD_LINEAR)
continue;
- if (!ipu_prg_present(ipu_plane->ipu) || !available_pres)
+ if (!ipu_prg_present(ipu_plane->ipu) || available_pres <= 0)
return -EINVAL;
if (!ipu_prg_format_supported(ipu_plane->ipu,
@@ -871,7 +884,7 @@ int ipu_planes_assign_pre(struct drm_device *dev,
/* make sure that modifier is initialized */
plane_state->fb->modifier = DRM_FORMAT_MOD_LINEAR;
- if (ipu_prg_present(ipu_plane->ipu) && available_pres &&
+ if (ipu_prg_present(ipu_plane->ipu) && available_pres > 0 &&
ipu_prg_format_supported(ipu_plane->ipu,
plane_state->fb->format->format,
plane_state->fb->modifier)) {
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-08 21:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 21:53 [PATCH 1/2] drm/imx: ipuv3: account for active PREs in atomic check Osama Abdelkader
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox