i965: fix segfault caused by commit e131c46b20241737ceba4856dbe01dcca6dd2c03.
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 10 Jan 2008 08:45:35 +0000 (16:45 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 10 Jan 2008 08:45:35 +0000 (16:45 +0800)
src/mesa/drivers/dri/i965/intel_context.c
src/mesa/drivers/dri/intel/intel_span.c

index 4ee7ca6a261edcf8f59daff7cb6f9d39b44d3a1a..973eed50f9835a4b710a834c8a3dd7ea47289eb6 100644 (file)
@@ -670,27 +670,27 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
        */
       {
          struct intel_renderbuffer *irbDepth
-            = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
+             = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
          struct intel_renderbuffer *irbStencil
-            = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
+             = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
 
-         if (intel_fb->color_rb[0] && !intel_fb->color_rb[0]->region) {
-            intel_region_reference(&intel_fb->color_rb[0]->region,
-                                  intel->front_region);
+         if (intel_fb->color_rb[0]) {
+             intel_renderbuffer_set_region(intel_fb->color_rb[0],
+                                           intel->front_region);
          }
-         if (intel_fb->color_rb[1] && !intel_fb->color_rb[1]->region) {
-            intel_region_reference(&intel_fb->color_rb[1]->region,
-                                  intel->back_region);
+         if (intel_fb->color_rb[1]) {
+             intel_renderbuffer_set_region(intel_fb->color_rb[1],
+                                           intel->back_region);
          }
-         if (intel_fb->color_rb[2] && !intel_fb->color_rb[2]->region) {
-            intel_region_reference(&intel_fb->color_rb[2]->region,
-                                  intel->third_region);
+         if (intel_fb->color_rb[2]) {
+             intel_renderbuffer_set_region(intel_fb->color_rb[2],
+                                           intel->third_region);
          }
-         if (irbDepth && !irbDepth->region) {
-            intel_region_reference(&irbDepth->region, intel->depth_region);
+         if (irbDepth) {
+             intel_renderbuffer_set_region(irbDepth, intel->depth_region);
          }
-         if (irbStencil && !irbStencil->region) {
-            intel_region_reference(&irbStencil->region, intel->depth_region);
+         if (irbStencil) {
+             intel_renderbuffer_set_region(irbStencil, intel->depth_region);
          }
       }
 
index 298e453c428ae0faab8c58f62c0e8b3833f4f430..df4f5927a0fd7060c566f95287d493e948620ea2 100644 (file)
@@ -264,7 +264,7 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
    /* depth buffer (Note wrapper!) */
    if (ctx->DrawBuffer->_DepthBuffer) {
       irb = intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped);
-      if (irb && irb->region && irb->Base.Name != 0) {
+      if (irb && irb->region) {
          if (map) {
             intel_region_map(intel, irb->region);
             irb->pfMap = irb->region->map;
@@ -272,8 +272,8 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
          }
          else {
             intel_region_unmap(intel, irb->region);
-            irb->pfMap = NULL;
-            irb->pfPitch = 0;
+            irb->pfMap = irb->region->map;
+            irb->pfPitch = irb->region->pitch;
          }
       }
    }
@@ -281,7 +281,7 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
    /* stencil buffer (Note wrapper!) */
    if (ctx->DrawBuffer->_StencilBuffer) {
       irb = intel_renderbuffer(ctx->DrawBuffer->_StencilBuffer->Wrapped);
-      if (irb && irb->region && irb->Base.Name != 0) {
+      if (irb && irb->region) {
          if (map) {
             intel_region_map(intel, irb->region);
             irb->pfMap = irb->region->map;
@@ -289,8 +289,8 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
          }
          else {
             intel_region_unmap(intel, irb->region);
-            irb->pfMap = NULL;
-            irb->pfPitch = 0;
+            irb->pfMap = irb->region->map;
+            irb->pfPitch = irb->region->pitch;
          }
       }
    }