diff mbox series

[04/14] drm/i915/ddi: For an active output call the DP encoder sync_state() only for DP

Message ID 20240722165503.2084999-5-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dp_mst: Enable LT fallback for UHBR<->non-UHBR rates | expand

Commit Message

Imre Deak July 22, 2024, 4:54 p.m. UTC
If the DDI encoder output is enabled in HDMI mode there is no point in
calling intel_dp_sync_state(), as in that case the DPCD initialization
will fail - as expected - with AUX timeouts. Prevent calling the hook in
this case.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Kandpal, Suraj July 23, 2024, 8:28 a.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Imre
> Deak
> Sent: Monday, July 22, 2024 10:25 PM
> To: intel-gfx@lists.freedesktop.org
> Subject: [PATCH 04/14] drm/i915/ddi: For an active output call the DP
> encoder sync_state() only for DP
> 
> If the DDI encoder output is enabled in HDMI mode there is no point in
> calling intel_dp_sync_state(), as in that case the DPCD initialization will fail -
> as expected - with AUX timeouts. Prevent calling the hook in this case.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index a07aca96e5517..11ee4406dce8f 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4172,7 +4172,8 @@ static void intel_ddi_sync_state(struct
> intel_encoder *encoder,
>  		intel_tc_port_sanitize_mode(enc_to_dig_port(encoder),
>  					    crtc_state);
> 
> -	if (intel_encoder_is_dp(encoder))
> +	if ((crtc_state && intel_crtc_has_dp_encoder(crtc_state)) ||
> +	    (!crtc_state && intel_encoder_is_dp(encoder)))

So we are trying to avoid calling  intel_dp_sync_state incase intel_encoder_is_dp returns INTEL_OUTPUT_DDI
in that case why are we still keeping the check intel_encoder_is_dp when crtc_state is not present.

Regards,
Suraj Kandpal

>  		intel_dp_sync_state(encoder, crtc_state);  }
> 
> --
> 2.44.2
Imre Deak July 23, 2024, 11:56 a.m. UTC | #2
On Tue, Jul 23, 2024 at 11:28:33AM +0300, Kandpal, Suraj wrote:
> 
> 
> > -----Original Message-----
> > From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Imre
> > Deak
> > Sent: Monday, July 22, 2024 10:25 PM
> > To: intel-gfx@lists.freedesktop.org
> > Subject: [PATCH 04/14] drm/i915/ddi: For an active output call the DP
> > encoder sync_state() only for DP
> >
> > If the DDI encoder output is enabled in HDMI mode there is no point in
> > calling intel_dp_sync_state(), as in that case the DPCD initialization will fail -
> > as expected - with AUX timeouts. Prevent calling the hook in this case.
> >
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_ddi.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > index a07aca96e5517..11ee4406dce8f 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > @@ -4172,7 +4172,8 @@ static void intel_ddi_sync_state(struct
> > intel_encoder *encoder,
> >               intel_tc_port_sanitize_mode(enc_to_dig_port(encoder),
> >                                           crtc_state);
> >
> > -     if (intel_encoder_is_dp(encoder))
> > +     if ((crtc_state && intel_crtc_has_dp_encoder(crtc_state)) ||
> > +         (!crtc_state && intel_encoder_is_dp(encoder)))
> 
> So we are trying to avoid calling  intel_dp_sync_state incase
> intel_encoder_is_dp returns INTEL_OUTPUT_DDI in that case why are we
> still keeping the check intel_encoder_is_dp when crtc_state is not
> present.

intel_encoder_is_dp() returns true if a DP connector is registered using
this DDI encoder. If the output is disabled (so crtc_state==NULL) that's
the only way to determine if the encoder may be used for DP (unless an
HDMI connector is also registered using this same encoder and that's
what is actually used on the given platform). In case the output is
enabled the DP/HDMI mode in crtc_state gives the same answer, but by
checking that instead we avoid calling the DP specific hook if the
encoder is used by HDMI.

> Regards,
> Suraj Kandpal
> 
> >               intel_dp_sync_state(encoder, crtc_state);  }
> >
> > --
> > 2.44.2
>
Kandpal, Suraj July 23, 2024, 1:04 p.m. UTC | #3
> -----Original Message-----
> From: Deak, Imre <imre.deak@intel.com>
> Sent: Tuesday, July 23, 2024 5:26 PM
> To: Kandpal, Suraj <suraj.kandpal@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [PATCH 04/14] drm/i915/ddi: For an active output call the DP
> encoder sync_state() only for DP
> 
> On Tue, Jul 23, 2024 at 11:28:33AM +0300, Kandpal, Suraj wrote:
> >
> >
> > > -----Original Message-----
> > > From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf
> > > Of Imre Deak
> > > Sent: Monday, July 22, 2024 10:25 PM
> > > To: intel-gfx@lists.freedesktop.org
> > > Subject: [PATCH 04/14] drm/i915/ddi: For an active output call the
> > > DP encoder sync_state() only for DP
> > >
> > > If the DDI encoder output is enabled in HDMI mode there is no point
> > > in calling intel_dp_sync_state(), as in that case the DPCD
> > > initialization will fail - as expected - with AUX timeouts. Prevent calling
> the hook in this case.
> > >
> > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_ddi.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> > > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > index a07aca96e5517..11ee4406dce8f 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > @@ -4172,7 +4172,8 @@ static void intel_ddi_sync_state(struct
> > > intel_encoder *encoder,
> > >               intel_tc_port_sanitize_mode(enc_to_dig_port(encoder),
> > >                                           crtc_state);
> > >
> > > -     if (intel_encoder_is_dp(encoder))
> > > +     if ((crtc_state && intel_crtc_has_dp_encoder(crtc_state)) ||
> > > +         (!crtc_state && intel_encoder_is_dp(encoder)))
> >
> > So we are trying to avoid calling  intel_dp_sync_state incase
> > intel_encoder_is_dp returns INTEL_OUTPUT_DDI in that case why are we
> > still keeping the check intel_encoder_is_dp when crtc_state is not
> > present.
> 
> intel_encoder_is_dp() returns true if a DP connector is registered using this
> DDI encoder. If the output is disabled (so crtc_state==NULL) that's the only
> way to determine if the encoder may be used for DP (unless an HDMI
> connector is also registered using this same encoder and that's what is
> actually used on the given platform). In case the output is enabled the
> DP/HDMI mode in crtc_state gives the same answer, but by checking that
> instead we avoid calling the DP specific hook if the encoder is used by HDMI.
> 

Ohkay got it
In that case LGTM,
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>

> > Regards,
> > Suraj Kandpal
> >
> > >               intel_dp_sync_state(encoder, crtc_state);  }
> > >
> > > --
> > > 2.44.2
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index a07aca96e5517..11ee4406dce8f 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4172,7 +4172,8 @@  static void intel_ddi_sync_state(struct intel_encoder *encoder,
 		intel_tc_port_sanitize_mode(enc_to_dig_port(encoder),
 					    crtc_state);
 
-	if (intel_encoder_is_dp(encoder))
+	if ((crtc_state && intel_crtc_has_dp_encoder(crtc_state)) ||
+	    (!crtc_state && intel_encoder_is_dp(encoder)))
 		intel_dp_sync_state(encoder, crtc_state);
 }