diff mbox series

[v3,5/6] drm/i915: Tighten DRRS capability reporting

Message ID 20221003113249.16213-6-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Per-crtc/connector DRRS debugfs | expand

Commit Message

Ville Syrjälä Oct. 3, 2022, 11:32 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Only report DRRS capability for the connector if its fixed_modes
list contains at least two modes capable of seamless DRRS switch
between them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_panel.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Comments

Jani Nikula Oct. 4, 2022, 8:59 a.m. UTC | #1
On Mon, 03 Oct 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Only report DRRS capability for the connector if its fixed_modes
> list contains at least two modes capable of seamless DRRS switch
> between them.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Makes sense,

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_panel.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 41cec9dc4223..d18c56cf957d 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -147,10 +147,25 @@ int intel_panel_get_modes(struct intel_connector *connector)
>  	return num_modes;
>  }
>  
> +static bool has_drrs_modes(struct intel_connector *connector)
> +{
> +	const struct drm_display_mode *mode1;
> +
> +	list_for_each_entry(mode1, &connector->panel.fixed_modes, head) {
> +		const struct drm_display_mode *mode2 = mode1;
> +
> +		list_for_each_entry_continue(mode2, &connector->panel.fixed_modes, head) {
> +			if (is_alt_drrs_mode(mode1, mode2))
> +				return true;
> +		}
> +	}
> +
> +	return false;
> +}
> +
>  enum drrs_type intel_panel_drrs_type(struct intel_connector *connector)
>  {
> -	if (list_empty(&connector->panel.fixed_modes) ||
> -	    list_is_singular(&connector->panel.fixed_modes))
> +	if (!has_drrs_modes(connector))
>  		return DRRS_TYPE_NONE;
>  
>  	return connector->panel.vbt.drrs_type;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 41cec9dc4223..d18c56cf957d 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -147,10 +147,25 @@  int intel_panel_get_modes(struct intel_connector *connector)
 	return num_modes;
 }
 
+static bool has_drrs_modes(struct intel_connector *connector)
+{
+	const struct drm_display_mode *mode1;
+
+	list_for_each_entry(mode1, &connector->panel.fixed_modes, head) {
+		const struct drm_display_mode *mode2 = mode1;
+
+		list_for_each_entry_continue(mode2, &connector->panel.fixed_modes, head) {
+			if (is_alt_drrs_mode(mode1, mode2))
+				return true;
+		}
+	}
+
+	return false;
+}
+
 enum drrs_type intel_panel_drrs_type(struct intel_connector *connector)
 {
-	if (list_empty(&connector->panel.fixed_modes) ||
-	    list_is_singular(&connector->panel.fixed_modes))
+	if (!has_drrs_modes(connector))
 		return DRRS_TYPE_NONE;
 
 	return connector->panel.vbt.drrs_type;