[Mesa-dev] [PATCH] intel: Replace intel_renderbuffer::region with a miptree [v2]

Eric Anholt eric at anholt.net
Fri Nov 18 17:03:01 PST 2011


On Fri, 18 Nov 2011 12:50:36 -0800, Chad Versace <chad.versace at linux.intel.com> wrote:
> Essentially, this patch just globally substitutes `irb->region` with
> `irb->mt->region` and then does some minor cleanups to avoid segfaults
> and other problems.
> 
> This is in preparation for
>   1. Fixing scatter/gather for mipmapped separate stencil textures.
>   2. Supporting HiZ for mipmapped depth textures.
> 
> As a nice benefit, this lays down some preliminary groundwork for easily
> texturing from any renderbuffer, even those of the window system.
> 
> A future commit will replace intel_mipmap_tree::hiz_region with a miptree.
> 
> v2:
>    - Return early in intel_process_dri2_buffer_*() if region allocation
>      fails.
>    - Fix double semicolon.
>    - Fix miptree reference leaks in the following functions:
>        intel_process_dri2_buffer_with_separate_stencil()
>        intel_image_target_renderbuffer_storage()

> @@ -702,20 +696,21 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
>        _mesa_reference_renderbuffer(&irb->wrapped_stencil, stencil_rb);
>  
>     } else {
> -      irb->region = intel_region_alloc(intel->intelScreen, tiling, cpp,
> -				       width, height, true);
> -      if (!irb->region)
> +      irb->mt = intel_miptree_create_for_renderbuffer(intel, rb->Format,
> +                                                      tiling, cpp,
> +                                                      width, height);
> +      if (!irb->mt)
>  	 return false;
>  
>        if (intel->vtbl.is_hiz_depth_format(intel, rb->Format)) {
> -	 irb->hiz_region = intel_region_alloc(intel->intelScreen,
> -					      I915_TILING_Y,
> -					      irb->region->cpp,
> -					      irb->region->width,
> -					      irb->region->height,
> -					      true);
> -	 if (!irb->hiz_region) {
> -	    intel_region_release(&irb->region);
> +	 irb->mt->hiz_region = intel_region_alloc(intel->intelScreen,
> +	                                          I915_TILING_Y,
> +	                                          cpp,
> +	                                          rb->Width,
> +	                                          rb->Height,
> +	                                          true);
> +	 if (!irb->mt) {
> +	    intel_miptree_release(&irb->mt);
>  	    return false;

I think this was meant to be if (!irb->mt->his_region).

Other than that,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111118/3349678d/attachment-0001.pgp>


More information about the mesa-dev mailing list