[PATCH 22/36] drm/i915: Check pipe source size when using skl+ scalers

Ville Syrjala ville.syrjala at linux.intel.com
Wed Dec 18 16:10:39 UTC 2019


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

The skl+ scalers only sample 12 bits of PIPESRC so we can't
do any plane scaling at all when the pipe source size is >4k.

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

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index abcdc0760ac3..5172a80f4a79 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5590,6 +5590,32 @@ static int skl_scaler_check_src_size(struct intel_crtc *crtc,
 	return 0;
 }
 
+static int skl_scaler_check_pipe_src_size(const struct intel_crtc_state *crtc_state,
+					  unsigned int scaler_user)
+{
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	int max_w, max_h;
+
+	/*
+	 * The pipe scaler does not use all the bits of PIPESRC on the
+	 * earlier platforms. So even when we're scaling a plane the
+	 * *pipe* source size can't be too large. For simplicity we
+	 * assume the limits match the scaler source size limits.
+	 * Might not be 100% true, but good enough for now.
+	 */
+	skl_scaler_max_src_size(crtc, &max_w, &max_h);
+
+	if (crtc_state->pipe_src_w > max_w || crtc_state->pipe_src_h > max_h) {
+		DRM_DEBUG_KMS("[CRTC:%d:%s] scaler_user %u: pipe source size (%dx%d) above max (%dx%d)\n",
+			      crtc->base.base.id, crtc->base.name,
+			      scaler_user, crtc_state->pipe_src_w,
+			      crtc_state->pipe_src_h, max_w, max_h);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int
 skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		  unsigned int scaler_user, int *scaler_id,
@@ -5654,6 +5680,10 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 	if (ret)
 		return ret;
 
+	ret = skl_scaler_check_pipe_src_size(crtc_state, scaler_user);
+	if (ret)
+		return ret;
+
 	/* mark this pipe/plane as a scaler user in crtc_state */
 	scaler_state->scaler_users |= (1 << scaler_user);
 	DRM_DEBUG_KMS("scaler_user index %u.%u: "
-- 
2.23.0



More information about the Intel-gfx-trybot mailing list