Skip to content

Commit 3607b30

Browse files
StanFox1984vsyrjala
authored andcommitted
drm/i915: Handle joined pipes inside hsw_crtc_enable()
Handle only bigjoiner masters in skl_commit_modeset_enables/disables, slave crtcs should be handled by master hooks. Same for encoders. That way we can also remove a bunch of checks like intel_crtc_is_bigjoiner_slave. v2: - Moved skl_pfit_enable, intel_dsc_enable, intel_crtc_vblank_on to intel_enable_ddi, so that it is now finally symmetrical with the disable case, because currently for some weird reason we are calling those from skl_commit_modeset_enables, while for the disable case those are called from the ddi disable hooks. v3: - Create intel_ddi_enable_hdmi_or_sst symmetrical to intel_ddi_post_disable_hdmi_or_sst and move it also under non-mst check. v4: - Fix intel_enable_ddi sequence - Call intel_crtc_update_active_timings for slave pipes as well [v5: vsyrjala: Use the name 'pipe_crtc' for the per-pipe crtc pointer Use consistent style and naming Protect macro arguments properly Drop superfluous changes to the modeset sequence, this now follows the old non-joiner sequence 100% apart from just looping in places] Signed-off-by: Stanislav Lisovskiy <[email protected]> Tested-by: Vidya Srinivas <[email protected]> Reviewed-by: Manasi Navare <[email protected]> #v4? Co-developed-by: Ville Syrjälä <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e16bcbb commit 3607b30

File tree

3 files changed

+107
-83
lines changed

3 files changed

+107
-83
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,10 +3363,10 @@ static void intel_enable_ddi(struct intel_atomic_state *state,
33633363
const struct intel_crtc_state *crtc_state,
33643364
const struct drm_connector_state *conn_state)
33653365
{
3366-
drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
3366+
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
3367+
struct intel_crtc *pipe_crtc;
33673368

3368-
if (!intel_crtc_is_bigjoiner_slave(crtc_state))
3369-
intel_ddi_enable_transcoder_func(encoder, crtc_state);
3369+
intel_ddi_enable_transcoder_func(encoder, crtc_state);
33703370

33713371
/* Enable/Disable DP2.0 SDP split config before transcoder */
33723372
intel_audio_sdp_split_update(crtc_state);
@@ -3375,7 +3375,13 @@ static void intel_enable_ddi(struct intel_atomic_state *state,
33753375

33763376
intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
33773377

3378-
intel_crtc_vblank_on(crtc_state);
3378+
for_each_intel_crtc_in_pipe_mask_reverse(&i915->drm, pipe_crtc,
3379+
intel_crtc_joined_pipe_mask(crtc_state)) {
3380+
const struct intel_crtc_state *pipe_crtc_state =
3381+
intel_atomic_get_new_crtc_state(state, pipe_crtc);
3382+
3383+
intel_crtc_vblank_on(pipe_crtc_state);
3384+
}
33793385

33803386
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
33813387
intel_enable_ddi_hdmi(state, encoder, crtc_state, conn_state);

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

Lines changed: 91 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,24 +1620,6 @@ static void hsw_set_frame_start_delay(const struct intel_crtc_state *crtc_state)
16201620
HSW_FRAME_START_DELAY(crtc_state->framestart_delay - 1));
16211621
}
16221622

1623-
static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
1624-
const struct intel_crtc_state *crtc_state)
1625-
{
1626-
struct intel_crtc *master_crtc = intel_master_crtc(crtc_state);
1627-
1628-
/*
1629-
* Enable sequence steps 1-7 on bigjoiner master
1630-
*/
1631-
if (intel_crtc_is_bigjoiner_slave(crtc_state))
1632-
intel_encoders_pre_pll_enable(state, master_crtc);
1633-
1634-
if (crtc_state->shared_dpll)
1635-
intel_enable_shared_dpll(crtc_state);
1636-
1637-
if (intel_crtc_is_bigjoiner_slave(crtc_state))
1638-
intel_encoders_pre_enable(state, master_crtc);
1639-
}
1640-
16411623
static void hsw_configure_cpu_transcoder(const struct intel_crtc_state *crtc_state)
16421624
{
16431625
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -1674,85 +1656,106 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
16741656
intel_atomic_get_new_crtc_state(state, crtc);
16751657
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
16761658
enum transcoder cpu_transcoder = new_crtc_state->cpu_transcoder;
1677-
enum pipe hsw_workaround_pipe;
1659+
struct intel_crtc *pipe_crtc;
16781660

16791661
if (drm_WARN_ON(&dev_priv->drm, crtc->active))
16801662
return;
16811663

1682-
intel_dmc_enable_pipe(dev_priv, crtc->pipe);
1664+
for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
1665+
intel_crtc_joined_pipe_mask(new_crtc_state))
1666+
intel_dmc_enable_pipe(dev_priv, pipe_crtc->pipe);
16831667

1684-
if (!new_crtc_state->bigjoiner_pipes) {
1685-
intel_encoders_pre_pll_enable(state, crtc);
1668+
intel_encoders_pre_pll_enable(state, crtc);
16861669

1687-
if (new_crtc_state->shared_dpll)
1688-
intel_enable_shared_dpll(new_crtc_state);
1670+
for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
1671+
intel_crtc_joined_pipe_mask(new_crtc_state)) {
1672+
const struct intel_crtc_state *pipe_crtc_state =
1673+
intel_atomic_get_new_crtc_state(state, pipe_crtc);
16891674

1690-
intel_encoders_pre_enable(state, crtc);
1691-
} else {
1692-
icl_ddi_bigjoiner_pre_enable(state, new_crtc_state);
1675+
if (pipe_crtc_state->shared_dpll)
1676+
intel_enable_shared_dpll(pipe_crtc_state);
16931677
}
16941678

1695-
intel_dsc_enable(new_crtc_state);
1679+
intel_encoders_pre_enable(state, crtc);
16961680

1697-
if (DISPLAY_VER(dev_priv) >= 13)
1698-
intel_uncompressed_joiner_enable(new_crtc_state);
1681+
for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
1682+
intel_crtc_joined_pipe_mask(new_crtc_state)) {
1683+
const struct intel_crtc_state *pipe_crtc_state =
1684+
intel_atomic_get_new_crtc_state(state, pipe_crtc);
16991685

1700-
intel_set_pipe_src_size(new_crtc_state);
1701-
if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
1702-
bdw_set_pipe_misc(new_crtc_state);
1686+
intel_dsc_enable(pipe_crtc_state);
17031687

1704-
if (!intel_crtc_is_bigjoiner_slave(new_crtc_state) &&
1705-
!transcoder_is_dsi(cpu_transcoder))
1688+
if (DISPLAY_VER(dev_priv) >= 13)
1689+
intel_uncompressed_joiner_enable(pipe_crtc_state);
1690+
1691+
intel_set_pipe_src_size(pipe_crtc_state);
1692+
1693+
if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
1694+
bdw_set_pipe_misc(pipe_crtc_state);
1695+
}
1696+
1697+
if (!transcoder_is_dsi(cpu_transcoder))
17061698
hsw_configure_cpu_transcoder(new_crtc_state);
17071699

1708-
crtc->active = true;
1700+
for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
1701+
intel_crtc_joined_pipe_mask(new_crtc_state)) {
1702+
const struct intel_crtc_state *pipe_crtc_state =
1703+
intel_atomic_get_new_crtc_state(state, pipe_crtc);
17091704

1710-
if (glk_need_scaler_clock_gating_wa(new_crtc_state))
1711-
glk_pipe_scaler_clock_gating_wa(crtc, true);
1705+
pipe_crtc->active = true;
17121706

1713-
if (DISPLAY_VER(dev_priv) >= 9)
1714-
skl_pfit_enable(new_crtc_state);
1715-
else
1716-
ilk_pfit_enable(new_crtc_state);
1707+
if (glk_need_scaler_clock_gating_wa(pipe_crtc_state))
1708+
glk_pipe_scaler_clock_gating_wa(pipe_crtc, true);
17171709

1718-
/*
1719-
* On ILK+ LUT must be loaded before the pipe is running but with
1720-
* clocks enabled
1721-
*/
1722-
intel_color_load_luts(new_crtc_state);
1723-
intel_color_commit_noarm(new_crtc_state);
1724-
intel_color_commit_arm(new_crtc_state);
1725-
/* update DSPCNTR to configure gamma/csc for pipe bottom color */
1726-
if (DISPLAY_VER(dev_priv) < 9)
1727-
intel_disable_primary_plane(new_crtc_state);
1710+
if (DISPLAY_VER(dev_priv) >= 9)
1711+
skl_pfit_enable(pipe_crtc_state);
1712+
else
1713+
ilk_pfit_enable(pipe_crtc_state);
17281714

1729-
hsw_set_linetime_wm(new_crtc_state);
1715+
/*
1716+
* On ILK+ LUT must be loaded before the pipe is running but with
1717+
* clocks enabled
1718+
*/
1719+
intel_color_load_luts(pipe_crtc_state);
1720+
intel_color_commit_noarm(pipe_crtc_state);
1721+
intel_color_commit_arm(pipe_crtc_state);
1722+
/* update DSPCNTR to configure gamma/csc for pipe bottom color */
1723+
if (DISPLAY_VER(dev_priv) < 9)
1724+
intel_disable_primary_plane(pipe_crtc_state);
17301725

1731-
if (DISPLAY_VER(dev_priv) >= 11)
1732-
icl_set_pipe_chicken(new_crtc_state);
1726+
hsw_set_linetime_wm(pipe_crtc_state);
17331727

1734-
intel_initial_watermarks(state, crtc);
1728+
if (DISPLAY_VER(dev_priv) >= 11)
1729+
icl_set_pipe_chicken(pipe_crtc_state);
17351730

1736-
if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
1737-
intel_crtc_vblank_on(new_crtc_state);
1731+
intel_initial_watermarks(state, pipe_crtc);
1732+
}
17381733

17391734
intel_encoders_enable(state, crtc);
17401735

1741-
if (glk_need_scaler_clock_gating_wa(new_crtc_state)) {
1742-
intel_crtc_wait_for_next_vblank(crtc);
1743-
glk_pipe_scaler_clock_gating_wa(crtc, false);
1744-
}
1736+
for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
1737+
intel_crtc_joined_pipe_mask(new_crtc_state)) {
1738+
const struct intel_crtc_state *pipe_crtc_state =
1739+
intel_atomic_get_new_crtc_state(state, pipe_crtc);
1740+
enum pipe hsw_workaround_pipe;
17451741

1746-
/* If we change the relative order between pipe/planes enabling, we need
1747-
* to change the workaround. */
1748-
hsw_workaround_pipe = new_crtc_state->hsw_workaround_pipe;
1749-
if (IS_HASWELL(dev_priv) && hsw_workaround_pipe != INVALID_PIPE) {
1750-
struct intel_crtc *wa_crtc;
1742+
if (glk_need_scaler_clock_gating_wa(pipe_crtc_state)) {
1743+
intel_crtc_wait_for_next_vblank(pipe_crtc);
1744+
glk_pipe_scaler_clock_gating_wa(pipe_crtc, false);
1745+
}
17511746

1752-
wa_crtc = intel_crtc_for_pipe(dev_priv, hsw_workaround_pipe);
1747+
/*
1748+
* If we change the relative order between pipe/planes
1749+
* enabling, we need to change the workaround.
1750+
*/
1751+
hsw_workaround_pipe = pipe_crtc_state->hsw_workaround_pipe;
1752+
if (IS_HASWELL(dev_priv) && hsw_workaround_pipe != INVALID_PIPE) {
1753+
struct intel_crtc *wa_crtc =
1754+
intel_crtc_for_pipe(dev_priv, hsw_workaround_pipe);
17531755

1754-
intel_crtc_wait_for_next_vblank(wa_crtc);
1755-
intel_crtc_wait_for_next_vblank(wa_crtc);
1756+
intel_crtc_wait_for_next_vblank(wa_crtc);
1757+
intel_crtc_wait_for_next_vblank(wa_crtc);
1758+
}
17561759
}
17571760
}
17581761

@@ -6763,17 +6766,21 @@ static void intel_enable_crtc(struct intel_atomic_state *state,
67636766
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
67646767
const struct intel_crtc_state *new_crtc_state =
67656768
intel_atomic_get_new_crtc_state(state, crtc);
6769+
struct intel_crtc *pipe_crtc;
67666770

67676771
if (!intel_crtc_needs_modeset(new_crtc_state))
67686772
return;
67696773

6770-
/* VRR will be enable later, if required */
6771-
intel_crtc_update_active_timings(new_crtc_state, false);
6774+
for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc,
6775+
intel_crtc_joined_pipe_mask(new_crtc_state)) {
6776+
const struct intel_crtc_state *pipe_crtc_state =
6777+
intel_atomic_get_new_crtc_state(state, pipe_crtc);
67726778

6773-
dev_priv->display.funcs.display->crtc_enable(state, crtc);
6779+
/* VRR will be enable later, if required */
6780+
intel_crtc_update_active_timings(pipe_crtc_state, false);
6781+
}
67746782

6775-
if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
6776-
return;
6783+
dev_priv->display.funcs.display->crtc_enable(state, crtc);
67776784

67786785
/* vblanks work again, re-enable pipe CRC. */
67796786
intel_crtc_enable_pipe_crc(crtc);
@@ -7079,12 +7086,14 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
70797086
if ((modeset_pipes & BIT(pipe)) == 0)
70807087
continue;
70817088

7089+
if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
7090+
continue;
7091+
70827092
if (intel_dp_mst_is_slave_trans(new_crtc_state) ||
7083-
is_trans_port_sync_master(new_crtc_state) ||
7084-
intel_crtc_is_bigjoiner_master(new_crtc_state))
7093+
is_trans_port_sync_master(new_crtc_state))
70857094
continue;
70867095

7087-
modeset_pipes &= ~BIT(pipe);
7096+
modeset_pipes &= ~intel_crtc_joined_pipe_mask(new_crtc_state);
70887097

70897098
intel_enable_crtc(state, crtc);
70907099
}
@@ -7099,7 +7108,10 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)
70997108
if ((modeset_pipes & BIT(pipe)) == 0)
71007109
continue;
71017110

7102-
modeset_pipes &= ~BIT(pipe);
7111+
if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
7112+
continue;
7113+
7114+
modeset_pipes &= ~intel_crtc_joined_pipe_mask(new_crtc_state);
71037115

71047116
intel_enable_crtc(state, crtc);
71057117
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ enum phy_fia {
280280
base.head) \
281281
for_each_if((pipe_mask) & BIT(intel_crtc->pipe))
282282

283+
#define for_each_intel_crtc_in_pipe_mask_reverse(dev, intel_crtc, pipe_mask) \
284+
list_for_each_entry_reverse((intel_crtc), \
285+
&(dev)->mode_config.crtc_list, \
286+
base.head) \
287+
for_each_if((pipe_mask) & BIT((intel_crtc)->pipe))
288+
283289
#define for_each_intel_encoder(dev, intel_encoder) \
284290
list_for_each_entry(intel_encoder, \
285291
&(dev)->mode_config.encoder_list, \

0 commit comments

Comments
 (0)