7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jouni Högander [ Upstream commit 94cb1f08b197d9ae932ff98c741bd0dbc96e17e8 ] Selective fetch support for biplanar formats relies on linking of UV and the Y planes. Planes that are not part of the atomic state are pulled in by the drm_atomic_add_affected_planes. If the UV plane is added into the state by drm_atomic_add_affected_planes in the selective fetch calculation, the linking isn't done anymore and the Y plane is left disabled. Fix this by adding affected planes already in intel_add_affected_planes if selective fetch is enabled. Remove redundant drm_atomic_add_affected_planes from intel_psr2_sel_fetch_update and redundant check for plane selective fetch support that is not needed as all planes are already in atomic state on first loop iterating them. Also switch to intel_atomic_get_new_plane_state for linked plane new plane state. Fixes: 3809991ff5f4 ("drm/i915/display: Add initial selective fetch support for biplanar formats") Cc: # v5.17+ Signed-off-by: Jouni Högander Reviewed-by: Mika Kahola Link: https://patch.msgid.link/20260929094434.77129-3-jouni.hogander@intel.com (cherry picked from commit 0d173898b11157d37de3e5f01ef28a48582167d8) Signed-off-by: Joonas Lahtinen Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/display/intel_plane.c | 10 +++++++++ drivers/gpu/drm/i915/display/intel_psr.c | 25 +++++++--------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_plane.c b/drivers/gpu/drm/i915/display/intel_plane.c index d0e7309483234..c1c5a6128614f 100644 --- a/drivers/gpu/drm/i915/display/intel_plane.c +++ b/drivers/gpu/drm/i915/display/intel_plane.c @@ -1931,6 +1931,16 @@ static int intel_add_affected_planes(struct intel_atomic_state *state) ret = intel_joiner_add_affected_planes(state, intel_crtc_joined_pipe_mask(crtc_state)); if (ret) return ret; + + /* + * Add affected plane here to ensure UV and Y plane linking is + * in place if UV plane is added as a part of selective update. + */ + if (crtc_state->enable_psr2_sel_fetch) { + ret = intel_plane_add_affected(state, crtc); + if (ret) + return ret; + } } return 0; diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c index 15421b0a3bb0d..5522d1e0cbcc5 100644 --- a/drivers/gpu/drm/i915/display/intel_psr.c +++ b/drivers/gpu/drm/i915/display/intel_psr.c @@ -2895,7 +2895,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, .y2 = crtc_state->hw.adjusted_mode.crtc_vdisplay, }; bool full_update = false, su_area_changed; - int i, ret; + int i; /* * Selective fetch is not always usable, for instance it is dropped @@ -3010,19 +3010,15 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, intel_psr_apply_su_area_workarounds(crtc_state); - ret = drm_atomic_add_affected_planes(&state->base, &crtc->base); - if (ret) - return ret; - do { bool cursor_in_su_area = false; /* * Adjust su area to cover cursor fully as necessary - * (early transport). This needs to be done after - * drm_atomic_add_affected_planes to ensure visible - * cursor is added into affected planes even when - * cursor is not updated by itself. + * (early transport). A visible cursor is in the state + * even when it is not updated by itself as all planes + * of the pipe are added into the state before the plane + * checks when selective fetch is enabled. */ intel_psr2_sel_fetch_et_alignment(state, crtc, &display_area, &cursor_in_su_area); @@ -3073,11 +3069,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, continue; } - if (!psr2_sel_fetch_plane_state_supported(new_plane_state)) { - full_update = true; - break; - } - sel_fetch_area = &new_plane_state->psr2_sel_fetch_area; sel_fetch_area->y1 = inter.y1 - new_plane_state->uapi.dst.y1; sel_fetch_area->y2 = inter.y2 - new_plane_state->uapi.dst.y1; @@ -3091,9 +3082,9 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, struct intel_plane_state *linked_new_plane_state; struct drm_rect *linked_sel_fetch_area; - linked_new_plane_state = intel_atomic_get_plane_state(state, linked); - if (IS_ERR(linked_new_plane_state)) - return PTR_ERR(linked_new_plane_state); + linked_new_plane_state = intel_atomic_get_new_plane_state(state, linked); + if (!linked_new_plane_state) + return -EINVAL; linked_sel_fetch_area = &linked_new_plane_state->psr2_sel_fetch_area; linked_sel_fetch_area->y1 = sel_fetch_area->y1; -- 2.53.0