[Intel-gfx] [PATCH v2 09/15] drm/i915: Check pfit minimum timings
Ville Syrjala
ville.syrjala at linux.intel.com
Thu Sep 5 10:38:19 UTC 2019
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Transcoder hdisplay/vdisplay have documented minimum limits
when using the panel fitter. Enforce those limits.
v2: Skip the checks if the crtc is disabled
Add debugs for the failures
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 63 ++++++++++++++++++--
1 file changed, 59 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index f7f93af55ec5..2c523f500cb4 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -11768,6 +11768,20 @@ 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_timings(const struct intel_crtc_state *crtc_state)
+{
+ const struct drm_display_mode *adjusted_mode =
+ &crtc_state->base.adjusted_mode;
+
+ if (adjusted_mode->crtc_vdisplay < 7) {
+ DRM_DEBUG_KMS("Vertical active (%d) below minimum (%d) for pfit\n",
+ adjusted_mode->crtc_vdisplay, 7);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
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);
@@ -11856,6 +11870,10 @@ static int intel_pch_pfit_check(const struct intel_crtc_state *crtc_state)
!crtc_state->pch_pfit.enabled)
return 0;
+ ret = intel_pch_pfit_check_timings(crtc_state);
+ if (ret)
+ return ret;
+
ret = intel_pch_pfit_check_src_size(crtc_state);
if (ret)
return ret;
@@ -11863,6 +11881,42 @@ static int intel_pch_pfit_check(const struct intel_crtc_state *crtc_state)
return intel_pch_pfit_check_scaling(crtc_state);
}
+static int intel_gmch_pfit_check_timings(const struct intel_crtc_state *crtc_state)
+{
+ struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
+ const struct drm_display_mode *adjusted_mode =
+ &crtc_state->base.adjusted_mode;
+ int min;
+
+ if (INTEL_GEN(dev_priv) >= 4)
+ min = 3;
+ else
+ min = 2;
+
+ if (adjusted_mode->crtc_hdisplay < min) {
+ DRM_DEBUG_KMS("Horizontal active (%d) below minimum (%d) for pfit\n",
+ adjusted_mode->crtc_hdisplay, min);
+ return -EINVAL;
+ }
+
+ if (adjusted_mode->crtc_vdisplay < min) {
+ DRM_DEBUG_KMS("Vertical active (%d) below minimum (%d) for pfit\n",
+ adjusted_mode->crtc_vdisplay, min);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int intel_gmch_pfit_check(const struct intel_crtc_state *crtc_state)
+{
+ if (!crtc_state->base.enable ||
+ (crtc_state->gmch_pfit.control & PFIT_ENABLE) == 0)
+ return 0;
+
+ return intel_gmch_pfit_check_timings(crtc_state);
+}
+
static int intel_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_crtc_state *crtc_state)
{
@@ -11886,11 +11940,12 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
return ret;
}
- if (!HAS_GMCH(dev_priv)) {
+ if (HAS_GMCH(dev_priv))
+ ret = intel_gmch_pfit_check(pipe_config);
+ else
ret = intel_pch_pfit_check(pipe_config);
- if (ret)
- return ret;
- }
+ if (ret)
+ return ret;
/*
* May need to update pipe gamma enable bits
--
2.21.0
More information about the Intel-gfx
mailing list