Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/9] drm/i915/pfit: Check pfit minimum timings in pre-SKL
Date: Wed, 16 Oct 2024 17:31:29 +0300	[thread overview]
Message-ID: <20241016143134.26903-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20241016143134.26903-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Transcoder hdisplay/vdisplay have documented minimum limits
when using the panel fitter. Enforce those limits for all
pre-SKL platforms. SKL+ handles everything in the unified
scaler code instead.

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

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 89cac3b3fd02..dc843892b01b 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -456,6 +456,24 @@ static int intel_pch_pfit_check_scaling(const struct intel_crtc_state *crtc_stat
 	return 0;
 }
 
+static int intel_pch_pfit_check_timings(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);
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->hw.adjusted_mode;
+
+	if (adjusted_mode->crtc_vdisplay < 7) {
+		drm_dbg_kms(display->drm,
+			    "[CRTC:%d:%s] vertical active (%d) below minimum (%d) for pfit\n",
+			    crtc->base.base.id, crtc->base.name,
+			    adjusted_mode->crtc_vdisplay, 7);
+		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)
@@ -542,6 +560,10 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
 	if (ret)
 		return ret;
 
+	ret = intel_pch_pfit_check_timings(crtc_state);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
@@ -678,6 +700,38 @@ static void i9xx_scale_aspect(struct intel_crtc_state *crtc_state,
 	}
 }
 
+static int intel_gmch_pfit_check_timings(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);
+	const struct drm_display_mode *adjusted_mode =
+		&crtc_state->hw.adjusted_mode;
+	int min;
+
+	if (DISPLAY_VER(display) >= 4)
+		min = 3;
+	else
+		min = 2;
+
+	if (adjusted_mode->crtc_hdisplay < min) {
+		drm_dbg_kms(display->drm,
+			    "[CRTC:%d:%s] horizontal active (%d) below minimum (%d) for pfit\n",
+			    crtc->base.base.id, crtc->base.name,
+			    adjusted_mode->crtc_hdisplay, min);
+		return -EINVAL;
+	}
+
+	if (adjusted_mode->crtc_vdisplay < min) {
+		drm_dbg_kms(display->drm,
+			    "[CRTC:%d:%s] vertical active (%d) below minimum (%d) for pfit\n",
+			    crtc->base.base.id, crtc->base.name,
+			    adjusted_mode->crtc_vdisplay, min);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int gmch_panel_fitting(struct intel_crtc_state *crtc_state,
 			      const struct drm_connector_state *conn_state)
 {
@@ -772,7 +826,10 @@ static int gmch_panel_fitting(struct intel_crtc_state *crtc_state,
 	crtc_state->gmch_pfit.pgm_ratios = pfit_pgm_ratios;
 	crtc_state->gmch_pfit.lvds_border_bits = border;
 
-	return 0;
+	if ((pfit_control & PFIT_ENABLE) == 0)
+		return 0;
+
+	return intel_gmch_pfit_check_timings(crtc_state);
 }
 
 int intel_panel_fitting(struct intel_crtc_state *crtc_state,
-- 
2.45.2


  parent reply	other threads:[~2024-10-16 14:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 14:31 [PATCH 0/9] drm/i915/pfit: Panel fitter stuff Ville Syrjala
2024-10-16 14:31 ` [PATCH 1/9] drm/i915/pfit: Check pipe source size against pfit limits on ILK-BDW Ville Syrjala
2024-10-22  8:24   ` Jani Nikula
2024-10-16 14:31 ` [PATCH 2/9] drm/i915/pfit: Check pfit scaling factors " Ville Syrjala
2024-10-22  8:24   ` Jani Nikula
2024-10-16 14:31 ` [PATCH 3/9] drm/i915/pfit: Reject pfit downscaling for GMCH platforms Ville Syrjala
2024-10-22  8:25   ` Jani Nikula
2024-10-16 14:31 ` Ville Syrjala [this message]
2024-10-22  8:25   ` [PATCH 4/9] drm/i915/pfit: Check pfit minimum timings in pre-SKL Jani Nikula
2024-10-16 14:31 ` [PATCH 5/9] drm/i915/pfit: Reject cloning when using pfit on ILK-BDW Ville Syrjala
2024-10-22  8:25   ` Jani Nikula
2024-10-16 14:31 ` [PATCH 6/9] drm/i915/pfit: Check pfit destination window " Ville Syrjala
2024-10-22  8:26   ` Jani Nikula
2024-10-16 14:31 ` [PATCH 7/9] drm/i915/panel: Convert panel code to intel_display Ville Syrjala
2024-10-22  8:26   ` Jani Nikula
2024-10-16 14:31 ` [PATCH 8/9] drm/i915/pfit: Extract intel_pfit.c Ville Syrjala
2024-10-22  8:31   ` Jani Nikula
2024-10-23 15:38     ` Ville Syrjälä
2024-10-16 14:31 ` [PATCH 9/9] drm/i915: Remove ckey/format checks from skl_update_scaler_plane() Ville Syrjala
2024-10-22  9:04   ` Jani Nikula
2024-10-16 19:58 ` ✓ Fi.CI.BAT: success for drm/i915/pfit: Panel fitter stuff Patchwork
2024-10-16 19:59 ` ✗ Fi.CI.CHECKPATCH: warning " Patchwork
2024-10-16 19:59 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-10-16 22:16 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241016143134.26903-5-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox