Mesa (radeon-rewrite): dri/radeon: export a function to cleanup a texture object.

Dave Airlie airlied at kemper.freedesktop.org
Tue Feb 17 00:29:43 UTC 2009


Module: Mesa
Branch: radeon-rewrite
Commit: 5325f8624093bb1ec30d581b4ff64218ceab99f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5325f8624093bb1ec30d581b4ff64218ceab99f9

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Feb 17 10:25:34 2009 +1000

dri/radeon: export a function to cleanup a texture object.

The radeon legacy code want to cleanup not free the texture obj,
so export a function to do that and wrap it.

---

 src/mesa/drivers/dri/common/texmem.c           |   16 +++++++++++++---
 src/mesa/drivers/dri/common/texmem.h           |    1 +
 src/mesa/drivers/dri/radeon/radeon_bo_legacy.c |    4 +++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c
index ff174a2..65c3c4e 100644
--- a/src/mesa/drivers/dri/common/texmem.c
+++ b/src/mesa/drivers/dri/common/texmem.c
@@ -314,11 +314,10 @@ void driSwapOutTextureObject( driTextureObject * t )
  * \param t Texture object to be destroyed
  */
 
-void driDestroyTextureObject( driTextureObject * t )
+void driCleanupTextureObject( driTextureObject * t )
 {
    driTexHeap * heap;
 
-
    if ( 0 ) {
       fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n",
 	       __FILE__, __LINE__,
@@ -350,7 +349,6 @@ void driDestroyTextureObject( driTextureObject * t )
       }
 
       remove_from_list( t );
-      FREE( t );
    }
 
    if ( 0 ) {
@@ -359,6 +357,18 @@ void driDestroyTextureObject( driTextureObject * t )
 }
 
 
+void driDestroyTextureObject( driTextureObject * t )
+{
+   driTexHeap * heap;
+
+   if (t == NULL)
+     return;
+
+   driCleanupTextureObject(t);
+   FREE(t);
+}
+
+
 
 
 /**
diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h
index 9c065da..b9beeea 100644
--- a/src/mesa/drivers/dri/common/texmem.h
+++ b/src/mesa/drivers/dri/common/texmem.h
@@ -272,6 +272,7 @@ void driAgeTextures( driTexHeap * heap );
 
 void driUpdateTextureLRU( driTextureObject * t );
 void driSwapOutTextureObject( driTextureObject * t );
+void driCleanupTextureObject( driTextureObject * t );
 void driDestroyTextureObject( driTextureObject * t );
 int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
     driTextureObject * t );
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
index 1d25887..65b0a9a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c
@@ -373,11 +373,13 @@ static void bo_free(struct bo_legacy *bo_legacy)
             /* dma buffers */
             bo_dma_free(&bo_legacy->base);
         } else {
+	    if (bo_legacy->got_dri_texture_obj)
+		driCleanupTextureObject(&bo_legacy->dri_texture_obj);
+
             /* free backing store */
             free(bo_legacy->ptr);
         }
     }
-    memset(bo_legacy, 0 , sizeof(struct bo_legacy));
     free(bo_legacy);
 }
 




More information about the mesa-commit mailing list