On Thu, 2005-05-05 at 09:48 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2005-05-04 at 09:35 -0400, Hui Yu wrote:
> 
> > I don't know an exception for it being a non-power of 2, but it can be
> > zero on some M6 chips. In these cases, set it to 8M.
> 
> Yup, I know about that case, I'll send a fixed patch later today,
> thanks !

Ok, here's the candidate for submission to Linus if no other comment by
tomorrow. David, will you take care of adapting it to DRI CVS ?

Index: linux-work/drivers/char/drm/radeon_drv.h
===================================================================
--- linux-work.orig/drivers/char/drm/radeon_drv.h       2005-05-04 
11:47:51.000000000 +1000
+++ linux-work/drivers/char/drm/radeon_drv.h    2005-05-04 11:47:53.000000000 
+1000
@@ -346,6 +346,7 @@
 #define RADEON_CLOCK_CNTL_DATA         0x000c
 #      define RADEON_PLL_WR_EN                 (1 << 7)
 #define RADEON_CLOCK_CNTL_INDEX                0x0008
+#define RADEON_CONFIG_MEMSIZE          0x00f8
 #define RADEON_CONFIG_APER_SIZE                0x0108
 #define RADEON_CRTC_OFFSET             0x0224
 #define RADEON_CRTC_OFFSET_CNTL                0x0228
Index: linux-work/drivers/char/drm/radeon_cp.c
===================================================================
--- linux-work.orig/drivers/char/drm/radeon_cp.c        2005-05-04 
11:47:51.000000000 +1000
+++ linux-work/drivers/char/drm/radeon_cp.c     2005-05-06 12:55:13.000000000 
+1000
@@ -1268,6 +1268,7 @@
 static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
 {
        drm_radeon_private_t *dev_priv = dev->dev_private;;
+       u32 gart_loc, mem_size;
        DRM_DEBUG( "\n" );
 
        dev_priv->is_pci = init->is_pci;
@@ -1476,8 +1477,23 @@
 
 
        dev_priv->gart_size = init->gart_size;
-       dev_priv->gart_vm_start = dev_priv->fb_location
-                               + RADEON_READ( RADEON_CONFIG_APER_SIZE );
+       mem_size = RADEON_READ(RADEON_CONFIG_MEMSIZE);
+       /* assume mem_size of 0 means one of those buggy M6 and thus
+        * is 8Mb
+        */
+       if (mem_size == 0)
+               mem_size = 0x00800000;
+       /* try to put the gart after the framebuffer */
+       gart_loc = dev_priv->fb_location + mem_size;
+       /* if it overflows, warn and try to put it _before_ the framebuffer */
+       if ((gart_loc + dev_priv->gart_size) < dev_priv->fb_location) {
+               DRM_INFO("Warning ! Gart does not fit above framebuffer in "
+                        "card space, moving it below. Risks collision with "
+                        " main memory ! ");
+               gart_loc = dev_priv->fb_location - dev_priv->gart_size;
+       }
+       
+       dev_priv->gart_vm_start = gart_loc;
 
 #if __OS_HAS_AGP
        if ( !dev_priv->is_pci )




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to