[Mesa-dev] [PATCH 08/41] intel: Replace intel_renderbuffer::region with a miptree

Chad Versace chad.versace at linux.intel.com
Fri Nov 18 12:48:56 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/18/2011 12:04 PM, Eric Anholt wrote:
> On Thu, 17 Nov 2011 19:58:35 -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.
>>
>> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> 

>> ---
>> @@ -1381,9 +1396,12 @@ intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel,
>>  				    buffer_name);
>>  
>>     if (buffer->attachment == __DRI_BUFFER_HIZ) {
>> -      intel_region_reference(&rb->hiz_region, region);
>> +      intel_region_reference(&rb->mt->hiz_region, region);
>>     } else {
>> -      intel_region_reference(&rb->region, region);
>> +      rb->mt = intel_miptree_create_for_region(intel,
>> +                                               GL_TEXTURE_2D,
>> +                                               rb->Base.Format,
>> +                                               region);;
>>     }
> 
> Leaked old rb->mt here?  I don't see this function kicking off with an
> intel_miptree_release(&rb->mt).  Next quoted hunk has the same issue.
> 
>>     if (buffer->attachment == __DRI_BUFFER_HIZ) {
>> -      intel_region_reference(&rb->hiz_region, region);
>> +      intel_region_reference(&rb->mt->hiz_region, region);
>>     } else {
>> -      intel_region_reference(&rb->region, region);
>> +      rb->mt = intel_miptree_create_for_region(intel,
>> +                                               GL_TEXTURE_2D,
>> +                                               rb->Base.Format,
>> +                                               region);;
> 
> extra ';'
> 
>> -	 intel_region_reference(&intel_get_renderbuffer(fb, BUFFER_DEPTH)->region,
>> -				region);
>> -	 intel_region_reference(&intel_get_renderbuffer(fb, BUFFER_STENCIL)->region,
>> -				region);
>> +	 struct intel_mipmap_tree *mt =
>> +	       intel_miptree_create_for_region(intel,
>> +	                                       GL_TEXTURE_2D,
>> +	                                       depth_stencil_rb->Base.Format,
>> +	                                       region);
>>  	 intel_region_release(&region);
>> +	 intel_miptree_reference(&intel_get_renderbuffer(fb, BUFFER_DEPTH)->mt, mt);
>> +	 intel_miptree_reference(&intel_get_renderbuffer(fb, BUFFER_STENCIL)->mt, mt);
> 
> Haven't you leaked a mt reference here?
>>     }
>>  
>>     irb = intel_renderbuffer(rb);
>> -   intel_region_reference(&irb->region, image->region);
>> +   irb->mt = intel_miptree_create_for_region(intel,
>> +                                             GL_TEXTURE_2D,
>> +                                             image->format,
>> +                                             image->region);
>> +   if (!irb->mt)
>> +      return;
> 
> Leak of existing irb->mt?
> 

Right. My refcounting here is a mess. Expect v2 of this patch in a moment.

- ----
Chad Versace
chad.versace at linux.intel.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOxsS3AAoJEAIvNt057x8ijPEP/3QrgfEIwGvXlcE1z0m8qumn
o3Iq9HhcWilUtCBQ/rm3kpg7htQvc9OjoDLGCpB97YCvtj0NMUh/8SrDipQZbdH4
o3+i1KtgHKNj+ZYbkajOlN1I6JPLds69QmYTW1XwYSyWe92oIp9mzC6RQHo8TDDs
1U+FvKnj3caoUAlLMCyjPoLQIQ/Z+R9bSd3+izuTRp4nd4cH7VU581WIYqitx88P
Fp9kZH+cMp0D+upg/SARbjk8XeAPm2v6/HtLomLZ3pnMpBBAJ5BofmULxD7Cgd6w
UMWTLg2OfiRbYfY03n/HEm9IAtTtoV80pNbDVeFEvGENk9Pa+Q4YTIm3ioYnxB1/
cks01ne2uCmteBOdUor6d6S+2LmuEOvuAkBSiE71O86c2ymyo96g/AR4tNslWANL
Uab1RLPxXisBEqL8vVt0yN/u2+8ATbrICIM1c51bCq2wL35fX7dKBMPscCcARVmJ
ZbWqpT1zNVU2AIagcqlYKCytxGqTbfTWTB0eSdFOnaRdMW2VapS2Y2xjXVWcingf
ynoWPbwTAD16jB24WBlLDaUHZ+sPdfR95Mx7LPYlo+Andcu7+l7HwNXGKZvx7VcZ
KJh600IRIBMG1qJzdfKC28D9zMgESRUxi6LJLCIEHj8y6UyThqUHkdU8Al3A3Qwu
q6SgTCDK3wmEj0Fp6wPO
=e7Px
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list