[patch 19/74] drm/i915: initialize fence registers to zero when loading GEM

From: Greg KH
Date: Thu Aug 13 2009 - 16:12:01 EST


2.6.30-stable review patch. If anyone has any objections, please let us know.

------------------

From: Grégoire Henry <henry@xxxxxxxxxxxxxx>

(cherry picked from commit b5aa8a0fc132dd512c33e7c2621d075e3b77a65e)

Unitialized fence register could leads to corrupted display. Problem
encountered on MacBooks (revision 1 and 2), directly booting from EFI
or through BIOS emulation.

(bug #21710 at freedestop.org)

Signed-off-by: Grégoire Henry <henry@xxxxxxxxxxxxxx>
Signed-off-by: Eric Anholt <eric@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
drivers/gpu/drm/i915/i915_gem.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4154,6 +4154,7 @@ i915_gem_lastclose(struct drm_device *de
void
i915_gem_load(struct drm_device *dev)
{
+ int i;
drm_i915_private_t *dev_priv = dev->dev_private;

spin_lock_init(&dev_priv->mm.active_list_lock);
@@ -4173,6 +4174,18 @@ i915_gem_load(struct drm_device *dev)
else
dev_priv->num_fence_regs = 8;

+ /* Initialize fence registers to zero */
+ if (IS_I965G(dev)) {
+ for (i = 0; i < 16; i++)
+ I915_WRITE64(FENCE_REG_965_0 + (i * 8), 0);
+ } else {
+ for (i = 0; i < 8; i++)
+ I915_WRITE(FENCE_REG_830_0 + (i * 4), 0);
+ if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
+ for (i = 0; i < 8; i++)
+ I915_WRITE(FENCE_REG_945_8 + (i * 4), 0);
+ }
+
i915_gem_detect_bit_6_swizzle(dev);
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/