Skip to content

Commit 73262db

Browse files
committed
drm/i915/display: Match PSR2 selective fetch sequences with specification
We were not completely following the selective fetch programming sequence, here some things we were doing wrong: - not programming plane selective fetch a PSR2_MAN_TRK_CTL registers when doing a modeset - programming PSR2_MAN_TRK_CTL out of vblank With this changes the last remainig underrun found in Alderlake-P is fixed. Bspec: 55229 Tested-by: Gwan-gyeong Mun <[email protected]> Reviewed-by: Gwan-gyeong Mun <[email protected]> Cc: Gwan-gyeong Mun <[email protected]> Signed-off-by: José Roberto de Souza <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 27493cb commit 73262db

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,10 @@ static void i9xx_update_cursor(struct intel_plane *plane,
536536
if (DISPLAY_VER(dev_priv) >= 9)
537537
skl_write_cursor_wm(plane, crtc_state);
538538

539-
if (!intel_crtc_needs_modeset(crtc_state))
539+
if (plane_state)
540540
intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, 0);
541+
else
542+
intel_psr2_disable_plane_sel_fetch(plane, crtc_state);
541543

542544
if (plane->cursor.base != base ||
543545
plane->cursor.size != fbc_ctl ||

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6819,11 +6819,9 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
68196819

68206820
}
68216821

6822-
if (!mode_changed) {
6823-
ret = intel_psr2_sel_fetch_update(state, crtc);
6824-
if (ret)
6825-
return ret;
6826-
}
6822+
ret = intel_psr2_sel_fetch_update(state, crtc);
6823+
if (ret)
6824+
return ret;
68276825

68286826
return 0;
68296827
}
@@ -9716,10 +9714,10 @@ static void commit_pipe_pre_planes(struct intel_atomic_state *state,
97169714

97179715
if (new_crtc_state->update_pipe)
97189716
intel_pipe_fastset(old_crtc_state, new_crtc_state);
9719-
9720-
intel_psr2_program_trans_man_trk_ctl(new_crtc_state);
97219717
}
97229718

9719+
intel_psr2_program_trans_man_trk_ctl(new_crtc_state);
9720+
97239721
if (dev_priv->display.atomic_update_watermarks)
97249722
dev_priv->display.atomic_update_watermarks(state, crtc);
97259723
}

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

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,16 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
561561
val |= EDP_PSR2_SU_SDP_SCANLINE;
562562

563563
if (intel_dp->psr.psr2_sel_fetch_enabled) {
564+
u32 tmp;
565+
564566
/* Wa_1408330847 */
565567
if (IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_B0))
566568
intel_de_rmw(dev_priv, CHICKEN_PAR1_1,
567569
DIS_RAM_BYPASS_PSR2_MAN_TRACK,
568570
DIS_RAM_BYPASS_PSR2_MAN_TRACK);
569571

570-
intel_de_write(dev_priv,
571-
PSR2_MAN_TRK_CTL(intel_dp->psr.transcoder),
572-
PSR2_MAN_TRK_CTL_ENABLE);
572+
tmp = intel_de_read(dev_priv, PSR2_MAN_TRK_CTL(intel_dp->psr.transcoder));
573+
drm_WARN_ON(&dev_priv->drm, !(tmp & PSR2_MAN_TRK_CTL_ENABLE));
573574
} else if (HAS_PSR2_SEL_FETCH(dev_priv)) {
574575
intel_de_write(dev_priv,
575576
PSR2_MAN_TRK_CTL(intel_dp->psr.transcoder), 0);
@@ -1450,6 +1451,18 @@ static void psr_force_hw_tracking_exit(struct intel_dp *intel_dp)
14501451
intel_de_write(dev_priv, CURSURFLIVE(intel_dp->psr.pipe), 0);
14511452
}
14521453

1454+
void intel_psr2_disable_plane_sel_fetch(struct intel_plane *plane,
1455+
const struct intel_crtc_state *crtc_state)
1456+
{
1457+
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
1458+
enum pipe pipe = plane->pipe;
1459+
1460+
if (!crtc_state->enable_psr2_sel_fetch)
1461+
return;
1462+
1463+
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_CTL(pipe, plane->id), 0);
1464+
}
1465+
14531466
void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane,
14541467
const struct intel_crtc_state *crtc_state,
14551468
const struct intel_plane_state *plane_state,
@@ -1464,11 +1477,11 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane,
14641477
if (!crtc_state->enable_psr2_sel_fetch)
14651478
return;
14661479

1467-
val = plane_state ? plane_state->ctl : 0;
1468-
val &= plane->id == PLANE_CURSOR ? val : PLANE_SEL_FETCH_CTL_ENABLE;
1469-
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_CTL(pipe, plane->id), val);
1470-
if (!val || plane->id == PLANE_CURSOR)
1480+
if (plane->id == PLANE_CURSOR) {
1481+
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_CTL(pipe, plane->id),
1482+
plane_state->ctl);
14711483
return;
1484+
}
14721485

14731486
clip = &plane_state->psr2_sel_fetch_area;
14741487

@@ -1487,14 +1500,16 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane,
14871500
val = (drm_rect_height(clip) - 1) << 16;
14881501
val |= (drm_rect_width(&plane_state->uapi.src) >> 16) - 1;
14891502
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_SIZE(pipe, plane->id), val);
1503+
1504+
intel_de_write_fw(dev_priv, PLANE_SEL_FETCH_CTL(pipe, plane->id),
1505+
PLANE_SEL_FETCH_CTL_ENABLE);
14901506
}
14911507

14921508
void intel_psr2_program_trans_man_trk_ctl(const struct intel_crtc_state *crtc_state)
14931509
{
14941510
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
14951511

1496-
if (!HAS_PSR2_SEL_FETCH(dev_priv) ||
1497-
!crtc_state->enable_psr2_sel_fetch)
1512+
if (!crtc_state->enable_psr2_sel_fetch)
14981513
return;
14991514

15001515
intel_de_write(dev_priv, PSR2_MAN_TRK_CTL(crtc_state->cpu_transcoder),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ void intel_psr2_program_plane_sel_fetch(struct intel_plane *plane,
5151
const struct intel_crtc_state *crtc_state,
5252
const struct intel_plane_state *plane_state,
5353
int color_plane);
54+
void intel_psr2_disable_plane_sel_fetch(struct intel_plane *plane,
55+
const struct intel_crtc_state *crtc_state);
5456
void intel_psr_pause(struct intel_dp *intel_dp);
5557
void intel_psr_resume(struct intel_dp *intel_dp);
5658

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ skl_disable_plane(struct intel_plane *plane,
656656

657657
skl_write_plane_wm(plane, crtc_state);
658658

659+
intel_psr2_disable_plane_sel_fetch(plane, crtc_state);
659660
intel_de_write_fw(dev_priv, PLANE_CTL(pipe, plane_id), 0);
660661
intel_de_write_fw(dev_priv, PLANE_SURF(pipe, plane_id), 0);
661662

@@ -1101,8 +1102,7 @@ skl_program_plane(struct intel_plane *plane,
11011102
(plane_state->view.color_plane[1].y << 16) |
11021103
plane_state->view.color_plane[1].x);
11031104

1104-
if (!drm_atomic_crtc_needs_modeset(&crtc_state->uapi))
1105-
intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, color_plane);
1105+
intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, color_plane);
11061106

11071107
/*
11081108
* Enable the scaler before the plane so that we don't

0 commit comments

Comments
 (0)