OBS User unknown 2009-02-12 21:14:51 +00:00 committed by Git OBS Bridge
parent b3971f8531
commit 5a3945291e
4 changed files with 299 additions and 1 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Feb 10 01:12:37 CET 2009 - sndirsch@suse.de
- commit-7d99ddc.diff
* intel: Fix a number of memory leaks on context destroy.
(bnc #457879,bfo #19665)
- intel_release_static_region.patch
* detach static region from intel_renderbuffer on contex destroy
(bnc #457879,bfo #19665)
-------------------------------------------------------------------
Fri Jan 23 15:09:50 CET 2009 - sndirsch@suse.de

View File

@ -33,7 +33,7 @@ Obsoletes: Mesa-64bit
%endif
#
Version: 7.2
Release: 17
Release: 18
Summary: Mesa is a 3-D graphics library with an API which is very similar to that of OpenGL
Source: MesaLib-%{version}_intel-2008-q3_793c3b9.tar.bz2
Source1: MesaDemos-%{version}.tar.bz2
@ -48,6 +48,8 @@ Patch9: i965-GL_MAX_TEXTURE_SIZE-4096.diff
Patch10: commit-b4bf9ac.diff
Patch11: mesa-7.1-fix-i8xx-vbos.patch
Patch12: i965_aperture_call_for_Q3.patch
Patch13: commit-7d99ddc.diff
Patch14: intel_release_static_region.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -143,6 +145,8 @@ sed -i 's/REPLACE/%_lib/g' src/glx/x11/Makefile
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%build
@ -251,6 +255,13 @@ rm -rf $RPM_BUILD_ROOT
/usr/%{_lib}/libOSMesa.a
%changelog
* Tue Feb 10 2009 sndirsch@suse.de
- commit-7d99ddc.diff
* intel: Fix a number of memory leaks on context destroy.
(bnc #457879,bfo #19665)
- intel_release_static_region.patch
* detach static region from intel_renderbuffer on contex destroy
(bnc #457879,bfo #19665)
* Fri Jan 23 2009 sndirsch@suse.de
- added intel-i810-Mesa, Mesa7 to Provides/Obsoletes, i.e. get rid
of SLE10 packages (bnc #468796)

212
commit-7d99ddc.diff Normal file
View File

@ -0,0 +1,212 @@
commit 7d99ddcb2bb09f1f54d91e6e20e42d217a5bccdf
Author: Eric Anholt <eric@anholt.net>
Date: Fri Sep 26 12:48:23 2008 -0700
intel: Fix a number of memory leaks on context destroy.
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 0ab2770..773a8b4 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -566,6 +566,13 @@ i830_destroy_context(struct intel_context *intel)
GLuint i;
struct i830_context *i830 = i830_context(&intel->ctx);
+ intel_region_release(&i830->state.draw_region);
+ intel_region_release(&i830->state.depth_region);
+ intel_region_release(&i830->meta.draw_region);
+ intel_region_release(&i830->meta.depth_region);
+ intel_region_release(&i830->initial.draw_region);
+ intel_region_release(&i830->initial.depth_region);
+
for (i = 0; i < I830_TEX_UNITS; i++) {
if (i830->state.tex_buffer[i] != NULL) {
dri_bo_unreference(i830->state.tex_buffer[i]);
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index edbbe23..7431a9c 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -490,6 +490,13 @@ i915_destroy_context(struct intel_context *intel)
GLuint i;
struct i915_context *i915 = i915_context(&intel->ctx);
+ intel_region_release(&i915->state.draw_region);
+ intel_region_release(&i915->state.depth_region);
+ intel_region_release(&i915->meta.draw_region);
+ intel_region_release(&i915->meta.depth_region);
+ intel_region_release(&i915->initial.draw_region);
+ intel_region_release(&i915->initial.depth_region);
+
for (i = 0; i < I915_TEX_UNITS; i++) {
if (i915->state.tex_buffer[i] != NULL) {
dri_bo_unreference(i915->state.tex_buffer[i]);
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 9a353fc..39ce8eb 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -409,8 +409,18 @@ void brw_draw_init( struct brw_context *brw )
void brw_draw_destroy( struct brw_context *brw )
{
+ int i;
+
if (brw->vb.upload.bo != NULL) {
dri_bo_unreference(brw->vb.upload.bo);
brw->vb.upload.bo = NULL;
}
+
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ dri_bo_unreference(brw->vb.inputs[i].bo);
+ brw->vb.inputs[i].bo = NULL;
+ }
+
+ dri_bo_unreference(brw->ib.bo);
+ brw->ib.bo = NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index 1318dea..d5b5166 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -497,9 +497,10 @@ void brw_destroy_cache( struct brw_context *brw )
GLuint i;
brw_clear_cache(brw);
- for (i = 0; i < BRW_MAX_CACHE; i++)
+ for (i = 0; i < BRW_MAX_CACHE; i++) {
+ dri_bo_unreference(brw->cache.last_bo[i]);
free(brw->cache.name[i]);
-
+ }
free(brw->cache.items);
brw->cache.items = NULL;
brw->cache.size = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 2a03fc5..3780d3d 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -51,6 +51,12 @@
#include "brw_vs.h"
#include <stdarg.h>
+static void
+dri_bo_release(dri_bo **bo)
+{
+ dri_bo_unreference(*bo);
+ *bo = NULL;
+}
/* called from intelDestroyContext()
*/
@@ -58,6 +64,7 @@ static void brw_destroy_context( struct intel_context *intel )
{
GLcontext *ctx = &intel->ctx;
struct brw_context *brw = brw_context(&intel->ctx);
+ int i;
brw_destroy_metaops(brw);
brw_destroy_state(brw);
@@ -65,6 +72,33 @@ static void brw_destroy_context( struct intel_context *intel )
brw_ProgramCacheDestroy( ctx );
brw_FrameBufferTexDestroy( brw );
+
+ for (i = 0; i < brw->state.nr_draw_regions; i++)
+ intel_region_release(&brw->state.draw_regions[i]);
+ brw->state.nr_draw_regions = 0;
+ intel_region_release(&brw->state.depth_region);
+
+ dri_bo_release(&brw->curbe.curbe_bo);
+ dri_bo_release(&brw->vs.prog_bo);
+ dri_bo_release(&brw->vs.state_bo);
+ dri_bo_release(&brw->gs.prog_bo);
+ dri_bo_release(&brw->gs.state_bo);
+ dri_bo_release(&brw->clip.prog_bo);
+ dri_bo_release(&brw->clip.state_bo);
+ dri_bo_release(&brw->clip.vp_bo);
+ dri_bo_release(&brw->sf.prog_bo);
+ dri_bo_release(&brw->sf.state_bo);
+ dri_bo_release(&brw->sf.vp_bo);
+ for (i = 0; i < BRW_MAX_TEX_UNIT; i++)
+ dri_bo_release(&brw->wm.sdc_bo[i]);
+ dri_bo_release(&brw->wm.bind_bo);
+ for (i = 0; i < BRW_WM_MAX_SURF; i++)
+ dri_bo_release(&brw->wm.surf_bo[i]);
+ dri_bo_release(&brw->wm.prog_bo);
+ dri_bo_release(&brw->wm.state_bo);
+ dri_bo_release(&brw->cc.prog_bo);
+ dri_bo_release(&brw->cc.state_bo);
+ dri_bo_release(&brw->cc.vp_bo);
}
/* called from intelDrawBuffer()
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 57e5744..ccd74ba 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -810,7 +810,12 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
intel->Fallback = 0; /* don't call _swrast_Flush later */
intel_batchbuffer_free(intel->batch);
+ intel->batch = NULL;
+
free(intel->prim.vb);
+ intel->prim.vb = NULL;
+ dri_bo_unreference(intel->prim.vb_bo);
+ intel->prim.vb_bo = NULL;
if (release_texture_heaps) {
/* This share group is about to go away, free our private
@@ -820,6 +825,13 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
fprintf(stderr, "do something to free texture heaps\n");
}
+ intel_region_release(&intel->front_region);
+ intel_region_release(&intel->back_region);
+ intel_region_release(&intel->third_region);
+ intel_region_release(&intel->depth_region);
+
+ driDestroyOptionCache(&intel->optionCache);
+
/* free the Mesa context */
_mesa_free_context_data(&intel->ctx);
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 4af4cb9..554159a 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -226,7 +226,6 @@ struct intel_context
GLenum reduced_primitive;
GLuint vertex_size;
GLubyte *verts; /* points to tnl->clipspace.vertex_buf */
- struct intel_region *draw_region;
/* Fallback rasterization functions
*/
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index cb0f4ba..45faf64 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -478,6 +478,11 @@ intel_recreate_static(struct intel_context *intel,
region->pitch = intelScreen->pitch;
region->height = intelScreen->height; /* needed? */
+ if (region->buffer != NULL) {
+ dri_bo_unreference(region->buffer);
+ region->buffer = NULL;
+ }
+
if (intel->ttm) {
assert(region_desc->bo_handle != -1);
region->buffer = intel_bo_gem_create_from_name(intel->bufmgr,
@@ -486,6 +491,11 @@ intel_recreate_static(struct intel_context *intel,
intel_set_region_tiling_gem(intel, region, region_desc->bo_handle);
} else {
+ if (region->classic_map != NULL) {
+ drmUnmap(region->classic_map,
+ region->pitch * region->cpp * region->height);
+ region->classic_map = NULL;
+ }
ret = drmMap(intel->driFd, region_desc->handle,
region->pitch * region->cpp * region->height,
&region->classic_map);

View File

@ -0,0 +1,65 @@
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 3601eca..3a56595 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -674,6 +674,31 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
fprintf(stderr, "do something to free texture heaps\n");
}
+ if (!driContextPriv->driScreenPriv->dri2.enabled && intel->driDrawable) {
+ struct intel_framebuffer *intel_fb =
+ (struct intel_framebuffer *) intel->driDrawable->driverPrivate;
+ struct intel_renderbuffer *irbDepth =
+ intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
+ struct intel_renderbuffer *irbStencil =
+ intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
+
+ if (intel_fb->color_rb[0]) {
+ intel_renderbuffer_set_region(intel_fb->color_rb[0], NULL);
+ }
+
+ if (intel_fb->color_rb[1]) {
+ intel_renderbuffer_set_region(intel_fb->color_rb[1], NULL);
+ }
+
+ if (irbDepth) {
+ intel_renderbuffer_set_region(irbDepth, NULL);
+ }
+
+ if (irbStencil) {
+ intel_renderbuffer_set_region(irbStencil, NULL);
+ }
+ }
+
intel_region_release(&intel->front_region);
intel_region_release(&intel->back_region);
intel_region_release(&intel->third_region);
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 98a6e18..fe7589a 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -374,7 +374,8 @@ intel_renderbuffer_set_region(struct intel_renderbuffer *rb,
intel_region_reference(&rb->region, region);
intel_region_release(&old);
- rb->pfPitch = region->pitch;
+ if (region)
+ rb->pfPitch = region->pitch;
}
/**
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index bbbaf3e..2eb393a 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -166,8 +166,9 @@ intel_region_reference(struct intel_region **dst, struct intel_region *src)
assert(*dst == NULL);
if (src) {
src->refcount++;
- *dst = src;
}
+
+ *dst = src;
}
void