From: Eric Anholt Date: Wed, 29 Jun 2011 18:26:32 +0000 (-0700) Subject: intel: Remove now trivial intel_renderbuffer_set_{hiz_,}region(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7ef5e8498550e6ed4d609641ca6deb932882485;p=mesa.git 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 --- 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(®ion, 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(®ion); - 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(®ion); @@ -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(®ion); } } 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);