intel: Fix refcounting on depth buffer initialization in DRI2.
authorEric Anholt <eric@anholt.net>
Wed, 3 Sep 2008 11:36:43 +0000 (12:36 +0100)
committerEric Anholt <eric@anholt.net>
Wed, 3 Sep 2008 12:31:44 +0000 (13:31 +0100)
(Reverts a change to work around the problem on 965).

src/mesa/drivers/dri/i965/brw_vtbl.c
src/mesa/drivers/dri/intel/intel_context.c

index ece01a8c9a52f90bb4ace1da3b03701691cbcff0..31e96a250ac41ccfff7b848b2457f446009699c1 100644 (file)
@@ -75,27 +75,15 @@ static void brw_set_draw_region( struct intel_context *intel,
                                GLuint num_regions)
 {
    struct brw_context *brw = brw_context(&intel->ctx);
-   struct intel_region *old_depth_region, *old_draw_regions[MAX_DRAW_BUFFERS];
    int i;
-
    if (brw->state.depth_region != depth_region)
       brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER;
-
-   for (i = 0; i < brw->state.nr_draw_regions; i++) {
-          old_draw_regions[i] = brw->state.draw_regions[i];
-          brw->state.draw_regions[i] = NULL;
-   }
-   old_depth_region = brw->state.depth_region;
-   brw->state.depth_region = NULL;
-
+   for (i = 0; i < brw->state.nr_draw_regions; i++)
+       intel_region_release(&brw->state.draw_regions[i]);
+   intel_region_release(&brw->state.depth_region);
    for (i = 0; i < num_regions; i++)
        intel_region_reference(&brw->state.draw_regions[i], draw_regions[i]);
    intel_region_reference(&brw->state.depth_region, depth_region);
-
-   for (i = 0; i < brw->state.nr_draw_regions; i++)
-       intel_region_release(&old_draw_regions[i]);
-   intel_region_release(&old_depth_region);
-
    brw->state.nr_draw_regions = num_regions;
 }
 
index 2975e4c0f0930c02ad39ef830c2641934976e901..c2ad5a04235dfd7e1495641ae393d579306d450a 100644 (file)
@@ -292,7 +292,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
        if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_region) {
          if (INTEL_DEBUG & DEBUG_DRI)
             fprintf(stderr, "(reusing depth buffer as stencil)\n");
-          region = depth_region;
+         intel_region_reference(&region, depth_region);
        }
        else
           region = intel_region_alloc_for_handle(intel, buffers[i].cpp,