i965: Set fast color clear mcs_state on newly allocated image miptrees
authorKeith Packard <keithp@keithp.com>
Fri, 22 Nov 2013 13:41:38 +0000 (05:41 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 21 Dec 2013 00:19:52 +0000 (16:19 -0800)
Just copying code from the dri2 path to set up the fast color clear state.

This also removes a couple of bogus intel_region_reference calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index a96c7ea2f8397d467897ffe8e0752b62ea4dc7d1..de47143397a1a69a529fa31841a97a654cd86a24 100644 (file)
@@ -771,7 +771,13 @@ intel_miptree_create_for_image_buffer(struct brw_context *intel,
    if (!singlesample_mt)
       return NULL;
 
-   intel_region_reference(&singlesample_mt->region, region);
+   /* If this miptree is capable of supporting fast color clears, set
+    * mcs_state appropriately to ensure that fast clears will occur.
+    * Allocation of the MCS miptree will be deferred until the first fast
+    * clear actually occurs.
+    */
+   if (intel_is_non_msrt_mcs_buffer_supported(intel, singlesample_mt))
+      singlesample_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
 
    if (num_samples == 0)
       return singlesample_mt;
@@ -789,8 +795,6 @@ intel_miptree_create_for_image_buffer(struct brw_context *intel,
    multisample_mt->singlesample_mt = singlesample_mt;
    multisample_mt->need_downsample = false;
 
-   intel_region_reference(&multisample_mt->region, region);
-
    if (intel->is_front_buffer_rendering && buffer_type == __DRI_IMAGE_BUFFER_FRONT) {
       intel_miptree_upsample(intel, multisample_mt);
    }