If the DDX driver didn't reserve any video RAM for textures, fall back to
authorMichel Dänzer <michel@daenzer.net>
Tue, 29 Nov 2005 13:13:34 +0000 (13:13 +0000)
committerMichel Dänzer <michel@daenzer.net>
Tue, 29 Nov 2005 13:13:34 +0000 (13:13 +0000)
using only GART memory for textures instead of segfaulting in the texture
management code. (Bug 5115)

src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c

index c91f9fdbf7a8ad39dd7c1e1ba651e387a2fb3aa5..4f1b20aadd7fb32710e0e4fee3f66647166fa3c7 100644 (file)
@@ -198,11 +198,19 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
    r128Screen->depthPitch      = r128DRIPriv->depthPitch;
    r128Screen->spanOffset      = r128DRIPriv->spanOffset;
 
-   r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset;
-   r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize;
-   r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran;
+   if ( r128DRIPriv->textureSize == 0 ) {
+      r128Screen->texOffset[R128_LOCAL_TEX_HEAP] =
+        r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET;
+      r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->agpTexMapSize;
+      r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] =
+        r128DRIPriv->log2AGPTexGran;
+   } else {
+      r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset;
+      r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize;
+      r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran;
+   }
 
-   if ( r128Screen->IsPCI ) {
+   if ( !r128Screen->agpTextures.map || r128DRIPriv->textureSize == 0 ) {
       r128Screen->numTexHeaps = R128_NR_TEX_HEAPS - 1;
       r128Screen->texOffset[R128_AGP_TEX_HEAP] = 0;
       r128Screen->texSize[R128_AGP_TEX_HEAP] = 0;
index 213af6d34f8bb28f0a7033b6b1106ccc3249a8aa..d92c2a78314d412e51ad14a362f769a4aea14ee1 100644 (file)
@@ -617,13 +617,20 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
    screen->depthHasSurface = ((sPriv->ddxMajor > 4) &&
       (screen->chip_flags & RADEON_CHIPSET_TCL));
 
-   screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset
-                                      + screen->fbLocation;
-   screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize;
-   screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
-      dri_priv->log2TexGran;
+   if ( dri_priv->textureSize == 0 ) {
+      screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset;
+      screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->gartTexMapSize;
+      screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
+        dri_priv->log2GARTTexGran;
+   } else {
+      screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset
+                                              + screen->fbLocation;
+      screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize;
+      screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
+        dri_priv->log2TexGran;
+   }
 
-   if ( !screen->gartTextures.map
+   if ( !screen->gartTextures.map || dri_priv->textureSize == 0
        || getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) {
       screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1;
       screen->texOffset[RADEON_GART_TEX_HEAP] = 0;