]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] radeon drm: fix agp aperture map offset
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 16 Dec 2005 05:52:22 +0000 (16:52 +1100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 16 Dec 2005 06:22:57 +0000 (22:22 -0800)
This finally fixes the radeon memory mapping bug that was incorrectly
fixed by the previous patch.  This time, we use the actual vram size as
the size to calculate how far to move the AGP aperture from the
framebuffer in card's memory space.

If there are still issues with this patch, they are due to bugs in the X
driver that I'm working on fixing too.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/drm/radeon_cp.c
drivers/char/drm/radeon_drv.h

index 9f2b4efd0c7aaccbaa7673d8a95e4f01c8a5ae0a..95ae9e0892ac32d5c0aafd7c7fca1062c8b2508f 100644 (file)
@@ -1312,6 +1312,8 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
 static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
 {
        drm_radeon_private_t *dev_priv = dev->dev_private;;
+       unsigned int mem_size;
+
        DRM_DEBUG("\n");
 
        dev_priv->is_pci = init->is_pci;
@@ -1521,8 +1523,11 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
                                          + dev_priv->fb_location) >> 10));
 
        dev_priv->gart_size = init->gart_size;
-       dev_priv->gart_vm_start = dev_priv->fb_location
-           + RADEON_READ(RADEON_CONFIG_APER_SIZE) * 2;
+
+       mem_size = RADEON_READ(RADEON_CONFIG_MEMSIZE);
+       if (mem_size == 0)
+               mem_size = 0x800000;
+       dev_priv->gart_vm_start = dev_priv->fb_location + mem_size;
 
 #if __OS_HAS_AGP
        if (!dev_priv->is_pci)
index 7bda7e33d2bdb03f40fb822431f54b46898df2ba..d92ccee3e54c64b29c9bbc7fcc4b1973386d3644 100644 (file)
@@ -379,6 +379,7 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
 #      define RADEON_PLL_WR_EN                 (1 << 7)
 #define RADEON_CLOCK_CNTL_INDEX                0x0008
 #define RADEON_CONFIG_APER_SIZE                0x0108
+#define RADEON_CONFIG_MEMSIZE          0x00f8
 #define RADEON_CRTC_OFFSET             0x0224
 #define RADEON_CRTC_OFFSET_CNTL                0x0228
 #      define RADEON_CRTC_TILE_EN              (1 << 15)