On Fri, 11 Mar 2022, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Add a helper to determine which type of DRRS the panel supports. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_drrs.c | 10 +++------- > drivers/gpu/drm/i915/display/intel_panel.c | 10 ++++++++++ > drivers/gpu/drm/i915/display/intel_panel.h | 2 ++ > 3 files changed, 15 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c > index 2a58bf4cb6cd..c663df51a84a 100644 > --- a/drivers/gpu/drm/i915/display/intel_drrs.c > +++ b/drivers/gpu/drm/i915/display/intel_drrs.c > @@ -48,11 +48,8 @@ > */ > > static bool can_enable_drrs(struct intel_connector *connector, > - const struct intel_crtc_state *pipe_config, > - const struct drm_display_mode *downclock_mode) > + const struct intel_crtc_state *pipe_config) > { > - const struct drm_i915_private *i915 = to_i915(connector->base.dev); > - > if (pipe_config->vrr.enable) > return false; > > @@ -65,8 +62,7 @@ static bool can_enable_drrs(struct intel_connector *connector, > if (pipe_config->has_psr) > return false; > > - return downclock_mode && > - i915->vbt.drrs_type == DRRS_TYPE_SEAMLESS; > + return intel_panel_drrs_type(connector) == DRRS_TYPE_SEAMLESS; > } > > void > @@ -80,7 +76,7 @@ intel_drrs_compute_config(struct intel_dp *intel_dp, > intel_panel_downclock_mode(connector, &pipe_config->hw.adjusted_mode); > int pixel_clock; > > - if (!can_enable_drrs(connector, pipe_config, downclock_mode)) { > + if (!can_enable_drrs(connector, pipe_config)) { > if (intel_cpu_transcoder_has_m2_n2(i915, pipe_config->cpu_transcoder)) > intel_zero_m_n(&pipe_config->dp_m2_n2); > return; > diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c > index 3ca37766ccb3..c15f5e3d53d1 100644 > --- a/drivers/gpu/drm/i915/display/intel_panel.c > +++ b/drivers/gpu/drm/i915/display/intel_panel.c > @@ -83,6 +83,16 @@ int intel_panel_get_modes(struct intel_connector *connector) > return num_modes; > } > > +enum drrs_type intel_panel_drrs_type(struct intel_connector *connector) > +{ > + struct drm_i915_private *i915 = to_i915(connector->base.dev); > + > + if (!connector->panel.downclock_mode) > + return DRRS_TYPE_NONE; > + > + return i915->vbt.drrs_type; > +} > + > int intel_panel_compute_config(struct intel_connector *connector, > struct drm_display_mode *adjusted_mode) > { > diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h > index 88e6f5c217d8..e86100903f9e 100644 > --- a/drivers/gpu/drm/i915/display/intel_panel.h > +++ b/drivers/gpu/drm/i915/display/intel_panel.h > @@ -9,6 +9,7 @@ > #include <linux/types.h> > > enum drm_connector_status; > +enum drrs_type; > struct drm_connector; > struct drm_connector_state; > struct drm_display_mode; > @@ -33,6 +34,7 @@ const struct drm_display_mode * > intel_panel_downclock_mode(struct intel_connector *connector, > const struct drm_display_mode *adjusted_mode); > int intel_panel_get_modes(struct intel_connector *connector); > +enum drrs_type intel_panel_drrs_type(struct intel_connector *connector); > enum drm_mode_status > intel_panel_mode_valid(struct intel_connector *connector, > const struct drm_display_mode *mode); -- Jani Nikula, Intel Open Source Graphics Center