Skip to content

Commit bf1f6f8

Browse files
hoganderrodrigovivi
authored andcommitted
drm/i915/psr: Fix intel_psr2_sel_fetch_et_alignment usage
Currently we are not aligning selective update area to cover cursor fully when cursor is not updated by itself but still in the selective update area. Fix this by checking cursor separately after drm_atomic_add_affected_planes. Bspec: 68927 Fixes: 1bff93b ("drm/i915/psr: Extend SU area to cover cursor fully if needed") Signed-off-by: Jouni Högander <[email protected]> Reviewed-by: Mika Kahola <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit d37b3da) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 4e29234 commit bf1f6f8

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

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

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,21 +2116,36 @@ static void intel_psr2_sel_fetch_pipe_alignment(struct intel_crtc_state *crtc_st
21162116
* cursor fully when cursor is in SU area.
21172117
*/
21182118
static void
2119-
intel_psr2_sel_fetch_et_alignment(struct intel_crtc_state *crtc_state,
2120-
struct intel_plane_state *cursor_state)
2119+
intel_psr2_sel_fetch_et_alignment(struct intel_atomic_state *state,
2120+
struct intel_crtc *crtc)
21212121
{
2122-
struct drm_rect inter;
2122+
struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
2123+
struct intel_plane_state *new_plane_state;
2124+
struct intel_plane *plane;
2125+
int i;
21232126

2124-
if (!crtc_state->enable_psr2_su_region_et ||
2125-
!cursor_state->uapi.visible)
2127+
if (!crtc_state->enable_psr2_su_region_et)
21262128
return;
21272129

2128-
inter = crtc_state->psr2_su_area;
2129-
if (!drm_rect_intersect(&inter, &cursor_state->uapi.dst))
2130-
return;
2130+
for_each_new_intel_plane_in_state(state, plane, new_plane_state, i) {
2131+
struct drm_rect inter;
21312132

2132-
clip_area_update(&crtc_state->psr2_su_area, &cursor_state->uapi.dst,
2133-
&crtc_state->pipe_src);
2133+
if (new_plane_state->uapi.crtc != crtc_state->uapi.crtc)
2134+
continue;
2135+
2136+
if (plane->id != PLANE_CURSOR)
2137+
continue;
2138+
2139+
if (!new_plane_state->uapi.visible)
2140+
continue;
2141+
2142+
inter = crtc_state->psr2_su_area;
2143+
if (!drm_rect_intersect(&inter, &new_plane_state->uapi.dst))
2144+
continue;
2145+
2146+
clip_area_update(&crtc_state->psr2_su_area, &new_plane_state->uapi.dst,
2147+
&crtc_state->pipe_src);
2148+
}
21342149
}
21352150

21362151
/*
@@ -2173,8 +2188,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
21732188
{
21742189
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
21752190
struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
2176-
struct intel_plane_state *new_plane_state, *old_plane_state,
2177-
*cursor_plane_state = NULL;
2191+
struct intel_plane_state *new_plane_state, *old_plane_state;
21782192
struct intel_plane *plane;
21792193
bool full_update = false;
21802194
int i, ret;
@@ -2259,13 +2273,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
22592273
damaged_area.x2 += new_plane_state->uapi.dst.x1 - src.x1;
22602274

22612275
clip_area_update(&crtc_state->psr2_su_area, &damaged_area, &crtc_state->pipe_src);
2262-
2263-
/*
2264-
* Cursor plane new state is stored to adjust su area to cover
2265-
* cursor are fully.
2266-
*/
2267-
if (plane->id == PLANE_CURSOR)
2268-
cursor_plane_state = new_plane_state;
22692276
}
22702277

22712278
/*
@@ -2294,9 +2301,13 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
22942301
if (ret)
22952302
return ret;
22962303

2297-
/* Adjust su area to cover cursor fully as necessary */
2298-
if (cursor_plane_state)
2299-
intel_psr2_sel_fetch_et_alignment(crtc_state, cursor_plane_state);
2304+
/*
2305+
* Adjust su area to cover cursor fully as necessary (early
2306+
* transport). This needs to be done after
2307+
* drm_atomic_add_affected_planes to ensure visible cursor is added into
2308+
* affected planes even when cursor is not updated by itself.
2309+
*/
2310+
intel_psr2_sel_fetch_et_alignment(state, crtc);
23002311

23012312
intel_psr2_sel_fetch_pipe_alignment(crtc_state);
23022313

0 commit comments

Comments
 (0)