Two patches here, one is against xf-4_2-branch, one against DRI cvs

Tested with 0.38mb free texture space running q3 on highest texture
settings, which is probably the minimum you can have (as a comparison,
1280x960 leaves something like 8mb or so) 

Regardless, if it hits the same problem it should exit the application
cleanly rather than hang.

Please send feedback to me or dri-devel

Thanks,


-- 
Michael.
Index: lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
===================================================================
RCS file: /cvs/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v
retrieving revision 1.4
diff -u -3 -p -r1.4 tdfx_texman.c
--- lib/GL/mesa/src/drv/tdfx/tdfx_texman.c      2001/08/18 02:51:07     1.4
+++ lib/GL/mesa/src/drv/tdfx/tdfx_texman.c      2002/05/15 12:29:23
@@ -77,7 +77,7 @@ static void tdfxTMVerifyFreeList( tdfxCo
       if ( t ) {
         if ( t->isInTM ) {
            numRes++;
-           assert( t->range[0] );
+/*         assert( t->range[0] ); */
            if ( t->range[unit] )
               totalUsed += (t->range[unit]->endAddr - t->range[unit]->startAddr);
         } else {
@@ -112,7 +112,7 @@ static void tdfxTMDumpTexMem( tdfxContex
         printf( "  isInTM=%d  whichTMU=%ld  lastTimeUsed=%d\n",
                 t->isInTM, t->whichTMU, t->lastTimeUsed );
         printf( "    tm[0] = %p", t->range[0] );
-        assert( t->range[0] );
+/*      assert( t->range[0] ); */
         if ( t->range[0] ) {
            printf( "  tm startAddr = %ld  endAddr = %ld",
                    t->range[0]->startAddr,
@@ -389,7 +389,10 @@ tdfxTMFindOldestObject( tdfxContextPtr f
             ( t->whichTMU == TDFX_TMU_SPLIT ) ) ) {
         GLuint age, lastTime;
 
-        assert( t->range[0] );
+/*      assert( t->range[0] );*/
+        if (! t->range[unit] ) {
+           return NULL;
+        }
         lastTime = t->lastTimeUsed;
 
         if ( lastTime > bindNumber ) {
@@ -568,6 +571,8 @@ tdfxTMAllocTexMem( tdfxContextPtr fxMesa
       fprintf( stderr,
               "tdfxTMAllocTexMem returned NULL!  unit=%ld size=%ld\n",
               unit, size );
+      UNLOCK_HARDWARE( fxMesa );
+      exit( 1 );
    }
    return range;
 }
Index: programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v
retrieving revision 1.87
diff -u -3 -p -r1.87 tdfx_driver.c
--- programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c      2002/01/04 21:22:35    
 1.87
+++ programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c      2002/05/15 12:29:28
@@ -1954,8 +1954,11 @@ static void allocateMemory(ScrnInfoPtr p
   /* for giggles.                           */
   pTDFX->fbOffset = pTDFX->fifoOffset + pTDFX->fifoSize;
   pTDFX->texOffset = pTDFX->fbOffset + fbSize;
+  pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset;
+
   if (pTDFX->depthOffset <= pTDFX->texOffset ||
-       pTDFX->backOffset <= pTDFX->texOffset) {
+       pTDFX->backOffset <= pTDFX->texOffset ||
+       pTDFX->texSize < 256*256*6) {
     /*
      * pTDFX->texSize < 0 means that the DRI is disabled.  pTDFX->backOffset
      * is used to calculate the maximum amount of memory available for
@@ -1970,7 +1973,6 @@ static void allocateMemory(ScrnInfoPtr p
        "\tand/or back buffer.  Disabling DRI.  To use DRI try lower\n"
        "\tresolution modes and/or a smaller virtual screen size\n");
   } else {
-    pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset;
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n",
                (float)pTDFX->texSize/1024.0/1024.0);
   }
Index: lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v
retrieving revision 1.11
diff -u -3 -p -r1.11 tdfx_texman.c
--- lib/GL/mesa/src/drv/tdfx/tdfx_texman.c      14 Feb 2002 01:59:59 -0000      1.11
+++ lib/GL/mesa/src/drv/tdfx/tdfx_texman.c      14 May 2002 20:45:12 -0000
@@ -396,7 +396,9 @@ FindOldestObject(tdfxContextPtr fxMesa, 
              (info->whichTMU == TDFX_TMU_SPLIT))) {
             GLuint age, lasttime;
 
-            assert(info->tm[0]);
+/*            assert(info->tm[0]);*/
+           if (!info->tm[tmu])
+              return NULL;
             lasttime = info->lastTimeUsed;
 
             if (lasttime > bindnumber)
@@ -625,7 +627,8 @@ AllocTexMem(tdfxContextPtr fxMesa, FxU32
         sprintf(err, "AllocTexMem returned NULL!  tmu=%d texmemsize=%d\n",
                (int) tmu, (int) texmemsize);
         _mesa_problem(fxMesa->glCtx, err);
-        return NULL;
+       UNLOCK_HARDWARE( fxMesa );
+       exit(1);
     }
     else {
         tdfxMemRange *range;
Index: programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
===================================================================
RCS file: /cvsroot/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v
retrieving revision 1.61
diff -u -3 -p -r1.61 tdfx_driver.c
--- programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c      27 Jan 2002 20:05:36 
-0000      1.61
+++ programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c      14 May 2002 20:45:19 
+-0000
@@ -1954,8 +1954,11 @@ static void allocateMemory(ScrnInfoPtr p
   /* for giggles.                           */
   pTDFX->fbOffset = pTDFX->fifoOffset + pTDFX->fifoSize;
   pTDFX->texOffset = pTDFX->fbOffset + fbSize;
+  pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset;
+
   if (pTDFX->depthOffset <= pTDFX->texOffset ||
-       pTDFX->backOffset <= pTDFX->texOffset) {
+       pTDFX->backOffset <= pTDFX->texOffset ||
+       pTDFX->texSize < 256*256*6 ) {
     /*
      * pTDFX->texSize < 0 means that the DRI is disabled.  pTDFX->backOffset
      * is used to calculate the maximum amount of memory available for
@@ -1970,7 +1973,6 @@ static void allocateMemory(ScrnInfoPtr p
        "\tand/or back buffer.  Disabling DRI.  To use DRI try lower\n"
        "\tresolution modes and/or a smaller virtual screen size\n");
   } else {
-    pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset;
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n",
                (float)pTDFX->texSize/1024.0/1024.0);
   }

Reply via email to