diff options
author | Eric Anholt <[email protected]> | 2011-09-21 15:38:32 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-09-26 15:33:42 -0700 |
commit | 32fe506ae14efa055f4773f422e2edd9fd1cffee (patch) | |
tree | 16b1319587e099ab713f41580c193ee25e4b424a /src | |
parent | db3ada6055814a4bd5aa95fc9505fc101864391d (diff) |
intel: Allow src == NULL and *dst != NULL in intel_miptree_reference().
This makes this API consistent with intel_region_reference, and the
consumers wanted it this way.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_validate.c | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index fb4695ce635..8289c398ff1 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -173,9 +173,17 @@ void intel_miptree_reference(struct intel_mipmap_tree **dst, struct intel_mipmap_tree *src) { - src->refcount++; + if (*dst == src) + return; + + intel_miptree_release(dst); + + if (src) { + src->refcount++; + DBG("%s %p refcount now %d\n", __FUNCTION__, src, src->refcount); + } + *dst = src; - DBG("%s %p refcount now %d\n", __FUNCTION__, src, src->refcount); } diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 69da0e25d1f..30c3cfbafd9 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -370,8 +370,6 @@ intelTexImage(struct gl_context * ctx, } } - assert(!intelImage->mt); - if (intelObj->mt && intel_miptree_match_image(intelObj->mt, &intelImage->base.Base)) { /* Use an existing miptree when possible */ @@ -391,10 +389,7 @@ intelTexImage(struct gl_context * ctx, * whole object since our level didn't fit what was there * before, and any lower levels would fit into our miptree. */ - if (intelImage->mt) { - intel_miptree_release(&intelObj->mt); - intel_miptree_reference(&intelObj->mt, intelImage->mt); - } + intel_miptree_reference(&intelObj->mt, intelImage->mt); } /* Attempt to use the blitter for PBO image uploads. diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 59354d66e34..137910816f5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -43,8 +43,6 @@ copy_image_data_to_tree(struct intel_context *intel, intelObj->mt, intelImage->base.Base.Face, intelImage->base.Base.Level, intelImage->mt); - - intel_miptree_release(&intelImage->mt); } else { assert(intelImage->base.Base.Data != NULL); |