[Mesa-dev] [PATCH 2/5] intel: Rely on intel_region_reference()'s support of *dst != NULL.

Eric Anholt eric at anholt.net
Wed Jun 29 15:26:49 PDT 2011


---
 src/mesa/drivers/dri/i915/i830_vtbl.c     |    2 --
 src/mesa/drivers/dri/i915/i915_vtbl.c     |    2 --
 src/mesa/drivers/dri/intel/intel_fbo.c    |   13 -------------
 src/mesa/drivers/dri/intel/intel_screen.c |    1 -
 4 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 584df82..7775e71 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -618,11 +618,9 @@ i830_set_draw_region(struct intel_context *intel,
    uint32_t draw_x, draw_y;
 
    if (state->draw_region != color_regions[0]) {
-      intel_region_release(&state->draw_region);
       intel_region_reference(&state->draw_region, color_regions[0]);
    }
    if (state->depth_region != depth_region) {
-      intel_region_release(&state->depth_region);
       intel_region_reference(&state->depth_region, depth_region);
    }
 
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 9721a1c..cd7d108 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -570,11 +570,9 @@ i915_set_draw_region(struct intel_context *intel,
    uint32_t draw_x, draw_y, draw_offset;
 
    if (state->draw_region != color_regions[0]) {
-      intel_region_release(&state->draw_region);
       intel_region_reference(&state->draw_region, color_regions[0]);
    }
    if (state->depth_region != depth_region) {
-      intel_region_release(&state->depth_region);
       intel_region_reference(&state->depth_region, depth_region);
    }
 
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 90c3909..ee656ed 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -277,8 +277,6 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
       return;
 
    irb = intel_renderbuffer(rb);
-   if (irb->region)
-      intel_region_release(&irb->region);
    intel_region_reference(&irb->region, image->region);
 
    rb->InternalFormat = image->internal_format;
@@ -351,12 +349,7 @@ intel_renderbuffer_set_region(struct intel_context *intel,
 			      struct intel_renderbuffer *rb,
 			      struct intel_region *region)
 {
-   struct intel_region *old;
-
-   old = rb->region;
-   rb->region = NULL;
    intel_region_reference(&rb->region, region);
-   intel_region_release(&old);
 }
 
 
@@ -365,10 +358,7 @@ intel_renderbuffer_set_hiz_region(struct intel_context *intel,
 				  struct intel_renderbuffer *rb,
 				  struct intel_region *region)
 {
-   struct intel_region *old = rb->hiz_region;
-   rb->hiz_region = NULL;
    intel_region_reference(&rb->hiz_region, region);
-   intel_region_release(&old);
 }
 
 
@@ -572,7 +562,6 @@ intel_update_tex_wrapper_regions(struct intel_context *intel,
 
    /* Point the renderbuffer's region to the texture's region. */
    if (irb->region != intel_image->mt->region) {
-      intel_region_release(&irb->region);
       intel_region_reference(&irb->region, intel_image->mt->region);
    }
 
@@ -592,7 +581,6 @@ intel_update_tex_wrapper_regions(struct intel_context *intel,
 
    /* Point the renderbuffer's hiz region to the texture's hiz region. */
    if (irb->hiz_region != intel_image->mt->hiz_region) {
-      intel_region_release(&irb->hiz_region);
       intel_region_reference(&irb->hiz_region, intel_image->mt->hiz_region);
    }
 
@@ -770,7 +758,6 @@ intel_render_texture(struct gl_context * ctx,
       intel_image->mt = new_mt;
       intel_renderbuffer_set_draw_offset(irb, intel_image, att->Zoffset);
 
-      intel_region_release(&irb->region);
       intel_region_reference(&irb->region, intel_image->mt->region);
    }
 #endif
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 2a3a601..bd8d574 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -291,7 +291,6 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate)
    if (image == NULL)
       return NULL;
 
-   image->region = NULL;
    intel_region_reference(&image->region, orig_image->region);
    if (image->region == NULL) {
       FREE(image);
-- 
1.7.5.4



More information about the mesa-dev mailing list