From 57eee52430813b8c011f786b9ee4c58720f7cf66 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Thu, 12 Jan 2012 14:51:45 +0000 Subject: [PATCH] add i915 gpu hang fix --- PKGBUILD | 16 +++++++++---- i915-gpu-finish.patch | 55 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 i915-gpu-finish.patch diff --git a/PKGBUILD b/PKGBUILD index ae7af12..f79a959 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,7 @@ pkgname=('linux' 'linux-headers' 'linux-docs') # Build stock -ARCH kernel _kernelname=${pkgname#linux} _basekernel=3.2 pkgver=${_basekernel} -pkgrel=2 +pkgrel=3 arch=('i686' 'x86_64') url="http://www.kernel.org/" license=('GPL2') @@ -21,13 +21,15 @@ source=("http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.tar.xz" # standard config files for mkinitcpio ramdisk "${pkgname}.preset" 'change-default-console-loglevel.patch' - 'i915-fix-ghost-tv-output.patch') + 'i915-fix-ghost-tv-output.patch' + 'i915-gpu-finish.patch') md5sums=('364066fa18767ec0ae5f4e4abcf9dc51' - '4a6567864c49c5bb0f7d76d1a638912e' - 'd9efdc5f471a4082caf2f61afede6302' + '4079a2ae3e2ee308e6db188f7bc04959' + '875b121a32a619e0ee262c541f330427' 'eb14dcfd80c00852ef81ded6e826826a' '9d3c56a4b999c8bfbd4018089a62f662' - '263725f20c0b9eb9c353040792d644e5') + '263725f20c0b9eb9c353040792d644e5' + '4cd79aa147825837dc8bc9f6b736c0a0') build() { cd "${srcdir}/linux-${_basekernel}" @@ -38,6 +40,10 @@ build() { # add latest fixes from stable queue, if needed # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git + # fix FS#27883 + # drm/i915: Only clear the GPU domains upon a successful finish + patch -Np1 -i "${srcdir}/i915-gpu-finish.patch" + # Some chips detect a ghost TV output # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html # Arch Linux bug report: FS#19234 diff --git a/i915-gpu-finish.patch b/i915-gpu-finish.patch new file mode 100644 index 0000000..5840c91 --- /dev/null +++ b/i915-gpu-finish.patch @@ -0,0 +1,55 @@ +commit 389a55581e30607af0fcde6cdb4e54f189cf46cf +Author: Chris Wilson +Date: Tue Nov 29 15:12:16 2011 +0000 + + drm/i915: Only clear the GPU domains upon a successful finish + + By clearing the GPU read domains before waiting upon the buffer, we run + the risk of the wait being interrupted and the domains prematurely + cleared. The next time we attempt to wait upon the buffer (after + userspace handles the signal), we believe that the buffer is idle and so + skip the wait. + + There are a number of bugs across all generations which show signs of an + overly haste reuse of active buffers. + + Such as: + + https://bugs.freedesktop.org/show_bug.cgi?id=29046 + https://bugs.freedesktop.org/show_bug.cgi?id=35863 + https://bugs.freedesktop.org/show_bug.cgi?id=38952 + https://bugs.freedesktop.org/show_bug.cgi?id=40282 + https://bugs.freedesktop.org/show_bug.cgi?id=41098 + https://bugs.freedesktop.org/show_bug.cgi?id=41102 + https://bugs.freedesktop.org/show_bug.cgi?id=41284 + https://bugs.freedesktop.org/show_bug.cgi?id=42141 + + A couple of those pre-date i915_gem_object_finish_gpu(), so may be + unrelated (such as a wild write from a userspace command buffer), but + this does look like a convincing cause for most of those bugs. + + Signed-off-by: Chris Wilson + Cc: stable@kernel.org + Reviewed-by: Daniel Vetter + Reviewed-by: Eugeni Dodonov + +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c +index d560175..036bc58 100644 +--- a/drivers/gpu/drm/i915/i915_gem.c ++++ b/drivers/gpu/drm/i915/i915_gem.c +@@ -3087,10 +3087,13 @@ i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj) + return ret; + } + ++ ret = i915_gem_object_wait_rendering(obj); ++ if (ret) ++ return ret; ++ + /* Ensure that we invalidate the GPU's caches and TLBs. */ + obj->base.read_domains &= ~I915_GEM_GPU_DOMAINS; +- +- return i915_gem_object_wait_rendering(obj); ++ return 0; + } + + /**