[kernel/f15/master] drm/i915: Gen4+ has non-power-of-two strides

Kyle McMartin kyle at fedoraproject.org
Fri Mar 4 17:07:55 UTC 2011


commit 973b532fe71153e8f0bb463e96021295f856902f
Author: Kyle McMartin <kyle at redhat.com>
Date:   Fri Mar 4 12:06:51 2011 -0500

    drm/i915: Gen4+ has non-power-of-two strides
    
    [bea96046b4245e9abd65ed7acfed9adfd5f6c639 in drm-intel-staging]

 drm-i915-gen4-has-non-power-of-two-strides.patch |   69 ++++++++++++++++++++++
 kernel.spec                                      |    7 ++
 2 files changed, 76 insertions(+), 0 deletions(-)
---
diff --git a/drm-i915-gen4-has-non-power-of-two-strides.patch b/drm-i915-gen4-has-non-power-of-two-strides.patch
new file mode 100644
index 0000000..f111614
--- /dev/null
+++ b/drm-i915-gen4-has-non-power-of-two-strides.patch
@@ -0,0 +1,69 @@
+From bea96046b4245e9abd65ed7acfed9adfd5f6c639 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris at chris-wilson.co.uk>
+Date: Thu, 3 Mar 2011 23:43:02 +0000
+Subject: [PATCH] drm/i915: Gen4+ has non-power-of-two strides
+
+In c2e0eb16707, we started checking that the buffer was the correct size
+for tiled access by ensuring that the size was a multiple of tiles.
+However, gen4+ complicates the issue by allowing any multiple of 4096
+bytes for the stride and so the simple check based on a power-of-two
+stride was failing for valid bo.
+
+Reported-by: Dan Williams <dcbw at redhat.com>
+Reported-by: Robert Hooker <sarvatt at gmail.com>
+Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
+Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
+---
+ drivers/gpu/drm/i915/i915_gem_tiling.c |   29 ++++++++++++++---------------
+ 1 files changed, 14 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
+index 79a04fd..654f350 100644
+--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
++++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
+@@ -215,6 +215,19 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
+ 		}
+ 	}
+ 
++	if (INTEL_INFO(dev)->gen >= 4) {
++		/* 965+ just needs multiples of tile width */
++		if (stride & (tile_width - 1))
++			return false;
++	} else {
++		/* Pre-965 needs power of two tile widths */
++		if (stride < tile_width)
++			return false;
++
++		if (stride & (stride - 1))
++			return false;
++	}
++
+ 	if (IS_GEN2(dev) ||
+ 	    (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)))
+ 		tile_height = 32;
+@@ -226,21 +239,7 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
+ 		tile_height *= 2;
+ 
+ 	/* Size needs to be aligned to a full tile row */
+-	if (size & (tile_height * stride - 1))
+-		return false;
+-
+-	/* 965+ just needs multiples of tile width */
+-	if (INTEL_INFO(dev)->gen >= 4) {
+-		if (stride & (tile_width - 1))
+-			return false;
+-		return true;
+-	}
+-
+-	/* Pre-965 needs power of two tile widths */
+-	if (stride < tile_width)
+-		return false;
+-
+-	if (stride & (stride - 1))
++	if (size % (tile_height * stride))
+ 		return false;
+ 
+ 	return true;
+-- 
+1.7.4.1
+
diff --git a/kernel.spec b/kernel.spec
index 8f6b3e3..37798f6 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -675,6 +675,7 @@ Patch1824: drm-intel-next.patch
 # make sure the lvds comes back on lid open
 Patch1825: drm-intel-make-lvds-work.patch
 Patch1826: drm-intel-edp-fixes.patch
+Patch1827: drm-i915-gen4-has-non-power-of-two-strides.patch
 
 Patch1900: linux-2.6-intel-iommu-igfx.patch
 
@@ -1289,6 +1290,9 @@ ApplyPatch drm-intel-big-hammer.patch
 ApplyPatch drm-intel-make-lvds-work.patch
 ApplyPatch linux-2.6-intel-iommu-igfx.patch
 ApplyPatch drm-intel-edp-fixes.patch
+# rhbz#681285 (i965: crash in brw_wm_surface_state.c::prepare_wm_surfaces()
+#  where intelObj->mt == NULL)
+ApplyPatch drm-i915-gen4-has-non-power-of-two-strides.patch
 
 # linux1394 git patches
 #ApplyPatch linux-2.6-firewire-git-update.patch
@@ -1946,6 +1950,9 @@ fi
 # and build.
 
 %changelog
+* Fri Mar 04 2011 Kyle McMartin <kmcmartin at redhat.com>
+- drm-i915-gen4-has-non-power-of-two-strides.patch (#681285)
+
 * Thu Mar 03 2011 Chuck Ebbert <cebbert at redhat.com> 2.6.38-0.rc7.git1.1
 - Linux 2.6.38-rc7-git1
 


More information about the scm-commits mailing list