summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-05-04 22:02:18 -0700
committerEric Anholt <eric@anholt.net>2010-05-04 22:06:12 -0700
commitce914fff0817cb3c25a2d715f8435c6b6d6fbcdd (patch)
treec03fc98efdec6226bfa078c5811cda3bf69cac00 /src/mesa/drivers
parent453f0b1f243b26e02b371293e9c8bbf09362c14a (diff)
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.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c13
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.h3
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c2
4 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 8ee9a292a1..8c947c41b4 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(&region);
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 8278d12bb9..7162c9f5bd 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 72413f7369..028f657d12 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 bd1dd13fb7..a40b232fff 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.