SHA256
1
0
forked from pool/Mesa
Mesa/intel_release_static_region.patch

66 lines
2.3 KiB
Diff

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