From: Eric Anholt Date: Wed, 5 May 2010 05:02:18 +0000 (-0700) Subject: i965: When an RB gets a new region, clear the old from the state cache. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ce914fff0817cb3c25a2d715f8435c6b6d6fbcdd;p=mesa.git i965: When an RB gets a new region, clear the old from the state cache. This prevents memory usage explosion in blender due to the state cache hanging on to old fake frontbuffer regions. Sigh at blender still using frontbuffer rendering. Bug #24119. --- diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 8ee9a292a1b..8c947c41b44 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -362,7 +362,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (buffers[i].attachment == __DRI_BUFFER_DEPTH) depth_region = region; - intel_renderbuffer_set_region(rb, region); + intel_renderbuffer_set_region(intel, rb, region); intel_region_release(®ion); if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) { @@ -374,7 +374,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) continue; intel_region_reference(&stencil_region, region); - intel_renderbuffer_set_region(rb, stencil_region); + intel_renderbuffer_set_region(intel, rb, stencil_region); intel_region_release(&stencil_region); } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 8278d12bb90..7162c9f5bd6 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -42,7 +42,9 @@ #include "intel_fbo.h" #include "intel_mipmap_tree.h" #include "intel_regions.h" - +#ifndef I915 +#include "brw_state.h" +#endif #define FILE_DEBUG_FLAG DEBUG_FBO @@ -280,7 +282,8 @@ intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, void -intel_renderbuffer_set_region(struct intel_renderbuffer *rb, +intel_renderbuffer_set_region(struct intel_context *intel, + struct intel_renderbuffer *rb, struct intel_region *region) { struct intel_region *old; @@ -288,6 +291,12 @@ intel_renderbuffer_set_region(struct intel_renderbuffer *rb, old = rb->region; rb->region = NULL; intel_region_reference(&rb->region, region); +#ifndef I915 + if (old) { + brw_state_cache_bo_delete(&brw_context(&intel->ctx)->surface_cache, + old->buffer); + } +#endif intel_region_release(&old); } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index 72413f73694..028f657d12d 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -82,7 +82,8 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, int attIndex) extern void -intel_renderbuffer_set_region(struct intel_renderbuffer *irb, +intel_renderbuffer_set_region(struct intel_context *intel, + struct intel_renderbuffer *irb, struct intel_region *region); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index bd1dd13fb7d..a40b232fff8 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -167,7 +167,7 @@ intel_stencil_drawpixels(GLcontext * ctx, irb = intel_create_renderbuffer(MESA_FORMAT_ARGB8888); irb->Base.Width = depth_irb->Base.Width; irb->Base.Height = depth_irb->Base.Height; - intel_renderbuffer_set_region(irb, depth_irb->region); + intel_renderbuffer_set_region(intel, irb, depth_irb->region); /* Create a name for our renderbuffer, which lets us use other mesa * rb functions for convenience.