drm/imx: ipuv3: account for active PREs in atomic check
Subsystems (5)
PATCH 1/2 drm/imx: ipuv3: account for active PREs in atomic check
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")
Signed-off-by Osama Abdelkader <[email protected]>
--- drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/ipuv3/ipuv3-plane.c +15 -2
@@ -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)) {
Signature · 1 line
2.43.0