summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-06-29 11:26:32 -0700
committerEric Anholt <[email protected]>2011-07-07 14:42:47 -0700
commitc7ef5e8498550e6ed4d609641ca6deb932882485 (patch)
tree221f0d93cf4fc677bbaeaf49e87b7cd83235faeb /src
parentb904321ed018c661271fb1fc3eefd1af0ec61c7f (diff)
intel: Remove now trivial intel_renderbuffer_set_{hiz_,}region().
As a result of this cleanup, a bug in intel_process_dri2_buffer_no_separate_stencil() became quite apparent. We were associating the NULL pointer after an unreference with the STENCIL attachment -- clarify the logic and attach the right region. Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c45
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c19
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.h12
3 files changed, 19 insertions, 57 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 547d81b9351..0402d83e9e3 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -1112,7 +1112,6 @@ intel_query_dri2_buffers_no_separate_stencil(struct intel_context *intel,
*
* \see intel_update_renderbuffers()
* \see intel_region_alloc_for_handle()
- * \see intel_renderbuffer_set_region()
*/
static void
intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel,
@@ -1124,7 +1123,6 @@ intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel,
assert(!intel->must_use_separate_stencil);
struct gl_framebuffer *fb = drawable->driverPrivate;
- struct intel_region *region = NULL;
struct intel_renderbuffer *depth_rb = NULL;
if (!rb)
@@ -1151,20 +1149,18 @@ intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel,
if (unlikely(INTEL_DEBUG & DEBUG_DRI)) {
fprintf(stderr, "(reusing depth buffer as stencil)\n");
}
- intel_region_reference(&region, depth_rb->region);
+ intel_region_reference(&rb->region, depth_rb->region);
} else {
- region = intel_region_alloc_for_handle(intel->intelScreen,
- buffer->cpp,
- drawable->w,
- drawable->h,
- buffer->pitch / buffer->cpp,
- buffer->name,
- buffer_name);
+ intel_region_release(&rb->region);
+ rb->region = intel_region_alloc_for_handle(intel->intelScreen,
+ buffer->cpp,
+ drawable->w,
+ drawable->h,
+ buffer->pitch / buffer->cpp,
+ buffer->name,
+ buffer_name);
}
- intel_renderbuffer_set_region(intel, rb, region);
- intel_region_release(&region);
-
if (buffer->attachment == __DRI_BUFFER_DEPTH_STENCIL) {
struct intel_renderbuffer *stencil_rb =
intel_get_renderbuffer(fb, BUFFER_STENCIL);
@@ -1172,10 +1168,10 @@ intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel,
if (!stencil_rb)
return;
- if (stencil_rb->region && stencil_rb->region->name == buffer->name)
- return;
-
- intel_renderbuffer_set_region(intel, stencil_rb, region);
+ /* The rb passed in is the BUFFER_DEPTH attachment, and we need
+ * to associate this region to BUFFER_STENCIL as well.
+ */
+ intel_region_reference(&stencil_rb->region, rb->region);
}
}
@@ -1300,7 +1296,6 @@ intel_query_dri2_buffers_with_separate_stencil(struct intel_context *intel,
*
* \see intel_update_renderbuffers()
* \see intel_region_alloc_for_handle()
- * \see intel_renderbuffer_set_region()
* \see enum intel_dri2_has_hiz
*/
static void
@@ -1360,9 +1355,9 @@ intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel,
buffer_name);
if (buffer->attachment == __DRI_BUFFER_HIZ) {
- intel_renderbuffer_set_hiz_region(intel, rb, region);
+ intel_region_reference(&rb->hiz_region, region);
} else {
- intel_renderbuffer_set_region(intel, rb, region);
+ intel_region_reference(&rb->region, region);
}
intel_region_release(&region);
@@ -1511,12 +1506,10 @@ intel_verify_dri2_has_hiz(struct intel_context *intel,
/ depth_stencil_buffer->cpp,
depth_stencil_buffer->name,
"dri2 depth / stencil buffer");
- intel_renderbuffer_set_region(intel,
- intel_get_renderbuffer(fb, BUFFER_DEPTH),
- region);
- intel_renderbuffer_set_region(intel,
- intel_get_renderbuffer(fb, BUFFER_STENCIL),
- region);
+ intel_region_reference(&intel_get_renderbuffer(fb, BUFFER_DEPTH)->region,
+ region);
+ intel_region_reference(&intel_get_renderbuffer(fb, BUFFER_STENCIL)->region,
+ region);
intel_region_release(&region);
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index ee656edae5b..12460020090 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -343,25 +343,6 @@ intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
return GL_FALSE;
}
-
-void
-intel_renderbuffer_set_region(struct intel_context *intel,
- struct intel_renderbuffer *rb,
- struct intel_region *region)
-{
- intel_region_reference(&rb->region, region);
-}
-
-
-void
-intel_renderbuffer_set_hiz_region(struct intel_context *intel,
- struct intel_renderbuffer *rb,
- struct intel_region *region)
-{
- intel_region_reference(&rb->hiz_region, region);
-}
-
-
/**
* Create a new intel_renderbuffer which corresponds to an on-screen window,
* not a user-created renderbuffer.
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index cbf29c86257..f7f99a4f00c 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -155,18 +155,6 @@ intel_framebuffer_has_hiz(struct gl_framebuffer *fb)
return intel_framebuffer_get_hiz_region(fb) != NULL;
}
-
-extern void
-intel_renderbuffer_set_region(struct intel_context *intel,
- struct intel_renderbuffer *irb,
- struct intel_region *region);
-
-extern void
-intel_renderbuffer_set_hiz_region(struct intel_context *intel,
- struct intel_renderbuffer *rb,
- struct intel_region *region);
-
-
extern struct intel_renderbuffer *
intel_create_renderbuffer(gl_format format);