diff mbox series

[v2,4/6] drm/i915/alpm: Add compute config for lobf

Message ID 20240412155243.2891996-5-animesh.manna@intel.com (mailing list archive)
State New, archived
Headers show
Series Link off between frames for edp | expand

Commit Message

Manna, Animesh April 12, 2024, 3:52 p.m. UTC
Link Off Between Active Frames, is a new feature for eDP
that allows the panel to go to lower power state after
transmission of data. This is a feature on top of ALPM, AS SDP.
Add compute config during atomic-check phase.

v1: RFC version.
v2: Add separate flag for auxless-alpm. [Jani]

Signed-off-by: Animesh Manna <animesh.manna@intel.com>
---
 drivers/gpu/drm/i915/display/intel_alpm.c     | 44 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_alpm.h     |  5 +++
 .../drm/i915/display/intel_display_types.h    |  4 ++
 drivers/gpu/drm/i915/display/intel_dp.c       |  5 +++
 4 files changed, 58 insertions(+)

Comments

Hogander, Jouni April 15, 2024, 10:06 a.m. UTC | #1
On Fri, 2024-04-12 at 21:22 +0530, Animesh Manna wrote:
> Link Off Between Active Frames, is a new feature for eDP
> that allows the panel to go to lower power state after
> transmission of data. This is a feature on top of ALPM, AS SDP.
> Add compute config during atomic-check phase.
> 
> v1: RFC version.
> v2: Add separate flag for auxless-alpm. [Jani]
> 
> Signed-off-by: Animesh Manna <animesh.manna@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_alpm.c     | 44
> +++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_alpm.h     |  5 +++
>  .../drm/i915/display/intel_display_types.h    |  4 ++
>  drivers/gpu/drm/i915/display/intel_dp.c       |  5 +++
>  4 files changed, 58 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c
> b/drivers/gpu/drm/i915/display/intel_alpm.c
> index 13bac3e8c8fa..699f2f051766 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.c
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.c
> @@ -11,6 +11,16 @@
>  #include "intel_dp_aux.h"
>  #include "intel_psr_regs.h"
>  
> +bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp)
> +{
> +       u8 alpm_caps = 0;
> +
> +       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_RECEIVER_ALPM_CAP,
> +                             &alpm_caps) != 1)
> +               return false;
> +       return alpm_caps & DP_ALPM_AUX_LESS_CAP;
> +}
> +
>  /*
>   * See Bspec: 71632 for the table
>   *
> @@ -242,6 +252,40 @@ bool intel_alpm_compute_params(struct intel_dp
> *intel_dp,
>         return true;
>  }
>  
> +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> +                                   struct intel_crtc_state
> *crtc_state,
> +                                   struct drm_connector_state
> *conn_state)
> +{
> +       struct drm_display_mode *adjusted_mode = &crtc_state-
> >hw.adjusted_mode;
> +       int waketime_in_lines, first_sdp_position;
> +       int context_latency, guardband;
> +
> +       intel_dp->lobf_supported = false;
> +
> +       if (!intel_dp_is_edp(intel_dp))
> +               return;
> +
> +       if (!intel_dp_as_sdp_supported(intel_dp))
> +               return;
> +
> +       if (crtc_state->has_psr2 || crtc_state->has_panel_replay)
> +               return;

LOBF is not supported with PSR1? I think checking crtc_state->has_psr
is enough. That covers PSR1/2 and Panel Replay.

> +
> +       if (intel_alpm_compute_params(intel_dp, crtc_state)) {
> +               context_latency = adjusted_mode->crtc_vblank_start -
> adjusted_mode->crtc_vdisplay;
> +               guardband = adjusted_mode->crtc_vtotal -
> +                           adjusted_mode->crtc_vdisplay -
> context_latency;
> +               first_sdp_position = adjusted_mode->crtc_vtotal -
> adjusted_mode->crtc_vsync_start;
> +               if (intel_dp->alpm_parameters.auxless_alpm_supported)
> +                       waketime_in_lines = intel_dp-
> >alpm_parameters.io_wake_lines;
> +               else
> +                       waketime_in_lines = intel_dp-
> >alpm_parameters.fast_wake_lines;
> +
> +               if ((context_latency + guardband) >
> (first_sdp_position + waketime_in_lines))
> +                       intel_dp->lobf_supported = true;
> +       }

You are not checking display version here. This is supported only on
LNL and onwards.

> +}
> +
>  static void lnl_alpm_configure(struct intel_dp *intel_dp)
>  {
>         struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.h
> b/drivers/gpu/drm/i915/display/intel_alpm.h
> index c45d078e5a6b..c341d2c2b7f7 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.h
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.h
> @@ -10,9 +10,14 @@
>  
>  struct intel_dp;
>  struct intel_crtc_state;
> +struct drm_connector_state;
>  
> +bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp);
>  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
>                                struct intel_crtc_state *crtc_state);
> +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> +                                   struct intel_crtc_state
> *crtc_state,
> +                                   struct drm_connector_state
> *conn_state);
>  void intel_alpm_configure(struct intel_dp *intel_dp);
>  
>  #endif
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 73197f014510..6116c383b543 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1876,10 +1876,14 @@ struct intel_dp {
>                 u8 fast_wake_lines;
>  
>                 /* LNL and beyond */
> +               bool auxless_alpm_supported;
>                 u8 check_entry_lines;
>                 u8 silence_period_sym_clocks;
>                 u8 lfps_half_cycle_num_of_syms;
>         } alpm_parameters;
> +
> +       /* LOBF flags*/
> +       bool lobf_supported;

I think having it here and naming like this is misleading. How about
intel_crtc_state->has_lobf?

>  };
>  
>  enum lspcon_vendor {
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index 163da48bc406..12ec796568d9 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -48,6 +48,7 @@
>  #include "i915_drv.h"
>  #include "i915_irq.h"
>  #include "i915_reg.h"
> +#include "intel_alpm.h"
>  #include "intel_atomic.h"
>  #include "intel_audio.h"
>  #include "intel_backlight.h"
> @@ -3001,6 +3002,7 @@ intel_dp_compute_config(struct intel_encoder
> *encoder,
>         intel_vrr_compute_config(pipe_config, conn_state);
>         intel_dp_compute_as_sdp(intel_dp, pipe_config);
>         intel_psr_compute_config(intel_dp, pipe_config, conn_state);
> +       intel_alpm_compute_lobf_config(intel_dp, pipe_config,
> conn_state);
>         intel_dp_drrs_compute_config(connector, pipe_config,
> link_bpp_x16);
>         intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state);
>         intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp,
> pipe_config, conn_state);
> @@ -6616,6 +6618,9 @@ static bool intel_edp_init_connector(struct
> intel_dp *intel_dp,
>  
>         intel_pps_init_late(intel_dp);
>  
> +       if (intel_dp_get_aux_less_alpm_status(intel_dp))
> +               intel_dp->alpm_parameters.auxless_alpm_supported =
> true;
> +

intel_dp->alpm_parameters.auxless_alpm_supported =
intel_dp_get_aux_less_alpm_status(intel_dp);

BR,

Jouni Högander

>         return true;
>  
>  out_vdd_off:
Jani Nikula April 15, 2024, 11:47 a.m. UTC | #2
On Fri, 12 Apr 2024, Animesh Manna <animesh.manna@intel.com> wrote:
> diff --git a/drivers/gpu/drm/i915/display/intel_alpm.h b/drivers/gpu/drm/i915/display/intel_alpm.h
> index c45d078e5a6b..c341d2c2b7f7 100644
> --- a/drivers/gpu/drm/i915/display/intel_alpm.h
> +++ b/drivers/gpu/drm/i915/display/intel_alpm.h
> @@ -10,9 +10,14 @@
>  
>  struct intel_dp;
>  struct intel_crtc_state;
> +struct drm_connector_state;
>  
> +bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp);

The names here are supposed to be intel_alpm_*. Is the function in the
wrong place or is the name wrong?

BR,
Jani.

>  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
>  			       struct intel_crtc_state *crtc_state);
> +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> +				    struct intel_crtc_state *crtc_state,
> +				    struct drm_connector_state *conn_state);
>  void intel_alpm_configure(struct intel_dp *intel_dp);
>  
>  #endif
Manna, Animesh April 16, 2024, 8:15 a.m. UTC | #3
> -----Original Message-----
> From: Hogander, Jouni <jouni.hogander@intel.com>
> Sent: Monday, April 15, 2024 3:36 PM
> To: Manna, Animesh <animesh.manna@intel.com>; intel-
> gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org; Murthy, Arun R
> <arun.r.murthy@intel.com>; Nikula, Jani <jani.nikula@intel.com>
> Subject: Re: [PATCH v2 4/6] drm/i915/alpm: Add compute config for lobf
> 
> On Fri, 2024-04-12 at 21:22 +0530, Animesh Manna wrote:
> > Link Off Between Active Frames, is a new feature for eDP that allows
> > the panel to go to lower power state after transmission of data. This
> > is a feature on top of ALPM, AS SDP.
> > Add compute config during atomic-check phase.
> >
> > v1: RFC version.
> > v2: Add separate flag for auxless-alpm. [Jani]
> >
> > Signed-off-by: Animesh Manna <animesh.manna@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_alpm.c     | 44
> > +++++++++++++++++++
> >  drivers/gpu/drm/i915/display/intel_alpm.h     |  5 +++
> >  .../drm/i915/display/intel_display_types.h    |  4 ++
> >  drivers/gpu/drm/i915/display/intel_dp.c       |  5 +++
> >  4 files changed, 58 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c
> > b/drivers/gpu/drm/i915/display/intel_alpm.c
> > index 13bac3e8c8fa..699f2f051766 100644
> > --- a/drivers/gpu/drm/i915/display/intel_alpm.c
> > +++ b/drivers/gpu/drm/i915/display/intel_alpm.c
> > @@ -11,6 +11,16 @@
> >  #include "intel_dp_aux.h"
> >  #include "intel_psr_regs.h"
> >
> > +bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp) {
> > +       u8 alpm_caps = 0;
> > +
> > +       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_RECEIVER_ALPM_CAP,
> > +                             &alpm_caps) != 1)
> > +               return false;
> > +       return alpm_caps & DP_ALPM_AUX_LESS_CAP; }
> > +
> >  /*
> >   * See Bspec: 71632 for the table
> >   *
> > @@ -242,6 +252,40 @@ bool intel_alpm_compute_params(struct intel_dp
> > *intel_dp,
> >         return true;
> >  }
> >
> > +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> > +                                   struct intel_crtc_state
> > *crtc_state,
> > +                                   struct drm_connector_state
> > *conn_state)
> > +{
> > +       struct drm_display_mode *adjusted_mode = &crtc_state-
> > >hw.adjusted_mode;
> > +       int waketime_in_lines, first_sdp_position;
> > +       int context_latency, guardband;
> > +
> > +       intel_dp->lobf_supported = false;
> > +
> > +       if (!intel_dp_is_edp(intel_dp))
> > +               return;
> > +
> > +       if (!intel_dp_as_sdp_supported(intel_dp))
> > +               return;
> > +
> > +       if (crtc_state->has_psr2 || crtc_state->has_panel_replay)
> > +               return;
> 
> LOBF is not supported with PSR1? I think checking crtc_state->has_psr is
> enough. That covers PSR1/2 and Panel Replay.

Ok.

> 
> > +
> > +       if (intel_alpm_compute_params(intel_dp, crtc_state)) {
> > +               context_latency = adjusted_mode->crtc_vblank_start -
> > adjusted_mode->crtc_vdisplay;
> > +               guardband = adjusted_mode->crtc_vtotal -
> > +                           adjusted_mode->crtc_vdisplay -
> > context_latency;
> > +               first_sdp_position = adjusted_mode->crtc_vtotal -
> > adjusted_mode->crtc_vsync_start;
> > +               if (intel_dp->alpm_parameters.auxless_alpm_supported)
> > +                       waketime_in_lines = intel_dp-
> > >alpm_parameters.io_wake_lines;
> > +               else
> > +                       waketime_in_lines = intel_dp-
> > >alpm_parameters.fast_wake_lines;
> > +
> > +               if ((context_latency + guardband) >
> > (first_sdp_position + waketime_in_lines))
> > +                       intel_dp->lobf_supported = true;
> > +       }
> 
> You are not checking display version here. This is supported only on LNL and
> onwards.

Sure will add, thought as-sdp-support will take care, but it has display_ver >= 13.

> 
> > +}
> > +
> >  static void lnl_alpm_configure(struct intel_dp *intel_dp)
> >  {
> >         struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); diff
> > --git a/drivers/gpu/drm/i915/display/intel_alpm.h
> > b/drivers/gpu/drm/i915/display/intel_alpm.h
> > index c45d078e5a6b..c341d2c2b7f7 100644
> > --- a/drivers/gpu/drm/i915/display/intel_alpm.h
> > +++ b/drivers/gpu/drm/i915/display/intel_alpm.h
> > @@ -10,9 +10,14 @@
> >
> >  struct intel_dp;
> >  struct intel_crtc_state;
> > +struct drm_connector_state;
> >
> > +bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp);
> >  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
> >                                struct intel_crtc_state *crtc_state);
> > +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> > +                                   struct intel_crtc_state
> > *crtc_state,
> > +                                   struct drm_connector_state
> > *conn_state);
> >  void intel_alpm_configure(struct intel_dp *intel_dp);
> >
> >  #endif
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index 73197f014510..6116c383b543 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -1876,10 +1876,14 @@ struct intel_dp {
> >                 u8 fast_wake_lines;
> >
> >                 /* LNL and beyond */
> > +               bool auxless_alpm_supported;
> >                 u8 check_entry_lines;
> >                 u8 silence_period_sym_clocks;
> >                 u8 lfps_half_cycle_num_of_syms;
> >         } alpm_parameters;
> > +
> > +       /* LOBF flags*/
> > +       bool lobf_supported;
> 
> I think having it here and naming like this is misleading. How about
> intel_crtc_state->has_lobf?

How about "bool lobf_entry_criteria" ?

> 
> >  };
> >
> >  enum lspcon_vendor {
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> > b/drivers/gpu/drm/i915/display/intel_dp.c
> > index 163da48bc406..12ec796568d9 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > @@ -48,6 +48,7 @@
> >  #include "i915_drv.h"
> >  #include "i915_irq.h"
> >  #include "i915_reg.h"
> > +#include "intel_alpm.h"
> >  #include "intel_atomic.h"
> >  #include "intel_audio.h"
> >  #include "intel_backlight.h"
> > @@ -3001,6 +3002,7 @@ intel_dp_compute_config(struct intel_encoder
> > *encoder,
> >         intel_vrr_compute_config(pipe_config, conn_state);
> >         intel_dp_compute_as_sdp(intel_dp, pipe_config);
> >         intel_psr_compute_config(intel_dp, pipe_config, conn_state);
> > +       intel_alpm_compute_lobf_config(intel_dp, pipe_config,
> > conn_state);
> >         intel_dp_drrs_compute_config(connector, pipe_config,
> > link_bpp_x16);
> >         intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state);
> >         intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp,
> > pipe_config, conn_state);
> > @@ -6616,6 +6618,9 @@ static bool intel_edp_init_connector(struct
> > intel_dp *intel_dp,
> >
> >         intel_pps_init_late(intel_dp);
> >
> > +       if (intel_dp_get_aux_less_alpm_status(intel_dp))
> > +               intel_dp->alpm_parameters.auxless_alpm_supported =
> > true;
> > +
> 
> intel_dp->alpm_parameters.auxless_alpm_supported =
> intel_dp_get_aux_less_alpm_status(intel_dp);

Ok.

Regards,
Animesh

> 
> BR,
> 
> Jouni Högander
> 
> >         return true;
> >
> >  out_vdd_off:
Manna, Animesh April 16, 2024, 8:24 a.m. UTC | #4
> -----Original Message-----
> From: Nikula, Jani <jani.nikula@intel.com>
> Sent: Monday, April 15, 2024 5:18 PM
> To: Manna, Animesh <animesh.manna@intel.com>; intel-
> gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org; Hogander, Jouni
> <jouni.hogander@intel.com>; Murthy, Arun R <arun.r.murthy@intel.com>;
> Manna, Animesh <animesh.manna@intel.com>
> Subject: Re: [PATCH v2 4/6] drm/i915/alpm: Add compute config for lobf
> 
> On Fri, 12 Apr 2024, Animesh Manna <animesh.manna@intel.com> wrote:
> > diff --git a/drivers/gpu/drm/i915/display/intel_alpm.h
> > b/drivers/gpu/drm/i915/display/intel_alpm.h
> > index c45d078e5a6b..c341d2c2b7f7 100644
> > --- a/drivers/gpu/drm/i915/display/intel_alpm.h
> > +++ b/drivers/gpu/drm/i915/display/intel_alpm.h
> > @@ -10,9 +10,14 @@
> >
> >  struct intel_dp;
> >  struct intel_crtc_state;
> > +struct drm_connector_state;
> >
> > +bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp);
> 
> The names here are supposed to be intel_alpm_*. Is the function in the
> wrong place or is the name wrong?

Sure, will change the function name to intel_alpm_get_auxless_status().

Regards,
Animesh
> 
> BR,
> Jani.
> 
> >  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
> >  			       struct intel_crtc_state *crtc_state);
> > +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> > +				    struct intel_crtc_state *crtc_state,
> > +				    struct drm_connector_state *conn_state);
> >  void intel_alpm_configure(struct intel_dp *intel_dp);
> >
> >  #endif
> 
> --
> Jani Nikula, Intel
Hogander, Jouni April 16, 2024, 9:06 a.m. UTC | #5
On Tue, 2024-04-16 at 08:15 +0000, Manna, Animesh wrote:
> 
> 
> > -----Original Message-----
> > From: Hogander, Jouni <jouni.hogander@intel.com>
> > Sent: Monday, April 15, 2024 3:36 PM
> > To: Manna, Animesh <animesh.manna@intel.com>; intel-
> > gfx@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org; Murthy, Arun R
> > <arun.r.murthy@intel.com>; Nikula, Jani <jani.nikula@intel.com>
> > Subject: Re: [PATCH v2 4/6] drm/i915/alpm: Add compute config for
> > lobf
> > 
> > On Fri, 2024-04-12 at 21:22 +0530, Animesh Manna wrote:
> > > Link Off Between Active Frames, is a new feature for eDP that
> > > allows
> > > the panel to go to lower power state after transmission of data.
> > > This
> > > is a feature on top of ALPM, AS SDP.
> > > Add compute config during atomic-check phase.
> > > 
> > > v1: RFC version.
> > > v2: Add separate flag for auxless-alpm. [Jani]
> > > 
> > > Signed-off-by: Animesh Manna <animesh.manna@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_alpm.c     | 44
> > > +++++++++++++++++++
> > >  drivers/gpu/drm/i915/display/intel_alpm.h     |  5 +++
> > >  .../drm/i915/display/intel_display_types.h    |  4 ++
> > >  drivers/gpu/drm/i915/display/intel_dp.c       |  5 +++
> > >  4 files changed, 58 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c
> > > b/drivers/gpu/drm/i915/display/intel_alpm.c
> > > index 13bac3e8c8fa..699f2f051766 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_alpm.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_alpm.c
> > > @@ -11,6 +11,16 @@
> > >  #include "intel_dp_aux.h"
> > >  #include "intel_psr_regs.h"
> > > 
> > > +bool intel_dp_get_aux_less_alpm_status(struct intel_dp
> > > *intel_dp) {
> > > +       u8 alpm_caps = 0;
> > > +
> > > +       if (drm_dp_dpcd_readb(&intel_dp->aux,
> > > DP_RECEIVER_ALPM_CAP,
> > > +                             &alpm_caps) != 1)
> > > +               return false;
> > > +       return alpm_caps & DP_ALPM_AUX_LESS_CAP; }
> > > +
> > >  /*
> > >   * See Bspec: 71632 for the table
> > >   *
> > > @@ -242,6 +252,40 @@ bool intel_alpm_compute_params(struct
> > > intel_dp
> > > *intel_dp,
> > >         return true;
> > >  }
> > > 
> > > +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> > > +                                   struct intel_crtc_state
> > > *crtc_state,
> > > +                                   struct drm_connector_state
> > > *conn_state)
> > > +{
> > > +       struct drm_display_mode *adjusted_mode = &crtc_state-
> > > > hw.adjusted_mode;
> > > +       int waketime_in_lines, first_sdp_position;
> > > +       int context_latency, guardband;
> > > +
> > > +       intel_dp->lobf_supported = false;
> > > +
> > > +       if (!intel_dp_is_edp(intel_dp))
> > > +               return;
> > > +
> > > +       if (!intel_dp_as_sdp_supported(intel_dp))
> > > +               return;
> > > +
> > > +       if (crtc_state->has_psr2 || crtc_state->has_panel_replay)
> > > +               return;
> > 
> > LOBF is not supported with PSR1? I think checking crtc_state-
> > >has_psr is
> > enough. That covers PSR1/2 and Panel Replay.
> 
> Ok.
> 
> > 
> > > +
> > > +       if (intel_alpm_compute_params(intel_dp, crtc_state)) {
> > > +               context_latency = adjusted_mode-
> > > >crtc_vblank_start -
> > > adjusted_mode->crtc_vdisplay;
> > > +               guardband = adjusted_mode->crtc_vtotal -
> > > +                           adjusted_mode->crtc_vdisplay -
> > > context_latency;
> > > +               first_sdp_position = adjusted_mode->crtc_vtotal -
> > > adjusted_mode->crtc_vsync_start;
> > > +               if (intel_dp-
> > > >alpm_parameters.auxless_alpm_supported)
> > > +                       waketime_in_lines = intel_dp-
> > > > alpm_parameters.io_wake_lines;
> > > +               else
> > > +                       waketime_in_lines = intel_dp-
> > > > alpm_parameters.fast_wake_lines;
> > > +
> > > +               if ((context_latency + guardband) >
> > > (first_sdp_position + waketime_in_lines))
> > > +                       intel_dp->lobf_supported = true;
> > > +       }
> > 
> > You are not checking display version here. This is supported only
> > on LNL and
> > onwards.
> 
> Sure will add, thought as-sdp-support will take care, but it has
> display_ver >= 13.
> 
> > 
> > > +}
> > > +
> > >  static void lnl_alpm_configure(struct intel_dp *intel_dp)
> > >  {
> > >         struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> > > diff
> > > --git a/drivers/gpu/drm/i915/display/intel_alpm.h
> > > b/drivers/gpu/drm/i915/display/intel_alpm.h
> > > index c45d078e5a6b..c341d2c2b7f7 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_alpm.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_alpm.h
> > > @@ -10,9 +10,14 @@
> > > 
> > >  struct intel_dp;
> > >  struct intel_crtc_state;
> > > +struct drm_connector_state;
> > > 
> > > +bool intel_dp_get_aux_less_alpm_status(struct intel_dp
> > > *intel_dp);
> > >  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
> > >                                struct intel_crtc_state
> > > *crtc_state);
> > > +void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
> > > +                                   struct intel_crtc_state
> > > *crtc_state,
> > > +                                   struct drm_connector_state
> > > *conn_state);
> > >  void intel_alpm_configure(struct intel_dp *intel_dp);
> > > 
> > >  #endif
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h
> > > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > index 73197f014510..6116c383b543 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > > @@ -1876,10 +1876,14 @@ struct intel_dp {
> > >                 u8 fast_wake_lines;
> > > 
> > >                 /* LNL and beyond */
> > > +               bool auxless_alpm_supported;
> > >                 u8 check_entry_lines;
> > >                 u8 silence_period_sym_clocks;
> > >                 u8 lfps_half_cycle_num_of_syms;
> > >         } alpm_parameters;
> > > +
> > > +       /* LOBF flags*/
> > > +       bool lobf_supported;
> > 
> > I think having it here and naming like this is misleading. How
> > about
> > intel_crtc_state->has_lobf?
> 
> How about "bool lobf_entry_criteria" ?

My mind is polluted with PSR code: I would have chosen has_lobf. I'm
not against lobf_entry_criteria.

BR,

Jouni Högander

> 
> > 
> > >  };
> > > 
> > >  enum lspcon_vendor {
> > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> > > b/drivers/gpu/drm/i915/display/intel_dp.c
> > > index 163da48bc406..12ec796568d9 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > > @@ -48,6 +48,7 @@
> > >  #include "i915_drv.h"
> > >  #include "i915_irq.h"
> > >  #include "i915_reg.h"
> > > +#include "intel_alpm.h"
> > >  #include "intel_atomic.h"
> > >  #include "intel_audio.h"
> > >  #include "intel_backlight.h"
> > > @@ -3001,6 +3002,7 @@ intel_dp_compute_config(struct
> > > intel_encoder
> > > *encoder,
> > >         intel_vrr_compute_config(pipe_config, conn_state);
> > >         intel_dp_compute_as_sdp(intel_dp, pipe_config);
> > >         intel_psr_compute_config(intel_dp, pipe_config,
> > > conn_state);
> > > +       intel_alpm_compute_lobf_config(intel_dp, pipe_config,
> > > conn_state);
> > >         intel_dp_drrs_compute_config(connector, pipe_config,
> > > link_bpp_x16);
> > >         intel_dp_compute_vsc_sdp(intel_dp, pipe_config,
> > > conn_state);
> > >         intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp,
> > > pipe_config, conn_state);
> > > @@ -6616,6 +6618,9 @@ static bool intel_edp_init_connector(struct
> > > intel_dp *intel_dp,
> > > 
> > >         intel_pps_init_late(intel_dp);
> > > 
> > > +       if (intel_dp_get_aux_less_alpm_status(intel_dp))
> > > +               intel_dp->alpm_parameters.auxless_alpm_supported
> > > =
> > > true;
> > > +
> > 
> > intel_dp->alpm_parameters.auxless_alpm_supported =
> > intel_dp_get_aux_less_alpm_status(intel_dp);
> 
> Ok.
> 
> Regards,
> Animesh
> 
> > 
> > BR,
> > 
> > Jouni Högander
> > 
> > >         return true;
> > > 
> > >  out_vdd_off:
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
index 13bac3e8c8fa..699f2f051766 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.c
+++ b/drivers/gpu/drm/i915/display/intel_alpm.c
@@ -11,6 +11,16 @@ 
 #include "intel_dp_aux.h"
 #include "intel_psr_regs.h"
 
+bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp)
+{
+	u8 alpm_caps = 0;
+
+	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_RECEIVER_ALPM_CAP,
+			      &alpm_caps) != 1)
+		return false;
+	return alpm_caps & DP_ALPM_AUX_LESS_CAP;
+}
+
 /*
  * See Bspec: 71632 for the table
  *
@@ -242,6 +252,40 @@  bool intel_alpm_compute_params(struct intel_dp *intel_dp,
 	return true;
 }
 
+void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
+				    struct intel_crtc_state *crtc_state,
+				    struct drm_connector_state *conn_state)
+{
+	struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
+	int waketime_in_lines, first_sdp_position;
+	int context_latency, guardband;
+
+	intel_dp->lobf_supported = false;
+
+	if (!intel_dp_is_edp(intel_dp))
+		return;
+
+	if (!intel_dp_as_sdp_supported(intel_dp))
+		return;
+
+	if (crtc_state->has_psr2 || crtc_state->has_panel_replay)
+		return;
+
+	if (intel_alpm_compute_params(intel_dp, crtc_state)) {
+		context_latency = adjusted_mode->crtc_vblank_start - adjusted_mode->crtc_vdisplay;
+		guardband = adjusted_mode->crtc_vtotal -
+			    adjusted_mode->crtc_vdisplay - context_latency;
+		first_sdp_position = adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vsync_start;
+		if (intel_dp->alpm_parameters.auxless_alpm_supported)
+			waketime_in_lines = intel_dp->alpm_parameters.io_wake_lines;
+		else
+			waketime_in_lines = intel_dp->alpm_parameters.fast_wake_lines;
+
+		if ((context_latency + guardband) > (first_sdp_position + waketime_in_lines))
+			intel_dp->lobf_supported = true;
+	}
+}
+
 static void lnl_alpm_configure(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
diff --git a/drivers/gpu/drm/i915/display/intel_alpm.h b/drivers/gpu/drm/i915/display/intel_alpm.h
index c45d078e5a6b..c341d2c2b7f7 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.h
+++ b/drivers/gpu/drm/i915/display/intel_alpm.h
@@ -10,9 +10,14 @@ 
 
 struct intel_dp;
 struct intel_crtc_state;
+struct drm_connector_state;
 
+bool intel_dp_get_aux_less_alpm_status(struct intel_dp *intel_dp);
 bool intel_alpm_compute_params(struct intel_dp *intel_dp,
 			       struct intel_crtc_state *crtc_state);
+void intel_alpm_compute_lobf_config(struct intel_dp *intel_dp,
+				    struct intel_crtc_state *crtc_state,
+				    struct drm_connector_state *conn_state);
 void intel_alpm_configure(struct intel_dp *intel_dp);
 
 #endif
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 73197f014510..6116c383b543 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1876,10 +1876,14 @@  struct intel_dp {
 		u8 fast_wake_lines;
 
 		/* LNL and beyond */
+		bool auxless_alpm_supported;
 		u8 check_entry_lines;
 		u8 silence_period_sym_clocks;
 		u8 lfps_half_cycle_num_of_syms;
 	} alpm_parameters;
+
+	/* LOBF flags*/
+	bool lobf_supported;
 };
 
 enum lspcon_vendor {
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 163da48bc406..12ec796568d9 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -48,6 +48,7 @@ 
 #include "i915_drv.h"
 #include "i915_irq.h"
 #include "i915_reg.h"
+#include "intel_alpm.h"
 #include "intel_atomic.h"
 #include "intel_audio.h"
 #include "intel_backlight.h"
@@ -3001,6 +3002,7 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 	intel_vrr_compute_config(pipe_config, conn_state);
 	intel_dp_compute_as_sdp(intel_dp, pipe_config);
 	intel_psr_compute_config(intel_dp, pipe_config, conn_state);
+	intel_alpm_compute_lobf_config(intel_dp, pipe_config, conn_state);
 	intel_dp_drrs_compute_config(connector, pipe_config, link_bpp_x16);
 	intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state);
 	intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, pipe_config, conn_state);
@@ -6616,6 +6618,9 @@  static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 
 	intel_pps_init_late(intel_dp);
 
+	if (intel_dp_get_aux_less_alpm_status(intel_dp))
+		intel_dp->alpm_parameters.auxless_alpm_supported = true;
+
 	return true;
 
 out_vdd_off: