From 12d9b7cc8550c1999e5c39a38b1b14e654f49065 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Fri, 2 Oct 2009 11:11:31 -0700
Subject: intel: Don't free the reloc list when putting a freed BO in the
 cache.

This takes firefox-talos-gfx from 74 seconds to 70 seconds on my GM965.
---
 libdrm/intel/intel_bufmgr_gem.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'libdrm')

diff --git a/libdrm/intel/intel_bufmgr_gem.c b/libdrm/intel/intel_bufmgr_gem.c
index d4fa1598..44d096ff 100644
--- a/libdrm/intel/intel_bufmgr_gem.c
+++ b/libdrm/intel/intel_bufmgr_gem.c
@@ -514,6 +514,9 @@ drm_intel_gem_bo_free(drm_intel_bo *bo)
     if (bo_gem->gtt_virtual)
 	munmap (bo_gem->gtt_virtual, bo_gem->bo.size);
 
+    free(bo_gem->reloc_target_bo);
+    free(bo_gem->relocs);
+
     /* Close this object */
     memset(&close, 0, sizeof(close));
     close.handle = bo_gem->gem_handle;
@@ -566,8 +569,6 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
 	    /* Unreference all the target buffers */
 	    for (i = 0; i < bo_gem->reloc_count; i++)
 		 drm_intel_gem_bo_unreference_locked(bo_gem->reloc_target_bo[i]);
-	    free(bo_gem->reloc_target_bo);
-	    free(bo_gem->relocs);
 	}
 
 	DBG("bo_unreference final: %d (%s)\n",
@@ -586,8 +587,6 @@ drm_intel_gem_bo_unreference_locked(drm_intel_bo *bo)
 
 	    bo_gem->name = NULL;
 	    bo_gem->validate_index = -1;
-	    bo_gem->relocs = NULL;
-	    bo_gem->reloc_target_bo = NULL;
 	    bo_gem->reloc_count = 0;
 
 	    DRMLISTADDTAIL(&bo_gem->head, &bucket->head);
-- 
cgit v1.2.3