Skip to content

Commit 1be2fca

Browse files
hogandertursulin
authored andcommitted
drm/i915/psr: Repeat Selective Update area alignment
Currently we are aligning Selective Update area to cover cursor fully if needed only once. It may happen that cursor is in Selective Update area after pipe alignment and after that covering cursor plane only partially. Fix this by looping alignment as long as alignment isn't needed anymore. v2: - do not unecessarily loop if cursor was already fully covered - rename aligned as su_area_changed Fixes: 1bff93b ("drm/i915/psr: Extend SU area to cover cursor fully if needed") Cc: <stable@vger.kernel.org> # v6.9+ Signed-off-by: Jouni Högander <jouni.hogander@intel.com> Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Link: https://patch.msgid.link/20260304113011.626542-2-jouni.hogander@intel.com (cherry picked from commit 681e124) Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
1 parent 029ae06 commit 1be2fca

1 file changed

Lines changed: 38 additions & 12 deletions

File tree

drivers/gpu/drm/i915/display/intel_psr.c

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,11 +2689,12 @@ static void clip_area_update(struct drm_rect *overlap_damage_area,
26892689
overlap_damage_area->y2 = damage_area->y2;
26902690
}
26912691

2692-
static void intel_psr2_sel_fetch_pipe_alignment(struct intel_crtc_state *crtc_state)
2692+
static bool intel_psr2_sel_fetch_pipe_alignment(struct intel_crtc_state *crtc_state)
26932693
{
26942694
struct intel_display *display = to_intel_display(crtc_state);
26952695
const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config;
26962696
u16 y_alignment;
2697+
bool su_area_changed = false;
26972698

26982699
/* ADLP aligns the SU region to vdsc slice height in case dsc is enabled */
26992700
if (crtc_state->dsc.compression_enable &&
@@ -2702,10 +2703,18 @@ static void intel_psr2_sel_fetch_pipe_alignment(struct intel_crtc_state *crtc_st
27022703
else
27032704
y_alignment = crtc_state->su_y_granularity;
27042705

2705-
crtc_state->psr2_su_area.y1 -= crtc_state->psr2_su_area.y1 % y_alignment;
2706-
if (crtc_state->psr2_su_area.y2 % y_alignment)
2706+
if (crtc_state->psr2_su_area.y1 % y_alignment) {
2707+
crtc_state->psr2_su_area.y1 -= crtc_state->psr2_su_area.y1 % y_alignment;
2708+
su_area_changed = true;
2709+
}
2710+
2711+
if (crtc_state->psr2_su_area.y2 % y_alignment) {
27072712
crtc_state->psr2_su_area.y2 = ((crtc_state->psr2_su_area.y2 /
27082713
y_alignment) + 1) * y_alignment;
2714+
su_area_changed = true;
2715+
}
2716+
2717+
return su_area_changed;
27092718
}
27102719

27112720
/*
@@ -2839,7 +2848,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
28392848
struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
28402849
struct intel_plane_state *new_plane_state, *old_plane_state;
28412850
struct intel_plane *plane;
2842-
bool full_update = false, cursor_in_su_area = false;
2851+
bool full_update = false, su_area_changed;
28432852
int i, ret;
28442853

28452854
if (!crtc_state->enable_psr2_sel_fetch)
@@ -2946,15 +2955,32 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
29462955
if (ret)
29472956
return ret;
29482957

2949-
/*
2950-
* Adjust su area to cover cursor fully as necessary (early
2951-
* transport). This needs to be done after
2952-
* drm_atomic_add_affected_planes to ensure visible cursor is added into
2953-
* affected planes even when cursor is not updated by itself.
2954-
*/
2955-
intel_psr2_sel_fetch_et_alignment(state, crtc, &cursor_in_su_area);
2958+
do {
2959+
bool cursor_in_su_area;
29562960

2957-
intel_psr2_sel_fetch_pipe_alignment(crtc_state);
2961+
/*
2962+
* Adjust su area to cover cursor fully as necessary
2963+
* (early transport). This needs to be done after
2964+
* drm_atomic_add_affected_planes to ensure visible
2965+
* cursor is added into affected planes even when
2966+
* cursor is not updated by itself.
2967+
*/
2968+
intel_psr2_sel_fetch_et_alignment(state, crtc, &cursor_in_su_area);
2969+
2970+
su_area_changed = intel_psr2_sel_fetch_pipe_alignment(crtc_state);
2971+
2972+
/*
2973+
* If the cursor was outside the SU area before
2974+
* alignment, the alignment step (which only expands
2975+
* SU) may pull the cursor partially inside, so we
2976+
* must run ET alignment again to fully cover it. But
2977+
* if the cursor was already fully inside before
2978+
* alignment, expanding the SU area won't change that,
2979+
* so no further work is needed.
2980+
*/
2981+
if (cursor_in_su_area)
2982+
break;
2983+
} while (su_area_changed);
29582984

29592985
/*
29602986
* Now that we have the pipe damaged area check if it intersect with

0 commit comments

Comments
 (0)