Fixes to cope with the lack of AGP textures. This is all that's needed
authorFelix Kuehling <fxkuehl@gmx.de>
Mon, 10 Jan 2005 22:49:00 +0000 (22:49 +0000)
committerFelix Kuehling <fxkuehl@gmx.de>
Mon, 10 Jan 2005 22:49:00 +0000 (22:49 +0000)
to support PCI Savages on the Mesa side. Bumped driver date.

src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/savage/savagedd.c
src/mesa/drivers/dri/savage/savagetex.c

index a4000b2a75abab605c947db56223152386020df2..b3cf3a9982ea35578fc3ef44e1132129093a4b85 100644 (file)
@@ -176,15 +176,17 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
 
    savageScreen->agpTextures.handle = gDRIPriv->agpTextureHandle;
    savageScreen->agpTextures.size   = gDRIPriv->agpTextureSize;
-   if (drmMap(sPriv->fd, 
-             savageScreen->agpTextures.handle,
-             savageScreen->agpTextures.size,
-             (drmAddress *)&(savageScreen->agpTextures.map)) != 0) 
-   {
-      Xfree(savageScreen);
-      sPriv->private = NULL;
-      return GL_FALSE;
-   }
+   if (gDRIPriv->agpTextureSize) {
+       if (drmMap(sPriv->fd, 
+                 savageScreen->agpTextures.handle,
+                 savageScreen->agpTextures.size,
+                 (drmAddress *)&(savageScreen->agpTextures.map)) != 0) {
+          Xfree(savageScreen);
+          sPriv->private = NULL;
+          return GL_FALSE;
+       }
+   } else
+       savageScreen->agpTextures.map = NULL;
 
    savageScreen->texVirtual[SAVAGE_CARD_HEAP] = 
              (drmAddress)(((unsigned int)sPriv->pFB)+gDRIPriv->textureOffset);
@@ -361,7 +363,12 @@ savageCreateContext( const __GLcontextModes *mesaVis,
           break;
    }
    ctx->Const.MaxTextureLevels = maxTextureLevels;
-   assert (ctx->Const.MaxTextureLevels > 6); /*spec requires at least 64x64*/
+   if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
+       __driUtilMessage("Not enough texture memory. "
+                       "Falling back to indirect rendering.");
+       Xfree(imesa);
+       return GL_FALSE;
+   }
 
 #if 0
    ctx->Const.MinLineWidth = 1.0;
@@ -401,7 +408,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
    {
      int i;
      
-     for(i=0;i<SAVAGE_NR_TEX_HEAPS;i++)
+     for(i=0;i<imesa->lastTexHeap;i++)
      {
        imesa->texHeap[i] = mmInit( 0, savageScreen->textureSize[i] );
        make_empty_list(&imesa->TexObjList[i]);
@@ -503,7 +510,7 @@ savageDestroyContext(__DRIcontextPrivate *driContextPriv)
       /* update for multi-tex*/ 
       {
        int i;
-       for(i=0;i<SAVAGE_NR_TEX_HEAPS;i++)
+       for(i=0;i<imesa->lastTexHeap;i++)
           foreach_s (t, next_t, &(imesa->TexObjList[i]))
         savageDestroyTexObj(imesa, t);
       }
index 312f6f62f48363ec3a88e48f92faeee1a1f22670..1878bef524c1a07e88ffd98bc87bfb85fe6526b9 100644 (file)
@@ -41,7 +41,7 @@
 #include "utils.h"
 
 
-#define DRIVER_DATE "20050101"
+#define DRIVER_DATE "20050110"
 
 /***************************************
  * Mesa's Driver Functions
index 2650f66e4626964d126f430d1e3426f55ebce503..62031f76c3b721ea07f71ab78777a7ec18867379 100644 (file)
@@ -760,7 +760,7 @@ int savageUploadTexImages( savageContextPtr imesa, savageTextureObjectPtr t )
         t->MemBlock = mmAllocMem( imesa->texHeap[heap], t->totalSize, 12, 0 ); 
         if (t->MemBlock)
            break;
-        else
+        else if (imesa->lastTexHeap == 2)
         {
             heap = t->heap = SAVAGE_AGP_HEAP;
             t->MemBlock = mmAllocMem( imesa->texHeap[heap], t->totalSize, 12, 0 );