Re: [PATCH 5/6] drm/i915: Handle joined pipes inside hsw_crtc_enable()

2024-03-26 Thread Manasi Navare
The bigjoiner master handling in modset_enables/disables looks good.

Reviewed-by: Manasi Navare 

Manasi

On Mon, Mar 25, 2024 at 12:20 AM Srinivas, Vidya
 wrote:
>
> Thank you Stan. Rev 14 works.
> Tested-by: Vidya Srinivas 
>
> > -Original Message-
> > From: Lisovskiy, Stanislav 
> > Sent: Wednesday, March 20, 2024 8:45 PM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: Lisovskiy, Stanislav ; Saarinen, Jani
> > ; ville.syrj...@linux.intel.com; Srinivas, Vidya
> > 
> > Subject: [PATCH 5/6] 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
> >
> > Signed-off-by: Stanislav Lisovskiy 
> > ---
> >  drivers/gpu/drm/i915/display/intel_ddi.c |  45 -
> >  drivers/gpu/drm/i915/display/intel_display.c | 179 ++-
> >  drivers/gpu/drm/i915/display/intel_display.h |   7 +
> >  3 files changed, 137 insertions(+), 94 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > index 290ccab7c9ee8..9128b82a49c31 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > @@ -3366,15 +3366,28 @@ static void intel_enable_ddi_hdmi(struct
> > intel_atomic_state *state,
> >   intel_wait_ddi_buf_active(dev_priv, port);  }
> >
> > -static void intel_enable_ddi(struct intel_atomic_state *state,
> > -  struct intel_encoder *encoder,
> > -  const struct intel_crtc_state *crtc_state,
> > -  const struct drm_connector_state *conn_state)
> > +static void intel_ddi_enable_hdmi_or_sst(struct intel_atomic_state *state,
> > +  struct intel_encoder *encoder,
> > +  const struct intel_crtc_state
> > *crtc_state,
> > +  const struct drm_connector_state
> > *conn_state)
> >  {
> > - drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
> > + struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> > + u8 pipe_mask = intel_crtc_joined_pipe_mask(crtc_state);
> > + struct intel_crtc *crtc;
> > +
> > + for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc,
> > pipe_mask) {
> > + const struct intel_crtc_state *new_crtc_state =
> > + intel_atomic_get_new_crtc_state(state, crtc);
> > +
> > + intel_dsc_enable(new_crtc_state);
> > +
> > + if (DISPLAY_VER(i915) >= 9)
> > + skl_pfit_enable(new_crtc_state);
> > + else
> > + ilk_pfit_enable(new_crtc_state);
> > + }
> >
> > - if (!intel_crtc_is_bigjoiner_slave(crtc_state))
> > - intel_ddi_enable_transcoder_func(encoder, crtc_state);
> > + intel_ddi_enable_transcoder_func(encoder, crtc_state);
> >
> >   /* Enable/Disable DP2.0 SDP split config before transcoder */
> >   intel_audio_sdp_split_update(crtc_state);
> > @@ -3383,7 +3396,22 @@ static void intel_enable_ddi(struct
> > intel_atomic_state *state,
> >
> >   intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
> >
> > - intel_crtc_vblank_on(crtc_state);
> > + for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc,
> > pipe_mask) {
> > + const struct intel_crtc_state *new_crtc_state =
> > + intel_atomic_get_new_crtc_state(state, crtc);
> > + intel_crtc_vblank_on(new_crtc_state);
> > + }
> > +}
> > +
> > +static void intel_enable_ddi(struct in

RE: [PATCH 5/6] drm/i915: Handle joined pipes inside hsw_crtc_enable()

2024-03-25 Thread Srinivas, Vidya
Thank you Stan. Rev 14 works.
Tested-by: Vidya Srinivas 

> -Original Message-
> From: Lisovskiy, Stanislav 
> Sent: Wednesday, March 20, 2024 8:45 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Lisovskiy, Stanislav ; Saarinen, Jani
> ; ville.syrj...@linux.intel.com; Srinivas, Vidya
> 
> Subject: [PATCH 5/6] 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
> 
> Signed-off-by: Stanislav Lisovskiy 
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c |  45 -
>  drivers/gpu/drm/i915/display/intel_display.c | 179 ++-
>  drivers/gpu/drm/i915/display/intel_display.h |   7 +
>  3 files changed, 137 insertions(+), 94 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 290ccab7c9ee8..9128b82a49c31 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3366,15 +3366,28 @@ static void intel_enable_ddi_hdmi(struct
> intel_atomic_state *state,
>   intel_wait_ddi_buf_active(dev_priv, port);  }
> 
> -static void intel_enable_ddi(struct intel_atomic_state *state,
> -  struct intel_encoder *encoder,
> -  const struct intel_crtc_state *crtc_state,
> -  const struct drm_connector_state *conn_state)
> +static void intel_ddi_enable_hdmi_or_sst(struct intel_atomic_state *state,
> +  struct intel_encoder *encoder,
> +  const struct intel_crtc_state
> *crtc_state,
> +  const struct drm_connector_state
> *conn_state)
>  {
> - drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
> + struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> + u8 pipe_mask = intel_crtc_joined_pipe_mask(crtc_state);
> + struct intel_crtc *crtc;
> +
> + for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc,
> pipe_mask) {
> + const struct intel_crtc_state *new_crtc_state =
> + intel_atomic_get_new_crtc_state(state, crtc);
> +
> + intel_dsc_enable(new_crtc_state);
> +
> + if (DISPLAY_VER(i915) >= 9)
> + skl_pfit_enable(new_crtc_state);
> + else
> + ilk_pfit_enable(new_crtc_state);
> + }
> 
> - if (!intel_crtc_is_bigjoiner_slave(crtc_state))
> - intel_ddi_enable_transcoder_func(encoder, crtc_state);
> + intel_ddi_enable_transcoder_func(encoder, crtc_state);
> 
>   /* Enable/Disable DP2.0 SDP split config before transcoder */
>   intel_audio_sdp_split_update(crtc_state);
> @@ -3383,7 +3396,22 @@ static void intel_enable_ddi(struct
> intel_atomic_state *state,
> 
>   intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
> 
> - intel_crtc_vblank_on(crtc_state);
> + for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc,
> pipe_mask) {
> + const struct intel_crtc_state *new_crtc_state =
> + intel_atomic_get_new_crtc_state(state, crtc);
> + intel_crtc_vblank_on(new_crtc_state);
> + }
> +}
> +
> +static void intel_enable_ddi(struct intel_atomic_state *state,
> +  struct intel_encoder *encoder,
> +  const struct intel_crtc_state *crtc_state,
> +  const struct drm_connector_state *conn_state) {
> + drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
> +
> + if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))
> + intel_ddi_enable_hdmi_or_sst(state, encoder, crtc_state,
> conn_state);
> 
>   if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
>   intel_enable_ddi_hdmi(state, encoder, crtc_state,
> conn_state); @

[PATCH 5/6] drm/i915: Handle joined pipes inside hsw_crtc_enable()

2024-03-20 Thread Stanislav Lisovskiy
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

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_ddi.c |  45 -
 drivers/gpu/drm/i915/display/intel_display.c | 179 ++-
 drivers/gpu/drm/i915/display/intel_display.h |   7 +
 3 files changed, 137 insertions(+), 94 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 290ccab7c9ee8..9128b82a49c31 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3366,15 +3366,28 @@ static void intel_enable_ddi_hdmi(struct 
intel_atomic_state *state,
intel_wait_ddi_buf_active(dev_priv, port);
 }
 
-static void intel_enable_ddi(struct intel_atomic_state *state,
-struct intel_encoder *encoder,
-const struct intel_crtc_state *crtc_state,
-const struct drm_connector_state *conn_state)
+static void intel_ddi_enable_hdmi_or_sst(struct intel_atomic_state *state,
+struct intel_encoder *encoder,
+const struct intel_crtc_state 
*crtc_state,
+const struct drm_connector_state 
*conn_state)
 {
-   drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   u8 pipe_mask = intel_crtc_joined_pipe_mask(crtc_state);
+   struct intel_crtc *crtc;
+
+   for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc, pipe_mask) {
+   const struct intel_crtc_state *new_crtc_state =
+   intel_atomic_get_new_crtc_state(state, crtc);
+
+   intel_dsc_enable(new_crtc_state);
+
+   if (DISPLAY_VER(i915) >= 9)
+   skl_pfit_enable(new_crtc_state);
+   else
+   ilk_pfit_enable(new_crtc_state);
+   }
 
-   if (!intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_ddi_enable_transcoder_func(encoder, crtc_state);
+   intel_ddi_enable_transcoder_func(encoder, crtc_state);
 
/* Enable/Disable DP2.0 SDP split config before transcoder */
intel_audio_sdp_split_update(crtc_state);
@@ -3383,7 +3396,22 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
 
intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
 
-   intel_crtc_vblank_on(crtc_state);
+   for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc, pipe_mask) {
+   const struct intel_crtc_state *new_crtc_state =
+   intel_atomic_get_new_crtc_state(state, crtc);
+   intel_crtc_vblank_on(new_crtc_state);
+   }
+}
+
+static void intel_enable_ddi(struct intel_atomic_state *state,
+struct intel_encoder *encoder,
+const struct intel_crtc_state *crtc_state,
+const struct drm_connector_state *conn_state)
+{
+   drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
+
+   if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))
+   intel_ddi_enable_hdmi_or_sst(state, encoder, crtc_state, 
conn_state);
 
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
intel_enable_ddi_hdmi(state, encoder, crtc_state, conn_state);
@@ -3391,7 +3419,6 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
intel_enable_ddi_dp(state, encoder, crtc_state, conn_state);
 
intel_hdcp_enable(state, encoder, crtc_state, conn_state);
-
 }
 
 static void intel_disable_ddi_dp(struct intel_atomic_state *state,
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index a1eccefde9f09..af029577e58bb 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -794,7 +794,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state 
*state,
return encoder;
 }
 
-static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
+void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
 {

[PATCH 5/6] drm/i915: Handle joined pipes inside hsw_crtc_enable()

2024-03-18 Thread Stanislav Lisovskiy
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

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_ddi.c |  45 --
 drivers/gpu/drm/i915/display/intel_display.c | 162 +--
 drivers/gpu/drm/i915/display/intel_display.h |   7 +
 3 files changed, 124 insertions(+), 90 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 290ccab7c9ee8..9128b82a49c31 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3366,15 +3366,28 @@ static void intel_enable_ddi_hdmi(struct 
intel_atomic_state *state,
intel_wait_ddi_buf_active(dev_priv, port);
 }
 
-static void intel_enable_ddi(struct intel_atomic_state *state,
-struct intel_encoder *encoder,
-const struct intel_crtc_state *crtc_state,
-const struct drm_connector_state *conn_state)
+static void intel_ddi_enable_hdmi_or_sst(struct intel_atomic_state *state,
+struct intel_encoder *encoder,
+const struct intel_crtc_state 
*crtc_state,
+const struct drm_connector_state 
*conn_state)
 {
-   drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   u8 pipe_mask = intel_crtc_joined_pipe_mask(crtc_state);
+   struct intel_crtc *crtc;
+
+   for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc, pipe_mask) {
+   const struct intel_crtc_state *new_crtc_state =
+   intel_atomic_get_new_crtc_state(state, crtc);
+
+   intel_dsc_enable(new_crtc_state);
+
+   if (DISPLAY_VER(i915) >= 9)
+   skl_pfit_enable(new_crtc_state);
+   else
+   ilk_pfit_enable(new_crtc_state);
+   }
 
-   if (!intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_ddi_enable_transcoder_func(encoder, crtc_state);
+   intel_ddi_enable_transcoder_func(encoder, crtc_state);
 
/* Enable/Disable DP2.0 SDP split config before transcoder */
intel_audio_sdp_split_update(crtc_state);
@@ -3383,7 +3396,22 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
 
intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
 
-   intel_crtc_vblank_on(crtc_state);
+   for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc, pipe_mask) {
+   const struct intel_crtc_state *new_crtc_state =
+   intel_atomic_get_new_crtc_state(state, crtc);
+   intel_crtc_vblank_on(new_crtc_state);
+   }
+}
+
+static void intel_enable_ddi(struct intel_atomic_state *state,
+struct intel_encoder *encoder,
+const struct intel_crtc_state *crtc_state,
+const struct drm_connector_state *conn_state)
+{
+   drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
+
+   if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))
+   intel_ddi_enable_hdmi_or_sst(state, encoder, crtc_state, 
conn_state);
 
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
intel_enable_ddi_hdmi(state, encoder, crtc_state, conn_state);
@@ -3391,7 +3419,6 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
intel_enable_ddi_dp(state, encoder, crtc_state, conn_state);
 
intel_hdcp_enable(state, encoder, crtc_state, conn_state);
-
 }
 
 static void intel_disable_ddi_dp(struct intel_atomic_state *state,
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index a1eccefde9f09..eccc680affad7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -794,7 +794,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state 
*state,
return encoder;
 }
 
-static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
+void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
   

[PATCH 5/6] drm/i915: Handle joined pipes inside hsw_crtc_enable()

2024-03-13 Thread Stanislav Lisovskiy
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.

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_ddi.c |  30 +++-
 drivers/gpu/drm/i915/display/intel_display.c | 162 +--
 drivers/gpu/drm/i915/display/intel_display.h |   7 +
 3 files changed, 115 insertions(+), 84 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 15441674c6f58..edfd22bea9e7a 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3366,6 +3366,30 @@ static void intel_enable_ddi_hdmi(struct 
intel_atomic_state *state,
intel_wait_ddi_buf_active(dev_priv, port);
 }
 
+static void intel_ddi_enable_hdmi_or_sst(struct intel_atomic_state *state,
+struct intel_encoder *encoder,
+const struct intel_crtc_state 
*crtc_state,
+const struct drm_connector_state 
*conn_state)
+{
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   u8 pipe_mask = intel_crtc_joined_pipe_mask(crtc_state);
+   struct intel_crtc *crtc;
+
+   for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc, pipe_mask) {
+   const struct intel_crtc_state *new_crtc_state =
+   intel_atomic_get_new_crtc_state(state, crtc);
+
+   intel_dsc_enable(new_crtc_state);
+
+   if (DISPLAY_VER(i915) >= 9)
+   skl_pfit_enable(new_crtc_state);
+   else
+   ilk_pfit_enable(new_crtc_state);
+
+   intel_crtc_vblank_on(new_crtc_state);
+   }
+}
+
 static void intel_enable_ddi(struct intel_atomic_state *state,
 struct intel_encoder *encoder,
 const struct intel_crtc_state *crtc_state,
@@ -3373,8 +3397,7 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
 {
drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
 
-   if (!intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_ddi_enable_transcoder_func(encoder, crtc_state);
+   intel_ddi_enable_transcoder_func(encoder, crtc_state);
 
/* Enable/Disable DP2.0 SDP split config before transcoder */
intel_audio_sdp_split_update(crtc_state);
@@ -3383,7 +3406,8 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
 
intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
 
-   intel_crtc_vblank_on(crtc_state);
+   if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))
+   intel_ddi_enable_hdmi_or_sst(state, encoder, crtc_state, 
conn_state);
 
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
intel_enable_ddi_hdmi(state, encoder, crtc_state, conn_state);
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 3120fc80f0a67..8fa4f93700151 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -794,7 +794,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state 
*state,
return encoder;
 }
 
-static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
+void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -1593,24 +1593,6 @@ static void hsw_set_frame_start_delay(const struct 
intel_crtc_state *crtc_state)
 HSW_FRAME_START_DELAY(crtc_state->framestart_delay - 1));
 }
 
-static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
-const struct intel_crtc_state 
*crtc_state)
-{
-   struct intel_crtc *master_crtc = intel_master_crtc(crtc_state);
-
-   /*
-* Enable sequence steps 1-7 on bigjoiner master
-*/
-   if (intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_encoders_pre_pll_enable(state, master_crtc);
-
-   if (crtc_state->shared_dpll)
-   intel_enable_shared_dpll(crtc_state);
-
-   if (intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_encoders_pre_enable(state, 

[PATCH 5/6] drm/i915: Handle joined pipes inside hsw_crtc_enable()

2024-03-08 Thread Stanislav Lisovskiy
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.

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_ddi.c |  20 ++-
 drivers/gpu/drm/i915/display/intel_display.c | 162 +--
 drivers/gpu/drm/i915/display/intel_display.h |   7 +
 3 files changed, 105 insertions(+), 84 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 15441674c6f58..3756975bd561c 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3372,9 +3372,11 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
 const struct drm_connector_state *conn_state)
 {
drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder);
+   struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+   u8 pipe_mask = intel_crtc_joined_pipe_mask(crtc_state);
+   struct intel_crtc *crtc;
 
-   if (!intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_ddi_enable_transcoder_func(encoder, crtc_state);
+   intel_ddi_enable_transcoder_func(encoder, crtc_state);
 
/* Enable/Disable DP2.0 SDP split config before transcoder */
intel_audio_sdp_split_update(crtc_state);
@@ -3383,7 +3385,19 @@ static void intel_enable_ddi(struct intel_atomic_state 
*state,
 
intel_ddi_wait_for_fec_status(encoder, crtc_state, true);
 
-   intel_crtc_vblank_on(crtc_state);
+   for_each_intel_crtc_in_pipe_mask_reverse(>drm, crtc, pipe_mask) {
+   const struct intel_crtc_state *new_crtc_state =
+   intel_atomic_get_new_crtc_state(state, crtc);
+
+   intel_dsc_enable(new_crtc_state);
+
+   if (DISPLAY_VER(i915) >= 9)
+   skl_pfit_enable(new_crtc_state);
+   else
+   ilk_pfit_enable(new_crtc_state);
+
+   intel_crtc_vblank_on(new_crtc_state);
+   }
 
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
intel_enable_ddi_hdmi(state, encoder, crtc_state, conn_state);
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 3120fc80f0a67..8fa4f93700151 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -794,7 +794,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state 
*state,
return encoder;
 }
 
-static void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
+void ilk_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
@@ -1593,24 +1593,6 @@ static void hsw_set_frame_start_delay(const struct 
intel_crtc_state *crtc_state)
 HSW_FRAME_START_DELAY(crtc_state->framestart_delay - 1));
 }
 
-static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
-const struct intel_crtc_state 
*crtc_state)
-{
-   struct intel_crtc *master_crtc = intel_master_crtc(crtc_state);
-
-   /*
-* Enable sequence steps 1-7 on bigjoiner master
-*/
-   if (intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_encoders_pre_pll_enable(state, master_crtc);
-
-   if (crtc_state->shared_dpll)
-   intel_enable_shared_dpll(crtc_state);
-
-   if (intel_crtc_is_bigjoiner_slave(crtc_state))
-   intel_encoders_pre_enable(state, master_crtc);
-}
-
 static void hsw_configure_cpu_transcoder(const struct intel_crtc_state 
*crtc_state)
 {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -1646,90 +1628,103 @@ static void hsw_crtc_enable(struct intel_atomic_state 
*state,
const struct intel_crtc_state *new_crtc_state =
intel_atomic_get_new_crtc_state(state, crtc);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-   enum pipe pipe = crtc->pipe, hsw_workaround_pipe;
+   u8 pipe_mask = intel_crtc_joined_pipe_mask(new_crtc_state);
+   struct intel_crtc *pipe_mask_crtc;
enum transcoder cpu_transcoder = new_crtc_state->cpu_transcoder;
-   bool psl_clkgate_wa;
 
if (drm_WARN_ON(_priv->drm, crtc->active))
return;
 
-   intel_dmc_enable_pipe(dev_priv, crtc->pipe);
+