radeon: set the address to access the GART table on the CPU side correctly
authorDave Airlie <airlied@linux.ie>
Mon, 5 Nov 2007 00:45:27 +0000 (10:45 +1000)
committerDave Airlie <airlied@linux.ie>
Mon, 5 Nov 2007 00:49:04 +0000 (10:49 +1000)
This code relied on the CPU and GPU address for the aperture being the same,
On some r5xx hardware I was playing with I noticed that this isn't always true.
This fixes issues seen on some r400 cards. (bugs.freedesktop.org 9957)

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/char/drm/radeon_cp.c
drivers/char/drm/radeon_drv.h

index 335423c5c18662e4993428d49db05d37c4e4fdd0..24fca8ec137957524240bbf018a0ff3374e29c03 100644 (file)
@@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
                        dev_priv->gart_info.bus_addr =
                            dev_priv->pcigart_offset + dev_priv->fb_location;
                        dev_priv->gart_info.mapping.offset =
-                           dev_priv->gart_info.bus_addr;
+                           dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
                        dev_priv->gart_info.mapping.size =
                            dev_priv->gart_info.table_size;
 
@@ -2275,7 +2275,8 @@ int radeon_driver_firstopen(struct drm_device *dev)
        if (ret != 0)
                return ret;
 
-       ret = drm_addmap(dev, drm_get_resource_start(dev, 0),
+       dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
+       ret = drm_addmap(dev, dev_priv->fb_aper_offset,
                         drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
                         _DRM_WRITE_COMBINING, &map);
        if (ret != 0)
index e4077bc212b32fb0460ddba4db60fcbf28415d87..bfbb60a9298ca7d57e0ad030751fe61799ccc73e 100644 (file)
@@ -293,6 +293,7 @@ typedef struct drm_radeon_private {
 
        /* starting from here on, data is preserved accross an open */
        uint32_t flags;         /* see radeon_chip_flags */
+       unsigned long fb_aper_offset;
 } drm_radeon_private_t;
 
 typedef struct drm_radeon_buf_priv {