diff options
author | Keith Packard <keithp@keithp.com> | 2008-10-15 02:20:35 +0200 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-10-17 23:10:53 +0200 |
commit | 50aa253d820ad4577e2231202f2c8fd89f9dc4e6 (patch) | |
tree | 2357e6f184456b44a9c38f57d5f2f16345219ba5 /drivers/gpu | |
parent | i915: Use non-reserved status page index for breadcrumb (diff) | |
download | linux-50aa253d820ad4577e2231202f2c8fd89f9dc4e6.tar.xz linux-50aa253d820ad4577e2231202f2c8fd89f9dc4e6.zip |
i915: Fix up ring initialization to cover G45 oddities
G45 appears quite sensitive to ring initialization register writes,
sometimes leaving the HEAD register with the START register contents. Check
to make sure HEAD is reset correctly when START is written, and fix it up,
screaming loudly.
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index a31ee3202f17..94b9bdce0c75 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2350,6 +2350,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev) struct drm_gem_object *obj; struct drm_i915_gem_object *obj_priv; int ret; + u32 head; ret = i915_gem_init_hws(dev); if (ret != 0) @@ -2390,17 +2391,49 @@ i915_gem_init_ringbuffer(struct drm_device *dev) /* Stop the ring if it's running. */ I915_WRITE(PRB0_CTL, 0); - I915_WRITE(PRB0_HEAD, 0); I915_WRITE(PRB0_TAIL, 0); - I915_WRITE(PRB0_START, 0); + I915_WRITE(PRB0_HEAD, 0); /* Initialize the ring. */ I915_WRITE(PRB0_START, obj_priv->gtt_offset); + head = I915_READ(PRB0_HEAD) & HEAD_ADDR; + + /* G45 ring initialization fails to reset head to zero */ + if (head != 0) { + DRM_ERROR("Ring head not reset to zero " + "ctl %08x head %08x tail %08x start %08x\n", + I915_READ(PRB0_CTL), + I915_READ(PRB0_HEAD), + I915_READ(PRB0_TAIL), + I915_READ(PRB0_START)); + I915_WRITE(PRB0_HEAD, 0); + + DRM_ERROR("Ring head forced to zero " + "ctl %08x head %08x tail %08x start %08x\n", + I915_READ(PRB0_CTL), + I915_READ(PRB0_HEAD), + I915_READ(PRB0_TAIL), + I915_READ(PRB0_START)); + } + I915_WRITE(PRB0_CTL, ((obj->size - 4096) & RING_NR_PAGES) | RING_NO_REPORT | RING_VALID); + head = I915_READ(PRB0_HEAD) & HEAD_ADDR; + + /* If the head is still not zero, the ring is dead */ + if (head != 0) { + DRM_ERROR("Ring initialization failed " + "ctl %08x head %08x tail %08x start %08x\n", + I915_READ(PRB0_CTL), + I915_READ(PRB0_HEAD), + I915_READ(PRB0_TAIL), + I915_READ(PRB0_START)); + return -EIO; + } + /* Update our cache of the ring state */ i915_kernel_lost_context(dev); |