i965: Allow fast clear to be used with lossless compression
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Mon, 7 Dec 2015 10:23:04 +0000 (12:23 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 16 Feb 2016 06:52:24 +0000 (08:52 +0200)
v2 (Ben): Use combination of msaa_layout and number of samples
          instead of introducing explicit type for lossless
          compression.
v3 (Ben): Squash with "i965: Resolve color buffer also in
          lossless compression case" and clarify simple
          non-compressed fast clear case.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index b2b07e7e58e800f7b84b6f62091f9bcb84a73847..c8d812628d81cdd29385be4408a58b05049b6306 100644 (file)
@@ -228,7 +228,9 @@ get_fast_clear_rect(struct brw_context *brw, struct gl_framebuffer *fb,
    unsigned int x_align, y_align;
    unsigned int x_scaledown, y_scaledown;
 
-   if (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE) {
+   /* Only single sampled surfaces need to (and actually can) be resolved. */
+   if (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE ||
+       intel_miptree_is_lossless_compressed(brw, irb->mt)) {
       /* From the Ivy Bridge PRM, Vol2 Part1 11.7 "MCS Buffer for Render
        * Target(s)", beneath the "Fast Color Clear" bullet (p327):
        *
index f926265316b78f591c2ed36480a9c5193b50962d..dd1d8be345e65d69b0ff3b82179819ce55beeb65 100644 (file)
@@ -2051,8 +2051,10 @@ intel_miptree_resolve_color(struct brw_context *brw,
    case INTEL_FAST_CLEAR_STATE_UNRESOLVED:
    case INTEL_FAST_CLEAR_STATE_CLEAR:
       /* Fast color clear resolves only make sense for non-MSAA buffers. */
-      if (mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE)
+      if (mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE ||
+          intel_miptree_is_lossless_compressed(brw, mt)) {
          brw_meta_resolve_color(brw, mt);
+      }
       break;
    }
 }