Commit b5aa8a0f authored by Grégoire Henry's avatar Grégoire Henry Committed by Eric Anholt

drm/i915: initialize fence registers to zero when loading GEM

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: default avatarGrégoire Henry <henry@pps.jussieu.fr>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 56d21b07
...@@ -4227,6 +4227,7 @@ i915_gem_lastclose(struct drm_device *dev) ...@@ -4227,6 +4227,7 @@ i915_gem_lastclose(struct drm_device *dev)
void void
i915_gem_load(struct drm_device *dev) i915_gem_load(struct drm_device *dev)
{ {
int i;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
spin_lock_init(&dev_priv->mm.active_list_lock); spin_lock_init(&dev_priv->mm.active_list_lock);
...@@ -4246,6 +4247,18 @@ i915_gem_load(struct drm_device *dev) ...@@ -4246,6 +4247,18 @@ i915_gem_load(struct drm_device *dev)
else else
dev_priv->num_fence_regs = 8; 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); i915_gem_detect_bit_6_swizzle(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment