From 4928a41bd3342b359e65eb4d0b2f8b854c902294 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 20 Feb 2013 14:41:41 +0000 Subject: [PATCH] drm/i915: Align scanouts to 256k when VT-d is enabled From the w/a database: 'To prevent false VT-d type 6 error, the scanouts must be 256KiB aligned, and require an extra 128 PTEs of padding afterward' This implements the first step of aligning the scanouts as required. References: https://bugs.freedesktop.org/show_bug.cgi?id=59626 Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 86edbb2..f97de05 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2006,6 +2006,15 @@ static void intel_disable_plane(struct drm_i915_private *dev_priv, intel_wait_for_vblank(dev_priv->dev, pipe); } +static bool need_vtd_wa(struct drm_device *dev) +{ +#ifdef CONFIG_INTEL_IOMMU + if (INTEL_INFO(dev)->gen >= 6 && intel_iommu_gfx_mapped) + return true; +#endif + return false; +} + int intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_i915_gem_object *obj, @@ -2036,6 +2045,9 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, BUG(); } + if (need_vtd_wa(dev) && alignment < 256 * 1024) + alignment = 256 * 1024; + dev_priv->mm.interruptible = false; ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined); if (ret) -- 1.7.10.4