From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Clint Taylor <clinton.a.taylor@intel.com>,
Anusha Srivatsa <anusha.srivatsa@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [Intel-xe] [PATCH 17/42] drm/i915/xe2lpd: D2D Enable preserve bits in DDI_BUF_CTL
Date: Thu, 24 Aug 2023 11:25:15 +0300 [thread overview]
Message-ID: <8735086e50.fsf@intel.com> (raw)
In-Reply-To: <20230823170740.1180212-18-lucas.demarchi@intel.com>
On Wed, 23 Aug 2023, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> From: Clint Taylor <clinton.a.taylor@intel.com>
>
> Display Ver 20 moved the D2D Enable bit to DDI_BUF_CTL(DDI_CTL_DE)
> register. We used multiple variables for HDMI and DisplayPort copies of
> this register. Consolidate the various locations to use
> intel_digital_port saved_port_bits.
All changes like this would be better off in two steps:
1) non-functional moving of the member to another struct
2) adding new stuff on top
The reason is two-fold: it's easier to review each step, and should a
bisect ever point at either of them regressing, it's easier to debug.
BR,
Jani.
>
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_ddi.c | 40 +++++++++++++-----------
> drivers/gpu/drm/i915/display/intel_dp.c | 2 +-
> 2 files changed, 22 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index a9440c0ecf61..3147ed174d83 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -324,26 +324,25 @@ static void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder,
> const struct intel_crtc_state *crtc_state)
> {
> struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> - struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> enum phy phy = intel_port_to_phy(i915, encoder->port);
>
> /* DDI_BUF_CTL_ENABLE will be set by intel_ddi_prepare_link_retrain() later */
> - intel_dp->DP = dig_port->saved_port_bits |
> + dig_port->saved_port_bits |=
> DDI_PORT_WIDTH(crtc_state->lane_count) |
> DDI_BUF_TRANS_SELECT(0);
>
> if (DISPLAY_VER(i915) >= 14) {
> if (intel_dp_is_uhbr(crtc_state))
> - intel_dp->DP |= DDI_BUF_PORT_DATA_40BIT;
> + dig_port->saved_port_bits |= DDI_BUF_PORT_DATA_40BIT;
> else
> - intel_dp->DP |= DDI_BUF_PORT_DATA_10BIT;
> + dig_port->saved_port_bits |= DDI_BUF_PORT_DATA_10BIT;
> }
>
> if (IS_ALDERLAKE_P(i915) && intel_phy_is_tc(i915, phy)) {
> - intel_dp->DP |= ddi_buf_phy_link_rate(crtc_state->port_clock);
> + dig_port->saved_port_bits |= ddi_buf_phy_link_rate(crtc_state->port_clock);
> if (!intel_tc_port_in_tbt_alt_mode(dig_port))
> - intel_dp->DP |= DDI_BUF_CTL_TC_PHY_OWNERSHIP;
> + dig_port->saved_port_bits |= DDI_BUF_CTL_TC_PHY_OWNERSHIP;
> }
> }
>
> @@ -1449,7 +1448,7 @@ hsw_set_signal_levels(struct intel_encoder *encoder,
> const struct intel_crtc_state *crtc_state)
> {
> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> - struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> + struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> int level = intel_ddi_level(encoder, crtc_state, 0);
> enum port port = encoder->port;
> u32 signal_levels;
> @@ -1466,10 +1465,10 @@ hsw_set_signal_levels(struct intel_encoder *encoder,
> drm_dbg_kms(&dev_priv->drm, "Using signal levels %08x\n",
> signal_levels);
>
> - intel_dp->DP &= ~DDI_BUF_EMP_MASK;
> - intel_dp->DP |= signal_levels;
> + dig_port->saved_port_bits &= ~DDI_BUF_EMP_MASK;
> + dig_port->saved_port_bits |= signal_levels;
>
> - intel_de_write(dev_priv, DDI_BUF_CTL(port), intel_dp->DP);
> + intel_de_write(dev_priv, DDI_BUF_CTL(port), dig_port->saved_port_bits);
> intel_de_posting_read(dev_priv, DDI_BUF_CTL(port));
> }
>
> @@ -2355,6 +2354,7 @@ static void
> mtl_ddi_enable_d2d(struct intel_encoder *encoder)
> {
> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> + struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> enum port port = encoder->port;
> i915_reg_t reg;
> u32 set_bits, wait_bits;
> @@ -2362,6 +2362,7 @@ mtl_ddi_enable_d2d(struct intel_encoder *encoder)
> if (DISPLAY_VER(dev_priv) >= 20) {
> reg = DDI_BUF_CTL(port);
> set_bits = XE2LPD_DDI_BUF_D2D_LINK_ENABLE;
> + dig_port->saved_port_bits |= XE2LPD_DDI_BUF_D2D_LINK_ENABLE;
> wait_bits = XE2LPD_DDI_BUF_D2D_LINK_STATE;
> } else {
> reg = XELPDP_PORT_BUF_CTL1(port);
> @@ -2817,6 +2818,7 @@ static void
> mtl_ddi_disable_d2d_link(struct intel_encoder *encoder)
> {
> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> + struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> enum port port = encoder->port;
> i915_reg_t reg;
> u32 clr_bits, wait_bits;
> @@ -2824,6 +2826,7 @@ mtl_ddi_disable_d2d_link(struct intel_encoder *encoder)
> if (DISPLAY_VER(dev_priv) >= 20) {
> reg = DDI_BUF_CTL(port);
> clr_bits = XE2LPD_DDI_BUF_D2D_LINK_ENABLE;
> + dig_port->saved_port_bits &= ~XE2LPD_DDI_BUF_D2D_LINK_ENABLE;
> wait_bits = XE2LPD_DDI_BUF_D2D_LINK_STATE;
> } else {
> reg = XELPDP_PORT_BUF_CTL1(port);
> @@ -3162,7 +3165,6 @@ static void intel_enable_ddi_hdmi(struct intel_atomic_state *state,
> struct drm_connector *connector = conn_state->connector;
> enum port port = encoder->port;
> enum phy phy = intel_port_to_phy(dev_priv, port);
> - u32 buf_ctl;
>
> if (!intel_hdmi_handle_sink_scrambling(encoder, connector,
> crtc_state->hdmi_high_tmds_clock_ratio,
> @@ -3228,7 +3230,7 @@ static void intel_enable_ddi_hdmi(struct intel_atomic_state *state,
> * is filled with lane count, already set in the crtc_state.
> * The same is required to be filled in PORT_BUF_CTL for C10/20 Phy.
> */
> - buf_ctl = dig_port->saved_port_bits | DDI_BUF_CTL_ENABLE;
> + dig_port->saved_port_bits |= DDI_BUF_CTL_ENABLE;
> if (DISPLAY_VER(dev_priv) >= 14) {
> u8 lane_count = mtl_get_port_width(crtc_state->lane_count);
> u32 port_buf = 0;
> @@ -3241,13 +3243,13 @@ static void intel_enable_ddi_hdmi(struct intel_atomic_state *state,
> intel_de_rmw(dev_priv, XELPDP_PORT_BUF_CTL1(port),
> XELPDP_PORT_WIDTH_MASK | XELPDP_PORT_REVERSAL, port_buf);
>
> - buf_ctl |= DDI_PORT_WIDTH(lane_count);
> + dig_port->saved_port_bits |= DDI_PORT_WIDTH(lane_count);
> } else if (IS_ALDERLAKE_P(dev_priv) && intel_phy_is_tc(dev_priv, phy)) {
> drm_WARN_ON(&dev_priv->drm, !intel_tc_port_in_legacy_mode(dig_port));
> - buf_ctl |= DDI_BUF_CTL_TC_PHY_OWNERSHIP;
> + dig_port->saved_port_bits |= DDI_BUF_CTL_TC_PHY_OWNERSHIP;
> }
>
> - intel_de_write(dev_priv, DDI_BUF_CTL(port), buf_ctl);
> + intel_de_write(dev_priv, DDI_BUF_CTL(port), dig_port->saved_port_bits);
>
> intel_wait_ddi_buf_active(dev_priv, port);
>
> @@ -3465,8 +3467,8 @@ static void mtl_ddi_prepare_link_retrain(struct intel_dp *intel_dp,
> mtl_port_buf_ctl_program(encoder, crtc_state);
>
> /* 6.i Configure and enable DDI_CTL_DE to start sending valid data to port slice */
> - intel_dp->DP |= DDI_BUF_CTL_ENABLE;
> - intel_de_write(dev_priv, DDI_BUF_CTL(port), intel_dp->DP);
> + dig_port->saved_port_bits |= DDI_BUF_CTL_ENABLE;
> + intel_de_write(dev_priv, DDI_BUF_CTL(port), dig_port->saved_port_bits);
> intel_de_posting_read(dev_priv, DDI_BUF_CTL(port));
>
> /* 6.j Poll for PORT_BUF_CTL Idle Status == 0, timeout after 100 us */
> @@ -3516,8 +3518,8 @@ static void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp,
> (intel_tc_port_in_dp_alt_mode(dig_port) || intel_tc_port_in_legacy_mode(dig_port)))
> adlp_tbt_to_dp_alt_switch_wa(encoder);
>
> - intel_dp->DP |= DDI_BUF_CTL_ENABLE;
> - intel_de_write(dev_priv, DDI_BUF_CTL(port), intel_dp->DP);
> + dig_port->saved_port_bits |= DDI_BUF_CTL_ENABLE;
> + intel_de_write(dev_priv, DDI_BUF_CTL(port), dig_port->saved_port_bits);
> intel_de_posting_read(dev_priv, DDI_BUF_CTL(port));
>
> intel_wait_ddi_buf_active(dev_priv, port);
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 84584864511b..334789be0054 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -5631,7 +5631,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
> intel_dp->pps.active_pipe = INVALID_PIPE;
>
> /* Preserve the current hw state. */
> - intel_dp->DP = intel_de_read(dev_priv, intel_dp->output_reg);
> + dig_port->saved_port_bits = intel_de_read(dev_priv, intel_dp->output_reg);
> intel_dp->attached_connector = intel_connector;
>
> if (_intel_dp_is_port_edp(dev_priv, intel_encoder->devdata, port)) {
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-08-24 8:25 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 17:06 [Intel-xe] [PATCH 00/42] Enable Lunar Lake display Lucas De Marchi
2023-08-23 17:06 ` [Intel-xe] [PATCH 01/42] drm/i915: Start using plane scale factor for relative data rate Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 02/42] drm/i915/display: Remove unused POWER_DOMAIN_MASK Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 03/42] drm/i915/cx0: Add intel_cx0_get_owned_lane_mask() Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 04/42] drm/i915: Simplify intel_cx0_program_phy_lane() with loop Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 05/42] drm/i915/cx0: Enable/disable TX only for owned PHY lanes Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 06/42] drm/i915/cx0: Program vswing only for owned lanes Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 07/42] drm/i915/tc: rename mtl_tc_port_get_pin_assignment_mask() Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 08/42] drm/i915/tc: make intel_tc_port_get_lane_mask() static Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 09/42] drm/i915/tc: move legacy code out of the main _max_lane_count() func Lucas De Marchi
2023-08-24 5:43 ` [Intel-xe] [Intel-gfx] " Kandpal, Suraj
2023-08-24 11:09 ` Coelho, Luciano
2023-08-24 15:08 ` Lucas De Marchi
2023-08-24 16:15 ` Kandpal, Suraj
2023-08-23 17:07 ` [Intel-xe] [PATCH 10/42] drm/i915/tc: remove "fia" from intel_tc_port_fia_max_lane_count() Lucas De Marchi
2023-08-24 5:47 ` [Intel-xe] [Intel-gfx] " Kandpal, Suraj
2023-08-23 17:07 ` [Intel-xe] [PATCH 11/42] drm/xe/lnl: Add IS_LUNARLAKE Lucas De Marchi
2023-08-23 17:55 ` Matt Roper
2023-08-24 15:32 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 12/42] drm/i915/lnl: Add display definitions Lucas De Marchi
2023-08-23 18:03 ` Matt Roper
2023-08-24 8:20 ` Jani Nikula
2023-08-24 15:49 ` [Intel-xe] [Intel-gfx] " Lucas De Marchi
2023-08-24 15:58 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 13/42] drm/i915: Re-order if/else ladder in intel_detect_pch() Lucas De Marchi
2023-08-23 18:04 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 14/42] drm/i915/lnl: Add fake PCH Lucas De Marchi
2023-08-23 18:05 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 15/42] drm/i915/xe2lpd: Treat cursor plane as regular plane for DDB allocation Lucas De Marchi
2023-08-23 18:08 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 16/42] drm/i915/xe2lpd: Move D2D enable/disable Lucas De Marchi
2023-08-23 19:01 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 17/42] drm/i915/xe2lpd: D2D Enable preserve bits in DDI_BUF_CTL Lucas De Marchi
2023-08-24 8:25 ` Jani Nikula [this message]
2023-08-23 17:07 ` [Intel-xe] [PATCH 18/42] drm/i915/xe2lpd: Move registers to PICA Lucas De Marchi
2023-08-23 19:24 ` Matt Roper
2023-08-24 8:34 ` Jani Nikula
2023-08-24 10:34 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 19/42] drm/i915/xe2lpd: Don't try to program PLANE_AUX_DIST Lucas De Marchi
2023-08-25 19:42 ` [Intel-xe] [Intel-gfx] " Srivatsa, Anusha
2023-08-23 17:07 ` [Intel-xe] [PATCH 20/42] drm/i915/xe2lpd: Register DE_RRMR has been removed Lucas De Marchi
2023-08-23 19:28 ` Matt Roper
2023-08-24 22:46 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 21/42] drm/i915/xe2lpd: Add display power well Lucas De Marchi
2023-08-23 19:44 ` Matt Roper
2023-08-23 19:46 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 22/42] drm/i915/xe2lpd: Add DC state support Lucas De Marchi
2023-08-25 19:46 ` Srivatsa, Anusha
2023-08-23 17:07 ` [Intel-xe] [PATCH 23/42] drm/i915/xe2lpd: FBC is now supported on all pipes Lucas De Marchi
2023-08-23 19:49 ` Matt Roper
2023-08-24 15:53 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 24/42] drm/i915/display: Remove FBC capability from fused off pipes Lucas De Marchi
2023-08-23 19:53 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 25/42] drm/i915/xe2lpd: Add support for DP aux channels Lucas De Marchi
2023-08-23 20:01 ` Matt Roper
2023-08-23 20:14 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 26/42] drm/i915/xe2lpd: Handle port AUX interrupts Lucas De Marchi
2023-08-23 20:10 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 27/42] drm/i915/xe2lpd: Read pin assignment from IOM Lucas De Marchi
2023-08-23 20:28 ` Matt Roper
2023-08-24 11:31 ` [Intel-xe] [Intel-gfx] " Coelho, Luciano
2023-08-24 11:34 ` Coelho, Luciano
2023-08-24 15:06 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 28/42] drm/i915/xe2lpd: enable odd size and panning for planar yuv on xe2lpd Lucas De Marchi
2023-08-24 5:26 ` Kandpal, Suraj
2023-08-23 17:07 ` [Intel-xe] [PATCH 29/42] drm/i915/xe2lpd: Add support for HPD Lucas De Marchi
2023-08-23 20:37 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 30/42] drm/i915/xe2lpd: Extend Wa_15010685871 Lucas De Marchi
2023-08-23 20:44 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 31/42] drm/i915/lnl: Add gmbus/ddc support Lucas De Marchi
2023-08-23 20:49 ` Matt Roper
2023-08-25 4:25 ` Lucas De Marchi
2023-08-25 21:55 ` Matt Roper
2023-08-25 22:36 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 32/42] drm/i915/lnl: Introduce MDCLK Lucas De Marchi
2023-08-23 21:14 ` Matt Roper
2023-08-29 17:39 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 33/42] drm/i915/lnl: Add CDCLK table Lucas De Marchi
2023-08-23 21:36 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 34/42] drm/i915/lnl: Start using CDCLK through PLL Lucas De Marchi
2023-08-23 22:01 ` Matt Roper
2023-08-29 18:45 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 35/42] drm/i915/lnl: Introduce MDCLK_CDCLK ratio to DBuf Lucas De Marchi
2023-08-24 23:45 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 36/42] drm/i915/lnl: Add support for CDCLK initialization sequence Lucas De Marchi
2023-08-24 23:54 ` Matt Roper
2023-08-29 22:21 ` Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 37/42] drm/i915/xe2lpd: Write DBuf after CDCLK change in post plane Lucas De Marchi
2023-08-25 7:35 ` Kahola, Mika
2023-08-23 17:07 ` [Intel-xe] [PATCH 38/42] drm/i915/lnl: Serialize global state if mdclk/cdclk ratio changes Lucas De Marchi
2023-08-29 22:24 ` [Intel-xe] [Intel-gfx] " Lucas De Marchi
2023-08-23 17:07 ` [Intel-xe] [PATCH 39/42] drm/i915/lnl: Add pll table for LNL platform Lucas De Marchi
2023-08-25 0:06 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 40/42] drm/i915/lnl: Add support to check c10 phy link rate Lucas De Marchi
2023-08-25 0:07 ` Matt Roper
2023-08-23 17:07 ` [Intel-xe] [PATCH 41/42] drm/i915/xe2lpd: Update mbus on post plane updates Lucas De Marchi
2023-08-25 7:36 ` Kahola, Mika
2023-08-23 17:07 ` [Intel-xe] [PATCH 42/42] drm/xe/lnl: Enable the display support Lucas De Marchi
2023-08-25 0:13 ` Matt Roper
2023-08-23 17:12 ` [Intel-xe] ✓ CI.Patch_applied: success for Enable Lunar Lake display Patchwork
2023-08-23 17:12 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-08-23 17:13 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-08-23 17:17 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-08-23 17:18 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-08-23 17:18 ` [Intel-xe] ✗ CI.checksparse: warning " Patchwork
2023-08-23 17:46 ` [Intel-xe] ✓ CI.BAT: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8735086e50.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=anusha.srivatsa@intel.com \
--cc=clinton.a.taylor@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox