[Intel-gfx] [PATCH] drm/i915: Implement workaround for broken CS tlb on i830/845

Chris Wilson chris at chris-wilson.co.uk
Mon Dec 17 16:18:41 CET 2012


On Mon, 17 Dec 2012 13:33:01 +0000, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Sun, 16 Dec 2012 22:46:00 +0000, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > @@ -1087,6 +1087,9 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
> >  	if (!ring->get_seqno)
> >  		return NULL;
> >  
> > +	if (HAS_BROKEN_CS_TLB(dev_priv->dev))
> > +		return i915_error_object_create(dev_priv, ring->private);
> 
> Hmm, this is complicated by userspace opting out of the CS w/a, and
> imposes quite a burden upon our simple seq interface.

One possible solution is:

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 6ebdf1e..0e3bd04 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1087,8 +1087,14 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev
        if (!ring->get_seqno)
                return NULL;
 
-       if (HAS_BROKEN_CS_TLB(dev_priv->dev))
-               return i915_error_object_create(dev_priv, ring->private);
+       if (HAS_BROKEN_CS_TLB(dev_priv->dev)) {
+               u32 acthd = I915_READ(ACTHD);
+
+               obj = ring->private;
+               if (acthd >= obj->gtt_offset &&
+                   acthd <= obj->gtt_offset + obj->base.size)
+                       return i915_error_object_create(dev_priv, obj);
+       }
 
        seqno = ring->get_seqno(ring, false);
        list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list