drm: radeon: Fix calculation of RB_RPTR_ADDR in non-AGP case.
authorDavid Miller <davem@davemloft.net>
Thu, 12 Feb 2009 10:15:44 +0000 (02:15 -0800)
committerDave Airlie <airlied@redhat.com>
Fri, 13 Mar 2009 04:24:02 +0000 (14:24 +1000)
The address needs to be a GART relative address, rather than a PCI
DMA address.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/gpu/drm/radeon/radeon_cp.c

index 8a8a82a2c170cf2246bd2a498079d9e4cb130fbd..4a56e7d626a64ff1c8fae0a576c28514a85c93d4 100644 (file)
@@ -657,17 +657,10 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
        } else
 #endif
        {
-               struct drm_sg_mem *entry = dev->sg;
-               unsigned long tmp_ofs, page_ofs;
-
-               tmp_ofs = dev_priv->ring_rptr->offset -
-                               (unsigned long)dev->sg->virtual;
-               page_ofs = tmp_ofs >> PAGE_SHIFT;
-
-               RADEON_WRITE(RADEON_CP_RB_RPTR_ADDR, entry->busaddr[page_ofs]);
-               DRM_DEBUG("ring rptr: offset=0x%08lx handle=0x%08lx\n",
-                         (unsigned long)entry->busaddr[page_ofs],
-                         entry->handle + tmp_ofs);
+               RADEON_WRITE(RADEON_CP_RB_RPTR_ADDR,
+                            dev_priv->ring_rptr->offset
+                            - ((unsigned long) dev->sg->virtual)
+                            + dev_priv->gart_vm_start);
        }
 
        /* Set ring buffer size */