rpms/mesa/devel mesa-6.5-r300-free-gart-mem.patch, NONE, 1.1 mesa.spec, 1.68, 1.69

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Jul 24 21:01:36 UTC 2006


Author: krh

Update of /cvs/dist/rpms/mesa/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19137

Modified Files:
	mesa.spec 
Added Files:
	mesa-6.5-r300-free-gart-mem.patch 
Log Message:
* Mon Jul 24 2006 Kristian Høgsberg <krh at redhat.com> - 6.5-14.fc6
- Add mesa-6.5-r300-free-gart-mem.patch to make r300 driver free gart
  memory on context destroy.


mesa-6.5-r300-free-gart-mem.patch:
 r300_context.c |   50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletion(-)

--- NEW FILE mesa-6.5-r300-free-gart-mem.patch ---
diff-tree 17b5b882aefafabd1aad3dc759ff355165536b75 (from 3e9203e28680192dbbc54f38c2af9648205d6a01)
Author: Adam Jackson <ajax at freedesktop.org>
Date:   Fri Apr 21 19:53:52 2006 +0000

    Ensure all GART allocations are freed on context destruction, rather than
    waiting for the DRM to reap them at process exit.  Fixes (fatal) allocation
    failures in AIGLX configurations.
    
    Reviewed by: Aapo Tahkola

diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 4943d54..21a474b 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -372,6 +372,53 @@ #endif
 	return GL_TRUE;
 }
 
+static void r300FreeGartAllocations(r300ContextPtr r300)
+{
+    int i, ret;
+    drm_radeon_mem_free_t memfree;
+
+    memfree.region = RADEON_MEM_REGION_GART;
+
+#if 0
+    if (r300->rmm->u_last + 1 >= r300->rmm->u_size)
+	resize_u_list(r300);
+#endif
+
+    for (i = r300->rmm->u_last + 1; i > 0; i--) {
+	if (r300->rmm->u_list[i].ptr == NULL) {
+	    continue;
+	}
+
+	if (r300->rmm->u_list[i].h_pending == 0 &&
+		r300->rmm->u_list[i].pending) {
+	    memfree.region_offset = (char *)r300->rmm->u_list[i].ptr -
+			(char *)r300->radeon.radeonScreen->gartTextures.map;
+	    ret = drmCommandWrite(r300->radeon.radeonScreen->driScreen->fd,
+				  DRM_RADEON_FREE, &memfree, sizeof(memfree));
+	    if (ret) {
+		fprintf(stderr, "Failed to free at %p\nret = %s\n",
+			r300->rmm->u_list[i].ptr, strerror(-ret));
+	    } else {
+		fprintf(stderr, "Really freed %d at age %x\n", i,
+			radeonGetAge((radeonContextPtr)r300));
+		if (i == r300->rmm->u_last)
+		    r300->rmm->u_last--;
+		r300->rmm->u_list[i].pending = 0;
+		r300->rmm->u_list[i].ptr = NULL;
+		if (r300->rmm->u_list[i].fb) {
+		    LOCK_HARDWARE(&(r300->radeon));
+		    ret = mmFreeMem(r300->rmm->u_list[i].fb);
+		    UNLOCK_HARDWARE(&(r300->radeon));
+		    if (ret) fprintf(stderr, "failed to free!\n");
+		    r300->rmm->u_list[i].fb = NULL;
+		}
+		r300->rmm->u_list[i].ref_count = 0;
+	    }
+	}
+    }
+    r300->rmm->u_head = i;
+}
+
 /* Destroy the device specific context.
  */
 void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
@@ -408,7 +455,8 @@ void r300DestroyContext(__DRIcontextPriv
 			r300ReleaseDmaRegion(r300, &r300->dma.current, __FUNCTION__ );
 			r300FlushCmdBuf(r300, __FUNCTION__ );
 		}
-				
+
+		r300FreeGartAllocations(r300); // XXX SO MUCH HATE		
 		r300DestroyCmdBuf(r300);
 
 		if (radeon->state.scissor.pClipRects) {


Index: mesa.spec
===================================================================
RCS file: /cvs/dist/rpms/mesa/devel/mesa.spec,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- mesa.spec	12 Jul 2006 07:20:09 -0000	1.68
+++ mesa.spec	24 Jul 2006 21:01:30 -0000	1.69
@@ -53,7 +53,7 @@
 Summary: Mesa graphics libraries
 Name: mesa
 Version: 6.5
-Release: 13.1%{?dist}
+Release: 14%{?dist}
 License: MIT/X11
 Group: System Environment/Libraries
 URL: http://www.mesa3d.org
@@ -82,6 +82,7 @@
 Patch15: mesa-6.5-noexecstack.patch
 Patch16: mesa-6.5-force-r300.patch
 Patch17: mesa-6.5-fix-pbuffer-dispatch.patch
+Patch18: mesa-6.5-r300-free-gart-mem.patch
 
 # General patches from upstream go here:
 
@@ -266,6 +267,7 @@
 %patch15 -p0 -b .noexecstack
 %patch16 -p0 -b .force-r300
 %patch17 -p0 -b .fix-pbuffer-dispatch
+%patch18 -p1 -b .r300-free-gart-mem
 
 # According to Adam, this patch makes metacity's compositing
 # manager noticeably faster, but also may be a little too big of
@@ -457,7 +459,11 @@
 %{_bindir}/glxinfo
 
 %changelog
-* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - sh: line 0: fg: no job control
+* Mon Jul 24 2006 Kristian Høgsberg <krh at redhat.com> - 6.5-14.fc6
+- Add mesa-6.5-r300-free-gart-mem.patch to make r300 driver free gart
+  memory on context destroy.
+
+* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> 6.5-13.1.fc6
 - rebuild
 
 * Wed Jul 05 2006 Mike A. Harris <mharris at redhat.com> 6.5-13.fc6




More information about the fedora-cvs-commits mailing list