[Mesa-dev] [PATCH 1/5] intel: Allow intel_region_reference() with *dst != NULL.

Chad Versace chad at chad-versace.us
Wed Jul 6 15:34:43 PDT 2011


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

On 06/29/2011 03:26 PM, Eric Anholt wrote:
> This should help us avoid leaking regions in region reference code by
> making the API more predictable.
> ---
>  src/mesa/drivers/dri/intel/intel_regions.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
> index a4da1ce..6cf37c4 100644
> --- a/src/mesa/drivers/dri/intel/intel_regions.c
> +++ b/src/mesa/drivers/dri/intel/intel_regions.c
> @@ -264,11 +264,13 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
>  void
>  intel_region_reference(struct intel_region **dst, struct intel_region *src)
>  {
> -   if (src)
> -      _DBG("%s %p %d\n", __FUNCTION__, src, src->refcount);
> +   _DBG("%s: %p(%d) -> %p(%d)\n", __FUNCTION__,
> +	*dst, *dst ? (*dst)->refcount : 0, src, src ? src->refcount : 0);
> +
> +   if (src != *dst) {
> +      if (*dst)
> +	 intel_region_release(dst);
>  
> -   assert(*dst == NULL);
> -   if (src) {
>        src->refcount++;
>        *dst = src;
>     }

I'm glad to see the intel_region functions cleaned up.

Patches 1, 2, and 4 are
Reviewed-by: Chad Versace <chad at chad-versace.us>

See my comments to patch 3.

I have a fix for the XXX.

Withholding rb on patch 5; I'm not familiar with that code path.

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

iQIcBAEBAgAGBQJOFOMDAAoJEAIvNt057x8iMmcP/j/8gTcxlZbifOKP/9tdiQ59
Ctq/nAfXMxdSr7y2vV6HdiAGHQeuWtmv1Tub/I7F5v+2u16GfbaLYBj+uqkh0Sv6
mUeZvgpa7BXP8URg1mgo+YcST1A4RtmBItepxvEsbsNGC5TpqHoam7DMLSR3Ej/Q
/vKBpTQYuMlTrbnqSZN9BI+P9BqWlJDaCYFpY2jTBfx4ukDr1vUa8qpR369tJsMy
sPC3OmLFVFDW82Y+RIgi7klT0TP3uogQZ2zEOBwrLKX9uXP6NJMeOjVltwrjXoz8
kk4R9y9V5sQ29tfcret4Ebha6IWe+qh2dKhyNf3R8oRgKD2d1Zmgyc9oYhxK9q3y
eSacDS8OuuRkbUTvaIzIf+lHJWvsLwi5HsjKEeZpO7ptMveb/R9QamyUJeIQ2O76
Wkho7sKG1CP9xNWruGc/Mbjyz9KlN/eFGpMY2Dhks0MfDpazAPjfJXjATylIi8N6
myg8XGRXQ3t3rDOAV5E5EaBC+0FR4Ii6/gXulODfm9eXShPFR1bgasE2hlw/cveY
vgAkSi1jjJUbJZZ1x7PlXjOqPcOd0Ai+i2Fj12RAYGyLb0rqi+kTvlENhM+H7P9L
MiSWYOlWtmo3MRrCSYkY9r0pEdrKSp0bOAYBAhE3JwP3SD0NHv1ikNiOHA7prGjx
AocXVphCEmh3S+gfclDB
=2QX2
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list