summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-03-21 16:20:13 -0700
committerEric Anholt <[email protected]>2014-03-24 11:15:04 -0700
commitdd4b2261841421ec7f4389afffb27d6a1dba870e (patch)
tree22cab886ffbcd53ee189811430b847c6244bb2f0 /src
parent44e944c87cafd55c00c8837d8223be074436015c (diff)
i965: Skip reallocating the private MSAA miptree, unless it's resized.
Even if the singlesample_mt got reopened from DRI due to pageflipping/buffer swapping, our private miptree shouldn't need any changes. Improves performance of a little swapbuffers-loving microbenchmark with MSAA forced on, by 1.2371% +/- 0.624802% (n=102) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index e013de49b04..10a1bbc7fe6 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -681,9 +681,6 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
mesa_format format = rb->Format;
int num_samples = rb->NumSamples;
- intel_miptree_release(&irb->mt);
- intel_miptree_release(&irb->singlesample_mt);
-
/* Only the front and back buffers, which are color buffers, are allocated
* through the image loader.
*/
@@ -699,7 +696,8 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
region->pitch,
region->tiling);
if (!singlesample_mt)
- return;
+ goto fail;
+
singlesample_mt->region->name = region->name;
/* If this miptree is capable of supporting fast color clears, set
@@ -711,23 +709,36 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
singlesample_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
if (num_samples == 0) {
+ intel_miptree_release(&irb->mt);
irb->mt = singlesample_mt;
- return;
- }
- multisample_mt = intel_miptree_create_for_renderbuffer(intel,
- format,
- region->width,
- region->height,
- num_samples);
- if (!multisample_mt) {
- intel_miptree_release(&singlesample_mt);
- return;
+ assert(!irb->singlesample_mt);
+ } else {
+ intel_miptree_release(&irb->singlesample_mt);
+ irb->singlesample_mt = singlesample_mt;
+
+ if (!irb->mt ||
+ irb->mt->logical_width0 != region->width ||
+ irb->mt->logical_height0 != region->height) {
+ multisample_mt = intel_miptree_create_for_renderbuffer(intel,
+ format,
+ region->width,
+ region->height,
+ num_samples);
+ if (!multisample_mt)
+ goto fail;
+
+ irb->need_downsample = false;
+ intel_miptree_release(&irb->mt);
+ irb->mt = multisample_mt;
+ }
}
+ return;
- irb->need_downsample = false;
- irb->mt = multisample_mt;
- irb->singlesample_mt = singlesample_mt;
+fail:
+ intel_miptree_release(&irb->singlesample_mt);
+ intel_miptree_release(&irb->mt);
+ return;
}
struct intel_mipmap_tree*