With Savage DRM version 2.3.x or later use event counters for texture
authorFelix Kuehling <fxkuehl@gmx.de>
Wed, 23 Feb 2005 16:37:27 +0000 (16:37 +0000)
committerFelix Kuehling <fxkuehl@gmx.de>
Wed, 23 Feb 2005 16:37:27 +0000 (16:37 +0000)
heap aging, similar to the way it's done in the i810 and i855 drivers.
This avoids idling the engine on every texture upload.

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

index 3c0fae76473e271744702dd8840c8ffb9c126c9e..8d274866371dcb28c2b07805571e57ec9be34454 100644 (file)
@@ -742,6 +742,7 @@ void savageGetLock( savageContextPtr imesa, GLuint flags )
    int me = imesa->hHWContext;
    int stamp = dPriv->lastStamp; 
    int heap;
+   unsigned int timestamp = 0;
 
   
 
@@ -781,6 +782,15 @@ void savageGetLock( savageContextPtr imesa, GLuint flags )
    }
 
    for (heap = 0; heap < imesa->lastTexHeap; ++heap) {
+      /* If a heap was changed, update its timestamp. Do this before
+       * DRI_AGE_TEXTURES updates the local_age. */
+      if (imesa->textureHeaps[heap] &&
+         imesa->textureHeaps[heap]->global_age[0] >
+         imesa->textureHeaps[heap]->local_age) {
+        if (timestamp == 0)
+           timestamp = savageEmitEventLocked(imesa, 0);
+        imesa->textureHeaps[heap]->timestamp = timestamp;
+      }
       DRI_AGE_TEXTURES( imesa->textureHeaps[heap] );
    }
 
index 707fcb6ffb5e24a5b42ff4ad5d0a762ec68bb75f..3c93255361356aa3864d03d23a333a5d22ef6b79 100644 (file)
@@ -617,6 +617,18 @@ void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard )
        imesa->cmdBuf.write = imesa->cmdBuf.base;
        savageEmitOldState(imesa);
        imesa->cmdBuf.start = imesa->cmdBuf.write;
+
+       /* Timestamp current texture objects for texture heap aging.
+        * Only useful with long-lived 32-bit event tags available
+        * with Savage DRM 2.3.x or later. */
+       if ((imesa->CurrentTexObj[0] || imesa->CurrentTexObj[1]) &&
+           imesa->savageScreen->driScrnPriv->drmMinor >= 3) {
+           unsigned int e = savageEmitEventLocked(imesa, 0);
+           if (imesa->CurrentTexObj[0])
+               imesa->CurrentTexObj[0]->timestamp = e;
+           if (imesa->CurrentTexObj[1])
+               imesa->CurrentTexObj[1]->timestamp = e;
+       }
     }
 
     if (discard) {
index ec04b189620a8ba87c15132d54a468eb9e4379e5..0badde9dac779defeb88d8ecfdaf7b634154faf2 100644 (file)
@@ -770,7 +770,14 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t )
       savageFlushVertices (imesa);
       LOCK_HARDWARE(imesa);
       savageFlushCmdBufLocked (imesa, GL_FALSE);
-      WAIT_IDLE_EMPTY_LOCKED(imesa);
+      /* Heap timestamps are only reliable with Savage DRM 2.3.x or
+       * later. Earlier versions had only 16 bit time stamps which
+       * would wrap too frequently. */
+      if (imesa->savageScreen->driScrnPriv->drmMinor >= 3) {
+         unsigned int heap = t->base.heap->heapId;
+         savageWaitEvent (imesa, imesa->textureHeaps[heap]->timestamp);
+      } else
+         WAIT_IDLE_EMPTY_LOCKED(imesa);
 
       for (i = 0 ; i < numLevels ; i++) {
          const GLint j = t->base.firstLevel + i;  /* the texObj's level */