diff mbox series

[5/9] drm/i915/pfit: Reject cloning when using pfit on ILK-BDW

Message ID 20241016143134.26903-6-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/pfit: Panel fitter stuff | expand

Commit Message

Ville Syrjala Oct. 16, 2024, 2:31 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The panel fitter lives inside the pipe and so would affect all cloned
outputs. However the relevant properties (scaling mode, TV margins)
are per-connector so we could end up with a situation where each cloned
output wants a different pfit configuration. Let's just reject pfit
usage with cloning entirely.

Currently not an issue as we don't yet expose the TV margin
properties, but if/when we add those to HDMI we could end up
in this situation. For eDP/DP we don't support cloning anyyway.

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

Comments

Jani Nikula Oct. 22, 2024, 8:25 a.m. UTC | #1
On Wed, 16 Oct 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The panel fitter lives inside the pipe and so would affect all cloned
> outputs. However the relevant properties (scaling mode, TV margins)
> are per-connector so we could end up with a situation where each cloned
> output wants a different pfit configuration. Let's just reject pfit
> usage with cloning entirely.
>
> Currently not an issue as we don't yet expose the TV margin
> properties, but if/when we add those to HDMI we could end up
> in this situation. For eDP/DP we don't support cloning anyyway.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_panel.c | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index dc843892b01b..593e41907d53 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -474,6 +474,29 @@ static int intel_pch_pfit_check_timings(const struct intel_crtc_state *crtc_stat
>  	return 0;
>  }
>  
> +static int intel_pch_pfit_check_cloning(const struct intel_crtc_state *crtc_state)
> +{
> +	struct intel_display *display = to_intel_display(crtc_state);
> +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> +
> +	/*
> +	 * The panel fitter is in the pipe and thus would affect every
> +	 * cloned output. The relevant properties (scaling mode, TV
> +	 * margins) are per-connector so we'd have to make sure each
> +	 * output sets them up identically. Seems like a very niche use
> +	 * case so let's just reject cloning entirely when pfit is used.
> +	 */
> +	if (crtc_state->uapi.encoder_mask &&
> +	    !is_power_of_2(crtc_state->uapi.encoder_mask)) {
> +		drm_dbg_kms(display->drm,
> +			    "[CRTC:%d:%s] no pfit when cloning\n",
> +			    crtc->base.base.id, crtc->base.name);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
>  /* adjusted_mode has been preset to be the panel's fixed mode */
>  static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
>  			     const struct drm_connector_state *conn_state)
> @@ -564,6 +587,10 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
>  	if (ret)
>  		return ret;
>  
> +	ret = intel_pch_pfit_check_cloning(crtc_state);
> +	if (ret)
> +		return ret;
> +
>  	return 0;
>  }
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 dc843892b01b..593e41907d53 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -474,6 +474,29 @@  static int intel_pch_pfit_check_timings(const struct intel_crtc_state *crtc_stat
 	return 0;
 }
 
+static int intel_pch_pfit_check_cloning(const struct intel_crtc_state *crtc_state)
+{
+	struct intel_display *display = to_intel_display(crtc_state);
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+	/*
+	 * The panel fitter is in the pipe and thus would affect every
+	 * cloned output. The relevant properties (scaling mode, TV
+	 * margins) are per-connector so we'd have to make sure each
+	 * output sets them up identically. Seems like a very niche use
+	 * case so let's just reject cloning entirely when pfit is used.
+	 */
+	if (crtc_state->uapi.encoder_mask &&
+	    !is_power_of_2(crtc_state->uapi.encoder_mask)) {
+		drm_dbg_kms(display->drm,
+			    "[CRTC:%d:%s] no pfit when cloning\n",
+			    crtc->base.base.id, crtc->base.name);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 /* adjusted_mode has been preset to be the panel's fixed mode */
 static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
 			     const struct drm_connector_state *conn_state)
@@ -564,6 +587,10 @@  static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
 	if (ret)
 		return ret;
 
+	ret = intel_pch_pfit_check_cloning(crtc_state);
+	if (ret)
+		return ret;
+
 	return 0;
 }