All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 07/15] drm/i915: Check pipe source size against pfit limits
Date: Thu,  5 Sep 2019 13:37:06 +0300	[thread overview]
Message-ID: <20190905103706.3421-1-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190904162625.15048-8-ville.syrjala@linux.intel.com>

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

The panel fitter imposes extra limits on the maximum pipe source
size we can use. Check for that.

v2: Skip the checks if the crtc is disabled

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

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 348071db8b4c..ccec2b54677d 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -11768,6 +11768,57 @@ static bool c8_planes_changed(const struct intel_crtc_state *new_crtc_state)
 	return !old_crtc_state->c8_planes != !new_crtc_state->c8_planes;
 }
 
+static int intel_pch_pfit_check_src_size(const struct intel_crtc_state *crtc_state)
+{
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+	int max_src_w, max_src_h;
+
+	if (INTEL_GEN(dev_priv) >= 11) {
+		max_src_w = 5120;
+		max_src_h = 4320;
+	} else if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
+		max_src_w = crtc->pipe == PIPE_A ? 5120 : 4096;
+		max_src_h = 4096;
+	} else if (INTEL_GEN(dev_priv) >= 8) {
+		max_src_w = 4096;
+		max_src_h = 4096;
+	} else if (INTEL_GEN(dev_priv) >= 7) {
+		/*
+		 * PF0 7x5 capable
+		 * PF1 3x3 capable (could be switched to 7x5
+		 *                  mode on HSW when PF2 unused)
+		 * PF2 3x3 capable
+		 *
+		 * This assumes we use a 1:1 mapping between pipe and PF.
+		 */
+		max_src_w = crtc->pipe == PIPE_A ? 4096 : 2048;
+		max_src_h = 4096;
+	} else {
+		max_src_w = 4096;
+		max_src_h = 4096;
+	}
+
+	if (crtc_state->pipe_src_w > max_src_w ||
+	    crtc_state->pipe_src_h > max_src_h) {
+		DRM_DEBUG_KMS("pipe %c source size (%dx%d) exceeds pfit max (%dx%d)\n",
+			      pipe_name(crtc->pipe), crtc_state->pipe_src_w,
+			      crtc_state->pipe_src_h, max_src_w, max_src_h);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int intel_pch_pfit_check(const struct intel_crtc_state *crtc_state)
+{
+	if (!crtc_state->base.enable ||
+	    !crtc_state->pch_pfit.enabled)
+		return 0;
+
+	return intel_pch_pfit_check_src_size(crtc_state);
+}
+
 static int intel_crtc_atomic_check(struct drm_crtc *crtc,
 				   struct drm_crtc_state *crtc_state)
 {
@@ -11791,6 +11842,12 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
 			return ret;
 	}
 
+	if (!HAS_GMCH(dev_priv)) {
+		ret = intel_pch_pfit_check(pipe_config);
+		if (ret)
+			return ret;
+	}
+
 	/*
 	 * May need to update pipe gamma enable bits
 	 * when C8 planes are getting enabled/disabled.
-- 
2.21.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-09-05 10:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 16:26 [PATCH 00/15] drm/i915: Expose margin connector properties for underscan Ville Syrjala
2019-09-04 16:26 ` [PATCH 01/15] drm/edid: Add drm_hdmi_avi_infoframe_bars() Ville Syrjala
2019-09-04 16:26 ` Ville Syrjala
2019-09-04 16:26 ` [PATCH 02/15] drm/i915: Parametrize PFIT_PIPE Ville Syrjala
2019-09-04 16:26 ` [PATCH 03/15] drm/i915: Replace some accidental I915_READ_FW()s with the normal version Ville Syrjala
2019-09-04 16:26 ` [PATCH 04/15] drm/i915: Fix skl+ non-scaled pfit modes Ville Syrjala
2019-09-04 16:26 ` [PATCH 05/15] drm/i915: Flatten a bunch of the pfit functions Ville Syrjala
2019-09-04 16:26 ` [PATCH 06/15] drm/i915: Use drm_rect to store the pfit window pos/size Ville Syrjala
2019-09-04 16:26 ` [PATCH 07/15] drm/i915: Check pipe source size against pfit limits Ville Syrjala
2019-09-05 10:37   ` Ville Syrjala [this message]
2019-09-05 12:30     ` [PATCH v2 " Ville Syrjälä
2019-09-04 16:26 ` [PATCH 08/15] drm/i915: Check pfit scaling factors Ville Syrjala
2019-09-05 10:37   ` [PATCH v2 " Ville Syrjala
2019-09-04 16:26 ` [PATCH 09/15] drm/i915: Check pfit minimum timings Ville Syrjala
2019-09-05 10:38   ` [PATCH v2 " Ville Syrjala
2019-09-04 16:26 ` [PATCH 10/15] drm/i915: s/pipe_config/crtc_state/ in pfit functions Ville Syrjala
2019-09-04 16:26 ` [PATCH 11/15] drm/i915: Pass connector state to pfit calculations Ville Syrjala
2019-09-04 16:26 ` [PATCH 12/15] drm/i915: Have pfit calculations return an error code Ville Syrjala
2019-09-04 16:26 ` [PATCH 13/15] drm/i915: Expose margin properties on ilk+ HDMI Ville Syrjala
2019-09-04 16:26 ` [PATCH 14/15] drm/i915: Expose margin properties on ilk+ DP SST Ville Syrjala
2019-09-04 16:26 ` [PATCH 15/15] drm/i915: Expose margin properties on DP MST Ville Syrjala
2019-09-04 16:47 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Expose margin connector properties for underscan Patchwork
2019-09-04 17:18 ` ✓ Fi.CI.BAT: success " Patchwork
2019-09-04 20:08 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-09-05 11:06 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Expose margin connector properties for underscan (rev4) Patchwork
2019-09-05 11:29 ` ✓ Fi.CI.BAT: success " Patchwork
2019-09-05 12:52 ` ✓ Fi.CI.IGT: " 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=20190905103706.3421-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.